diff --git a/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts b/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts index abae7a1b3..03123130e 100644 --- a/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts +++ b/src/boilerplate/contract/solidity/raw/ContractBoilerplateGenerator.ts @@ -219,7 +219,6 @@ class ContractBoilerplateGenerator { newCommitments: 0, encryption: 0, }; - _inputs.map(i => verifyInputsMap(type, i, counter)); diff --git a/src/transformers/visitors/toContractVisitor.ts b/src/transformers/visitors/toContractVisitor.ts index 9e5c6618f..cb4acfc23 100644 --- a/src/transformers/visitors/toContractVisitor.ts +++ b/src/transformers/visitors/toContractVisitor.ts @@ -301,6 +301,23 @@ export default { state.circuitParams ??= {}; state.circuitParams[path.getUniqueFunctionName()] ??= {}; state.circuitParams[path.getUniqueFunctionName()].parameters = circuitParams; + // Delete repeated circuit parameters + let deletedIndexes = []; + state.circuitParams[path.getUniqueFunctionName()].parameters.forEach((circParam1, index1) => { + state.circuitParams[path.getUniqueFunctionName()].parameters.forEach((circParam2, index2) => { + if (circParam1.bpType === 'nullification' && circParam2.bpType === 'nullification' && circParam1.name === circParam2.name && index1 > index2) { + deletedIndexes.push(index1); + } + if (circParam1.bpType === 'newCommitment' && circParam2.bpType === 'newCommitment' && circParam1.name === circParam2.name && index1 > index2) { + deletedIndexes.push(index1); + } + }); + }); + deletedIndexes = [...new Set(deletedIndexes)]; + deletedIndexes.sort((a, b) => b - a); + deletedIndexes.forEach(index => { + state.circuitParams[path.getUniqueFunctionName()].parameters.splice(index, 1); + }); }, exit(path: NodePath, state: any) { @@ -901,7 +918,6 @@ DoWhileStatement: { ...(internalfnDefIndicators.nullifiersRequired? [`newNullifiers`] : []), ...(internalfnDefIndicators.oldCommitmentAccessRequired ? [`commitmentRoot`] : []), ...(internalfnDefIndicators.newCommitmentsRequired ? [`newCommitments`] : []), - ...(internalfnDefIndicators.containsAccessedOnlyState ? [`checkNullifiers`] : []), ...(internalfnDefIndicators.encryptionRequired ? [`cipherText`] : []), ...(internalfnDefIndicators.encryptionRequired ? [`ephPubKeys`] : []), `proof`,