Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
fix: fixing private voting by correctly throwing an error if simulation fails (#7840)

This PR makes a simulation of a tx fail, if the tx cannot be included in
a block and added to the state.

e.g. If a simulation produces duplicate nullifiers, or nullifiers that
already exist in a state tree, the results of this simulation should not
be returned, but should warn users that the transaction simulated is
impossible to actually be added to a block due to being an invalid
transaction.

The method for achieving the above is that a new API on the node was
created, used for validating the correctness of the metadata and
side-effects produced by a transaction. A transaction is deemed valid if
and only if the transaction can be added to a block that can be used to
advance state.

Note: this update does not make this validation necessary, and defaults
to offline simulation. Offline simulation is previous non-validated
behavior, and is potentially useful if we ever move to a model where a
node is optional to a pxe.

Another note just for reference: there is weirdness in e2e_prover, that
fails the proof validation.

Resolves #4781.

Apply suggestions from code review

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
  • Loading branch information
sklppy88 and nventuro committed Aug 18, 2024
1 parent 2ebba0d commit 56b7ddc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion yarn-project/aztec-node/src/aztec-node/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ import { getCanonicalMultiCallEntrypointAddress } from '@aztec/protocol-contract
import {
AggregateTxValidator,
DataTxValidator,
DoubleSpendTxValidator,
type GlobalVariableBuilder,
SequencerClient,
getGlobalVariableBuilder,
} from '@aztec/sequencer-client';
import { PublicProcessorFactory, WASMSimulator, createSimulationProvider } from '@aztec/simulator';
import { PublicProcessorFactory, WASMSimulator, WorldStateDB, createSimulationProvider } from '@aztec/simulator';
import { type TelemetryClient } from '@aztec/telemetry-client';
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
import {
Expand Down Expand Up @@ -169,6 +170,7 @@ export class AztecNodeService implements AztecNode {
new DataTxValidator(),
new MetadataTxValidator(config.l1ChainId),
new TxProofValidator(proofVerifier),
new DoubleSpendTxValidator(new WorldStateDB(worldStateSynchronizer.getLatest())),
);

const simulationProvider = await createSimulationProvider(config, log);
Expand Down
1 change: 1 addition & 0 deletions yarn-project/sequencer-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './publisher/index.js';
export * from './sequencer/index.js';
export * from './tx_validator/aggregate_tx_validator.js';
export * from './tx_validator/data_validator.js';
export * from './tx_validator/double_spend_validator.js';

// Used by the node to simulate public parts of transactions. Should these be moved to a shared library?
export * from './global_variable_builder/index.js';

0 comments on commit 56b7ddc

Please sign in to comment.