diff --git a/yarn-project/aztec-node/src/aztec-node/server.ts b/yarn-project/aztec-node/src/aztec-node/server.ts index 27d0cbc032fb..da98547c0bf4 100644 --- a/yarn-project/aztec-node/src/aztec-node/server.ts +++ b/yarn-project/aztec-node/src/aztec-node/server.ts @@ -15,6 +15,7 @@ import { LogType, MerkleTreeId, NullifierMembershipWitness, + type ProcessedTx, type ProverConfig, PublicDataWitness, PublicSimulationOutput, @@ -25,6 +26,7 @@ import { type TxHash, TxReceipt, TxStatus, + type TxValidator, partitionReverts, } from '@aztec/circuit-types'; import { @@ -762,7 +764,7 @@ export class AztecNodeService implements AztecNode { ); } - public async isValidTx(tx: Tx): Promise { + public async isValidTx(tx: Tx, isSimulation: boolean = false): Promise { const blockNumber = (await this.blockSource.getBlockNumber()) + 1; const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables( @@ -775,12 +777,17 @@ export class AztecNodeService implements AztecNode { // These validators are taken from the sequencer, and should match. // The reason why `phases` and `gas` tx validator is in the sequencer and not here is because // those tx validators are customizable by the sequencer. - const txValidator = new AggregateTxValidator( + const txValidators: TxValidator[] = [ new DataTxValidator(), new MetadataTxValidator(newGlobalVariables), new DoubleSpendTxValidator(new WorldStateDB(this.worldStateSynchronizer.getLatest())), - new TxProofValidator(this.proofVerifier), - ); + ]; + + if (!isSimulation) { + txValidators.push(new TxProofValidator(this.proofVerifier)); + } + + const txValidator = new AggregateTxValidator(...txValidators); const [_, invalidTxs] = await txValidator.validateTxs([tx]); if (invalidTxs.length > 0) { diff --git a/yarn-project/aztec.js/src/contract/batch_call.ts b/yarn-project/aztec.js/src/contract/batch_call.ts index 3a02a7139015..19fb03999f69 100644 --- a/yarn-project/aztec.js/src/contract/batch_call.ts +++ b/yarn-project/aztec.js/src/contract/batch_call.ts @@ -78,7 +78,7 @@ export class BatchCall extends BaseContractInteraction { const [unconstrainedResults, simulatedTx] = await Promise.all([ Promise.all(unconstrainedCalls), - this.wallet.simulateTx(txRequest, true, options?.from), + this.wallet.simulateTx(txRequest, true, options?.from, options?.skipTxValidation), ]); const results: any[] = []; diff --git a/yarn-project/circuit-types/src/interfaces/aztec-node.ts b/yarn-project/circuit-types/src/interfaces/aztec-node.ts index 70dbc3fb8b4f..16c64a1ac423 100644 --- a/yarn-project/circuit-types/src/interfaces/aztec-node.ts +++ b/yarn-project/circuit-types/src/interfaces/aztec-node.ts @@ -327,8 +327,9 @@ export interface AztecNode { * made invalid by *other* transactions if e.g. they emit the same nullifiers, or come become invalid * due to e.g. the max_block_number property. * @param tx - The transaction to validate for correctness. + * @param isSimulation - True if the transaction is a simulated one without generated proofs. (Optional) */ - isValidTx(tx: Tx): Promise; + isValidTx(tx: Tx, isSimulation?: boolean): Promise; /** * Updates the configuration of this node. diff --git a/yarn-project/end-to-end/package.local.json b/yarn-project/end-to-end/package.local.json index c76111c3c265..16ebe7dc24aa 100644 --- a/yarn-project/end-to-end/package.local.json +++ b/yarn-project/end-to-end/package.local.json @@ -5,4 +5,4 @@ "test": "TIME_TRAVELER=${TIME_TRAVELER:-true} LOG_LEVEL=${LOG_LEVEL:-verbose} DEBUG_COLORS=1 NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit", "test:unit": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest src/fixtures" } -} \ No newline at end of file +} diff --git a/yarn-project/end-to-end/src/simulators/token_simulator.ts b/yarn-project/end-to-end/src/simulators/token_simulator.ts index c4addad4b217..3e43b617e390 100644 --- a/yarn-project/end-to-end/src/simulators/token_simulator.ts +++ b/yarn-project/end-to-end/src/simulators/token_simulator.ts @@ -105,7 +105,11 @@ export class TokenSimulator { } const results = ( - await Promise.all(chunk(calls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate())) + await Promise.all( + chunk(calls, 4).map(batch => + new BatchCall(this.defaultWallet, batch).simulate(), + ), + ) ).flat(); expect(results[0]).toEqual(this.totalSupply); @@ -133,7 +137,11 @@ export class TokenSimulator { defaultCalls.push(this.token.methods.balance_of_private(address).request()); } const results = ( - await Promise.all(chunk(defaultCalls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate())) + await Promise.all( + chunk(defaultCalls, 4).map(batch => + new BatchCall(this.defaultWallet, batch).simulate(), + ), + ) ).flat(); for (let i = 0; i < defaultLookups.length; i++) { expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i])); diff --git a/yarn-project/pxe/src/pxe_service/pxe_service.ts b/yarn-project/pxe/src/pxe_service/pxe_service.ts index 972ef5ce916a..1b058896756b 100644 --- a/yarn-project/pxe/src/pxe_service/pxe_service.ts +++ b/yarn-project/pxe/src/pxe_service/pxe_service.ts @@ -532,7 +532,7 @@ export class PXEService implements PXE { txRequest: TxExecutionRequest, simulatePublic: boolean, msgSender: AztecAddress | undefined = undefined, - skipTxValidation: boolean = true, // TODO(#7956): make the default be false + skipTxValidation: boolean = false, scopes?: AztecAddress[], ): Promise { return await this.jobQueue.put(async () => { @@ -542,7 +542,7 @@ export class PXEService implements PXE { } if (!skipTxValidation) { - if (!(await this.node.isValidTx(simulatedTx.tx))) { + if (!(await this.node.isValidTx(simulatedTx.tx, true))) { throw new Error('The simulated transaction is unable to be added to state and is invalid.'); } }