Skip to content

Commit

Permalink
fix: enforce parity of sequencer tx validation and node tx validation (
Browse files Browse the repository at this point in the history
…#7951)

Part of #4781 by having parity between sequencer tx validation and node
tx validation.

Note that we are using the validators from the sequencer, and they
should match. We are omitting `phases` and `gas` tx validator which is
in the sequencer and not here is because those tx validators are
customizable by the sequencer and not uniform between all sequencers.

---------

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
  • Loading branch information
2 people authored and codygunton committed Aug 30, 2024
1 parent 571c7c7 commit 8cadd87
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
type TxHash,
TxReceipt,
TxStatus,
type TxValidator,
partitionReverts,
} from '@aztec/circuit-types';
import {
Expand Down Expand Up @@ -764,7 +763,7 @@ export class AztecNodeService implements AztecNode {
);
}

public async isValidTx(tx: Tx, isSimulation: boolean = false): Promise<boolean> {
public async isValidTx(tx: Tx): Promise<boolean> {
const blockNumber = (await this.blockSource.getBlockNumber()) + 1;

const newGlobalVariables = await this.globalVariableBuilder.buildGlobalVariables(
Expand All @@ -777,17 +776,12 @@ 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 txValidators: TxValidator<Tx | ProcessedTx>[] = [
const txValidator = new AggregateTxValidator(
new DataTxValidator(),
new MetadataTxValidator(newGlobalVariables),
new DoubleSpendTxValidator(new WorldStateDB(this.worldStateSynchronizer.getLatest())),
];

if (!isSimulation) {
txValidators.push(new TxProofValidator(this.proofVerifier));
}

const txValidator = new AggregateTxValidator(...txValidators);
new TxProofValidator(this.proofVerifier),
);

const [_, invalidTxs] = await txValidator.validateTxs([tx]);
if (invalidTxs.length > 0) {
Expand Down

0 comments on commit 8cadd87

Please sign in to comment.