@aztec/simulator 0.47.1 → 0.49.2
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/acvm/acvm.d.ts +2 -2
- package/dest/acvm/acvm.d.ts.map +1 -1
- package/dest/acvm/acvm.js +12 -7
- package/dest/acvm/oracle/oracle.d.ts +3 -3
- package/dest/acvm/oracle/oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/oracle.js +8 -9
- package/dest/acvm/oracle/typed_oracle.d.ts +5 -5
- package/dest/acvm/oracle/typed_oracle.d.ts.map +1 -1
- package/dest/acvm/oracle/typed_oracle.js +6 -6
- package/dest/avm/avm_gas.d.ts +1 -0
- package/dest/avm/avm_gas.d.ts.map +1 -1
- package/dest/avm/avm_gas.js +142 -79
- package/dest/avm/fixtures/index.d.ts.map +1 -1
- package/dest/avm/fixtures/index.js +2 -2
- package/dest/avm/opcodes/accrued_substate.js +2 -2
- package/dest/avm/opcodes/commitment.js +4 -4
- package/dest/avm/opcodes/conversion.js +2 -2
- package/dest/avm/opcodes/external_calls.js +4 -4
- package/dest/avm/opcodes/instruction.d.ts +2 -1
- package/dest/avm/opcodes/instruction.d.ts.map +1 -1
- package/dest/avm/opcodes/instruction.js +8 -5
- package/dest/avm/opcodes/memory.js +2 -2
- package/dest/avm/opcodes/storage.js +3 -3
- package/dest/avm/serialization/instruction_serialization.js +2 -2
- package/dest/client/client_execution_context.d.ts +8 -8
- package/dest/client/client_execution_context.d.ts.map +1 -1
- package/dest/client/client_execution_context.js +22 -23
- package/dest/client/db_oracle.d.ts +4 -3
- package/dest/client/db_oracle.d.ts.map +1 -1
- package/dest/client/execution_note_cache.d.ts +17 -13
- package/dest/client/execution_note_cache.d.ts.map +1 -1
- package/dest/client/execution_note_cache.js +65 -26
- package/dest/client/execution_result.d.ts +3 -2
- package/dest/client/execution_result.d.ts.map +1 -1
- package/dest/client/execution_result.js +20 -9
- package/dest/client/private_execution.js +3 -3
- package/dest/client/simulator.d.ts +7 -6
- package/dest/client/simulator.d.ts.map +1 -1
- package/dest/client/simulator.js +14 -12
- package/dest/client/test_utils.d.ts +9 -0
- package/dest/client/test_utils.d.ts.map +1 -0
- package/dest/client/test_utils.js +21 -0
- package/dest/client/view_data_oracle.d.ts +2 -1
- package/dest/client/view_data_oracle.d.ts.map +1 -1
- package/dest/client/view_data_oracle.js +4 -3
- package/dest/index.d.ts +0 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/providers/acvm_native.js +2 -2
- package/dest/public/abstract_phase_manager.d.ts.map +1 -1
- package/dest/public/abstract_phase_manager.js +3 -3
- package/dest/public/executor.d.ts +4 -1
- package/dest/public/executor.d.ts.map +1 -1
- package/dest/public/executor.js +10 -2
- package/dest/public/executor_metrics.d.ts +10 -0
- package/dest/public/executor_metrics.d.ts.map +1 -0
- package/dest/public/executor_metrics.js +32 -0
- package/dest/public/fee_payment.d.ts +2 -2
- package/dest/public/fee_payment.d.ts.map +1 -1
- package/dest/public/fee_payment.js +9 -10
- package/dest/public/hints_builder.d.ts.map +1 -1
- package/dest/public/hints_builder.js +1 -1
- package/dest/public/public_processor.d.ts +6 -5
- package/dest/public/public_processor.d.ts.map +1 -1
- package/dest/public/public_processor.js +38 -18
- package/dest/public/public_processor_metrics.d.ts +19 -0
- package/dest/public/public_processor_metrics.d.ts.map +1 -0
- package/dest/public/public_processor_metrics.js +59 -0
- package/package.json +9 -9
- package/src/acvm/acvm.ts +14 -5
- package/src/acvm/oracle/oracle.ts +8 -23
- package/src/acvm/oracle/typed_oracle.ts +8 -21
- package/src/avm/avm_gas.ts +145 -79
- package/src/avm/fixtures/index.ts +1 -0
- package/src/avm/opcodes/accrued_substate.ts +1 -1
- package/src/avm/opcodes/commitment.ts +3 -3
- package/src/avm/opcodes/conversion.ts +1 -1
- package/src/avm/opcodes/external_calls.ts +3 -3
- package/src/avm/opcodes/instruction.ts +7 -4
- package/src/avm/opcodes/memory.ts +1 -1
- package/src/avm/opcodes/storage.ts +2 -2
- package/src/avm/serialization/instruction_serialization.ts +1 -1
- package/src/client/client_execution_context.ts +23 -20
- package/src/client/db_oracle.ts +9 -3
- package/src/client/execution_note_cache.ts +76 -25
- package/src/client/execution_result.ts +29 -9
- package/src/client/private_execution.ts +2 -2
- package/src/client/simulator.ts +18 -14
- package/src/client/test_utils.ts +30 -0
- package/src/client/view_data_oracle.ts +2 -1
- package/src/index.ts +0 -1
- package/src/providers/acvm_native.ts +1 -1
- package/src/public/abstract_phase_manager.ts +1 -2
- package/src/public/executor.ts +14 -1
- package/src/public/executor_metrics.ts +48 -0
- package/src/public/fee_payment.ts +8 -10
- package/src/public/hints_builder.ts +2 -2
- package/src/public/public_processor.ts +52 -20
- package/src/public/public_processor_metrics.ts +92 -0
- package/dest/utils.d.ts +0 -12
- package/dest/utils.d.ts.map +0 -1
- package/dest/utils.js +0 -11
- package/src/utils.ts +0 -18
package/src/avm/avm_gas.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as c from '@aztec/circuits.js/constants';
|
|
2
|
+
|
|
1
3
|
import { TypeTag } from './avm_memory_types.js';
|
|
2
4
|
import { InstructionExecutionError } from './errors.js';
|
|
3
5
|
import { Addressing, AddressingMode } from './opcodes/addressing_mode.js';
|
|
@@ -46,90 +48,150 @@ export const EmptyGas: Gas = {
|
|
|
46
48
|
daGas: 0,
|
|
47
49
|
};
|
|
48
50
|
|
|
51
|
+
function makeCost(l2Gas: number, daGas: number): Gas {
|
|
52
|
+
return { l2Gas, daGas };
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
/** Dimensions of gas usage: L1, L2, and DA. */
|
|
50
56
|
export const GasDimensions = ['l2Gas', 'daGas'] as const;
|
|
51
57
|
|
|
52
|
-
/** Default gas cost for an opcode. */
|
|
53
|
-
const DefaultBaseGasCost: Gas = { l2Gas: 10, daGas: 0 };
|
|
54
|
-
|
|
55
58
|
/** Base gas costs for each instruction. Additional gas cost may be added on top due to memory or storage accesses, etc. */
|
|
56
59
|
const BaseGasCosts: Record<Opcode, Gas> = {
|
|
57
|
-
[Opcode.ADD]:
|
|
58
|
-
[Opcode.SUB]:
|
|
59
|
-
[Opcode.MUL]:
|
|
60
|
-
[Opcode.DIV]:
|
|
61
|
-
[Opcode.FDIV]:
|
|
62
|
-
[Opcode.EQ]:
|
|
63
|
-
[Opcode.LT]:
|
|
64
|
-
[Opcode.LTE]:
|
|
65
|
-
[Opcode.AND]:
|
|
66
|
-
[Opcode.OR]:
|
|
67
|
-
[Opcode.XOR]:
|
|
68
|
-
[Opcode.NOT]:
|
|
69
|
-
[Opcode.SHL]:
|
|
70
|
-
[Opcode.SHR]:
|
|
71
|
-
[Opcode.CAST]:
|
|
72
|
-
|
|
73
|
-
[Opcode.
|
|
74
|
-
[Opcode.
|
|
75
|
-
[Opcode.
|
|
76
|
-
[Opcode.
|
|
77
|
-
[Opcode.
|
|
78
|
-
[Opcode.
|
|
79
|
-
[Opcode.
|
|
80
|
-
[Opcode.
|
|
81
|
-
[Opcode.
|
|
82
|
-
[Opcode.
|
|
83
|
-
[Opcode.
|
|
84
|
-
[Opcode.
|
|
85
|
-
[Opcode.
|
|
86
|
-
[Opcode.
|
|
87
|
-
[Opcode.
|
|
88
|
-
|
|
89
|
-
[Opcode.
|
|
90
|
-
[Opcode.
|
|
91
|
-
|
|
92
|
-
[Opcode.
|
|
93
|
-
[Opcode.
|
|
94
|
-
[Opcode.
|
|
95
|
-
[Opcode.
|
|
96
|
-
|
|
97
|
-
[Opcode.
|
|
98
|
-
[Opcode.
|
|
99
|
-
[Opcode.
|
|
100
|
-
|
|
101
|
-
[Opcode.
|
|
102
|
-
[Opcode.
|
|
103
|
-
[Opcode.
|
|
104
|
-
[Opcode.
|
|
105
|
-
[Opcode.
|
|
106
|
-
[Opcode.
|
|
107
|
-
[Opcode.
|
|
108
|
-
[Opcode.
|
|
109
|
-
[Opcode.
|
|
110
|
-
[Opcode.
|
|
111
|
-
[Opcode.
|
|
112
|
-
|
|
113
|
-
[Opcode.
|
|
114
|
-
[Opcode.
|
|
115
|
-
[Opcode.
|
|
116
|
-
[Opcode.
|
|
117
|
-
[Opcode.
|
|
118
|
-
|
|
119
|
-
[Opcode.
|
|
120
|
-
|
|
121
|
-
[Opcode.
|
|
122
|
-
[Opcode.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
[Opcode.
|
|
127
|
-
[Opcode.
|
|
128
|
-
|
|
129
|
-
[Opcode.
|
|
130
|
-
|
|
131
|
-
[Opcode.
|
|
132
|
-
[Opcode.
|
|
60
|
+
[Opcode.ADD]: makeCost(c.AVM_ADD_BASE_L2_GAS, 0),
|
|
61
|
+
[Opcode.SUB]: makeCost(c.AVM_SUB_BASE_L2_GAS, 0),
|
|
62
|
+
[Opcode.MUL]: makeCost(c.AVM_MUL_BASE_L2_GAS, 0),
|
|
63
|
+
[Opcode.DIV]: makeCost(c.AVM_DIV_BASE_L2_GAS, 0),
|
|
64
|
+
[Opcode.FDIV]: makeCost(c.AVM_FDIV_BASE_L2_GAS, 0),
|
|
65
|
+
[Opcode.EQ]: makeCost(c.AVM_EQ_BASE_L2_GAS, 0),
|
|
66
|
+
[Opcode.LT]: makeCost(c.AVM_LT_BASE_L2_GAS, 0),
|
|
67
|
+
[Opcode.LTE]: makeCost(c.AVM_LTE_BASE_L2_GAS, 0),
|
|
68
|
+
[Opcode.AND]: makeCost(c.AVM_AND_BASE_L2_GAS, 0),
|
|
69
|
+
[Opcode.OR]: makeCost(c.AVM_OR_BASE_L2_GAS, 0),
|
|
70
|
+
[Opcode.XOR]: makeCost(c.AVM_XOR_BASE_L2_GAS, 0),
|
|
71
|
+
[Opcode.NOT]: makeCost(c.AVM_NOT_BASE_L2_GAS, 0),
|
|
72
|
+
[Opcode.SHL]: makeCost(c.AVM_SHL_BASE_L2_GAS, 0),
|
|
73
|
+
[Opcode.SHR]: makeCost(c.AVM_SHR_BASE_L2_GAS, 0),
|
|
74
|
+
[Opcode.CAST]: makeCost(c.AVM_CAST_BASE_L2_GAS, 0),
|
|
75
|
+
[Opcode.ADDRESS]: makeCost(c.AVM_ADDRESS_BASE_L2_GAS, 0),
|
|
76
|
+
[Opcode.STORAGEADDRESS]: makeCost(c.AVM_STORAGEADDRESS_BASE_L2_GAS, 0),
|
|
77
|
+
[Opcode.SENDER]: makeCost(c.AVM_SENDER_BASE_L2_GAS, 0),
|
|
78
|
+
[Opcode.FEEPERL2GAS]: makeCost(c.AVM_FEEPERL2GAS_BASE_L2_GAS, 0),
|
|
79
|
+
[Opcode.FEEPERDAGAS]: makeCost(c.AVM_FEEPERDAGAS_BASE_L2_GAS, 0),
|
|
80
|
+
[Opcode.TRANSACTIONFEE]: makeCost(c.AVM_TRANSACTIONFEE_BASE_L2_GAS, 0),
|
|
81
|
+
[Opcode.FUNCTIONSELECTOR]: makeCost(c.AVM_FUNCTIONSELECTOR_BASE_L2_GAS, 0),
|
|
82
|
+
[Opcode.CHAINID]: makeCost(c.AVM_CHAINID_BASE_L2_GAS, 0),
|
|
83
|
+
[Opcode.VERSION]: makeCost(c.AVM_VERSION_BASE_L2_GAS, 0),
|
|
84
|
+
[Opcode.BLOCKNUMBER]: makeCost(c.AVM_BLOCKNUMBER_BASE_L2_GAS, 0),
|
|
85
|
+
[Opcode.TIMESTAMP]: makeCost(c.AVM_TIMESTAMP_BASE_L2_GAS, 0),
|
|
86
|
+
[Opcode.COINBASE]: makeCost(c.AVM_COINBASE_BASE_L2_GAS, 0),
|
|
87
|
+
[Opcode.BLOCKL2GASLIMIT]: makeCost(c.AVM_BLOCKL2GASLIMIT_BASE_L2_GAS, 0),
|
|
88
|
+
[Opcode.BLOCKDAGASLIMIT]: makeCost(c.AVM_BLOCKDAGASLIMIT_BASE_L2_GAS, 0),
|
|
89
|
+
[Opcode.CALLDATACOPY]: makeCost(c.AVM_CALLDATACOPY_BASE_L2_GAS, 0),
|
|
90
|
+
[Opcode.L2GASLEFT]: makeCost(c.AVM_L2GASLEFT_BASE_L2_GAS, 0),
|
|
91
|
+
[Opcode.DAGASLEFT]: makeCost(c.AVM_DAGASLEFT_BASE_L2_GAS, 0),
|
|
92
|
+
[Opcode.JUMP]: makeCost(c.AVM_JUMP_BASE_L2_GAS, 0),
|
|
93
|
+
[Opcode.JUMPI]: makeCost(c.AVM_JUMPI_BASE_L2_GAS, 0),
|
|
94
|
+
[Opcode.INTERNALCALL]: makeCost(c.AVM_INTERNALCALL_BASE_L2_GAS, 0),
|
|
95
|
+
[Opcode.INTERNALRETURN]: makeCost(c.AVM_INTERNALRETURN_BASE_L2_GAS, 0),
|
|
96
|
+
[Opcode.SET]: makeCost(c.AVM_SET_BASE_L2_GAS, 0),
|
|
97
|
+
[Opcode.MOV]: makeCost(c.AVM_MOV_BASE_L2_GAS, 0),
|
|
98
|
+
[Opcode.CMOV]: makeCost(c.AVM_CMOV_BASE_L2_GAS, 0),
|
|
99
|
+
[Opcode.SLOAD]: makeCost(c.AVM_SLOAD_BASE_L2_GAS, 0),
|
|
100
|
+
[Opcode.SSTORE]: makeCost(c.AVM_SSTORE_BASE_L2_GAS, 0),
|
|
101
|
+
[Opcode.NOTEHASHEXISTS]: makeCost(c.AVM_NOTEHASHEXISTS_BASE_L2_GAS, 0),
|
|
102
|
+
[Opcode.EMITNOTEHASH]: makeCost(c.AVM_EMITNOTEHASH_BASE_L2_GAS, 0),
|
|
103
|
+
[Opcode.NULLIFIEREXISTS]: makeCost(c.AVM_NULLIFIEREXISTS_BASE_L2_GAS, 0),
|
|
104
|
+
[Opcode.EMITNULLIFIER]: makeCost(c.AVM_EMITNULLIFIER_BASE_L2_GAS, 0),
|
|
105
|
+
[Opcode.L1TOL2MSGEXISTS]: makeCost(c.AVM_L1TOL2MSGEXISTS_BASE_L2_GAS, 0),
|
|
106
|
+
[Opcode.HEADERMEMBER]: makeCost(c.AVM_HEADERMEMBER_BASE_L2_GAS, 0),
|
|
107
|
+
[Opcode.EMITUNENCRYPTEDLOG]: makeCost(c.AVM_EMITUNENCRYPTEDLOG_BASE_L2_GAS, 0),
|
|
108
|
+
[Opcode.SENDL2TOL1MSG]: makeCost(c.AVM_SENDL2TOL1MSG_BASE_L2_GAS, 0),
|
|
109
|
+
[Opcode.GETCONTRACTINSTANCE]: makeCost(c.AVM_GETCONTRACTINSTANCE_BASE_L2_GAS, 0),
|
|
110
|
+
[Opcode.CALL]: makeCost(c.AVM_CALL_BASE_L2_GAS, 0),
|
|
111
|
+
[Opcode.STATICCALL]: makeCost(c.AVM_STATICCALL_BASE_L2_GAS, 0),
|
|
112
|
+
[Opcode.DELEGATECALL]: makeCost(c.AVM_DELEGATECALL_BASE_L2_GAS, 0),
|
|
113
|
+
[Opcode.RETURN]: makeCost(c.AVM_RETURN_BASE_L2_GAS, 0),
|
|
114
|
+
[Opcode.REVERT]: makeCost(c.AVM_REVERT_BASE_L2_GAS, 0),
|
|
115
|
+
[Opcode.DEBUGLOG]: makeCost(c.AVM_DEBUGLOG_BASE_L2_GAS, 0),
|
|
116
|
+
[Opcode.KECCAK]: makeCost(c.AVM_KECCAK_BASE_L2_GAS, 0),
|
|
117
|
+
[Opcode.POSEIDON2]: makeCost(c.AVM_POSEIDON2_BASE_L2_GAS, 0),
|
|
118
|
+
[Opcode.SHA256]: makeCost(c.AVM_SHA256_BASE_L2_GAS, 0),
|
|
119
|
+
[Opcode.PEDERSEN]: makeCost(c.AVM_PEDERSEN_BASE_L2_GAS, 0),
|
|
120
|
+
[Opcode.ECADD]: makeCost(c.AVM_ECADD_BASE_L2_GAS, 0),
|
|
121
|
+
[Opcode.MSM]: makeCost(c.AVM_MSM_BASE_L2_GAS, 0),
|
|
122
|
+
[Opcode.PEDERSENCOMMITMENT]: makeCost(c.AVM_PEDERSENCOMMITMENT_BASE_L2_GAS, 0),
|
|
123
|
+
[Opcode.TORADIXLE]: makeCost(c.AVM_TORADIXLE_BASE_L2_GAS, 0),
|
|
124
|
+
[Opcode.SHA256COMPRESSION]: makeCost(c.AVM_SHA256COMPRESSION_BASE_L2_GAS, 0),
|
|
125
|
+
[Opcode.KECCAKF1600]: makeCost(c.AVM_KECCAKF1600_BASE_L2_GAS, 0),
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const DynamicGasCosts: Record<Opcode, Gas> = {
|
|
129
|
+
[Opcode.ADD]: makeCost(c.AVM_ADD_DYN_L2_GAS, 0),
|
|
130
|
+
[Opcode.SUB]: makeCost(c.AVM_SUB_DYN_L2_GAS, 0),
|
|
131
|
+
[Opcode.MUL]: makeCost(c.AVM_MUL_DYN_L2_GAS, 0),
|
|
132
|
+
[Opcode.DIV]: makeCost(c.AVM_DIV_DYN_L2_GAS, 0),
|
|
133
|
+
[Opcode.FDIV]: makeCost(c.AVM_FDIV_DYN_L2_GAS, 0),
|
|
134
|
+
[Opcode.EQ]: makeCost(c.AVM_EQ_DYN_L2_GAS, 0),
|
|
135
|
+
[Opcode.LT]: makeCost(c.AVM_LT_DYN_L2_GAS, 0),
|
|
136
|
+
[Opcode.LTE]: makeCost(c.AVM_LTE_DYN_L2_GAS, 0),
|
|
137
|
+
[Opcode.AND]: makeCost(c.AVM_AND_DYN_L2_GAS, 0),
|
|
138
|
+
[Opcode.OR]: makeCost(c.AVM_OR_DYN_L2_GAS, 0),
|
|
139
|
+
[Opcode.XOR]: makeCost(c.AVM_XOR_DYN_L2_GAS, 0),
|
|
140
|
+
[Opcode.NOT]: makeCost(c.AVM_NOT_DYN_L2_GAS, 0),
|
|
141
|
+
[Opcode.SHL]: makeCost(c.AVM_SHL_DYN_L2_GAS, 0),
|
|
142
|
+
[Opcode.SHR]: makeCost(c.AVM_SHR_DYN_L2_GAS, 0),
|
|
143
|
+
[Opcode.CAST]: makeCost(c.AVM_CAST_DYN_L2_GAS, 0),
|
|
144
|
+
[Opcode.ADDRESS]: makeCost(c.AVM_ADDRESS_DYN_L2_GAS, 0),
|
|
145
|
+
[Opcode.STORAGEADDRESS]: makeCost(c.AVM_STORAGEADDRESS_DYN_L2_GAS, 0),
|
|
146
|
+
[Opcode.SENDER]: makeCost(c.AVM_SENDER_DYN_L2_GAS, 0),
|
|
147
|
+
[Opcode.FEEPERL2GAS]: makeCost(c.AVM_FEEPERL2GAS_DYN_L2_GAS, 0),
|
|
148
|
+
[Opcode.FEEPERDAGAS]: makeCost(c.AVM_FEEPERDAGAS_DYN_L2_GAS, 0),
|
|
149
|
+
[Opcode.TRANSACTIONFEE]: makeCost(c.AVM_TRANSACTIONFEE_DYN_L2_GAS, 0),
|
|
150
|
+
[Opcode.FUNCTIONSELECTOR]: makeCost(c.AVM_FUNCTIONSELECTOR_DYN_L2_GAS, 0),
|
|
151
|
+
[Opcode.CHAINID]: makeCost(c.AVM_CHAINID_DYN_L2_GAS, 0),
|
|
152
|
+
[Opcode.VERSION]: makeCost(c.AVM_VERSION_DYN_L2_GAS, 0),
|
|
153
|
+
[Opcode.BLOCKNUMBER]: makeCost(c.AVM_BLOCKNUMBER_DYN_L2_GAS, 0),
|
|
154
|
+
[Opcode.TIMESTAMP]: makeCost(c.AVM_TIMESTAMP_DYN_L2_GAS, 0),
|
|
155
|
+
[Opcode.COINBASE]: makeCost(c.AVM_COINBASE_DYN_L2_GAS, 0),
|
|
156
|
+
[Opcode.BLOCKL2GASLIMIT]: makeCost(c.AVM_BLOCKL2GASLIMIT_DYN_L2_GAS, 0),
|
|
157
|
+
[Opcode.BLOCKDAGASLIMIT]: makeCost(c.AVM_BLOCKDAGASLIMIT_DYN_L2_GAS, 0),
|
|
158
|
+
[Opcode.CALLDATACOPY]: makeCost(c.AVM_CALLDATACOPY_DYN_L2_GAS, 0),
|
|
159
|
+
[Opcode.L2GASLEFT]: makeCost(c.AVM_L2GASLEFT_DYN_L2_GAS, 0),
|
|
160
|
+
[Opcode.DAGASLEFT]: makeCost(c.AVM_DAGASLEFT_DYN_L2_GAS, 0),
|
|
161
|
+
[Opcode.JUMP]: makeCost(c.AVM_JUMP_DYN_L2_GAS, 0),
|
|
162
|
+
[Opcode.JUMPI]: makeCost(c.AVM_JUMPI_DYN_L2_GAS, 0),
|
|
163
|
+
[Opcode.INTERNALCALL]: makeCost(c.AVM_INTERNALCALL_DYN_L2_GAS, 0),
|
|
164
|
+
[Opcode.INTERNALRETURN]: makeCost(c.AVM_INTERNALRETURN_DYN_L2_GAS, 0),
|
|
165
|
+
[Opcode.SET]: makeCost(c.AVM_SET_DYN_L2_GAS, 0),
|
|
166
|
+
[Opcode.MOV]: makeCost(c.AVM_MOV_DYN_L2_GAS, 0),
|
|
167
|
+
[Opcode.CMOV]: makeCost(c.AVM_CMOV_DYN_L2_GAS, 0),
|
|
168
|
+
[Opcode.SLOAD]: makeCost(c.AVM_SLOAD_DYN_L2_GAS, 0),
|
|
169
|
+
[Opcode.SSTORE]: makeCost(c.AVM_SSTORE_DYN_L2_GAS, 0),
|
|
170
|
+
[Opcode.NOTEHASHEXISTS]: makeCost(c.AVM_NOTEHASHEXISTS_DYN_L2_GAS, 0),
|
|
171
|
+
[Opcode.EMITNOTEHASH]: makeCost(c.AVM_EMITNOTEHASH_DYN_L2_GAS, 0),
|
|
172
|
+
[Opcode.NULLIFIEREXISTS]: makeCost(c.AVM_NULLIFIEREXISTS_DYN_L2_GAS, 0),
|
|
173
|
+
[Opcode.EMITNULLIFIER]: makeCost(c.AVM_EMITNULLIFIER_DYN_L2_GAS, 0),
|
|
174
|
+
[Opcode.L1TOL2MSGEXISTS]: makeCost(c.AVM_L1TOL2MSGEXISTS_DYN_L2_GAS, 0),
|
|
175
|
+
[Opcode.HEADERMEMBER]: makeCost(c.AVM_HEADERMEMBER_DYN_L2_GAS, 0),
|
|
176
|
+
[Opcode.EMITUNENCRYPTEDLOG]: makeCost(c.AVM_EMITUNENCRYPTEDLOG_DYN_L2_GAS, 0),
|
|
177
|
+
[Opcode.SENDL2TOL1MSG]: makeCost(c.AVM_SENDL2TOL1MSG_DYN_L2_GAS, 0),
|
|
178
|
+
[Opcode.GETCONTRACTINSTANCE]: makeCost(c.AVM_GETCONTRACTINSTANCE_DYN_L2_GAS, 0),
|
|
179
|
+
[Opcode.CALL]: makeCost(c.AVM_CALL_DYN_L2_GAS, 0),
|
|
180
|
+
[Opcode.STATICCALL]: makeCost(c.AVM_STATICCALL_DYN_L2_GAS, 0),
|
|
181
|
+
[Opcode.DELEGATECALL]: makeCost(c.AVM_DELEGATECALL_DYN_L2_GAS, 0),
|
|
182
|
+
[Opcode.RETURN]: makeCost(c.AVM_RETURN_DYN_L2_GAS, 0),
|
|
183
|
+
[Opcode.REVERT]: makeCost(c.AVM_REVERT_DYN_L2_GAS, 0),
|
|
184
|
+
[Opcode.DEBUGLOG]: makeCost(c.AVM_DEBUGLOG_DYN_L2_GAS, 0),
|
|
185
|
+
[Opcode.KECCAK]: makeCost(c.AVM_KECCAK_DYN_L2_GAS, 0),
|
|
186
|
+
[Opcode.POSEIDON2]: makeCost(c.AVM_POSEIDON2_DYN_L2_GAS, 0),
|
|
187
|
+
[Opcode.SHA256]: makeCost(c.AVM_SHA256_DYN_L2_GAS, 0),
|
|
188
|
+
[Opcode.PEDERSEN]: makeCost(c.AVM_PEDERSEN_DYN_L2_GAS, 0),
|
|
189
|
+
[Opcode.ECADD]: makeCost(c.AVM_ECADD_DYN_L2_GAS, 0),
|
|
190
|
+
[Opcode.MSM]: makeCost(c.AVM_MSM_DYN_L2_GAS, 0),
|
|
191
|
+
[Opcode.PEDERSENCOMMITMENT]: makeCost(c.AVM_PEDERSENCOMMITMENT_DYN_L2_GAS, 0),
|
|
192
|
+
[Opcode.TORADIXLE]: makeCost(c.AVM_TORADIXLE_DYN_L2_GAS, 0),
|
|
193
|
+
[Opcode.SHA256COMPRESSION]: makeCost(c.AVM_SHA256COMPRESSION_DYN_L2_GAS, 0),
|
|
194
|
+
[Opcode.KECCAKF1600]: makeCost(c.AVM_KECCAKF1600_DYN_L2_GAS, 0),
|
|
133
195
|
};
|
|
134
196
|
|
|
135
197
|
/** Returns the fixed base gas cost for a given opcode. */
|
|
@@ -137,6 +199,10 @@ export function getBaseGasCost(opcode: Opcode): Gas {
|
|
|
137
199
|
return BaseGasCosts[opcode];
|
|
138
200
|
}
|
|
139
201
|
|
|
202
|
+
export function getDynamicGasCost(opcode: Opcode): Gas {
|
|
203
|
+
return DynamicGasCosts[opcode];
|
|
204
|
+
}
|
|
205
|
+
|
|
140
206
|
/** Returns the gas cost associated with the memory operations performed. */
|
|
141
207
|
export function getMemoryGasCost(args: { reads?: number; writes?: number; indirect?: number }) {
|
|
142
208
|
const { reads, writes, indirect } = args;
|
|
@@ -91,6 +91,7 @@ export function initGlobalVariables(overrides?: Partial<GlobalVariables>): Globa
|
|
|
91
91
|
overrides?.chainId ?? Fr.zero(),
|
|
92
92
|
overrides?.version ?? Fr.zero(),
|
|
93
93
|
overrides?.blockNumber ?? Fr.zero(),
|
|
94
|
+
overrides?.slotNumber ?? Fr.zero(),
|
|
94
95
|
overrides?.timestamp ?? Fr.zero(),
|
|
95
96
|
overrides?.coinbase ?? EthAddress.ZERO,
|
|
96
97
|
overrides?.feeRecipient ?? AztecAddress.zero(),
|
|
@@ -241,7 +241,7 @@ export class EmitUnencryptedLog extends Instruction {
|
|
|
241
241
|
const contractAddress = context.environment.address;
|
|
242
242
|
|
|
243
243
|
const memoryOperations = { reads: 1 + logSize, indirect: this.indirect };
|
|
244
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
244
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: logSize }));
|
|
245
245
|
const log = memory.getSlice(logOffset, logSize).map(f => f.toFr());
|
|
246
246
|
context.persistableState.writeUnencryptedLog(contractAddress, log);
|
|
247
247
|
|
|
@@ -43,15 +43,15 @@ export class PedersenCommitment extends Instruction {
|
|
|
43
43
|
const inputs = memory.getSlice(inputOffset, inputSize);
|
|
44
44
|
memory.checkTagsRange(TypeTag.FIELD, inputOffset, inputSize);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
const generatorIndex = memory.get(genIndexOffset).toNumber();
|
|
47
47
|
memory.checkTag(TypeTag.UINT32, genIndexOffset);
|
|
48
48
|
|
|
49
|
-
const memoryOperations = { reads: inputSize +
|
|
49
|
+
const memoryOperations = { reads: inputSize + 2, writes: 3, indirect: this.indirect };
|
|
50
50
|
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
51
51
|
|
|
52
52
|
const inputBuffer: Buffer[] = inputs.map(input => input.toBuffer());
|
|
53
53
|
// TODO: Add the generate index to the pedersenCommit function
|
|
54
|
-
const commitment = pedersenCommit(inputBuffer).map(f => new Field(f));
|
|
54
|
+
const commitment = pedersenCommit(inputBuffer, generatorIndex).map(f => new Field(f));
|
|
55
55
|
// The function doesnt include a flag if the output point is infinity, come back to this
|
|
56
56
|
// for now we just check if theyre zero - until we know how bb encodes them
|
|
57
57
|
const isInfinity = commitment[0].equals(new Field(0)) && commitment[1].equals(new Field(0));
|
|
@@ -35,7 +35,7 @@ export class ToRadixLE extends Instruction {
|
|
|
35
35
|
const memory = context.machineState.memory.track(this.type);
|
|
36
36
|
const [srcOffset, dstOffset] = Addressing.fromWire(this.indirect).resolve([this.srcOffset, this.dstOffset], memory);
|
|
37
37
|
const memoryOperations = { reads: 1, writes: this.numLimbs, indirect: this.indirect };
|
|
38
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
38
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: this.numLimbs }));
|
|
39
39
|
|
|
40
40
|
// The radix gadget only takes in a Field
|
|
41
41
|
memory.checkTag(TypeTag.FIELD, srcOffset);
|
|
@@ -67,7 +67,7 @@ abstract class ExternalCall extends Instruction {
|
|
|
67
67
|
|
|
68
68
|
// First we consume the gas for this operation.
|
|
69
69
|
const memoryOperations = { reads: calldataSize + 5, writes: 1 + this.retSize, indirect: this.indirect };
|
|
70
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
70
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: calldataSize + this.retSize }));
|
|
71
71
|
// Then we consume the gas allocated for the nested call. The excess will be refunded later.
|
|
72
72
|
// Gas allocation is capped by the amount of gas left in the current context.
|
|
73
73
|
// We have to do some dancing here because the gas allocation is a field,
|
|
@@ -170,7 +170,7 @@ export class Return extends Instruction {
|
|
|
170
170
|
public async execute(context: AvmContext): Promise<void> {
|
|
171
171
|
const memoryOperations = { reads: this.copySize, indirect: this.indirect };
|
|
172
172
|
const memory = context.machineState.memory.track(this.type);
|
|
173
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
173
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: this.copySize }));
|
|
174
174
|
|
|
175
175
|
const [returnOffset] = Addressing.fromWire(this.indirect).resolve([this.returnOffset], memory);
|
|
176
176
|
|
|
@@ -199,7 +199,7 @@ export class Revert extends Instruction {
|
|
|
199
199
|
public async execute(context: AvmContext): Promise<void> {
|
|
200
200
|
const memoryOperations = { reads: this.retSize, indirect: this.indirect };
|
|
201
201
|
const memory = context.machineState.memory.track(this.type);
|
|
202
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
202
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: this.retSize }));
|
|
203
203
|
|
|
204
204
|
const [returnOffset] = Addressing.fromWire(this.indirect).resolve([this.returnOffset], memory);
|
|
205
205
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { strict as assert } from 'assert';
|
|
2
2
|
|
|
3
3
|
import type { AvmContext } from '../avm_context.js';
|
|
4
|
-
import { getBaseGasCost, sumGas } from '../avm_gas.js';
|
|
4
|
+
import { getBaseGasCost, getDynamicGasCost, mulGas, sumGas } from '../avm_gas.js';
|
|
5
5
|
import { type MemoryOperations } from '../avm_memory_types.js';
|
|
6
6
|
import { type BufferCursor } from '../serialization/buffer_cursor.js';
|
|
7
7
|
import { Opcode, type OperandType, deserialize, serialize } from '../serialization/instruction_serialization.js';
|
|
@@ -67,12 +67,15 @@ export abstract class Instruction {
|
|
|
67
67
|
* @param memoryOps Memory operations performed by the instruction.
|
|
68
68
|
* @returns Gas cost.
|
|
69
69
|
*/
|
|
70
|
-
protected gasCost(
|
|
70
|
+
protected gasCost(ops: Partial<MemoryOperations & { indirect: number; dynMultiplier: number }> = {}) {
|
|
71
71
|
const baseGasCost = getBaseGasCost(this.opcode);
|
|
72
|
+
// TODO: We are using a simplified gas model to reduce complexity in the circuit.
|
|
73
|
+
// Memory accounting will probably be removed.
|
|
72
74
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/6861): reconsider.
|
|
73
75
|
// const memoryGasCost = getMemoryGasCost(memoryOps);
|
|
74
|
-
const memoryGasCost = { l2Gas: 0, daGas: 0 };
|
|
75
|
-
|
|
76
|
+
// const memoryGasCost = { l2Gas: 0, daGas: 0 };
|
|
77
|
+
const dynGasCost = mulGas(getDynamicGasCost(this.opcode), ops.dynMultiplier ?? 0);
|
|
78
|
+
return sumGas(baseGasCost, dynGasCost);
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
/**
|
|
@@ -208,7 +208,7 @@ export class CalldataCopy extends Instruction {
|
|
|
208
208
|
public async execute(context: AvmContext): Promise<void> {
|
|
209
209
|
const memoryOperations = { writes: this.copySize, indirect: this.indirect };
|
|
210
210
|
const memory = context.machineState.memory.track(this.type);
|
|
211
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
211
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: this.copySize }));
|
|
212
212
|
|
|
213
213
|
// We don't need to check tags here because: (1) the calldata is NOT in memory, and (2) we are the ones writing to destination.
|
|
214
214
|
const [cdOffset, dstOffset] = Addressing.fromWire(this.indirect).resolve([this.cdOffset, this.dstOffset], memory);
|
|
@@ -42,7 +42,7 @@ export class SStore extends BaseStorageInstruction {
|
|
|
42
42
|
|
|
43
43
|
const memoryOperations = { reads: this.size + 1, indirect: this.indirect };
|
|
44
44
|
const memory = context.machineState.memory.track(this.type);
|
|
45
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
45
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: this.size }));
|
|
46
46
|
|
|
47
47
|
const [srcOffset, slotOffset] = Addressing.fromWire(this.indirect).resolve([this.aOffset, this.bOffset], memory);
|
|
48
48
|
memory.checkTag(TypeTag.FIELD, slotOffset);
|
|
@@ -72,7 +72,7 @@ export class SLoad extends BaseStorageInstruction {
|
|
|
72
72
|
public async execute(context: AvmContext): Promise<void> {
|
|
73
73
|
const memoryOperations = { writes: this.size, reads: 1, indirect: this.indirect };
|
|
74
74
|
const memory = context.machineState.memory.track(this.type);
|
|
75
|
-
context.machineState.consumeGas(this.gasCost(memoryOperations));
|
|
75
|
+
context.machineState.consumeGas(this.gasCost({ ...memoryOperations, dynMultiplier: this.size }));
|
|
76
76
|
|
|
77
77
|
const [slotOffset, dstOffset] = Addressing.fromWire(this.indirect).resolve([this.aOffset, this.bOffset], memory);
|
|
78
78
|
memory.checkTag(TypeTag.FIELD, slotOffset);
|
|
@@ -87,7 +87,7 @@ export enum Opcode {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// Possible types for an instruction's operand in its wire format. (Keep in sync with CPP code.
|
|
90
|
-
// See vm/avm_trace/
|
|
90
|
+
// See vm/avm_trace/deserialization.cpp)
|
|
91
91
|
// Note that cpp code introduced an additional enum value TAG to express the instruction tag. In TS,
|
|
92
92
|
// this one is parsed as UINT8.
|
|
93
93
|
export enum OperandType {
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
countArgumentsSize,
|
|
31
31
|
} from '@aztec/foundation/abi';
|
|
32
32
|
import { type AztecAddress } from '@aztec/foundation/aztec-address';
|
|
33
|
-
import {
|
|
33
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto';
|
|
34
34
|
import { Fr, GrumpkinScalar, type Point } from '@aztec/foundation/fields';
|
|
35
35
|
import { applyStringFormatting, createDebugLogger } from '@aztec/foundation/log';
|
|
36
36
|
|
|
@@ -71,7 +71,7 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
71
71
|
* They should act as references for the read requests output by an app circuit via public inputs.
|
|
72
72
|
*/
|
|
73
73
|
private noteHashLeafIndexMap: Map<bigint, bigint> = new Map();
|
|
74
|
-
private
|
|
74
|
+
private noteHashNullifierCounterMap: Map<number, number> = new Map();
|
|
75
75
|
private noteEncryptedLogs: CountedNoteLog[] = [];
|
|
76
76
|
private encryptedLogs: CountedLog<EncryptedL2Log>[] = [];
|
|
77
77
|
private unencryptedLogs: CountedLog<UnencryptedL2Log>[] = [];
|
|
@@ -94,8 +94,9 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
94
94
|
private node: AztecNode,
|
|
95
95
|
protected sideEffectCounter: number = 0,
|
|
96
96
|
log = createDebugLogger('aztec:simulator:client_execution_context'),
|
|
97
|
+
scopes?: AztecAddress[],
|
|
97
98
|
) {
|
|
98
|
-
super(contractAddress, authWitnesses, db, node, log);
|
|
99
|
+
super(contractAddress, authWitnesses, db, node, log, scopes);
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
// We still need this function until we can get user-defined ordering of structs for fn arguments
|
|
@@ -135,14 +136,13 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
138
|
* Get the data for the newly created notes.
|
|
138
|
-
* @param innerNoteHashes - Inner note hashes for the notes.
|
|
139
139
|
*/
|
|
140
140
|
public getNewNotes(): NoteAndSlot[] {
|
|
141
141
|
return this.newNotes;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
public
|
|
145
|
-
return this.
|
|
144
|
+
public getNoteHashNullifierCounterMap() {
|
|
145
|
+
return this.noteHashNullifierCounterMap;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
@@ -251,7 +251,7 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
251
251
|
const pendingNotes = this.noteCache.getNotes(this.callContext.storageContractAddress, storageSlot);
|
|
252
252
|
|
|
253
253
|
const pendingNullifiers = this.noteCache.getNullifiers(this.callContext.storageContractAddress);
|
|
254
|
-
const dbNotes = await this.db.getNotes(this.callContext.storageContractAddress, storageSlot, status);
|
|
254
|
+
const dbNotes = await this.db.getNotes(this.callContext.storageContractAddress, storageSlot, status, this.scopes);
|
|
255
255
|
const dbNotesFiltered = dbNotes.filter(n => !pendingNullifiers.has((n.siloedNullifier as Fr).value));
|
|
256
256
|
|
|
257
257
|
const notes = pickNotes<NoteData>([...dbNotesFiltered, ...pendingNotes], {
|
|
@@ -276,12 +276,9 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
276
276
|
|
|
277
277
|
notes.forEach(n => {
|
|
278
278
|
if (n.index !== undefined) {
|
|
279
|
-
|
|
280
|
-
// Should always call computeUniqueNoteHash when publicly created notes include nonces.
|
|
281
|
-
const uniqueNoteHash = n.nonce.isZero() ? n.innerNoteHash : computeUniqueNoteHash(n.nonce, n.innerNoteHash);
|
|
279
|
+
const uniqueNoteHash = computeUniqueNoteHash(n.nonce, n.noteHash);
|
|
282
280
|
const siloedNoteHash = siloNoteHash(n.contractAddress, uniqueNoteHash);
|
|
283
|
-
|
|
284
|
-
this.noteHashLeafIndexMap.set(noteHashForReadRequest.toBigInt(), n.index);
|
|
281
|
+
this.noteHashLeafIndexMap.set(siloedNoteHash.toBigInt(), n.index);
|
|
285
282
|
}
|
|
286
283
|
});
|
|
287
284
|
|
|
@@ -295,14 +292,14 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
295
292
|
* @param storageSlot - The storage slot.
|
|
296
293
|
* @param noteTypeId - The type ID of the note.
|
|
297
294
|
* @param noteItems - The items to be included in a Note.
|
|
298
|
-
* @param
|
|
295
|
+
* @param noteHash - A hash of the new note.
|
|
299
296
|
* @returns
|
|
300
297
|
*/
|
|
301
298
|
public override notifyCreatedNote(
|
|
302
299
|
storageSlot: Fr,
|
|
303
300
|
noteTypeId: NoteSelector,
|
|
304
301
|
noteItems: Fr[],
|
|
305
|
-
|
|
302
|
+
noteHash: Fr,
|
|
306
303
|
counter: number,
|
|
307
304
|
) {
|
|
308
305
|
const note = new Note(noteItems);
|
|
@@ -313,7 +310,7 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
313
310
|
nonce: Fr.ZERO, // Nonce cannot be known during private execution.
|
|
314
311
|
note,
|
|
315
312
|
siloedNullifier: undefined, // Siloed nullifier cannot be known for newly created note.
|
|
316
|
-
|
|
313
|
+
noteHash,
|
|
317
314
|
},
|
|
318
315
|
counter,
|
|
319
316
|
);
|
|
@@ -328,16 +325,16 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
328
325
|
* Adding a siloed nullifier into the current set of all pending nullifiers created
|
|
329
326
|
* within the current transaction/execution.
|
|
330
327
|
* @param innerNullifier - The pending nullifier to add in the list (not yet siloed by contract address).
|
|
331
|
-
* @param
|
|
328
|
+
* @param noteHash - A hash of the new note.
|
|
332
329
|
*/
|
|
333
|
-
public override notifyNullifiedNote(innerNullifier: Fr,
|
|
330
|
+
public override notifyNullifiedNote(innerNullifier: Fr, noteHash: Fr, counter: number) {
|
|
334
331
|
const nullifiedNoteHashCounter = this.noteCache.nullifyNote(
|
|
335
332
|
this.callContext.storageContractAddress,
|
|
336
333
|
innerNullifier,
|
|
337
|
-
|
|
334
|
+
noteHash,
|
|
338
335
|
);
|
|
339
336
|
if (nullifiedNoteHashCounter !== undefined) {
|
|
340
|
-
this.
|
|
337
|
+
this.noteHashNullifierCounterMap.set(nullifiedNoteHashCounter, counter);
|
|
341
338
|
}
|
|
342
339
|
return Promise.resolve();
|
|
343
340
|
}
|
|
@@ -360,7 +357,7 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
360
357
|
// An app providing randomness = 0 signals to not mask the address.
|
|
361
358
|
const maskedContractAddress = randomness.isZero()
|
|
362
359
|
? contractAddress.toField()
|
|
363
|
-
:
|
|
360
|
+
: poseidon2HashWithSeparator([contractAddress, randomness], 0);
|
|
364
361
|
const encryptedLog = new CountedLog(new EncryptedL2Log(encryptedEvent, maskedContractAddress), counter);
|
|
365
362
|
this.encryptedLogs.push(encryptedLog);
|
|
366
363
|
}
|
|
@@ -519,6 +516,8 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
519
516
|
this.db,
|
|
520
517
|
this.node,
|
|
521
518
|
sideEffectCounter,
|
|
519
|
+
this.log,
|
|
520
|
+
this.scopes,
|
|
522
521
|
);
|
|
523
522
|
|
|
524
523
|
const childExecutionResult = await executePrivateFunction(
|
|
@@ -645,6 +644,10 @@ export class ClientExecutionContext extends ViewDataOracle {
|
|
|
645
644
|
);
|
|
646
645
|
}
|
|
647
646
|
|
|
647
|
+
public override notifySetMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter: number): void {
|
|
648
|
+
this.noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
649
|
+
}
|
|
650
|
+
|
|
648
651
|
/**
|
|
649
652
|
* Derives the call context for a nested execution.
|
|
650
653
|
* @param targetContractAddress - The address of the contract being called.
|
package/src/client/db_oracle.ts
CHANGED
|
@@ -78,12 +78,18 @@ export interface DBOracle extends CommitmentsDB {
|
|
|
78
78
|
* The query result is paginated using 'limit' and 'offset' values.
|
|
79
79
|
* Returns an object containing an array of note data.
|
|
80
80
|
*
|
|
81
|
-
* @param contractAddress - The
|
|
82
|
-
* @param storageSlot - The
|
|
81
|
+
* @param contractAddress - The contract address of the notes.
|
|
82
|
+
* @param storageSlot - The storage slot of the notes.
|
|
83
83
|
* @param status - The status of notes to fetch.
|
|
84
|
+
* @param scopes - The accounts whose notes we can access in this call. Currently optional and will default to all.
|
|
84
85
|
* @returns A Promise that resolves to an array of note data.
|
|
85
86
|
*/
|
|
86
|
-
getNotes(
|
|
87
|
+
getNotes(
|
|
88
|
+
contractAddress: AztecAddress,
|
|
89
|
+
storageSlot: Fr,
|
|
90
|
+
status: NoteStatus,
|
|
91
|
+
scopes?: AztecAddress[],
|
|
92
|
+
): Promise<NoteData[]>;
|
|
87
93
|
|
|
88
94
|
/**
|
|
89
95
|
* Retrieve the artifact information of a specific function within a contract.
|