diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 6d09300..04435a0 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -41,7 +41,6 @@ jobs: msystem: MINGW64 update: true install: >- - mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq @@ -57,17 +56,57 @@ jobs: base-devel wget - - name: Install ICU v75.1 + - name: Install pinned MinGW64 toolchain v16.2.0 run: | - wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst - echo "bf57882d43efcdfd746463613ea982c69b64aa4ba9bed4cb24c02a81ad06c3a9 mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst" | sha256sum -c - pacman -U --noconfirm mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "acad5748942953f91a0f2bba03e20437b909366e55949f478f1b2f2d30c726a7 mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "d24b4e7614756414ae3ef58793265448a3ca7d5fd447a991e9b2facde7b59d75 mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst + echo "827363748ce3320683319d860ee4fcfcdbb36baf66aac6dab0ec3822be2d4ff7 mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "481babe8c2fdfa4fc7f51bf13939701719af9f8166ef6a91a9a209cc25961b03 mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "7d86a267b6069198d28f3e77314282ff7b4e3c7bb8fe482299ca58f7a5b439db mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "1d0ed7fda332a5c879de210f3d72c75fa1f3df7cc63dd951e763dec8eb02c1ee mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "7fcafd7ba30bd47000263e76a06bd893406c64f88955825f0a9188407a35c3d3 mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "c17557d09371e39db38deb56c7da6ae54e2c65b6f3466ca02f4da26b616ca8c3 mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst + echo "37b97f372409fa7cf54d709bab892f34e9c62d2658230a09f783a89a55ae590e mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst + echo "c19e7caf09bbc89b2730556b2da73004118d4e1f967a685cc48524c7ff80d864 mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst + echo "f8e25ea67bb796e7f65550f0dca9fce4cdde8aaa3dadafe4d13c6a8233c8de26 mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst + echo "8b37c953ae12f3d8fa05c854236463231ea0a294dff423007cbd93d4d8089f9f mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst" | sha256sum -c + pacman -U --noconfirm \ + mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst \ + mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst \ + mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst \ + mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst \ + mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst + + - name: Install ICU v78.3 + run: | + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst + echo "8486a018aca2e56d1fcd2eed2069011f2e1da02e03af72b38916ee06cbe7203f mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst" | sha256sum -c + pacman -U --noconfirm mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst - - name: Install boost v1.87.0 + - name: Install boost v1.92.0 run: | - wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst - echo "241919a5885a9270d0e0937e71cf5e146c2a8cabecc2714f09248350181cb1b6 mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst" | sha256sum -c - pacman -U --noconfirm mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst + echo "8d5a7621778e955a52755940fe16ead78c0e57a2ff443418b43c25388df1ba2a mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst" | sha256sum -c + pacman -U --noconfirm mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst - name: Install pybind11 v2.13.6 run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 082053d..7d37f9e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -119,14 +119,20 @@ jobs: name: test-logs path: monero_tests_*.log - - name: Generate coverage report + - name: Generate python bindings coverage report if: always() run: | lcov --capture --directory build --ignore-errors mismatch,mismatch,inconsistent,source,source,gcov,gcov --output-file coverage_full.info lcov --ignore-errors unused,unused --remove coverage_full.info '/usr/*' '*/external/*' '*/pybind11/*' '*monero-cpp/*' '*monero-project/*' --output-file coverage.info sed -i "s|$(pwd)/||g" coverage.info + genhtml coverage.info --output-directory coverage_monero_python_bindings_html --ignore-errors mismatch,inconsistent,source,corrupt --title "monero-python bindings coverage @ ${GITHUB_SHA::7}" lcov --summary coverage.info + - name: Generate python tests coverage report + if: always() + run: | + coverage html -d coverage_monero_python_tests_html --title "monero-python tests coverage @ ${GITHUB_SHA::7}" + - name: Generate monero-cpp coverage report if: always() run: | @@ -146,6 +152,8 @@ jobs: coverage.xml coverage_monero_cpp.info coverage_monero_cpp_html/ + coverage_monero_python_bindings_html/ + coverage_monero_python_tests_html/ windows: name: windows (pytest) @@ -178,7 +186,6 @@ jobs: msystem: MINGW64 update: true install: >- - mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq @@ -194,17 +201,57 @@ jobs: base-devel wget - - name: Install ICU v75.1 + - name: Install pinned MinGW64 toolchain v16.2.0 + run: | + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "acad5748942953f91a0f2bba03e20437b909366e55949f478f1b2f2d30c726a7 mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "d24b4e7614756414ae3ef58793265448a3ca7d5fd447a991e9b2facde7b59d75 mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst + echo "827363748ce3320683319d860ee4fcfcdbb36baf66aac6dab0ec3822be2d4ff7 mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "481babe8c2fdfa4fc7f51bf13939701719af9f8166ef6a91a9a209cc25961b03 mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "7d86a267b6069198d28f3e77314282ff7b4e3c7bb8fe482299ca58f7a5b439db mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "1d0ed7fda332a5c879de210f3d72c75fa1f3df7cc63dd951e763dec8eb02c1ee mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "7fcafd7ba30bd47000263e76a06bd893406c64f88955825f0a9188407a35c3d3 mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst + echo "c17557d09371e39db38deb56c7da6ae54e2c65b6f3466ca02f4da26b616ca8c3 mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst + echo "37b97f372409fa7cf54d709bab892f34e9c62d2658230a09f783a89a55ae590e mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst + echo "c19e7caf09bbc89b2730556b2da73004118d4e1f967a685cc48524c7ff80d864 mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst + echo "f8e25ea67bb796e7f65550f0dca9fce4cdde8aaa3dadafe4d13c6a8233c8de26 mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst" | sha256sum -c + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst + echo "8b37c953ae12f3d8fa05c854236463231ea0a294dff423007cbd93d4d8089f9f mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst" | sha256sum -c + pacman -U --noconfirm \ + mingw-w64-x86_64-headers-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-crt-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-binutils-2.47-3-any.pkg.tar.zst \ + mingw-w64-x86_64-libmangle-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-winpthreads-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-libwinpthread-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-winstorecompat-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-tools-14.0.0.r375.g9c1abbbf5-1-any.pkg.tar.zst \ + mingw-w64-x86_64-pkgconf-1~3.0.7-1-any.pkg.tar.zst \ + mingw-w64-x86_64-make-4.4.1-5-any.pkg.tar.zst \ + mingw-w64-x86_64-gcc-libs-16.2.0-3-any.pkg.tar.zst \ + mingw-w64-x86_64-gcc-16.2.0-3-any.pkg.tar.zst + + - name: Install ICU v78.3 run: | - wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst - echo "bf57882d43efcdfd746463613ea982c69b64aa4ba9bed4cb24c02a81ad06c3a9 mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst" | sha256sum -c - pacman -U --noconfirm mingw-w64-x86_64-icu-75.1-2-any.pkg.tar.zst + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst + echo "8486a018aca2e56d1fcd2eed2069011f2e1da02e03af72b38916ee06cbe7203f mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst" | sha256sum -c + pacman -U --noconfirm mingw-w64-x86_64-icu-78.3-4-any.pkg.tar.zst - - name: Install boost v1.87.0 + - name: Install boost v1.92.0 run: | - wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst - echo "241919a5885a9270d0e0937e71cf5e146c2a8cabecc2714f09248350181cb1b6 mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst" | sha256sum -c - pacman -U --noconfirm mingw-w64-x86_64-boost-1.87.0-3-any.pkg.tar.zst + wget https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst + echo "8d5a7621778e955a52755940fe16ead78c0e57a2ff443418b43c25388df1ba2a mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst" | sha256sum -c + pacman -U --noconfirm mingw-w64-x86_64-boost-1.92.0-3-any.pkg.tar.zst - name: Install pybind11 v2.13.6 run: | diff --git a/external/monero-cpp b/external/monero-cpp index 6c7b4f2..83832b8 160000 --- a/external/monero-cpp +++ b/external/monero-cpp @@ -1 +1 @@ -Subproject commit 6c7b4f2bbb2af79c236955ccc2ca56a86a656ae8 +Subproject commit 83832b89f97cfadd36690a629566584d1336cf41 diff --git a/src/cpp/daemon/py_monero_daemon.h b/src/cpp/daemon/py_monero_daemon.h index bdf1abb..57bd172 100644 --- a/src/cpp/daemon/py_monero_daemon.h +++ b/src/cpp/daemon/py_monero_daemon.h @@ -349,7 +349,7 @@ class PyMoneroDaemon : public monero_daemon { PYBIND11_OVERRIDE(std::shared_ptr, monero_daemon, get_mining_status); } - std::shared_ptr generate_blocks(const std::string& wallet_address, uint64_t num_blocks, const boost::optional& prev_block_hash = boost::none, const boost::optional& starting_nonce = boost::none) { + std::shared_ptr generate_blocks(const std::string& wallet_address, uint64_t num_blocks, const boost::optional& prev_block_hash = boost::none, const boost::optional& starting_nonce = boost::none) override { PYBIND11_OVERRIDE(std::shared_ptr, monero_daemon, generate_blocks, wallet_address, num_blocks, prev_block_hash, starting_nonce); } diff --git a/tests/test_monero_wallet_model.py b/tests/test_monero_wallet_model.py index 94f8bbd..afad808 100644 --- a/tests/test_monero_wallet_model.py +++ b/tests/test_monero_wallet_model.py @@ -1065,19 +1065,10 @@ def test_tx_query_deserialize_from_block(self) -> None: assert restored.block is not None assert restored.block.txs[0] is restored - @pytest.mark.xfail(reason="monero_tx_query::deserialize_from_block() segfaults when array txs is empty", strict=True) - def test_tx_query_deserialize_from_block_no_txs_does_not_crash(self) -> None: - # a block node with an empty "txs" array causes a native segfault (SIGSEGV) - script: str = ( - "import monero\n" - "monero.MoneroTxQuery.deserialize_from_block('{\"txs\": []}')\n" - ) - result: subprocess.CompletedProcess[str] = subprocess.run([sys.executable, "-c", script], capture_output=True, text=True, timeout=30) - logger.debug(f"subprocess exit code: {result.returncode}, stderr: {result.stderr.strip()}") - assert result.returncode == 0, ( - f"deserialize_from_block() crashed the interpreter (exit code {result.returncode}) " - "instead of raising a Python exception for a block with no txs" - ) + def test_tx_query_deserialize_from_block_no_txs(self) -> None: + restored: MoneroTxQuery = MoneroTxQuery.deserialize_from_block('{"txs": []}') + assert restored.hash is None + assert restored.block is None def test_integrated_address_deserialize(self) -> None: address: MoneroIntegratedAddress = MoneroIntegratedAddress() @@ -1536,6 +1527,33 @@ def test_tx_wallet_copy(self) -> None: assert copy is not tx assert copy.serialize() == tx.serialize() + def test_tx_wallet_copy_re_copies_inputs_as_output_wallet(self) -> None: + tx: MoneroTxWallet = MoneroTxWallet() + tx.hash = "a" * 64 + + key_image: MoneroKeyImage = MoneroKeyImage() + key_image.hex = "1" * 64 + tx_input: MoneroOutputWallet = MoneroOutputWallet() + tx_input.tx = tx + tx_input.key_image = key_image + tx_input.amount = 1234 + tx_input.account_index = 2 + tx_input.subaddress_index = 3 + tx_input.is_spent = True + tx_input.is_frozen = False + tx.inputs = [tx_input] + + copy: MoneroTxWallet = tx.copy() + assert isinstance(copy.inputs[0], MoneroOutputWallet) + assert copy.inputs[0] is not tx_input + assert copy.inputs[0].amount == 1234 + assert copy.inputs[0].account_index == 2 + assert copy.inputs[0].subaddress_index == 3 + assert copy.inputs[0].is_spent is True + assert copy.inputs[0].is_frozen is False + assert copy.inputs[0].key_image.hex == "1" * 64 # type: ignore + assert copy.inputs[0].tx is copy + def test_tx_wallet_merge(self) -> None: a: MoneroTxWallet = MoneroTxWallet() a.hash = "a" * 64