Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Check initialization arguments in constructors #5144

Merged
merged 13 commits into from
Mar 13, 2024
Prev Previous commit
Next Next commit
Fix simulator test
spalladino committed Mar 13, 2024
commit 03ef9861fde1c37918b34ef8c11b0d89b86a7b63
13 changes: 5 additions & 8 deletions yarn-project/simulator/src/client/private_execution.test.ts
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ import {
computeNullifierSecretKey,
computeSiloedNullifierSecretKey,
derivePublicKey,
getContractInstanceFromDeployParams,
nonEmptySideEffects,
sideEffectArrayToValueArray,
} from '@aztec/circuits.js';
@@ -117,13 +118,7 @@ describe('Private Execution test suite', () => {
authWitnesses: [],
});

return acirSimulator.run(
txRequest,
artifact,
functionData.isConstructor ? AztecAddress.ZERO : contractAddress,
portalContractAddress,
msgSender,
);
return acirSimulator.run(txRequest, artifact, contractAddress, portalContractAddress, msgSender);
};

const insertLeaves = async (leaves: Fr[], name = 'noteHash') => {
@@ -298,8 +293,10 @@ describe('Private Execution test suite', () => {
});

it('should have a constructor with arguments that inserts notes', async () => {
const instance = getContractInstanceFromDeployParams(StatefulTestContractArtifact, [owner, 140]);
oracle.getContractInstance.mockResolvedValue(instance);
const artifact = getFunctionArtifact(StatefulTestContractArtifact, 'constructor');
const topLevelResult = await runSimulator({ args: [owner, 140], artifact });
const topLevelResult = await runSimulator({ args: [owner, 140], artifact, contractAddress: instance.address });
const result = topLevelResult.nestedExecutions[0];

expect(result.newNotes).toHaveLength(1);