From 2ff2d3e32e50cea5aca2322978705f0ff13caeeb Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Fri, 17 Apr 2026 20:43:05 +0100 Subject: [PATCH 1/6] chore(orchestration): add transaction hash of event to commitment DB in event listener --- .../common/backup-encrypted-data-listener.mjs | 1 + src/boilerplate/common/commitment-storage.mjs | 1 + src/boilerplate/common/encrypted-data-listener.mjs | 9 +++++++-- .../orchestration/files/toOrchestration.ts | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/boilerplate/common/backup-encrypted-data-listener.mjs b/src/boilerplate/common/backup-encrypted-data-listener.mjs index 199cba19c..ac8cfcd51 100644 --- a/src/boilerplate/common/backup-encrypted-data-listener.mjs +++ b/src/boilerplate/common/backup-encrypted-data-listener.mjs @@ -388,6 +388,7 @@ export default class BackupEncryptedDataEventListener { await storeCommitment({ hash: newCommitment, name, + transactionHash: eventData.transactionHash || null, mappingKey: mappingKey?.integer, type: commitmentType, typeNames: structTypeNames, diff --git a/src/boilerplate/common/commitment-storage.mjs b/src/boilerplate/common/commitment-storage.mjs index 7b309df17..96237471d 100644 --- a/src/boilerplate/common/commitment-storage.mjs +++ b/src/boilerplate/common/commitment-storage.mjs @@ -83,6 +83,7 @@ export function formatCommitment(commitment) { _id: commitment.hash.hex(32), name: commitment.name, source: commitment.source, + transactionHash: commitment.transactionHash ?? null, type: commitment.type ?? null, typeNames: Array.isArray(commitment.typeNames) ? commitment.typeNames diff --git a/src/boilerplate/common/encrypted-data-listener.mjs b/src/boilerplate/common/encrypted-data-listener.mjs index 9c087a7fe..8ec456497 100644 --- a/src/boilerplate/common/encrypted-data-listener.mjs +++ b/src/boilerplate/common/encrypted-data-listener.mjs @@ -78,8 +78,13 @@ export default class EncryptedDataEventListener { .flatMap(e => e.returnValues.nullifiers) return Promise.all( backupEvents - .map(e => decrypt(e.returnValues.cipherText, this.publicKey, this.secretKey)) - .map(decodeCommitmentData) + .map(e => { + const commitment = decodeCommitmentData( + decrypt(e.returnValues.cipherText, this.publicKey, this.secretKey), + ); + if (commitment) commitment.transactionHash = e.transactionHash; + return commitment; + }) .filter(c => c) .map(formatCommitment) .map(c => { diff --git a/src/codeGenerators/orchestration/files/toOrchestration.ts b/src/codeGenerators/orchestration/files/toOrchestration.ts index 951f43540..c3dcb0efc 100644 --- a/src/codeGenerators/orchestration/files/toOrchestration.ts +++ b/src/codeGenerators/orchestration/files/toOrchestration.ts @@ -307,6 +307,7 @@ node.stateVariables?.forEach( hash: newCommitment, name: '${variable.name}', source: 'encrypted data', + transactionHash: eventData.transactionHash || null, mappingKey: stateVarId.integer, preimage: { stateVarId, @@ -358,6 +359,7 @@ node.stateVariables?.forEach( hash: newCommitment, name: '${variable.name}', source: 'encrypted data', + transactionHash: eventData.transactionHash || null, mappingKey: stateVarId.integer, preimage: { stateVarId, @@ -811,6 +813,7 @@ const prepareBackupVariable = (node: any) => { await storeCommitment({ hash: newCommitment, name: name, + transactionHash: log.transactionHash || null, mappingKey: mappingKey?.integer, type: commitmentType, typeNames: structTypeNames, @@ -1045,6 +1048,7 @@ const prepareBackupDataRetriever = (node: any) => { await storeCommitment({ hash: newCommitment, name: name, + transactionHash: log.transactionHash || null, mappingKey: mappingKey?.integer, type: commitmentType, typeNames: structTypeNames, From 09771dc85cca6cdc6d349271fb172f8c448f9413 Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Wed, 15 Apr 2026 11:41:38 +0100 Subject: [PATCH 2/6] fix(deployment): parameter defined twice --- src/codeGenerators/orchestration/files/toOrchestration.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codeGenerators/orchestration/files/toOrchestration.ts b/src/codeGenerators/orchestration/files/toOrchestration.ts index c3dcb0efc..669bac9c1 100644 --- a/src/codeGenerators/orchestration/files/toOrchestration.ts +++ b/src/codeGenerators/orchestration/files/toOrchestration.ts @@ -545,7 +545,7 @@ const prepareMigrationsFile = (file: localFile, node: any) => { } } }); - } else if(constructorParamsIncludesAddr) { + } else if (!node.isConstructor && constructorParamsIncludesAddr) { // for each address in the shield contract constructor... constructorAddrParams.forEach(name => { // we have an address input which is likely not a another contract @@ -558,7 +558,7 @@ const prepareMigrationsFile = (file: localFile, node: any) => { }); } if (node.isConstructor) { - // we have a constructor which requires a proof + // we have a cnstrctr.mjs file if (node.functionNames.includes('cnstrctr') || publicConstructorParams.length > 0) { customProofImport += `const constructorInput = JSON.parse( fs.readFileSync('/app/orchestration/common/db/constructorTx.json', 'utf-8'), From 8b076d64806dc97c9b49c0d2b45ac811a3115b22 Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Wed, 15 Apr 2026 12:05:36 +0100 Subject: [PATCH 3/6] fix(tests): use bytes20 which is a supported variable type --- test/real-world-zapps/Voting.zol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/real-world-zapps/Voting.zol b/test/real-world-zapps/Voting.zol index 4a5850999..3b78791ba 100644 --- a/test/real-world-zapps/Voting.zol +++ b/test/real-world-zapps/Voting.zol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; contract Voting { secret mapping (uint256 => uint256) public proposalVotes; - mapping (uint256 => bytes32) public proposals; + mapping (uint256 => bytes20) public proposals; mapping (address => bool) public hasVoted; mapping (address => bool) public canPropose; address public admin; @@ -21,7 +21,7 @@ contract Voting { hasVoted[msg.sender] = true; } - function propose(uint256 proposalId, bytes32 proposalName) public { + function propose(uint256 proposalId, bytes20 proposalName) public { require(canPropose[msg.sender]); proposals[proposalId] = proposalName; } From 2d46b2b3f217c90c9294a1236bb9ebc9daafb09d Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Thu, 16 Apr 2026 16:26:59 +0100 Subject: [PATCH 4/6] fix: github workflows as npm 20 deprecated --- .github/workflows/main.yml | 7 +++---- .github/workflows/release.yml | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed8c72df1..c0e529c2d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v5 # Runs a single command using the runners shell - name: compile and test @@ -41,8 +41,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v5 with: node-version: '16.17.0' @@ -76,4 +76,3 @@ jobs: - name: run zapp apitest run: npx mocha --exit --timeout 50000 --require @babel/register apitest.js - diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aeb769205..e6e8de9c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,8 +8,8 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/checkout@v5 + - uses: actions/setup-node@v5 with: node-version: '14.17.0' - run: | @@ -22,4 +22,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: echo ${{ steps.semantic.outputs.release-version }} \ No newline at end of file + - run: echo ${{ steps.semantic.outputs.release-version }} From e17dba9a85f371123851a1bdb05ccc071b8b46bb Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Thu, 16 Apr 2026 16:40:08 +0100 Subject: [PATCH 5/6] fix(workflow): use local TypeScript in CI via npx tsc --- .github/workflows/main.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0e529c2d..fef98fc4a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: - name: compile and test run: | npm i npm@7 - tsc + npx tsc npm test - name: compile shield contracts and circuits diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6e8de9c5..c8d3bbe7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: node-version: '14.17.0' - run: | npm install - tsc + npx tsc - uses: codfish/semantic-release-action@master id: semantic From b5e13a9b4f410a33539c37a7037ea7d88dc74f8b Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Tue, 21 Apr 2026 17:02:48 +0100 Subject: [PATCH 6/6] chore(orchestration): add tx hash to commitment storage in api calls --- .../orchestration/javascript/raw/boilerplate-generator.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts b/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts index 5fdb2c983..935fff9a4 100644 --- a/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts +++ b/src/boilerplate/orchestration/javascript/raw/boilerplate-generator.ts @@ -687,6 +687,9 @@ sendTransaction = { isConstructor }): string[] { let value; + const transactionHash = isConstructor + ? `null` + : `encBackupEvent?.[0]?.transactionHash || null`; const commitmentType = !Array.isArray(valueType) && ['bytes20', 'address'].includes(valueType) ? `\n type: '${valueType}',` : ''; @@ -708,6 +711,7 @@ sendTransaction = { \nawait storeCommitment({ hash: ${stateName}_newCommitment, name: '${mappingName}', + transactionHash: ${transactionHash}, mappingKey: ${mappingKey === `` ? `null` : `${mappingKey}`}, ${commitmentType} ${commitmentTypeNames} @@ -729,6 +733,7 @@ sendTransaction = { \nawait storeCommitment({ hash: ${stateName}_2_newCommitment, name: '${mappingName}', + transactionHash: ${transactionHash}, mappingKey: ${mappingKey === `` ? `null` : `${mappingKey}`}, ${commitmentType} ${commitmentTypeNames} @@ -755,6 +760,7 @@ sendTransaction = { \nawait storeCommitment({ hash: ${stateName}_newCommitment, name: '${mappingName}', + transactionHash: ${transactionHash}, mappingKey: ${mappingKey === `` ? `null` : `${mappingKey}`}, ${commitmentType} ${commitmentTypeNames}