From 213ec746859919d008745c42b3cfeaca6f9d3889 Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Wed, 19 Nov 2025 22:59:17 -0300 Subject: [PATCH 1/3] fix: burningfor reinitialisable variables --- src/traverse/Binding.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/traverse/Binding.ts b/src/traverse/Binding.ts index 3e3f554c..ed66ec53 100644 --- a/src/traverse/Binding.ts +++ b/src/traverse/Binding.ts @@ -601,17 +601,7 @@ export class VariableBinding extends Binding { } } } - // mapping[key] = msg.sender is owned by msg.sender => look for mapping[key] = 0 - // OR owner is some value (admin = address) => look for admin = 0 - if ( - ownerNode.name === 'msg' && - ownerNode.mappingOwnershipType === 'value' - ) { - // the owner is represented by the mapping value - we look through the modifyingPaths for 0 - this.searchModifyingPathsForZero(); - } else if (ownerBinding && ownerBinding instanceof VariableBinding) { - ownerBinding.searchModifyingPathsForZero(); - } + this.searchModifyingPathsForZero(); if (this.reinitialisable && !this.isBurned) throw new SyntaxUsageError( `The state ${this.name} has been marked as reinitialisable but we can't find anywhere to burn a commitment ready for reinitialisation.`, From 6a0d64e978631988bba952e97ed4caa44bf4d640 Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Thu, 27 Nov 2025 17:38:49 +0000 Subject: [PATCH 2/3] fix(contracts): error in length of inputs for proof verification when there are checkNullifiers but no new nullifiers --- .../solidity/raw/ContractBoilerplateGenerator.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts b/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts index dea9db85..ab051966 100644 --- a/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts +++ b/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts @@ -218,7 +218,18 @@ class ContractBoilerplateGenerator { 'customInputs.length', ...(newNullifiers ? ['newNullifiers.length'] : []), ...(checkNullifiers ? ['checkNullifiers.length']: []), - ...(commitmentRoot ? ['(newNullifiers.length > 0 ? 1 : 0)'] : []), + ...(() => { + if (commitmentRoot){ + if (checkNullifiers && newNullifiers) { + return ['((newNullifiers.length + checkNullifiers.length) > 0 ? 1 : 0)']; + } + if (checkNullifiers) { + return ['((checkNullifiers.length) > 0 ? 1 : 0)']; + } + return ['(newNullifiers.length > 0 ? 1 : 0)']; + } + return []; + })(), ...(newCommitments ? ['newCommitments.length'] : []), ...(encryptionRequired ? ['encInputsLen'] : []), ].join(' + ')});`, From e884c8696d692540cdb25ec107e0f2bf7e3d8de5 Mon Sep 17 00:00:00 2001 From: Lydia Garms Date: Fri, 28 Nov 2025 14:00:12 +0000 Subject: [PATCH 3/3] fix(orchestration): error where we ensure there are new leaves even for functions where there are no new commitments --- .../orchestration/javascript/raw/toOrchestration.ts | 2 +- src/traverse/Indicator.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts b/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts index 63b214e2..04d70e84 100644 --- a/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts +++ b/src/boilerplate/orchestration/javascript/raw/toOrchestration.ts @@ -1052,7 +1052,7 @@ export const OrchestrationCodeBoilerPlate: any = (node: any) => { \n if (!tx) { throw new Error( 'Tx failed - the commitment was not accepted on-chain, or the contract is not deployed.'); } \n`; - if (!node.newCommitmentsRequired){ + if (!node.newCommitmentsRequired) { checkLeaves = ''; } return { diff --git a/src/traverse/Indicator.ts b/src/traverse/Indicator.ts index db20579d..86576543 100644 --- a/src/traverse/Indicator.ts +++ b/src/traverse/Indicator.ts @@ -142,10 +142,11 @@ export class FunctionDefinitionIndicator extends ContractDefinitionIndicator { let burnedOnly = true; for (const [, stateVarIndicator] of Object.entries(this)) { if (!(stateVarIndicator instanceof StateVariableIndicator)) continue; // eslint-disable-line no-continue, no-use-before-define - // if we have a indicator which is NOT burned, then we do need new commitments + // if we have a indicator which is NOT burned and requires new commitments, then we do need new commitments if ( stateVarIndicator.isSecret && - (!stateVarIndicator.isBurned || stateVarIndicator.newCommitmentsRequired) + !stateVarIndicator.isBurned && + stateVarIndicator.newCommitmentsRequired ) { burnedOnly = false; break;