diff --git a/yarn-project/simulator/src/avm/journal/journal.ts b/yarn-project/simulator/src/avm/journal/journal.ts index e80f01a53c3..7d27597a30e 100644 --- a/yarn-project/simulator/src/avm/journal/journal.ts +++ b/yarn-project/simulator/src/avm/journal/journal.ts @@ -161,7 +161,7 @@ export class AvmPersistableStateManager { const leafSlot = computePublicDataTreeLeafSlot(contractAddress, slot); if (this.doMerkleOperations) { const result = await this.merkleTrees.writePublicStorage(leafSlot, value); - assert(result !== undefined, 'Public data tree insertion error. You might want to disable skipMerkleOperations.'); + assert(result !== undefined, 'Public data tree insertion error. You might want to disable doMerkleOperations.'); this.log.debug(`Inserted public data tree leaf at leafSlot ${leafSlot}, value: ${value}`); const lowLeafInfo = result.lowWitness; @@ -525,15 +525,22 @@ export class AvmPersistableStateManager { public async getContractInstance(contractAddress: AztecAddress): Promise { this.log.debug(`Getting contract instance for address ${contractAddress}`); const instanceWithAddress = await this.worldStateDB.getContractInstance(contractAddress); - const contractAddressNullifier = siloNullifier( - AztecAddress.fromNumber(DEPLOYER_CONTRACT_ADDRESS), - contractAddress.toField(), - ); const exists = instanceWithAddress !== undefined; - const [existsInTree, leafOrLowLeafPreimage, leafOrLowLeafIndex, leafOrLowLeafPath] = - await this.getNullifierMembership(/*siloedNullifier=*/ contractAddressNullifier); + let [existsInTree, leafOrLowLeafPreimage, leafOrLowLeafIndex, leafOrLowLeafPath] = [ + exists, + NullifierLeafPreimage.empty(), + Fr.ZERO, + new Array(), + ]; if (!contractAddressIsCanonical(contractAddress)) { + const contractAddressNullifier = siloNullifier( + AztecAddress.fromNumber(DEPLOYER_CONTRACT_ADDRESS), + contractAddress.toField(), + ); + [existsInTree, leafOrLowLeafPreimage, leafOrLowLeafIndex, leafOrLowLeafPath] = await this.getNullifierMembership( + /*siloedNullifier=*/ contractAddressNullifier, + ); assert( exists == existsInTree, 'WorldStateDB contains contract instance, but nullifier tree does not contain contract address (or vice versa).... This is a bug!', @@ -584,14 +591,21 @@ export class AvmPersistableStateManager { this.log.debug(`Getting bytecode for contract address ${contractAddress}`); const instanceWithAddress = await this.worldStateDB.getContractInstance(contractAddress); const exists = instanceWithAddress !== undefined; - const contractAddressNullifier = siloNullifier( - AztecAddress.fromNumber(DEPLOYER_CONTRACT_ADDRESS), - contractAddress.toField(), - ); - const [existsInTree, leafOrLowLeafPreimage, leafOrLowLeafIndex, leafOrLowLeafPath] = - await this.getNullifierMembership(/*siloedNullifier=*/ contractAddressNullifier); + let [existsInTree, leafOrLowLeafPreimage, leafOrLowLeafIndex, leafOrLowLeafPath] = [ + exists, + NullifierLeafPreimage.empty(), + Fr.ZERO, + new Array(), + ]; if (!contractAddressIsCanonical(contractAddress)) { + const contractAddressNullifier = siloNullifier( + AztecAddress.fromNumber(DEPLOYER_CONTRACT_ADDRESS), + contractAddress.toField(), + ); + [existsInTree, leafOrLowLeafPreimage, leafOrLowLeafIndex, leafOrLowLeafPath] = await this.getNullifierMembership( + /*siloedNullifier=*/ contractAddressNullifier, + ); assert( exists == existsInTree, 'WorldStateDB contains contract instance, but nullifier tree does not contain contract address (or vice versa).... This is a bug!', diff --git a/yarn-project/simulator/src/public/fixtures/index.ts b/yarn-project/simulator/src/public/fixtures/index.ts index 2538eda8139..f99e157ee14 100644 --- a/yarn-project/simulator/src/public/fixtures/index.ts +++ b/yarn-project/simulator/src/public/fixtures/index.ts @@ -73,7 +73,6 @@ export async function simulateAvmTestContractGenerateCircuitInputs( worldStateDB, new NoopTelemetryClient(), globalVariables, - /*realAvmProving=*/ true, /*doMerkleOperations=*/ true, ); diff --git a/yarn-project/simulator/src/public/public_processor.ts b/yarn-project/simulator/src/public/public_processor.ts index d11ac645e59..16d0b63ba94 100644 --- a/yarn-project/simulator/src/public/public_processor.ts +++ b/yarn-project/simulator/src/public/public_processor.ts @@ -53,7 +53,13 @@ export class PublicProcessorFactory { const historicalHeader = maybeHistoricalHeader ?? merkleTree.getInitialHeader(); const worldStateDB = new WorldStateDB(merkleTree, this.contractDataSource); - const publicTxSimulator = new PublicTxSimulator(merkleTree, worldStateDB, this.telemetryClient, globalVariables); + const publicTxSimulator = new PublicTxSimulator( + merkleTree, + worldStateDB, + this.telemetryClient, + globalVariables, + /*doMerkleOperations=*/ true, + ); return new PublicProcessor( merkleTree, diff --git a/yarn-project/simulator/src/public/public_tx_simulator.test.ts b/yarn-project/simulator/src/public/public_tx_simulator.test.ts index c17d1d03bf5..0b040f235a3 100644 --- a/yarn-project/simulator/src/public/public_tx_simulator.test.ts +++ b/yarn-project/simulator/src/public/public_tx_simulator.test.ts @@ -209,7 +209,6 @@ describe('public_tx_simulator', () => { worldStateDB, new NoopTelemetryClient(), GlobalVariables.from({ ...GlobalVariables.empty(), gasFees }), - /*realAvmProvingRequest=*/ false, /*doMerkleOperations=*/ true, ); diff --git a/yarn-project/simulator/src/public/public_tx_simulator.ts b/yarn-project/simulator/src/public/public_tx_simulator.ts index 7c7546e9b0c..3fd7afd5905 100644 --- a/yarn-project/simulator/src/public/public_tx_simulator.ts +++ b/yarn-project/simulator/src/public/public_tx_simulator.ts @@ -60,7 +60,6 @@ export class PublicTxSimulator { private worldStateDB: WorldStateDB, telemetryClient: TelemetryClient, private globalVariables: GlobalVariables, - private realAvmProvingRequests: boolean = true, private doMerkleOperations: boolean = false, ) { this.log = createDebugLogger(`aztec:public_tx_simulator`); diff --git a/yarn-project/txe/src/oracle/txe_oracle.ts b/yarn-project/txe/src/oracle/txe_oracle.ts index 3a2f5daae66..570365499c4 100644 --- a/yarn-project/txe/src/oracle/txe_oracle.ts +++ b/yarn-project/txe/src/oracle/txe_oracle.ts @@ -660,7 +660,6 @@ export class TXE implements TypedOracle { new TXEWorldStateDB(db, new TXEPublicContractDataSource(this)), new NoopTelemetryClient(), globalVariables, - /*realAvmProvingRequests=*/ false, ); // When setting up a teardown call, we tell it that