Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(' + ')});`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 1 addition & 11 deletions src/traverse/Binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
Expand Down
5 changes: 3 additions & 2 deletions src/traverse/Indicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading