From d7d48bf040485b4277c1dd0307c43e7266a66b39 Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 8 Sep 2025 10:55:57 -0400 Subject: [PATCH 1/8] test: fix get_contested_resources test Broken by a recent commit --- packages/wasm-sdk/test/voting-contested-resources.test.mjs | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/wasm-sdk/test/voting-contested-resources.test.mjs b/packages/wasm-sdk/test/voting-contested-resources.test.mjs index 5469a424060..6b60d86fa20 100644 --- a/packages/wasm-sdk/test/voting-contested-resources.test.mjs +++ b/packages/wasm-sdk/test/voting-contested-resources.test.mjs @@ -81,8 +81,6 @@ await test('get_contested_resources - fetch contested domain names', async () => 'domain', // document_type_name DPNS_CONTRACT, // data_contract_id 'parentNameAndLabel', // index_name - 'documents', // result_type - null, // allow_include_locked_and_abstaining_vote_tally null, // start_at_value 100, // limit null, // offset From d2cbe42a04236a6e09cce4ef66962e0c1a5c917c Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 8 Sep 2025 10:57:11 -0400 Subject: [PATCH 2/8] test: fix child key derivation tests Started failing once an implementation was available since the test expected it to be unimplemented. --- .../wasm-sdk/test/key-generation.test.mjs | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/packages/wasm-sdk/test/key-generation.test.mjs b/packages/wasm-sdk/test/key-generation.test.mjs index 10b00308af7..e5c39e95bf3 100644 --- a/packages/wasm-sdk/test/key-generation.test.mjs +++ b/packages/wasm-sdk/test/key-generation.test.mjs @@ -358,26 +358,57 @@ await test('derivation_path_dip13_testnet', () => { if (result.path !== "m/9'/1'/0'") throw new Error('Invalid DIP13 testnet path'); }); -// Child Key Derivation Tests (expected to fail for now) +// Child Key Derivation Tests describe('Child Key Derivation'); -await test('derive_child_public_key - not implemented', () => { +await test('derive_child_public_key - basic functionality', () => { + // Generate a master extended key to get a valid xpub + const masterResult = wasmSdk.derive_key_from_seed_with_extended_path(TEST_MNEMONIC, null, "m/44'/5'/0'", "mainnet"); + const parentXpub = masterResult.xpub; + + // Derive child public key + const childXpub = wasmSdk.derive_child_public_key(parentXpub, 0, false); + + if (!childXpub) throw new Error('No child xpub returned'); + if (typeof childXpub !== 'string') throw new Error('Child xpub should be string'); + if (childXpub === parentXpub) throw new Error('Child xpub should differ from parent'); + + // Test different indices produce different results + const childXpub1 = wasmSdk.derive_child_public_key(parentXpub, 1, false); + if (childXpub1 === childXpub) throw new Error('Different indices should produce different xpubs'); +}); + +await test('xprv_to_xpub - basic functionality', () => { + // Generate a master extended key to get a valid xprv + const masterResult = wasmSdk.derive_key_from_seed_with_extended_path(TEST_MNEMONIC, null, "m/44'/5'/0'", "mainnet"); + const xprv = masterResult.xprv; + const expectedXpub = masterResult.xpub; + + // Convert xprv to xpub + const derivedXpub = wasmSdk.xprv_to_xpub(xprv); + + if (!derivedXpub) throw new Error('No xpub returned'); + if (typeof derivedXpub !== 'string') throw new Error('Derived xpub should be string'); + if (derivedXpub !== expectedXpub) throw new Error('Derived xpub should match expected xpub'); +}); + +await test('derive_child_public_key - error handling', () => { try { - wasmSdk.derive_child_public_key("xpub...", 0, false); - throw new Error('Should have thrown not implemented error'); + wasmSdk.derive_child_public_key("invalid_xpub", 0, false); + throw new Error('Should have thrown error for invalid xpub'); } catch (error) { - if (!error.message.includes('not yet implemented')) { + if (!error.message.includes('Invalid extended public key')) { throw error; } } }); -await test('xprv_to_xpub - not implemented', () => { +await test('xprv_to_xpub - error handling', () => { try { - wasmSdk.xprv_to_xpub("xprv..."); - throw new Error('Should have thrown not implemented error'); + wasmSdk.xprv_to_xpub("invalid_xprv"); + throw new Error('Should have thrown error for invalid xprv'); } catch (error) { - if (!error.message.includes('not yet implemented')) { + if (!error.message.includes('Invalid extended private key')) { throw error; } } From c11cdf43080285508c581fa4ed1c8d88832ff6ad Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 8 Sep 2025 11:05:21 -0400 Subject: [PATCH 3/8] ci: fix test run to actually report failure if a test fails Previously tests always indicated successful even if a test failed. --- .github/workflows/wasm-sdk-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasm-sdk-build.yml b/.github/workflows/wasm-sdk-build.yml index 304d3eba5a7..49e63a0ffc7 100644 --- a/.github/workflows/wasm-sdk-build.yml +++ b/.github/workflows/wasm-sdk-build.yml @@ -222,7 +222,7 @@ jobs: working-directory: packages/wasm-sdk run: | echo "Running WASM SDK comprehensive test suite..." - node test/run-all-tests.mjs | tee test-output.log + set -o pipefail && node test/run-all-tests.mjs | tee test-output.log - name: Generate job summary if: always() From 512cfff50a158996c967f4b2673b825fde0fb7be Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 8 Sep 2025 11:40:08 -0400 Subject: [PATCH 4/8] fix(ci): remove redundant cache save steps causing build warnings The redundant actions/cache/save@v4 steps for protoc and wasm-opt were causing "Path Validation Error" warnings when cache hits occurred. The actions/cache@v4 action automatically handles both restore and save operations, making the separate save steps unnecessary. Issue was introduced in https://github.com/dashpay/platform/pull/2756 --- .github/workflows/wasm-sdk-build.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/wasm-sdk-build.yml b/.github/workflows/wasm-sdk-build.yml index 49e63a0ffc7..4b1b0d5b5a0 100644 --- a/.github/workflows/wasm-sdk-build.yml +++ b/.github/workflows/wasm-sdk-build.yml @@ -68,15 +68,6 @@ jobs: "https://github.com/protocolbuffers/protobuf/releases/download/v32.0/protoc-32.0-linux-x86_64.zip" unzip -o /tmp/protoc.zip -d "$PROTOC_DIR" - - name: Save cached protoc v32.0 - if: steps.cache-protoc.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - ${{ env.HOME }}/.local/protoc-32.0/bin - ${{ env.HOME }}/.local/protoc-32.0/include - key: protoc/32.0/${{ runner.os }}/x86_64 - - name: Export protoc v32.0 to PATH run: | echo "${HOME}/.local/protoc-32.0/bin" >> $GITHUB_PATH @@ -125,13 +116,6 @@ jobs: tar -xzf /tmp/binaryen.tar.gz -C "${HOME}/.cache/binaryen" mv "${HOME}/.cache/binaryen/binaryen-version_121" "${HOME}/.cache/binaryen/version_121" - - name: Save cached wasm-opt - if: steps.cache-binaryen.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: ${{ env.HOME }}/.cache/binaryen/version_121 - key: binaryen/version_121/${{ runner.os }}/x86_64 - - name: Export wasm-opt to PATH run: | echo "${HOME}/.cache/binaryen/version_121/bin" >> $GITHUB_PATH From a1caf8e20a156cad17931e8fc24aa9ed52b52ac1 Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 8 Sep 2025 12:19:49 -0400 Subject: [PATCH 5/8] perf(ci): restore wasm-opt to version 124 for faster builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts the downgrade to version 121 that was introduced in #2756. The newer version 124 should have better optimization algorithms and support more flags, reducing compatibility testing overhead and improving build performance. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/wasm-sdk-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wasm-sdk-build.yml b/.github/workflows/wasm-sdk-build.yml index 4b1b0d5b5a0..21b1ab3be85 100644 --- a/.github/workflows/wasm-sdk-build.yml +++ b/.github/workflows/wasm-sdk-build.yml @@ -103,8 +103,8 @@ jobs: uses: actions/cache@v4 id: cache-binaryen with: - path: ${{ env.HOME }}/.cache/binaryen/version_121 - key: binaryen/version_121/${{ runner.os }}/x86_64 + path: ${{ env.HOME }}/.cache/binaryen/version_124 + key: binaryen/version_124/${{ runner.os }}/x86_64 - name: Install wasm-opt if cache miss if: steps.cache-binaryen.outputs.cache-hit != 'true' @@ -112,13 +112,13 @@ jobs: set -euxo pipefail mkdir -p "${HOME}/.cache/binaryen" curl -fsSL -o /tmp/binaryen.tar.gz \ - "https://github.com/WebAssembly/binaryen/releases/download/version_121/binaryen-version_121-x86_64-linux.tar.gz" + "https://github.com/WebAssembly/binaryen/releases/download/version_124/binaryen-version_124-x86_64-linux.tar.gz" tar -xzf /tmp/binaryen.tar.gz -C "${HOME}/.cache/binaryen" - mv "${HOME}/.cache/binaryen/binaryen-version_121" "${HOME}/.cache/binaryen/version_121" + mv "${HOME}/.cache/binaryen/binaryen-version_124" "${HOME}/.cache/binaryen/version_124" - name: Export wasm-opt to PATH run: | - echo "${HOME}/.cache/binaryen/version_121/bin" >> $GITHUB_PATH + echo "${HOME}/.cache/binaryen/version_124/bin" >> $GITHUB_PATH - name: Build WASM SDK working-directory: packages/wasm-sdk From e5f4e2773f23a54b584d02a5c6c60d73f2e0e19c Mon Sep 17 00:00:00 2001 From: thephez Date: Mon, 8 Sep 2025 13:16:30 -0400 Subject: [PATCH 6/8] refactor(ci): parameterize wasm-opt config with environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces hardcoded Binaryen configuration with environment variables for better maintainability. Adds SHA256 checksum verification for security. Now version updates only require changing values at the job level. - Add BINARYEN_VERSION, BINARYEN_ARCH, and BINARYEN_SHA256 env vars - Update all references to use environment variables - Add checksum verification before extraction 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/wasm-sdk-build.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wasm-sdk-build.yml b/.github/workflows/wasm-sdk-build.yml index 21b1ab3be85..df32c1986a1 100644 --- a/.github/workflows/wasm-sdk-build.yml +++ b/.github/workflows/wasm-sdk-build.yml @@ -39,6 +39,10 @@ env: jobs: build-wasm-sdk: runs-on: ubuntu-latest + env: + BINARYEN_VERSION: version_124 + BINARYEN_ARCH: x86_64 + BINARYEN_SHA256: 0290c3779fedf592b8da0ded3032ff55c41a2b7bfa2d6bf7b7bac6f0e6e28963 steps: - name: Checkout repository @@ -103,8 +107,8 @@ jobs: uses: actions/cache@v4 id: cache-binaryen with: - path: ${{ env.HOME }}/.cache/binaryen/version_124 - key: binaryen/version_124/${{ runner.os }}/x86_64 + path: ${{ env.HOME }}/.cache/binaryen/${{ env.BINARYEN_VERSION }} + key: binaryen/${{ env.BINARYEN_VERSION }}/${{ runner.os }}/${{ env.BINARYEN_ARCH }} - name: Install wasm-opt if cache miss if: steps.cache-binaryen.outputs.cache-hit != 'true' @@ -112,13 +116,15 @@ jobs: set -euxo pipefail mkdir -p "${HOME}/.cache/binaryen" curl -fsSL -o /tmp/binaryen.tar.gz \ - "https://github.com/WebAssembly/binaryen/releases/download/version_124/binaryen-version_124-x86_64-linux.tar.gz" + "https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/binaryen-${BINARYEN_VERSION}-${BINARYEN_ARCH}-linux.tar.gz" + # Verify checksum for security + echo "${BINARYEN_SHA256} /tmp/binaryen.tar.gz" | sha256sum -c - tar -xzf /tmp/binaryen.tar.gz -C "${HOME}/.cache/binaryen" - mv "${HOME}/.cache/binaryen/binaryen-version_124" "${HOME}/.cache/binaryen/version_124" + mv "${HOME}/.cache/binaryen/binaryen-${BINARYEN_VERSION}" "${HOME}/.cache/binaryen/${BINARYEN_VERSION}" - name: Export wasm-opt to PATH run: | - echo "${HOME}/.cache/binaryen/version_124/bin" >> $GITHUB_PATH + echo "${HOME}/.cache/binaryen/${BINARYEN_VERSION}/bin" >> $GITHUB_PATH - name: Build WASM SDK working-directory: packages/wasm-sdk From 364d53bb53ef4672055ae5889f9f36e9e97ae306 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 11 Sep 2025 10:35:20 -0400 Subject: [PATCH 7/8] Revert "refactor(ci): parameterize wasm-opt config with environment variables" This reverts commit e5f4e2773f23a54b584d02a5c6c60d73f2e0e19c. --- .github/workflows/wasm-sdk-build.yml | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/wasm-sdk-build.yml b/.github/workflows/wasm-sdk-build.yml index df32c1986a1..21b1ab3be85 100644 --- a/.github/workflows/wasm-sdk-build.yml +++ b/.github/workflows/wasm-sdk-build.yml @@ -39,10 +39,6 @@ env: jobs: build-wasm-sdk: runs-on: ubuntu-latest - env: - BINARYEN_VERSION: version_124 - BINARYEN_ARCH: x86_64 - BINARYEN_SHA256: 0290c3779fedf592b8da0ded3032ff55c41a2b7bfa2d6bf7b7bac6f0e6e28963 steps: - name: Checkout repository @@ -107,8 +103,8 @@ jobs: uses: actions/cache@v4 id: cache-binaryen with: - path: ${{ env.HOME }}/.cache/binaryen/${{ env.BINARYEN_VERSION }} - key: binaryen/${{ env.BINARYEN_VERSION }}/${{ runner.os }}/${{ env.BINARYEN_ARCH }} + path: ${{ env.HOME }}/.cache/binaryen/version_124 + key: binaryen/version_124/${{ runner.os }}/x86_64 - name: Install wasm-opt if cache miss if: steps.cache-binaryen.outputs.cache-hit != 'true' @@ -116,15 +112,13 @@ jobs: set -euxo pipefail mkdir -p "${HOME}/.cache/binaryen" curl -fsSL -o /tmp/binaryen.tar.gz \ - "https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/binaryen-${BINARYEN_VERSION}-${BINARYEN_ARCH}-linux.tar.gz" - # Verify checksum for security - echo "${BINARYEN_SHA256} /tmp/binaryen.tar.gz" | sha256sum -c - + "https://github.com/WebAssembly/binaryen/releases/download/version_124/binaryen-version_124-x86_64-linux.tar.gz" tar -xzf /tmp/binaryen.tar.gz -C "${HOME}/.cache/binaryen" - mv "${HOME}/.cache/binaryen/binaryen-${BINARYEN_VERSION}" "${HOME}/.cache/binaryen/${BINARYEN_VERSION}" + mv "${HOME}/.cache/binaryen/binaryen-version_124" "${HOME}/.cache/binaryen/version_124" - name: Export wasm-opt to PATH run: | - echo "${HOME}/.cache/binaryen/${BINARYEN_VERSION}/bin" >> $GITHUB_PATH + echo "${HOME}/.cache/binaryen/version_124/bin" >> $GITHUB_PATH - name: Build WASM SDK working-directory: packages/wasm-sdk From 93e83fa7ed0102a8b6c5d93ba6c08e9a976d0c85 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 11 Sep 2025 10:36:02 -0400 Subject: [PATCH 8/8] Revert "perf(ci): restore wasm-opt to version 124 for faster builds" This reverts commit a1caf8e20a156cad17931e8fc24aa9ed52b52ac1. --- .github/workflows/wasm-sdk-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wasm-sdk-build.yml b/.github/workflows/wasm-sdk-build.yml index 21b1ab3be85..4b1b0d5b5a0 100644 --- a/.github/workflows/wasm-sdk-build.yml +++ b/.github/workflows/wasm-sdk-build.yml @@ -103,8 +103,8 @@ jobs: uses: actions/cache@v4 id: cache-binaryen with: - path: ${{ env.HOME }}/.cache/binaryen/version_124 - key: binaryen/version_124/${{ runner.os }}/x86_64 + path: ${{ env.HOME }}/.cache/binaryen/version_121 + key: binaryen/version_121/${{ runner.os }}/x86_64 - name: Install wasm-opt if cache miss if: steps.cache-binaryen.outputs.cache-hit != 'true' @@ -112,13 +112,13 @@ jobs: set -euxo pipefail mkdir -p "${HOME}/.cache/binaryen" curl -fsSL -o /tmp/binaryen.tar.gz \ - "https://github.com/WebAssembly/binaryen/releases/download/version_124/binaryen-version_124-x86_64-linux.tar.gz" + "https://github.com/WebAssembly/binaryen/releases/download/version_121/binaryen-version_121-x86_64-linux.tar.gz" tar -xzf /tmp/binaryen.tar.gz -C "${HOME}/.cache/binaryen" - mv "${HOME}/.cache/binaryen/binaryen-version_124" "${HOME}/.cache/binaryen/version_124" + mv "${HOME}/.cache/binaryen/binaryen-version_121" "${HOME}/.cache/binaryen/version_121" - name: Export wasm-opt to PATH run: | - echo "${HOME}/.cache/binaryen/version_124/bin" >> $GITHUB_PATH + echo "${HOME}/.cache/binaryen/version_121/bin" >> $GITHUB_PATH - name: Build WASM SDK working-directory: packages/wasm-sdk