Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yarn-project/end-to-end/src/fixtures/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const U128_UNDERFLOW_ERROR = "Assertion failed: attempt to subtract with
export const U128_OVERFLOW_ERROR = "Assertion failed: attempt to add with overflow 'hi == high'";
export const BITSIZE_TOO_BIG_ERROR = "Assertion failed: call to assert_max_bit_size 'self.__assert_max_bit_size'";
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/5818): Make these a fixed error after transition.
export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted/;
export const DUPLICATE_NULLIFIER_ERROR = /dropped|duplicate nullifier|reverted|Nullifier collision/;
export const NO_L1_TO_L2_MSG_ERROR =
/No non-nullified L1 to L2 message found for message hash|Tried to consume nonexistent L1-to-L2 message/;
export const STATIC_CALL_STATE_MODIFICATION_ERROR =
Expand Down
21 changes: 19 additions & 2 deletions yarn-project/simulator/src/public/public_tx_simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { strict as assert } from 'assert';

import { type AvmFinalizedCallResult } from '../avm/avm_contract_call_result.js';
import { type AvmPersistableStateManager, AvmSimulator } from '../avm/index.js';
import { NullifierCollisionError } from '../avm/journal/nullifiers.js';
import { getPublicFunctionDebugName } from '../common/debug_fn_name.js';
import { ExecutorMetrics } from './executor_metrics.js';
import { type WorldStateDB } from './public_db_sources.js';
Expand Down Expand Up @@ -385,7 +386,15 @@ export class PublicTxSimulator {
*/
public async insertNonRevertiblesFromPrivate(context: PublicTxContext) {
const stateManager = context.state.getActiveStateManager();
await stateManager.writeSiloedNullifiersFromPrivate(context.nonRevertibleAccumulatedDataFromPrivate.nullifiers);
try {
await stateManager.writeSiloedNullifiersFromPrivate(context.nonRevertibleAccumulatedDataFromPrivate.nullifiers);
} catch (e) {
if (e instanceof NullifierCollisionError) {
Comment thread
dbanks12 marked this conversation as resolved.
throw new NullifierCollisionError(
`Nullifier collision encountered when inserting non-revertible nullifiers from private. Details: ${e.message}`,
);
}
}
}

/**
Expand All @@ -396,6 +405,14 @@ export class PublicTxSimulator {
// Fork the state manager so we can rollback to end of setup if app logic reverts.
context.state.fork();
const stateManager = context.state.getActiveStateManager();
await stateManager.writeSiloedNullifiersFromPrivate(context.revertibleAccumulatedDataFromPrivate.nullifiers);
try {
await stateManager.writeSiloedNullifiersFromPrivate(context.revertibleAccumulatedDataFromPrivate.nullifiers);
} catch (e) {
if (e instanceof NullifierCollisionError) {
throw new NullifierCollisionError(
`Nullifier collision encountered when inserting revertible nullifiers from private. Details: ${e.message}`,
);
}
}
}
}