@aztec/simulator 3.0.0-nightly.20251208 → 3.0.0-nightly.20251210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/common/errors.d.ts +2 -2
- package/dest/common/errors.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.d.ts +2 -2
- package/dest/private/acvm/deserialize.d.ts.map +1 -1
- package/dest/private/acvm/deserialize.js +1 -1
- package/dest/private/acvm/serialize.d.ts +2 -2
- package/dest/private/acvm/serialize.d.ts.map +1 -1
- package/dest/private/acvm/serialize.js +1 -1
- package/dest/private/circuit_recording/circuit_recorder.js +1 -1
- package/dest/public/avm/avm_context.d.ts +2 -2
- package/dest/public/avm/avm_context.d.ts.map +1 -1
- package/dest/public/avm/avm_contract_call_result.d.ts +2 -2
- package/dest/public/avm/avm_contract_call_result.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.d.ts +2 -2
- package/dest/public/avm/avm_execution_environment.d.ts.map +1 -1
- package/dest/public/avm/avm_execution_environment.js +1 -1
- package/dest/public/avm/avm_gas.d.ts +1 -1
- package/dest/public/avm/avm_gas.d.ts.map +1 -1
- package/dest/public/avm/avm_machine_state.d.ts +2 -2
- package/dest/public/avm/avm_machine_state.d.ts.map +1 -1
- package/dest/public/avm/avm_memory_types.d.ts +2 -2
- package/dest/public/avm/avm_memory_types.d.ts.map +1 -1
- package/dest/public/avm/avm_memory_types.js +1 -1
- package/dest/public/avm/avm_simulator.d.ts +2 -2
- package/dest/public/avm/avm_simulator.d.ts.map +1 -1
- package/dest/public/avm/avm_simulator.js +1 -1
- package/dest/public/avm/errors.d.ts +2 -2
- package/dest/public/avm/errors.d.ts.map +1 -1
- package/dest/public/avm/fixtures/avm_simulation_tester.js +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts +2 -2
- package/dest/public/avm/fixtures/base_avm_simulation_tester.d.ts.map +1 -1
- package/dest/public/avm/fixtures/base_avm_simulation_tester.js +1 -1
- package/dest/public/avm/fixtures/initializers.d.ts +2 -2
- package/dest/public/avm/fixtures/initializers.d.ts.map +1 -1
- package/dest/public/avm/fixtures/initializers.js +1 -1
- package/dest/public/avm/fixtures/utils.d.ts +2 -2
- package/dest/public/avm/fixtures/utils.d.ts.map +1 -1
- package/dest/public/avm/fixtures/utils.js +1 -1
- package/dest/public/avm/opcodes/arithmetic.d.ts +3 -1
- package/dest/public/avm/opcodes/arithmetic.d.ts.map +1 -1
- package/dest/public/avm/opcodes/arithmetic.js +11 -1
- package/dest/public/avm/opcodes/ec_add.js +2 -2
- package/dest/public/avm/opcodes/hashing.d.ts +1 -1
- package/dest/public/avm/opcodes/hashing.d.ts.map +1 -1
- package/dest/public/avm/opcodes/hashing.js +3 -1
- package/dest/public/avm/opcodes/memory.js +1 -1
- package/dest/public/avm/revert_reason.d.ts +2 -2
- package/dest/public/avm/revert_reason.d.ts.map +1 -1
- package/dest/public/avm/serialization/instruction_serialization.js +1 -1
- package/dest/public/avm/test_utils.d.ts +2 -2
- package/dest/public/avm/test_utils.d.ts.map +1 -1
- package/dest/public/avm/test_utils.js +1 -1
- package/dest/public/contracts_db_checkpoint.d.ts +2 -2
- package/dest/public/contracts_db_checkpoint.d.ts.map +1 -1
- package/dest/public/db_interfaces.d.ts +2 -2
- package/dest/public/db_interfaces.d.ts.map +1 -1
- package/dest/public/debug_fn_name.d.ts +2 -2
- package/dest/public/debug_fn_name.d.ts.map +1 -1
- package/dest/public/fixtures/amm_test.js +2 -2
- package/dest/public/fixtures/bulk_test.js +1 -1
- package/dest/public/fixtures/custom_bytecode_tests.d.ts +2 -1
- package/dest/public/fixtures/custom_bytecode_tests.d.ts.map +1 -1
- package/dest/public/fixtures/custom_bytecode_tests.js +21 -0
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.d.ts.map +1 -1
- package/dest/public/fixtures/public_tx_simulation_tester.js +2 -1
- package/dest/public/fixtures/simple_contract_data_source.d.ts +10 -2
- package/dest/public/fixtures/simple_contract_data_source.d.ts.map +1 -1
- package/dest/public/fixtures/simple_contract_data_source.js +35 -0
- package/dest/public/fixtures/token_test.js +1 -1
- package/dest/public/fixtures/utils.d.ts +2 -2
- package/dest/public/fixtures/utils.d.ts.map +1 -1
- package/dest/public/fixtures/utils.js +1 -1
- package/dest/public/fuzzing/avm_simulator_bin.d.ts +2 -0
- package/dest/public/fuzzing/avm_simulator_bin.d.ts.map +1 -0
- package/dest/public/fuzzing/avm_simulator_bin.js +123 -0
- package/dest/public/fuzzing/helpers.d.ts +14 -0
- package/dest/public/fuzzing/helpers.d.ts.map +1 -0
- package/dest/public/fuzzing/helpers.js +75 -0
- package/dest/public/hinting_db_sources.d.ts +2 -2
- package/dest/public/hinting_db_sources.d.ts.map +1 -1
- package/dest/public/hinting_db_sources.js +2 -2
- package/dest/public/index.d.ts +2 -2
- package/dest/public/index.d.ts.map +1 -1
- package/dest/public/index.js +1 -1
- package/dest/public/public_db_sources.d.ts +2 -2
- package/dest/public/public_db_sources.d.ts.map +1 -1
- package/dest/public/public_db_sources.js +1 -1
- package/dest/public/public_processor/public_processor.d.ts +1 -1
- package/dest/public/public_processor/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor/public_processor.js +5 -3
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts +1 -13
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/contract_provider_for_cpp.js +3 -42
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts +1 -1
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.js +4 -4
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts +22 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/dumping_cpp_public_tx_simulator.js +52 -0
- package/dest/public/public_tx_simulator/factories.d.ts +13 -0
- package/dest/public/public_tx_simulator/factories.d.ts.map +1 -0
- package/dest/public/public_tx_simulator/factories.js +28 -0
- package/dest/public/public_tx_simulator/index.d.ts +3 -1
- package/dest/public/public_tx_simulator/index.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/index.js +2 -0
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts +2 -2
- package/dest/public/public_tx_simulator/measured_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.d.ts +2 -2
- package/dest/public/public_tx_simulator/public_tx_context.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_context.js +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts +2 -2
- package/dest/public/public_tx_simulator/public_tx_simulator.d.ts.map +1 -1
- package/dest/public/public_tx_simulator/public_tx_simulator.js +5 -3
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts +2 -2
- package/dest/public/public_tx_simulator/telemetry_public_tx_simulator.d.ts.map +1 -1
- package/dest/public/side_effect_trace.d.ts +2 -2
- package/dest/public/side_effect_trace.d.ts.map +1 -1
- package/dest/public/side_effect_trace.js +1 -1
- package/dest/public/side_effect_trace_interface.d.ts +2 -2
- package/dest/public/side_effect_trace_interface.d.ts.map +1 -1
- package/dest/public/state_manager/nullifiers.d.ts +2 -2
- package/dest/public/state_manager/nullifiers.d.ts.map +1 -1
- package/dest/public/state_manager/public_storage.d.ts +2 -2
- package/dest/public/state_manager/public_storage.d.ts.map +1 -1
- package/dest/public/state_manager/public_storage.js +1 -1
- package/dest/public/state_manager/state_manager.d.ts +2 -2
- package/dest/public/state_manager/state_manager.d.ts.map +1 -1
- package/dest/public/state_manager/state_manager.js +1 -1
- package/package.json +17 -17
- package/src/common/errors.ts +1 -1
- package/src/private/acvm/deserialize.ts +1 -1
- package/src/private/acvm/serialize.ts +1 -1
- package/src/private/circuit_recording/circuit_recorder.ts +1 -1
- package/src/public/avm/avm_context.ts +1 -1
- package/src/public/avm/avm_contract_call_result.ts +1 -1
- package/src/public/avm/avm_execution_environment.ts +1 -1
- package/src/public/avm/avm_gas.ts +3 -3
- package/src/public/avm/avm_machine_state.ts +1 -1
- package/src/public/avm/avm_memory_types.ts +1 -1
- package/src/public/avm/avm_simulator.ts +1 -1
- package/src/public/avm/errors.ts +1 -1
- package/src/public/avm/fixtures/avm_simulation_tester.ts +1 -1
- package/src/public/avm/fixtures/base_avm_simulation_tester.ts +1 -1
- package/src/public/avm/fixtures/initializers.ts +1 -1
- package/src/public/avm/fixtures/utils.ts +1 -1
- package/src/public/avm/opcodes/arithmetic.ts +13 -1
- package/src/public/avm/opcodes/ec_add.ts +2 -2
- package/src/public/avm/opcodes/hashing.ts +3 -1
- package/src/public/avm/opcodes/memory.ts +1 -1
- package/src/public/avm/revert_reason.ts +1 -1
- package/src/public/avm/serialization/instruction_serialization.ts +1 -1
- package/src/public/avm/test_utils.ts +1 -1
- package/src/public/contracts_db_checkpoint.ts +1 -1
- package/src/public/db_interfaces.ts +1 -1
- package/src/public/debug_fn_name.ts +1 -1
- package/src/public/fixtures/amm_test.ts +2 -2
- package/src/public/fixtures/bulk_test.ts +1 -1
- package/src/public/fixtures/custom_bytecode_tests.ts +24 -0
- package/src/public/fixtures/minimal_public_tx.ts +1 -1
- package/src/public/fixtures/public_tx_simulation_tester.ts +2 -1
- package/src/public/fixtures/simple_contract_data_source.ts +40 -1
- package/src/public/fixtures/token_test.ts +1 -1
- package/src/public/fixtures/utils.ts +1 -1
- package/src/public/fuzzing/avm_simulator_bin.ts +157 -0
- package/src/public/fuzzing/helpers.ts +154 -0
- package/src/public/hinting_db_sources.ts +2 -2
- package/src/public/index.ts +2 -0
- package/src/public/public_db_sources.ts +1 -1
- package/src/public/public_processor/public_processor.ts +8 -3
- package/src/public/public_tx_simulator/contract_provider_for_cpp.ts +3 -49
- package/src/public/public_tx_simulator/cpp_public_tx_simulator_with_hinted_dbs.ts +1 -1
- package/src/public/public_tx_simulator/cpp_vs_ts_public_tx_simulator.ts +4 -8
- package/src/public/public_tx_simulator/dumping_cpp_public_tx_simulator.ts +81 -0
- package/src/public/public_tx_simulator/factories.ts +41 -0
- package/src/public/public_tx_simulator/index.ts +2 -0
- package/src/public/public_tx_simulator/measured_public_tx_simulator.ts +1 -1
- package/src/public/public_tx_simulator/public_tx_context.ts +1 -1
- package/src/public/public_tx_simulator/public_tx_simulator.ts +14 -3
- package/src/public/public_tx_simulator/telemetry_public_tx_simulator.ts +1 -1
- package/src/public/side_effect_trace.ts +1 -1
- package/src/public/side_effect_trace_interface.ts +1 -1
- package/src/public/state_manager/nullifiers.ts +1 -1
- package/src/public/state_manager/public_storage.ts +1 -1
- package/src/public/state_manager/state_manager.ts +2 -2
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS,
|
|
3
|
+
MAX_ENQUEUED_CALLS_PER_TX,
|
|
4
|
+
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
5
|
+
MAX_NOTE_HASHES_PER_TX,
|
|
6
|
+
MAX_NULLIFIERS_PER_TX,
|
|
7
|
+
MAX_PRIVATE_LOGS_PER_TX,
|
|
8
|
+
} from '@aztec/constants';
|
|
9
|
+
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
10
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
|
+
import type { AvmTxHint } from '@aztec/stdlib/avm';
|
|
12
|
+
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
13
|
+
import { siloNullifier } from '@aztec/stdlib/hash';
|
|
14
|
+
import {
|
|
15
|
+
PartialPrivateTailPublicInputsForPublic,
|
|
16
|
+
PrivateKernelTailCircuitPublicInputs,
|
|
17
|
+
PrivateToPublicAccumulatedData,
|
|
18
|
+
PublicCallRequest,
|
|
19
|
+
} from '@aztec/stdlib/kernel';
|
|
20
|
+
import { PrivateLog } from '@aztec/stdlib/logs';
|
|
21
|
+
import { ScopedL2ToL1Message } from '@aztec/stdlib/messaging';
|
|
22
|
+
import { ChonkProof } from '@aztec/stdlib/proofs';
|
|
23
|
+
import { MerkleTreeId, type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
24
|
+
import { BlockHeader, HashedValues, Tx, TxConstantData, TxContext, TxHash } from '@aztec/stdlib/tx';
|
|
25
|
+
|
|
26
|
+
// Registers a contract by inserting its address nullifier into the nullifier tree
|
|
27
|
+
export async function registerContract(
|
|
28
|
+
merkleTrees: MerkleTreeWriteOperations,
|
|
29
|
+
contractAddress: AztecAddress,
|
|
30
|
+
): Promise<void> {
|
|
31
|
+
const contractAddressNullifier = await siloNullifier(
|
|
32
|
+
AztecAddress.fromNumber(CONTRACT_INSTANCE_REGISTRY_CONTRACT_ADDRESS),
|
|
33
|
+
contractAddress.toField(),
|
|
34
|
+
);
|
|
35
|
+
await merkleTrees.sequentialInsert(MerkleTreeId.NULLIFIER_TREE, [contractAddressNullifier.toBuffer()]);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a TypeScript Tx object from a deserialized C++ Tx (AvmTxHint-like structure).
|
|
40
|
+
* This allows using PublicTxSimulator.simulate() with fuzzer-generated transactions.
|
|
41
|
+
*
|
|
42
|
+
* @param cppTx - Deserialized C++ Tx from msgpack (matches AvmTxHint structure)
|
|
43
|
+
* @returns A TypeScript Tx suitable for PublicTxSimulator
|
|
44
|
+
*/
|
|
45
|
+
export async function createFuzzerTx(cppTx: AvmTxHint): Promise<Tx> {
|
|
46
|
+
// Create TxHash from the C++ tx hash string
|
|
47
|
+
if (!cppTx.hash) {
|
|
48
|
+
throw new Error(`cppTx.hash is undefined. Keys: ${Object.keys(cppTx || {}).join(', ')}`);
|
|
49
|
+
}
|
|
50
|
+
const txHash = TxHash.fromString(cppTx.hash);
|
|
51
|
+
|
|
52
|
+
// Extract PublicCallRequest instances from enqueued calls
|
|
53
|
+
const setupCallRequests = cppTx.setupEnqueuedCalls.map(call => call.request);
|
|
54
|
+
const paddedSetupCalls = padArrayEnd(setupCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX);
|
|
55
|
+
|
|
56
|
+
const appLogicCallRequests = cppTx.appLogicEnqueuedCalls.map(call => call.request);
|
|
57
|
+
const paddedAppLogicCalls = padArrayEnd(appLogicCallRequests, PublicCallRequest.empty(), MAX_ENQUEUED_CALLS_PER_TX);
|
|
58
|
+
|
|
59
|
+
// Build non-revertible accumulated data from C++ tx
|
|
60
|
+
const emptyNonRevertible = PrivateToPublicAccumulatedData.empty();
|
|
61
|
+
const nonRevertibleAccumulatedData = new PrivateToPublicAccumulatedData(
|
|
62
|
+
padArrayEnd(cppTx.nonRevertibleAccumulatedData.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
|
|
63
|
+
padArrayEnd(cppTx.nonRevertibleAccumulatedData.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX),
|
|
64
|
+
padArrayEnd(
|
|
65
|
+
cppTx.nonRevertibleAccumulatedData.l2ToL1Messages,
|
|
66
|
+
ScopedL2ToL1Message.empty(),
|
|
67
|
+
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
68
|
+
),
|
|
69
|
+
padArrayEnd(cppTx.nonRevertibleContractDeploymentData.privateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX),
|
|
70
|
+
emptyNonRevertible.contractClassLogsHashes,
|
|
71
|
+
paddedSetupCalls,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// Build revertible accumulated data from C++ tx
|
|
75
|
+
const emptyRevertible = PrivateToPublicAccumulatedData.empty();
|
|
76
|
+
const revertibleAccumulatedData = new PrivateToPublicAccumulatedData(
|
|
77
|
+
padArrayEnd(cppTx.revertibleAccumulatedData.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX),
|
|
78
|
+
padArrayEnd(cppTx.revertibleAccumulatedData.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX),
|
|
79
|
+
padArrayEnd(cppTx.revertibleAccumulatedData.l2ToL1Messages, ScopedL2ToL1Message.empty(), MAX_L2_TO_L1_MSGS_PER_TX),
|
|
80
|
+
padArrayEnd(cppTx.revertibleContractDeploymentData.privateLogs, PrivateLog.empty(), MAX_PRIVATE_LOGS_PER_TX),
|
|
81
|
+
emptyRevertible.contractClassLogsHashes,
|
|
82
|
+
paddedAppLogicCalls,
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
// Build teardown call request (if exists)
|
|
86
|
+
const teardownCallRequest = cppTx.teardownEnqueuedCall?.request ?? PublicCallRequest.empty();
|
|
87
|
+
|
|
88
|
+
// Create forPublic structure
|
|
89
|
+
const forPublic = new PartialPrivateTailPublicInputsForPublic(
|
|
90
|
+
nonRevertibleAccumulatedData,
|
|
91
|
+
revertibleAccumulatedData,
|
|
92
|
+
teardownCallRequest,
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
// Build TxContext - gasSettings is already a proper GasSettings after AvmTxHint.fromPlainObject
|
|
96
|
+
const txContext = new TxContext(
|
|
97
|
+
Fr.ZERO, // chainId - this is fine because simulation actually reads from globalVariables not here
|
|
98
|
+
Fr.ZERO, // version - this is fine because simulation actually reads from globalVariables not here
|
|
99
|
+
cppTx.gasSettings,
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// Build TxConstantData
|
|
103
|
+
const constants = new TxConstantData(
|
|
104
|
+
BlockHeader.empty(), // anchorBlockHeader (unused in simulation)
|
|
105
|
+
txContext,
|
|
106
|
+
Fr.ZERO, // vkTreeRoot - not needed for public simulation
|
|
107
|
+
Fr.ZERO, // protocolContractsHash - not needed for public simulation
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const data = new PrivateKernelTailCircuitPublicInputs(
|
|
111
|
+
constants,
|
|
112
|
+
cppTx.gasUsedByPrivate,
|
|
113
|
+
cppTx.feePayer,
|
|
114
|
+
0n, // includeByTimestamp
|
|
115
|
+
forPublic,
|
|
116
|
+
undefined, // forRollup - not needed for public simulation
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// todo(ilyas): I don't think we need to construct this, but keeping for now - the hashing could get costly with
|
|
120
|
+
// large number of enqueued calls or large calldata so keep an eye on this!
|
|
121
|
+
// Build publicFunctionCalldata from all enqueued calls
|
|
122
|
+
// Calldata is already Fr[] after AvmTxHint.fromPlainObject
|
|
123
|
+
const publicFunctionCalldata: HashedValues[] = [];
|
|
124
|
+
|
|
125
|
+
// Add setup calls
|
|
126
|
+
for (const call of cppTx.setupEnqueuedCalls || []) {
|
|
127
|
+
publicFunctionCalldata.push(await HashedValues.fromCalldata(call.calldata));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Add app logic calls
|
|
131
|
+
for (const call of cppTx.appLogicEnqueuedCalls || []) {
|
|
132
|
+
publicFunctionCalldata.push(await HashedValues.fromCalldata(call.calldata));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Add teardown call if present
|
|
136
|
+
if (cppTx.teardownEnqueuedCall) {
|
|
137
|
+
publicFunctionCalldata.push(await HashedValues.fromCalldata(cppTx.teardownEnqueuedCall.calldata));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Extract contract class log fields from ContractDeploymentData
|
|
141
|
+
const contractClassLogFields = [
|
|
142
|
+
...cppTx.nonRevertibleContractDeploymentData.contractClassLogs.map(log => log.fields),
|
|
143
|
+
...cppTx.revertibleContractDeploymentData.contractClassLogs.map(log => log.fields),
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
// Create the Tx
|
|
147
|
+
return new Tx(
|
|
148
|
+
txHash,
|
|
149
|
+
data,
|
|
150
|
+
ChonkProof.empty(), // No real proof needed for simulation
|
|
151
|
+
contractClassLogFields,
|
|
152
|
+
publicFunctionCalldata,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { sha256Trunc } from '@aztec/foundation/crypto';
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
2
|
+
import { sha256Trunc } from '@aztec/foundation/crypto/sha256';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import type { IndexedTreeLeafPreimage, SiblingPath } from '@aztec/foundation/trees';
|
|
6
6
|
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
package/src/public/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { GuardedMerkleTreeOperations } from './public_processor/guarded_merkle_t
|
|
|
3
3
|
export { PublicProcessor, PublicProcessorFactory } from './public_processor/public_processor.js';
|
|
4
4
|
export {
|
|
5
5
|
CppPublicTxSimulator,
|
|
6
|
+
createPublicTxSimulatorForBlockBuilding,
|
|
7
|
+
DumpingCppPublicTxSimulator,
|
|
6
8
|
type PublicTxSimulatorInterface,
|
|
7
9
|
TelemetryCppPublicTxSimulator,
|
|
8
10
|
} from './public_tx_simulator/index.js';
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
NULLIFIER_SUBTREE_HEIGHT,
|
|
5
5
|
PUBLIC_DATA_SUBTREE_HEIGHT,
|
|
6
6
|
} from '@aztec/constants';
|
|
7
|
-
import { Fr } from '@aztec/foundation/
|
|
7
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
8
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
9
9
|
import { Timer } from '@aztec/foundation/timer';
|
|
10
10
|
import { ContractClassPublishedEvent } from '@aztec/protocol-contracts/class-registry';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NULLIFIER_SUBTREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { sleep } from '@aztec/foundation/sleep';
|
|
6
6
|
import { DateProvider, Timer, elapsed, executeTimeout } from '@aztec/foundation/timer';
|
|
@@ -523,7 +523,7 @@ export class PublicProcessor implements Traceable {
|
|
|
523
523
|
|
|
524
524
|
const result = await this.publicTxSimulator.simulate(tx);
|
|
525
525
|
// TODO: use the callStackMetadata here to extract more data about public execution
|
|
526
|
-
const { hints, publicInputs, gasUsed, revertCode /*callStackMetadata*/ } = result;
|
|
526
|
+
const { hints, publicInputs, publicTxEffect, gasUsed, revertCode /*callStackMetadata*/ } = result;
|
|
527
527
|
|
|
528
528
|
const contractClassLogs = revertCode.isOK()
|
|
529
529
|
? tx.getContractClassLogs()
|
|
@@ -542,10 +542,15 @@ export class PublicProcessor implements Traceable {
|
|
|
542
542
|
const appLogicReturnValues: NestedProcessReturnValues[] = result.getAppLogicReturnValues();
|
|
543
543
|
// Extract the revert reason from the call stack metadata.
|
|
544
544
|
const revertReason = result.findRevertReason();
|
|
545
|
+
// Create proving request if we have hints and public inputs.
|
|
546
|
+
const avmProvingRequest =
|
|
547
|
+
hints && publicInputs ? PublicProcessor.generateProvingRequest(publicInputs, hints) : undefined;
|
|
545
548
|
|
|
546
549
|
const processedTx = makeProcessedTxFromTxWithPublicCalls(
|
|
547
550
|
tx,
|
|
548
|
-
|
|
551
|
+
this.globalVariables,
|
|
552
|
+
avmProvingRequest,
|
|
553
|
+
publicTxEffect,
|
|
549
554
|
gasUsed,
|
|
550
555
|
revertCode,
|
|
551
556
|
revertReason,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
3
3
|
import type { ContractProvider } from '@aztec/native';
|
|
4
4
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
5
|
import { deserializeFromMessagePack, serializeWithMessagePack } from '@aztec/stdlib/avm';
|
|
6
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
7
|
import { ContractDeploymentData } from '@aztec/stdlib/contract';
|
|
8
|
-
import { ContractClassLog, ContractClassLogFields, PrivateLog } from '@aztec/stdlib/logs';
|
|
9
8
|
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
10
9
|
|
|
11
10
|
import type { PublicContractsDB } from '../public_db_sources.js';
|
|
@@ -55,8 +54,8 @@ export class ContractProviderForCpp implements ContractProvider {
|
|
|
55
54
|
|
|
56
55
|
const rawData: any = deserializeFromMessagePack(contractDeploymentDataBuffer);
|
|
57
56
|
|
|
58
|
-
// Construct
|
|
59
|
-
const contractDeploymentData =
|
|
57
|
+
// Construct ContractDeploymentData from plain object.
|
|
58
|
+
const contractDeploymentData = ContractDeploymentData.fromPlainObject(rawData);
|
|
60
59
|
|
|
61
60
|
// Add contracts to the contracts DB
|
|
62
61
|
this.log.debug(`Calling contractsDB.addContracts`);
|
|
@@ -114,49 +113,4 @@ export class ContractProviderForCpp implements ContractProvider {
|
|
|
114
113
|
this.log.debug(`Contract provider callback: revertCheckpoint`);
|
|
115
114
|
return Promise.resolve(this.contractsDB.revertCheckpoint());
|
|
116
115
|
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Reconstruct ContractDeploymentData from plain msgpack-deserialized objects.
|
|
120
|
-
*
|
|
121
|
-
* msgpackr does not automatically apply extensions to nested fields, so we need to
|
|
122
|
-
* manually reconstruct ContractClassLog and PrivateLog instances with proper types.
|
|
123
|
-
*
|
|
124
|
-
* TODO(dbanks12): we really shouldn't have to do this.... We need to for now because
|
|
125
|
-
* msgpack deserialization doesn't give us actual typed objects, but rather just JSON.
|
|
126
|
-
* It would be easier if all types matched between languages (like AztecAddress which is just
|
|
127
|
-
* FF in C++).
|
|
128
|
-
*/
|
|
129
|
-
private reconstructContractDeploymentData(rawData: any): ContractDeploymentData {
|
|
130
|
-
// Helper to ensure a value is an Fr instance
|
|
131
|
-
const toFr = (value: any): Fr => {
|
|
132
|
-
if (value instanceof Fr) {
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
|
-
if (Buffer.isBuffer(value)) {
|
|
136
|
-
return Fr.fromBuffer(value);
|
|
137
|
-
}
|
|
138
|
-
return new Fr(value);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// Reconstruct ContractClassLogs
|
|
142
|
-
const contractClassLogs = (rawData.contractClassLogs || []).map((log: any) => {
|
|
143
|
-
// Convert contractAddress to TS AztecAddress
|
|
144
|
-
const addressFr = toFr(log.contractAddress);
|
|
145
|
-
const address = AztecAddress.fromField(addressFr);
|
|
146
|
-
|
|
147
|
-
// Ensure all fields are Fr instances
|
|
148
|
-
const fields = (log.fields.fields || []).map((field: any) => toFr(field));
|
|
149
|
-
|
|
150
|
-
// Create proper ContractClassLog instance
|
|
151
|
-
return new ContractClassLog(address, new ContractClassLogFields(fields), log.emittedLength);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// Reconstruct PrivateLogs - ensure fields are Fr instances
|
|
155
|
-
const privateLogs = (rawData.privateLogs || []).map((log: any) => {
|
|
156
|
-
const fields = (log.fields || []).map((field: any) => toFr(field));
|
|
157
|
-
return new PrivateLog(fields as any, log.emittedLength);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
return new ContractDeploymentData(contractClassLogs, privateLogs);
|
|
161
|
-
}
|
|
162
116
|
}
|
|
@@ -64,7 +64,7 @@ export class CppPublicTxSimulatorHintedDbs extends PublicTxSimulator implements
|
|
|
64
64
|
this.log.debug(`TS simulation succeeded for tx ${txHash}`);
|
|
65
65
|
|
|
66
66
|
// Extract the full AvmCircuitInputs from the TS result
|
|
67
|
-
const avmCircuitInputs = new AvmCircuitInputs(tsResult.hints!, tsResult.publicInputs);
|
|
67
|
+
const avmCircuitInputs = new AvmCircuitInputs(tsResult.hints!, tsResult.publicInputs!);
|
|
68
68
|
|
|
69
69
|
// Second, run C++ simulation with hinted DBs
|
|
70
70
|
this.log.debug(`Running C++ simulation with hinted DBs for tx ${txHash}`);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type Logger, createLogger, logLevel } from '@aztec/foundation/log';
|
|
2
|
-
import { writeTestData } from '@aztec/foundation/testing/files';
|
|
3
2
|
import { avmSimulate } from '@aztec/native';
|
|
4
3
|
import { ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
5
4
|
import {
|
|
@@ -126,12 +125,6 @@ export class CppVsTsPublicTxSimulator extends PublicTxSimulator implements Publi
|
|
|
126
125
|
// Deserialize the msgpack result
|
|
127
126
|
this.log.debug(`Deserializing C++ from buffer (size: ${resultBuffer.length})...`);
|
|
128
127
|
const cppResultJSON: object = deserializeFromMessagePack(resultBuffer);
|
|
129
|
-
// Write testdata if AZTEC_WRITE_TESTDATA=1.
|
|
130
|
-
writeTestData(
|
|
131
|
-
`barretenberg/cpp/src/barretenberg/vm2/testing/tx_result_${txHash}.testdata.bin`,
|
|
132
|
-
resultBuffer,
|
|
133
|
-
/*raw=*/ true,
|
|
134
|
-
);
|
|
135
128
|
this.log.debug(`Deserializing C++ result to PublicTxResult...`);
|
|
136
129
|
const cppResult = PublicTxResult.fromPlainObject(cppResultJSON);
|
|
137
130
|
this.log.debug(`Done.`);
|
|
@@ -140,7 +133,10 @@ export class CppVsTsPublicTxSimulator extends PublicTxSimulator implements Publi
|
|
|
140
133
|
assert(cppResult.gasUsed.publicGas.equals(tsResult.gasUsed.publicGas));
|
|
141
134
|
assert(cppResult.gasUsed.teardownGas.equals(tsResult.gasUsed.teardownGas));
|
|
142
135
|
assert(cppResult.gasUsed.billedGas.equals(tsResult.gasUsed.billedGas));
|
|
143
|
-
assert(cppResult.
|
|
136
|
+
assert(cppResult.publicTxEffect.equals(tsResult.publicTxEffect));
|
|
137
|
+
if (cppResult.publicInputs !== undefined) {
|
|
138
|
+
assert(cppResult.publicInputs!.toBuffer().equals(tsResult.publicInputs!.toBuffer()));
|
|
139
|
+
}
|
|
144
140
|
|
|
145
141
|
// TODO(fcarreiro): complete this.
|
|
146
142
|
// Check that C++ hints are a strict subset of TS hints.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AvmCircuitInputs,
|
|
3
|
+
AvmCircuitPublicInputs,
|
|
4
|
+
AvmExecutionHints,
|
|
5
|
+
type PublicSimulatorConfig,
|
|
6
|
+
PublicTxResult,
|
|
7
|
+
serializeWithMessagePack,
|
|
8
|
+
} from '@aztec/stdlib/avm';
|
|
9
|
+
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
10
|
+
import type { GlobalVariables, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
11
|
+
|
|
12
|
+
import { strict as assert } from 'assert';
|
|
13
|
+
import { mkdirSync, writeFileSync } from 'fs';
|
|
14
|
+
import { join } from 'path';
|
|
15
|
+
|
|
16
|
+
import type { PublicContractsDB } from '../public_db_sources.js';
|
|
17
|
+
import { CppPublicTxSimulator } from './cpp_public_tx_simulator.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A C++ public tx simulator that dumps AVM circuit inputs to disk after simulation.
|
|
21
|
+
* Used during nightly CI runs to collect circuit inputs for benchmarking.
|
|
22
|
+
*/
|
|
23
|
+
export class DumpingCppPublicTxSimulator extends CppPublicTxSimulator {
|
|
24
|
+
private readonly outputDir: string;
|
|
25
|
+
|
|
26
|
+
constructor(
|
|
27
|
+
merkleTree: MerkleTreeWriteOperations,
|
|
28
|
+
contractsDB: PublicContractsDB,
|
|
29
|
+
globalVariables: GlobalVariables,
|
|
30
|
+
config: Partial<PublicSimulatorConfig>,
|
|
31
|
+
outputDir: string,
|
|
32
|
+
) {
|
|
33
|
+
super(merkleTree, contractsDB, globalVariables, config);
|
|
34
|
+
assert(config.collectHints === true, 'collectHints must be enabled to dump AVM circuit inputs');
|
|
35
|
+
assert(config.collectPublicInputs === true, 'collectPublicInputs must be enabled to dump AVM circuit inputs');
|
|
36
|
+
this.outputDir = outputDir;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public override async simulate(tx: Tx): Promise<PublicTxResult> {
|
|
40
|
+
const result = await super.simulate(tx);
|
|
41
|
+
|
|
42
|
+
// Dump the circuit inputs after successful simulation
|
|
43
|
+
const txHash = this.computeTxHash(tx);
|
|
44
|
+
this.dumpAvmCircuitInputs(result, txHash);
|
|
45
|
+
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Dumps AVM circuit inputs to disk.
|
|
51
|
+
*
|
|
52
|
+
* @param result - The simulation result containing hints and public inputs
|
|
53
|
+
* @param txHash - The transaction hash to use in the filename
|
|
54
|
+
*/
|
|
55
|
+
private dumpAvmCircuitInputs(result: PublicTxResult, txHash: TxHash): void {
|
|
56
|
+
try {
|
|
57
|
+
// Ensure the output directory exists
|
|
58
|
+
mkdirSync(this.outputDir, { recursive: true });
|
|
59
|
+
|
|
60
|
+
// Generate filename using transaction hash
|
|
61
|
+
const filename = `avm-circuit-inputs-tx-${txHash.toString()}.bin`;
|
|
62
|
+
const filepath = join(this.outputDir, filename);
|
|
63
|
+
|
|
64
|
+
// Create circuit inputs from the result
|
|
65
|
+
const hints = result.hints ?? AvmExecutionHints.empty();
|
|
66
|
+
const publicInputs = result.publicInputs ?? AvmCircuitPublicInputs.empty();
|
|
67
|
+
const avmCircuitInputs = new AvmCircuitInputs(hints, publicInputs);
|
|
68
|
+
|
|
69
|
+
// Serialize the circuit inputs using MessagePack
|
|
70
|
+
const serialized = serializeWithMessagePack(avmCircuitInputs);
|
|
71
|
+
|
|
72
|
+
// Write to disk
|
|
73
|
+
writeFileSync(filepath, serialized);
|
|
74
|
+
|
|
75
|
+
this.log.debug(`Dumped AVM circuit inputs to ${filepath}`);
|
|
76
|
+
} catch (error) {
|
|
77
|
+
// Non-blocking error handling - log but don't interrupt processing
|
|
78
|
+
this.log.warn(`Failed to dump AVM circuit inputs for tx ${txHash.toString()}: ${error}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
2
|
+
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
3
|
+
import type { GlobalVariables } from '@aztec/stdlib/tx';
|
|
4
|
+
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
5
|
+
|
|
6
|
+
import type { PublicContractsDB } from '../public_db_sources.js';
|
|
7
|
+
import { TelemetryCppPublicTxSimulator } from './cpp_public_tx_simulator.js';
|
|
8
|
+
import { DumpingCppPublicTxSimulator } from './dumping_cpp_public_tx_simulator.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates a public tx simulator for block building.
|
|
12
|
+
* Uses DumpingCppPublicTxSimulator if DUMP_AVM_INPUTS_TO_DIR env var is set (for CI/testing avm circuit),
|
|
13
|
+
* otherwise uses TelemetryCppPublicTxSimulator (for production).
|
|
14
|
+
*/
|
|
15
|
+
export function createPublicTxSimulatorForBlockBuilding(
|
|
16
|
+
merkleTree: MerkleTreeWriteOperations,
|
|
17
|
+
contractsDB: PublicContractsDB,
|
|
18
|
+
globalVariables: GlobalVariables,
|
|
19
|
+
telemetryClient: TelemetryClient,
|
|
20
|
+
) {
|
|
21
|
+
const config = PublicSimulatorConfig.from({
|
|
22
|
+
skipFeeEnforcement: false,
|
|
23
|
+
collectDebugLogs: false,
|
|
24
|
+
collectHints: false,
|
|
25
|
+
collectPublicInputs: false,
|
|
26
|
+
collectStatistics: false,
|
|
27
|
+
collectCallMetadata: false,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const dumpDir = process.env.DUMP_AVM_INPUTS_TO_DIR;
|
|
31
|
+
if (dumpDir) {
|
|
32
|
+
// must collect hints and PIs for dumping
|
|
33
|
+
const dumpingConfig = {
|
|
34
|
+
...config,
|
|
35
|
+
collectHints: true,
|
|
36
|
+
collectPublicInputs: true,
|
|
37
|
+
};
|
|
38
|
+
return new DumpingCppPublicTxSimulator(merkleTree, contractsDB, globalVariables, dumpingConfig, dumpDir);
|
|
39
|
+
}
|
|
40
|
+
return new TelemetryCppPublicTxSimulator(merkleTree, contractsDB, globalVariables, telemetryClient, config);
|
|
41
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './public_tx_simulator.js';
|
|
2
2
|
export { CppPublicTxSimulator, TelemetryCppPublicTxSimulator } from './cpp_public_tx_simulator.js';
|
|
3
|
+
export { DumpingCppPublicTxSimulator } from './dumping_cpp_public_tx_simulator.js';
|
|
4
|
+
export { createPublicTxSimulatorForBlockBuilding } from './factories.js';
|
|
3
5
|
export type { PublicTxSimulatorInterface } from './public_tx_simulator_interface.js';
|
|
4
6
|
export { TelemetryPublicTxSimulator } from './telemetry_public_tx_simulator.js';
|
|
5
7
|
export type { PublicTxResult, PublicSimulatorConfig as PublicTxSimulatorConfig } from '@aztec/stdlib/avm';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { Timer } from '@aztec/foundation/timer';
|
|
3
3
|
import type { PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
|
|
4
4
|
import type { Gas } from '@aztec/stdlib/gas';
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
7
7
|
} from '@aztec/constants';
|
|
8
8
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
9
|
-
import { Fr } from '@aztec/foundation/
|
|
9
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
10
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
11
11
|
import {
|
|
12
12
|
AvmAccumulatedData,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AVM_MAX_PROCESSABLE_L2_GAS } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { ProtocolContractAddress, ProtocolContractsList } from '@aztec/protocol-contracts';
|
|
5
5
|
import { computeFeePayerBalanceStorageSlot } from '@aztec/protocol-contracts/fee-juice';
|
|
6
|
-
import { AvmExecutionHints, AvmTxHint, PublicSimulatorConfig, PublicTxResult } from '@aztec/stdlib/avm';
|
|
6
|
+
import { AvmExecutionHints, AvmTxHint, PublicSimulatorConfig, PublicTxEffect, PublicTxResult } from '@aztec/stdlib/avm';
|
|
7
7
|
import { SimulationError } from '@aztec/stdlib/errors';
|
|
8
8
|
import { Gas } from '@aztec/stdlib/gas';
|
|
9
9
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
@@ -209,6 +209,16 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
|
209
209
|
(appLogicReturnValues as any).revertReason = context.revertReason;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
// Create PublicTxEffect from PublicInputs.
|
|
213
|
+
const publicTxEffect = new PublicTxEffect(
|
|
214
|
+
publicInputs.transactionFee,
|
|
215
|
+
publicInputs.accumulatedData.noteHashes.filter(h => !h.isEmpty()),
|
|
216
|
+
publicInputs.accumulatedData.nullifiers.filter(n => !n.isEmpty()),
|
|
217
|
+
publicInputs.accumulatedData.l2ToL1Msgs.filter(m => !m.isEmpty()),
|
|
218
|
+
publicInputs.accumulatedData.publicLogs.toLogs(),
|
|
219
|
+
publicInputs.accumulatedData.publicDataWrites.filter(w => !w.isEmpty()),
|
|
220
|
+
);
|
|
221
|
+
|
|
212
222
|
return new PublicTxResult(
|
|
213
223
|
/*gasUsed=*/ {
|
|
214
224
|
totalGas: context.getActualGasUsed(),
|
|
@@ -217,6 +227,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
|
217
227
|
billedGas: context.getTotalGasUsed(),
|
|
218
228
|
},
|
|
219
229
|
/*revertCode=*/ revertCode,
|
|
230
|
+
/*publicTxEffect=*/ publicTxEffect,
|
|
220
231
|
/*callStackMetadata=*/ appLogicReturnValues,
|
|
221
232
|
/*logs=*/ context.state.getActiveStateManager().getLogs(),
|
|
222
233
|
/*hints=*/ hints,
|
|
@@ -303,7 +314,7 @@ export class PublicTxSimulator implements PublicTxSimulatorInterface {
|
|
|
303
314
|
);
|
|
304
315
|
|
|
305
316
|
if (result.reverted) {
|
|
306
|
-
const culprit = `${contractAddress}:${
|
|
317
|
+
const culprit = `${contractAddress}:${fnName}`;
|
|
307
318
|
context.revert(phase, result.revertReason, culprit);
|
|
308
319
|
}
|
|
309
320
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
3
3
|
import type { Gas } from '@aztec/stdlib/gas';
|
|
4
4
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
MAX_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
8
8
|
PROTOCOL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
9
9
|
} from '@aztec/constants';
|
|
10
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
10
11
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
12
12
|
import { type LogLevel, createLogger } from '@aztec/foundation/log';
|
|
13
13
|
import { PublicDataUpdateRequest } from '@aztec/stdlib/avm';
|
|
14
14
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fr } from '@aztec/foundation/
|
|
1
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { LogLevel } from '@aztec/foundation/log';
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import type { DebugLog } from '@aztec/stdlib/logs';
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
MULTI_CALL_ENTRYPOINT_ADDRESS,
|
|
7
7
|
ROUTER_ADDRESS,
|
|
8
8
|
} from '@aztec/constants';
|
|
9
|
-
import { poseidon2Hash } from '@aztec/foundation/crypto';
|
|
10
|
-
import { Fr } from '@aztec/foundation/
|
|
9
|
+
import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
|
|
10
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
11
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
12
12
|
import { type LogLevel, createLogger } from '@aztec/foundation/log';
|
|
13
13
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|