@aztec/stdlib 0.0.1-commit.3100065 → 0.0.1-commit.330febf
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/abi/abi.d.ts +32 -7
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +11 -2
- package/dest/abi/contract_artifact.d.ts +1 -14
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +35 -36
- package/dest/abi/decoder.d.ts +12 -5
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +18 -21
- package/dest/abi/function_call.d.ts +17 -8
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +28 -9
- package/dest/avm/avm.d.ts +212 -211
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +3 -1
- package/dest/avm/index.d.ts +1 -6
- package/dest/avm/index.d.ts.map +1 -1
- package/dest/avm/index.js +0 -5
- package/dest/block/l2_block_source.d.ts +1 -1
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +6 -2
- package/dest/block/l2_block_stream/interfaces.d.ts +7 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +2 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +47 -20
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +9 -4
- package/dest/config/node-rpc-config.d.ts +1 -1
- package/dest/config/node-rpc-config.d.ts.map +1 -1
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/contract/artifact_hash.d.ts +2 -2
- package/dest/contract/artifact_hash.d.ts.map +1 -1
- package/dest/contract/artifact_hash.js +10 -2
- package/dest/contract/contract_class.d.ts +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -2
- package/dest/contract/index.d.ts +1 -2
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -1
- package/dest/interfaces/api_limit.d.ts +6 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +3 -0
- package/dest/interfaces/aztec-node-admin.d.ts +2 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/block-builder.d.ts +7 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +7 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +8 -3
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/private_kernel_prover.d.ts +64 -3
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +1 -1
- package/dest/interfaces/server.d.ts +1 -2
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +0 -1
- package/dest/interfaces/tx_provider.d.ts +5 -1
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/kernel/hints/index.d.ts +1 -2
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +0 -1
- package/dest/kernel/index.d.ts +5 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +4 -0
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +3 -7
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts +24 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_4_circuit_private_inputs.js +37 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts +25 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_init_5_circuit_private_inputs.js +39 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts +18 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_4_circuit_private_inputs.js +27 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts +19 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_inner_5_circuit_private_inputs.js +29 -0
- package/dest/kernel/private_kernel_prover_output.d.ts +4 -1
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_prover_output.js +4 -1
- package/dest/kernel/private_kernel_simulated_output.d.ts +1 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/private_kernel_simulated_output.js +2 -1
- package/dest/kernel/utils/index.d.ts +1 -2
- package/dest/kernel/utils/index.d.ts.map +1 -1
- package/dest/kernel/utils/index.js +0 -1
- package/dest/logs/index.d.ts +3 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -0
- package/dest/logs/logs_query.d.ts +2 -2
- package/dest/logs/message_context.d.ts +17 -0
- package/dest/logs/message_context.d.ts.map +1 -0
- package/dest/logs/message_context.js +9 -0
- package/dest/logs/pending_tagged_log.d.ts +11 -0
- package/dest/logs/pending_tagged_log.d.ts.map +1 -0
- package/dest/logs/pending_tagged_log.js +4 -0
- package/dest/logs/shared_secret_derivation.d.ts +12 -2
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +18 -0
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/p2p/index.d.ts +1 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +0 -1
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -27
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +0 -30
- package/dest/tx/hashed_values.d.ts +7 -1
- package/dest/tx/hashed_values.d.ts.map +1 -1
- package/dest/tx/hashed_values.js +9 -1
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/offchain_effect.js +1 -1
- package/dest/tx/profiling.d.ts +1 -1
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +2 -0
- package/dest/tx/simulated_tx.d.ts +1 -1
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +7 -2
- package/dest/tx/tx.d.ts +8 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +9 -3
- package/dest/validators/errors.d.ts +16 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +12 -0
- package/dest/world-state/world_state_revision.d.ts +1 -18
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +0 -20
- package/package.json +8 -8
- package/src/abi/abi.ts +32 -4
- package/src/abi/contract_artifact.ts +40 -35
- package/src/abi/decoder.ts +20 -24
- package/src/abi/function_call.ts +19 -7
- package/src/avm/avm.ts +4 -1
- package/src/avm/index.ts +0 -5
- package/src/block/l2_block_source.ts +14 -2
- package/src/block/l2_block_stream/interfaces.ts +6 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +58 -21
- package/src/block/test/l2_tips_store_test_suite.ts +5 -0
- package/src/config/node-rpc-config.ts +2 -1
- package/src/contract/artifact_hash.ts +15 -3
- package/src/contract/contract_class.ts +3 -2
- package/src/contract/index.ts +0 -1
- package/src/gas/README.md +108 -36
- package/src/interfaces/api_limit.ts +5 -0
- package/src/interfaces/block-builder.ts +6 -1
- package/src/interfaces/configs.ts +6 -0
- package/src/interfaces/merkle_tree_operations.ts +8 -2
- package/src/interfaces/private_kernel_prover.ts +94 -1
- package/src/interfaces/server.ts +0 -1
- package/src/interfaces/tx_provider.ts +4 -0
- package/src/kernel/hints/index.ts +0 -1
- package/src/kernel/index.ts +4 -0
- package/src/kernel/private_kernel_circuit_public_inputs.ts +0 -7
- package/src/kernel/private_kernel_init_4_circuit_private_inputs.ts +52 -0
- package/src/kernel/private_kernel_init_5_circuit_private_inputs.ts +55 -0
- package/src/kernel/private_kernel_inner_4_circuit_private_inputs.ts +39 -0
- package/src/kernel/private_kernel_inner_5_circuit_private_inputs.ts +42 -0
- package/src/kernel/private_kernel_prover_output.ts +4 -0
- package/src/kernel/private_kernel_reset_dimensions.ts +1 -1
- package/src/kernel/private_kernel_simulated_output.ts +0 -7
- package/src/kernel/utils/index.ts +0 -1
- package/src/logs/index.ts +2 -0
- package/src/logs/logs_query.ts +2 -2
- package/src/logs/message_context.ts +18 -0
- package/src/logs/pending_tagged_log.ts +12 -0
- package/src/logs/shared_secret_derivation.ts +18 -1
- package/src/noir/index.ts +2 -1
- package/src/p2p/index.ts +0 -1
- package/src/stats/stats.ts +4 -0
- package/src/tests/factories.ts +0 -38
- package/src/tx/hashed_values.ts +11 -6
- package/src/tx/index.ts +0 -1
- package/src/tx/offchain_effect.ts +1 -1
- package/src/tx/profiling.ts +2 -0
- package/src/tx/simulated_tx.ts +13 -2
- package/src/tx/tx.ts +19 -3
- package/src/validators/errors.ts +17 -0
- package/src/world-state/world_state_revision.ts +0 -33
- package/dest/avm/contract_storage_read.d.ts +0 -58
- package/dest/avm/contract_storage_read.d.ts.map +0 -1
- package/dest/avm/contract_storage_read.js +0 -65
- package/dest/avm/contract_storage_update_request.d.ts +0 -65
- package/dest/avm/contract_storage_update_request.d.ts.map +0 -1
- package/dest/avm/contract_storage_update_request.js +0 -80
- package/dest/avm/public_call_stack_item_compressed.d.ts +0 -43
- package/dest/avm/public_call_stack_item_compressed.d.ts.map +0 -1
- package/dest/avm/public_call_stack_item_compressed.js +0 -70
- package/dest/avm/public_data_update_request.d.ts +0 -62
- package/dest/avm/public_data_update_request.d.ts.map +0 -1
- package/dest/avm/public_data_update_request.js +0 -67
- package/dest/avm/public_inner_call_request.d.ts +0 -50
- package/dest/avm/public_inner_call_request.d.ts.map +0 -1
- package/dest/avm/public_inner_call_request.js +0 -74
- package/dest/contract/deployment_info.d.ts +0 -24
- package/dest/contract/deployment_info.d.ts.map +0 -1
- package/dest/contract/deployment_info.js +0 -3
- package/dest/interfaces/prover-coordination.d.ts +0 -15
- package/dest/interfaces/prover-coordination.d.ts.map +0 -1
- package/dest/interfaces/prover-coordination.js +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.d.ts +0 -14
- package/dest/kernel/hints/tree_leaf_read_request.d.ts.map +0 -1
- package/dest/kernel/hints/tree_leaf_read_request.js +0 -33
- package/dest/kernel/utils/optional_number.d.ts +0 -31
- package/dest/kernel/utils/optional_number.d.ts.map +0 -1
- package/dest/kernel/utils/optional_number.js +0 -42
- package/dest/p2p/interface.d.ts +0 -5
- package/dest/p2p/interface.d.ts.map +0 -1
- package/dest/p2p/interface.js +0 -1
- package/dest/tx/validator/empty_validator.d.ts +0 -5
- package/dest/tx/validator/empty_validator.d.ts.map +0 -1
- package/dest/tx/validator/empty_validator.js +0 -7
- package/src/avm/contract_storage_read.ts +0 -77
- package/src/avm/contract_storage_update_request.ts +0 -93
- package/src/avm/public_call_stack_item_compressed.ts +0 -113
- package/src/avm/public_data_update_request.ts +0 -106
- package/src/avm/public_inner_call_request.ts +0 -85
- package/src/contract/deployment_info.ts +0 -25
- package/src/interfaces/prover-coordination.ts +0 -17
- package/src/kernel/hints/tree_leaf_read_request.ts +0 -35
- package/src/kernel/utils/optional_number.ts +0 -50
- package/src/p2p/interface.ts +0 -4
- package/src/tx/validator/empty_validator.ts +0 -7
package/src/tests/factories.ts
CHANGED
|
@@ -54,8 +54,6 @@ import type { Bufferable, Serializable, Tuple } from '@aztec/foundation/serializ
|
|
|
54
54
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
55
55
|
|
|
56
56
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
57
|
-
import { ContractStorageRead } from '../avm/contract_storage_read.js';
|
|
58
|
-
import { ContractStorageUpdateRequest } from '../avm/contract_storage_update_request.js';
|
|
59
57
|
import {
|
|
60
58
|
AvmAccumulatedData,
|
|
61
59
|
AvmAccumulatedDataArrayLengths,
|
|
@@ -82,7 +80,6 @@ import {
|
|
|
82
80
|
AvmSequentialInsertHintPublicDataTree,
|
|
83
81
|
AvmTxHint,
|
|
84
82
|
} from '../avm/index.js';
|
|
85
|
-
import { PublicDataRead } from '../avm/public_data_read.js';
|
|
86
83
|
import { PublicDataWrite } from '../avm/public_data_write.js';
|
|
87
84
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
88
85
|
import { BlockHash } from '../block/block_hash.js';
|
|
@@ -276,41 +273,6 @@ export function makePublicDataWrite(seed = 1) {
|
|
|
276
273
|
return new PublicDataWrite(fr(seed), fr(seed + 1));
|
|
277
274
|
}
|
|
278
275
|
|
|
279
|
-
/**
|
|
280
|
-
* Creates arbitrary public data read.
|
|
281
|
-
* @param seed - The seed to use for generating the public data read.
|
|
282
|
-
* @returns A public data read.
|
|
283
|
-
*/
|
|
284
|
-
export function makePublicDataRead(seed = 1): PublicDataRead {
|
|
285
|
-
return new PublicDataRead(fr(seed), fr(seed + 1), 0);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Creates empty public data read.
|
|
290
|
-
* @returns An empty public data read.
|
|
291
|
-
*/
|
|
292
|
-
export function makeEmptyPublicDataRead(): PublicDataRead {
|
|
293
|
-
return new PublicDataRead(fr(0), fr(0), 0);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Creates arbitrary contract storage update request.
|
|
298
|
-
* @param seed - The seed to use for generating the contract storage update request.
|
|
299
|
-
* @returns A contract storage update request.
|
|
300
|
-
*/
|
|
301
|
-
export function makeContractStorageUpdateRequest(seed = 1): ContractStorageUpdateRequest {
|
|
302
|
-
return new ContractStorageUpdateRequest(fr(seed), fr(seed + 1), seed + 2);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Creates arbitrary contract storage read.
|
|
307
|
-
* @param seed - The seed to use for generating the contract storage read.
|
|
308
|
-
* @returns A contract storage read.
|
|
309
|
-
*/
|
|
310
|
-
export function makeContractStorageRead(seed = 1): ContractStorageRead {
|
|
311
|
-
return new ContractStorageRead(fr(seed), fr(seed + 1), seed + 2);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
276
|
function makeTxConstantData(seed = 1) {
|
|
315
277
|
return new TxConstantData(
|
|
316
278
|
makeBlockHeader(seed),
|
package/src/tx/hashed_values.ts
CHANGED
|
@@ -28,12 +28,17 @@ export class HashedValues {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
static get schema(): ZodFor<HashedValues> {
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
return HashedValues.schemaFor();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns a schema that additionally rejects more than `maxValues` values. The bound belongs to the caller
|
|
36
|
+
* rather than to this class: the same container carries public calldata, private call arguments and authwit
|
|
37
|
+
* arguments, and those have different limits.
|
|
38
|
+
*/
|
|
39
|
+
static schemaFor(maxValues?: number): ZodFor<HashedValues> {
|
|
40
|
+
const values = maxValues === undefined ? z.array(schemas.Fr) : z.array(schemas.Fr).max(maxValues);
|
|
41
|
+
return z.object({ values, hash: schemas.Fr }).transform(HashedValues.from);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
static from(fields: FieldsOf<HashedValues>): HashedValues {
|
package/src/tx/index.ts
CHANGED
|
@@ -21,7 +21,6 @@ export * from './tx_effect.js';
|
|
|
21
21
|
export * from './public_simulation_output.js';
|
|
22
22
|
export * from './tx_execution_request.js';
|
|
23
23
|
export * from './validator/tx_validator.js';
|
|
24
|
-
export * from './validator/empty_validator.js';
|
|
25
24
|
export * from './validator/error_texts.js';
|
|
26
25
|
export * from './capsule.js';
|
|
27
26
|
export * from './fee_provider.js';
|
|
@@ -2,7 +2,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
|
|
3
3
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
4
4
|
|
|
5
|
-
// The following identifier was copied over from `noir-projects/aztec-nr/aztec/src/messages/offchain_messages.nr`.
|
|
5
|
+
// The following identifier was copied over from `noir-projects/labs/aztec-nr/aztec/src/messages/offchain_messages.nr`.
|
|
6
6
|
// poseidon2hash("aztecnr_offchain_message")
|
|
7
7
|
export const OFFCHAIN_MESSAGE_IDENTIFIER: Fr = new Fr(
|
|
8
8
|
6023466688192654631553769360478808766602235351827869819420284624004071427516n,
|
package/src/tx/profiling.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CircuitKind } from '@aztec/bb.js';
|
|
1
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { type ZodFor, optional, schemas } from '@aztec/foundation/schemas';
|
|
3
4
|
|
|
@@ -125,6 +126,7 @@ export class TxProfileResult {
|
|
|
125
126
|
bytecode: Buffer.from('random'),
|
|
126
127
|
witness: new Map([[1, 'random']]),
|
|
127
128
|
vk: Buffer.from('random'),
|
|
129
|
+
kind: CircuitKind.App,
|
|
128
130
|
timings: {
|
|
129
131
|
witgen: 1,
|
|
130
132
|
gateCount: 1,
|
package/src/tx/simulated_tx.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '../contract/interfaces/contract_instance.js';
|
|
10
10
|
import { Gas } from '../gas/gas.js';
|
|
11
11
|
import type { GasUsed } from '../gas/gas_used.js';
|
|
12
|
+
import { MAX_RPC_CONTRACT_OVERRIDES_LEN, MAX_RPC_PUBLIC_STORAGE_OVERRIDES_LEN } from '../interfaces/api_limit.js';
|
|
12
13
|
import { type PublicStorageOverride, PublicStorageOverrideSchema } from '../interfaces/public_storage_override.js';
|
|
13
14
|
import { PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
14
15
|
import { ChonkProof } from '../proofs/chonk_proof.js';
|
|
@@ -50,8 +51,18 @@ export class SimulationOverrides {
|
|
|
50
51
|
static get schema() {
|
|
51
52
|
return z
|
|
52
53
|
.object({
|
|
53
|
-
publicStorage: optional(
|
|
54
|
-
|
|
54
|
+
publicStorage: optional(
|
|
55
|
+
z.array(PublicStorageOverrideSchema).max(MAX_RPC_PUBLIC_STORAGE_OVERRIDES_LEN, {
|
|
56
|
+
message: `publicStorage must have at most ${MAX_RPC_PUBLIC_STORAGE_OVERRIDES_LEN} entries`,
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
contracts: optional(
|
|
60
|
+
z
|
|
61
|
+
.record(z.string(), z.object({ instance: ContractInstanceWithAddressSchema }))
|
|
62
|
+
.refine(contracts => Object.keys(contracts).length <= MAX_RPC_CONTRACT_OVERRIDES_LEN, {
|
|
63
|
+
message: `contracts must have at most ${MAX_RPC_CONTRACT_OVERRIDES_LEN} entries`,
|
|
64
|
+
}),
|
|
65
|
+
),
|
|
55
66
|
})
|
|
56
67
|
.transform(args => new SimulationOverrides(args));
|
|
57
68
|
}
|
package/src/tx/tx.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DA_GAS_PER_FIELD,
|
|
3
|
+
MAX_CONTRACT_CLASS_LOGS_PER_TX,
|
|
4
|
+
MAX_ENQUEUED_CALLS_PER_TX,
|
|
5
|
+
MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS,
|
|
6
|
+
TX_DA_GAS_OVERHEAD,
|
|
7
|
+
} from '@aztec/constants';
|
|
2
8
|
import { type BaseBuffer32, Buffer32 } from '@aztec/foundation/buffer';
|
|
3
9
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
10
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
@@ -33,6 +39,14 @@ import { TxHash } from './tx_hash.js';
|
|
|
33
39
|
// with the existing cost.
|
|
34
40
|
const TX_SINK_PRESIZE_BYTES = 131072;
|
|
35
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Upper bound on the calldata entries a tx can carry: one per enqueued call, plus one for the teardown call.
|
|
44
|
+
* The revertible and non-revertible call request arrays are each sized `MAX_ENQUEUED_CALLS_PER_TX`, but the
|
|
45
|
+
* private tail circuit fills them by partitioning a single array of that size, so their lengths sum to it. The
|
|
46
|
+
* teardown request is propagated separately and can only be set once.
|
|
47
|
+
*/
|
|
48
|
+
export const MAX_PUBLIC_FUNCTION_CALLDATA_PER_TX = MAX_ENQUEUED_CALLS_PER_TX + 1;
|
|
49
|
+
|
|
36
50
|
/**
|
|
37
51
|
* The interface of an L2 transaction.
|
|
38
52
|
*/
|
|
@@ -172,8 +186,10 @@ export class Tx extends Gossipable {
|
|
|
172
186
|
.object({
|
|
173
187
|
data: PrivateKernelTailCircuitPublicInputs.schema,
|
|
174
188
|
chonkProof: ChonkProof.schema,
|
|
175
|
-
contractClassLogFields: z.array(ContractClassLogFields.schema),
|
|
176
|
-
publicFunctionCalldata: z
|
|
189
|
+
contractClassLogFields: z.array(ContractClassLogFields.schema).max(MAX_CONTRACT_CLASS_LOGS_PER_TX),
|
|
190
|
+
publicFunctionCalldata: z
|
|
191
|
+
.array(HashedValues.schemaFor(MAX_FR_CALLDATA_TO_ALL_ENQUEUED_CALLS))
|
|
192
|
+
.max(MAX_PUBLIC_FUNCTION_CALLDATA_PER_TX),
|
|
177
193
|
})
|
|
178
194
|
.transform(Tx.create);
|
|
179
195
|
}
|
package/src/validators/errors.ts
CHANGED
|
@@ -30,6 +30,23 @@ export class TransactionsNotAvailableError extends ValidatorError {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when a tx carried in a block proposal fails minimum integrity validation (metadata, size, data,
|
|
35
|
+
* contract instances, or proof). The proposer signs both the tx hashes and the tx objects, so this is
|
|
36
|
+
* proposer misbehavior rather than a local failure, and callers classify it as an invalid block proposal.
|
|
37
|
+
*/
|
|
38
|
+
export class InvalidBlockProposalTxsError extends ValidatorError {
|
|
39
|
+
constructor(public readonly invalidTxs: { txHash: TxHash; reasons: string[] }[]) {
|
|
40
|
+
super(
|
|
41
|
+
`Invalid txs in block proposal: ${invalidTxs
|
|
42
|
+
.map(({ txHash, reasons }) => `${txHash} (${reasons.join(', ')})`)
|
|
43
|
+
.join('; ')}`,
|
|
44
|
+
);
|
|
45
|
+
// Set so `isErrorClass` can recognize this error across package instances, where `instanceof` fails.
|
|
46
|
+
this.name = 'InvalidBlockProposalTxsError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
export class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
34
51
|
constructor(txHashes: TxHash[]) {
|
|
35
52
|
super(`Failed to re-execute transactions: ${txHashes.join(', ')}`);
|
|
@@ -36,36 +36,3 @@ export class WorldStateRevision {
|
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
export class WorldStateRevisionWithHandle extends WorldStateRevision {
|
|
41
|
-
constructor(
|
|
42
|
-
forkId: number,
|
|
43
|
-
blockNumber: number,
|
|
44
|
-
includeUncommitted: boolean,
|
|
45
|
-
public readonly handle: any,
|
|
46
|
-
) {
|
|
47
|
-
super(forkId, blockNumber, includeUncommitted);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public toWorldStateRevision() {
|
|
51
|
-
return new WorldStateRevision(this.forkId, this.blockNumber, this.includeUncommitted);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
static fromWorldStateRevision(revision: WorldStateRevision, handle: any) {
|
|
55
|
-
return new WorldStateRevisionWithHandle(revision.forkId, revision.blockNumber, revision.includeUncommitted, handle);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static override get schema() {
|
|
59
|
-
return z
|
|
60
|
-
.object({
|
|
61
|
-
forkId: z.number(),
|
|
62
|
-
blockNumber: z.number(),
|
|
63
|
-
includeUncommitted: z.boolean(),
|
|
64
|
-
handle: z.any(),
|
|
65
|
-
})
|
|
66
|
-
.transform(
|
|
67
|
-
({ forkId, blockNumber, includeUncommitted, handle }) =>
|
|
68
|
-
new WorldStateRevisionWithHandle(forkId, blockNumber, includeUncommitted, handle),
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Contract storage read operation on a specific contract.
|
|
6
|
-
*
|
|
7
|
-
* Note: Similar to `PublicDataRead` but it's from the POV of contract storage so we are not working with public data
|
|
8
|
-
* tree leaf index but storage slot index.
|
|
9
|
-
*/
|
|
10
|
-
export declare class ContractStorageRead {
|
|
11
|
-
/**
|
|
12
|
-
* Storage slot we are reading from.
|
|
13
|
-
*/
|
|
14
|
-
readonly storageSlot: Fr;
|
|
15
|
-
/**
|
|
16
|
-
* Value read from the storage slot.
|
|
17
|
-
*/
|
|
18
|
-
readonly currentValue: Fr;
|
|
19
|
-
/**
|
|
20
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
21
|
-
*/
|
|
22
|
-
readonly counter: number;
|
|
23
|
-
/**
|
|
24
|
-
* Contract address whose storage is being read.
|
|
25
|
-
*/
|
|
26
|
-
contractAddress?: AztecAddress | undefined;
|
|
27
|
-
constructor(
|
|
28
|
-
/**
|
|
29
|
-
* Storage slot we are reading from.
|
|
30
|
-
*/
|
|
31
|
-
storageSlot: Fr,
|
|
32
|
-
/**
|
|
33
|
-
* Value read from the storage slot.
|
|
34
|
-
*/
|
|
35
|
-
currentValue: Fr,
|
|
36
|
-
/**
|
|
37
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
38
|
-
*/
|
|
39
|
-
counter: number,
|
|
40
|
-
/**
|
|
41
|
-
* Contract address whose storage is being read.
|
|
42
|
-
*/
|
|
43
|
-
contractAddress?: AztecAddress | undefined);
|
|
44
|
-
static from(args: {
|
|
45
|
-
storageSlot: Fr;
|
|
46
|
-
currentValue: Fr;
|
|
47
|
-
counter: number;
|
|
48
|
-
contractAddress?: AztecAddress;
|
|
49
|
-
}): ContractStorageRead;
|
|
50
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
51
|
-
static fromBuffer(buffer: Buffer | BufferReader): ContractStorageRead;
|
|
52
|
-
static empty(): ContractStorageRead;
|
|
53
|
-
isEmpty(): boolean;
|
|
54
|
-
toFriendlyJSON(): string;
|
|
55
|
-
toFields(): Fr[];
|
|
56
|
-
static fromFields(fields: Fr[] | FieldReader): ContractStorageRead;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmFnZV9yZWFkLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXZtL2NvbnRyYWN0X3N0b3JhZ2VfcmVhZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQXFCLE1BQU0sNkJBQTZCLENBQUM7QUFFM0YsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFFOUQ7Ozs7O0dBS0c7QUFDSCxxQkFBYS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AE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAE3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;GAKG;AACH,qBAAa,mBAAmB;IAE5B;;OAEG;aACa,WAAW,EAAE,EAAE;IAC/B;;OAEG;aACa,YAAY,EAAE,EAAE;IAChC;;OAEG;aACa,OAAO,EAAE,MAAM;IAC/B;;OAEG;IACI,eAAe,CAAC;IAhBzB;IACE;;OAEG;IACa,WAAW,EAAE,EAAE;IAC/B;;OAEG;IACa,YAAY,EAAE,EAAE;IAChC;;OAEG;IACa,OAAO,EAAE,MAAM;IAC/B;;OAEG;IACI,eAAe,CAAC,0BAAc,EACnC;IAEJ,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,EAAE,CAAC;QAAC,YAAY,EAAE,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,YAAY,CAAA;KAAE,uBAEvG;IAED,QAAQ,4BAEP;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,uBAG9C;IAED,MAAM,CAAC,KAAK,wBAEX;IAED,OAAO,YAEN;IAED,cAAc,WAEb;IAED,QAAQ,IAAI,EAAE,EAAE,CAQf;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,mBAAmB,CAQjE;CACF"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { CONTRACT_STORAGE_READ_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
/**
|
|
5
|
-
* Contract storage read operation on a specific contract.
|
|
6
|
-
*
|
|
7
|
-
* Note: Similar to `PublicDataRead` but it's from the POV of contract storage so we are not working with public data
|
|
8
|
-
* tree leaf index but storage slot index.
|
|
9
|
-
*/ export class ContractStorageRead {
|
|
10
|
-
storageSlot;
|
|
11
|
-
currentValue;
|
|
12
|
-
counter;
|
|
13
|
-
contractAddress;
|
|
14
|
-
constructor(/**
|
|
15
|
-
* Storage slot we are reading from.
|
|
16
|
-
*/ storageSlot, /**
|
|
17
|
-
* Value read from the storage slot.
|
|
18
|
-
*/ currentValue, /**
|
|
19
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
20
|
-
*/ counter, /**
|
|
21
|
-
* Contract address whose storage is being read.
|
|
22
|
-
*/ contractAddress){
|
|
23
|
-
this.storageSlot = storageSlot;
|
|
24
|
-
this.currentValue = currentValue;
|
|
25
|
-
this.counter = counter;
|
|
26
|
-
this.contractAddress = contractAddress;
|
|
27
|
-
}
|
|
28
|
-
static from(args) {
|
|
29
|
-
return new ContractStorageRead(args.storageSlot, args.currentValue, args.counter, args.contractAddress);
|
|
30
|
-
}
|
|
31
|
-
toBuffer() {
|
|
32
|
-
return serializeToBuffer(this.storageSlot, this.currentValue, new Fr(this.counter));
|
|
33
|
-
}
|
|
34
|
-
static fromBuffer(buffer) {
|
|
35
|
-
const reader = BufferReader.asReader(buffer);
|
|
36
|
-
return new ContractStorageRead(Fr.fromBuffer(reader), Fr.fromBuffer(reader), Fr.fromBuffer(reader).toNumber());
|
|
37
|
-
}
|
|
38
|
-
static empty() {
|
|
39
|
-
return new ContractStorageRead(Fr.ZERO, Fr.ZERO, 0);
|
|
40
|
-
}
|
|
41
|
-
isEmpty() {
|
|
42
|
-
return this.storageSlot.isZero() && this.currentValue.isZero() && this.counter == 0;
|
|
43
|
-
}
|
|
44
|
-
toFriendlyJSON() {
|
|
45
|
-
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.currentValue.toFriendlyJSON()}`;
|
|
46
|
-
}
|
|
47
|
-
toFields() {
|
|
48
|
-
const fields = [
|
|
49
|
-
this.storageSlot,
|
|
50
|
-
this.currentValue,
|
|
51
|
-
new Fr(this.counter)
|
|
52
|
-
];
|
|
53
|
-
if (fields.length !== CONTRACT_STORAGE_READ_LENGTH) {
|
|
54
|
-
throw new Error(`Invalid number of fields for ContractStorageRead. Expected ${CONTRACT_STORAGE_READ_LENGTH}, got ${fields.length}`);
|
|
55
|
-
}
|
|
56
|
-
return fields;
|
|
57
|
-
}
|
|
58
|
-
static fromFields(fields) {
|
|
59
|
-
const reader = FieldReader.asReader(fields);
|
|
60
|
-
const storageSlot = reader.readField();
|
|
61
|
-
const currentValue = reader.readField();
|
|
62
|
-
const counter = reader.readField().toNumber();
|
|
63
|
-
return new ContractStorageRead(storageSlot, currentValue, counter);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
-
import type { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
-
/**
|
|
6
|
-
* Contract storage update request for a slot on a specific contract.
|
|
7
|
-
*
|
|
8
|
-
* Note: Similar to `PublicDataUpdateRequest` but it's from the POV of contract storage so we are not working with
|
|
9
|
-
* public data tree leaf index but storage slot index.
|
|
10
|
-
*/
|
|
11
|
-
export declare class ContractStorageUpdateRequest {
|
|
12
|
-
/**
|
|
13
|
-
* Storage slot we are updating.
|
|
14
|
-
*/
|
|
15
|
-
readonly storageSlot: Fr;
|
|
16
|
-
/**
|
|
17
|
-
* New value of the storage slot.
|
|
18
|
-
*/
|
|
19
|
-
readonly newValue: Fr;
|
|
20
|
-
/**
|
|
21
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
22
|
-
*/
|
|
23
|
-
readonly counter: number;
|
|
24
|
-
/**
|
|
25
|
-
* Contract address whose storage is being read.
|
|
26
|
-
*/
|
|
27
|
-
contractAddress?: AztecAddress | undefined;
|
|
28
|
-
constructor(
|
|
29
|
-
/**
|
|
30
|
-
* Storage slot we are updating.
|
|
31
|
-
*/
|
|
32
|
-
storageSlot: Fr,
|
|
33
|
-
/**
|
|
34
|
-
* New value of the storage slot.
|
|
35
|
-
*/
|
|
36
|
-
newValue: Fr,
|
|
37
|
-
/**
|
|
38
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
39
|
-
*/
|
|
40
|
-
counter: number,
|
|
41
|
-
/**
|
|
42
|
-
* Contract address whose storage is being read.
|
|
43
|
-
*/
|
|
44
|
-
contractAddress?: AztecAddress | undefined);
|
|
45
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
46
|
-
static fromBuffer(buffer: Buffer | BufferReader): ContractStorageUpdateRequest;
|
|
47
|
-
/**
|
|
48
|
-
* Create ContractStorageUpdateRequest from a fields dictionary.
|
|
49
|
-
* @param fields - The dictionary.
|
|
50
|
-
* @returns A ContractStorageUpdateRequest object.
|
|
51
|
-
*/
|
|
52
|
-
static from(fields: FieldsOf<ContractStorageUpdateRequest>): ContractStorageUpdateRequest;
|
|
53
|
-
/**
|
|
54
|
-
* Serialize into a field array. Low-level utility.
|
|
55
|
-
* @param fields - Object with fields.
|
|
56
|
-
* @returns The array.
|
|
57
|
-
*/
|
|
58
|
-
static getFields(fields: FieldsOf<ContractStorageUpdateRequest>): readonly [Fr, Fr, number, AztecAddress | undefined];
|
|
59
|
-
static empty(): ContractStorageUpdateRequest;
|
|
60
|
-
isEmpty(): boolean;
|
|
61
|
-
toFriendlyJSON(): string;
|
|
62
|
-
toFields(): Fr[];
|
|
63
|
-
static fromFields(fields: Fr[] | FieldReader): ContractStorageUpdateRequest;
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3Rfc3RvcmFnZV91cGRhdGVfcmVxdWVzdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2F2bS9jb250cmFjdF9zdG9yYWdlX3VwZGF0ZV9yZXF1ZXN0LnRzI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JQUVELE9BQU8sWUFFTjtJQUVELGNBQWMsV0FJYjtJQUVELFFBQVEsSUFBSSxFQUFFLEVBQUUsQ0FRZjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLEVBQUUsRUFBRSxHQUFHLFdBQVcsR0FBRyw0QkFBNEIsQ0FPMUU7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract_storage_update_request.d.ts","sourceRoot":"","sources":["../../src/avm/contract_storage_update_request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;GAKG;AACH,qBAAa,4BAA4B;IAErC;;OAEG;aACa,WAAW,EAAE,EAAE;IAC/B;;OAEG;aACa,QAAQ,EAAE,EAAE;IAC5B;;OAEG;aACa,OAAO,EAAE,MAAM;IAC/B;;OAEG;IACI,eAAe,CAAC;IAhBzB;IACE;;OAEG;IACa,WAAW,EAAE,EAAE;IAC/B;;OAEG;IACa,QAAQ,EAAE,EAAE;IAC5B;;OAEG;IACa,OAAO,EAAE,MAAM;IAC/B;;OAEG;IACI,eAAe,CAAC,0BAAc,EACnC;IAEJ,QAAQ,4BAEP;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,gCAG9C;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,4BAA4B,CAAC,GAAG,4BAA4B,CAExF;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,4BAA4B,CAAC,uDAE9D;IAED,MAAM,CAAC,KAAK,iCAEX;IAED,OAAO,YAEN;IAED,cAAc,WAIb;IAED,QAAQ,IAAI,EAAE,EAAE,CAQf;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,4BAA4B,CAO1E;CACF"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
/**
|
|
5
|
-
* Contract storage update request for a slot on a specific contract.
|
|
6
|
-
*
|
|
7
|
-
* Note: Similar to `PublicDataUpdateRequest` but it's from the POV of contract storage so we are not working with
|
|
8
|
-
* public data tree leaf index but storage slot index.
|
|
9
|
-
*/ export class ContractStorageUpdateRequest {
|
|
10
|
-
storageSlot;
|
|
11
|
-
newValue;
|
|
12
|
-
counter;
|
|
13
|
-
contractAddress;
|
|
14
|
-
constructor(/**
|
|
15
|
-
* Storage slot we are updating.
|
|
16
|
-
*/ storageSlot, /**
|
|
17
|
-
* New value of the storage slot.
|
|
18
|
-
*/ newValue, /**
|
|
19
|
-
* Side effect counter tracking position of this event in tx execution.
|
|
20
|
-
*/ counter, /**
|
|
21
|
-
* Contract address whose storage is being read.
|
|
22
|
-
*/ contractAddress){
|
|
23
|
-
this.storageSlot = storageSlot;
|
|
24
|
-
this.newValue = newValue;
|
|
25
|
-
this.counter = counter;
|
|
26
|
-
this.contractAddress = contractAddress;
|
|
27
|
-
}
|
|
28
|
-
toBuffer() {
|
|
29
|
-
return serializeToBuffer(this.storageSlot, this.newValue, this.counter);
|
|
30
|
-
}
|
|
31
|
-
static fromBuffer(buffer) {
|
|
32
|
-
const reader = BufferReader.asReader(buffer);
|
|
33
|
-
return new ContractStorageUpdateRequest(Fr.fromBuffer(reader), Fr.fromBuffer(reader), reader.readNumber());
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Create ContractStorageUpdateRequest from a fields dictionary.
|
|
37
|
-
* @param fields - The dictionary.
|
|
38
|
-
* @returns A ContractStorageUpdateRequest object.
|
|
39
|
-
*/ static from(fields) {
|
|
40
|
-
return new ContractStorageUpdateRequest(...ContractStorageUpdateRequest.getFields(fields));
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Serialize into a field array. Low-level utility.
|
|
44
|
-
* @param fields - Object with fields.
|
|
45
|
-
* @returns The array.
|
|
46
|
-
*/ static getFields(fields) {
|
|
47
|
-
return [
|
|
48
|
-
fields.storageSlot,
|
|
49
|
-
fields.newValue,
|
|
50
|
-
fields.counter,
|
|
51
|
-
fields.contractAddress
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
static empty() {
|
|
55
|
-
return new ContractStorageUpdateRequest(Fr.ZERO, Fr.ZERO, 0);
|
|
56
|
-
}
|
|
57
|
-
isEmpty() {
|
|
58
|
-
return this.storageSlot.isZero() && this.newValue.isZero();
|
|
59
|
-
}
|
|
60
|
-
toFriendlyJSON() {
|
|
61
|
-
return `Slot=${this.storageSlot.toFriendlyJSON()}: ${this.newValue.toFriendlyJSON()}, sideEffectCounter=${this.counter}`;
|
|
62
|
-
}
|
|
63
|
-
toFields() {
|
|
64
|
-
const fields = [
|
|
65
|
-
this.storageSlot,
|
|
66
|
-
this.newValue,
|
|
67
|
-
new Fr(this.counter)
|
|
68
|
-
];
|
|
69
|
-
if (fields.length !== CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH) {
|
|
70
|
-
throw new Error(`Invalid number of fields for ContractStorageUpdateRequest. Expected ${CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH}, got ${fields.length}`);
|
|
71
|
-
}
|
|
72
|
-
return fields;
|
|
73
|
-
}
|
|
74
|
-
static fromFields(fields) {
|
|
75
|
-
const reader = FieldReader.asReader(fields);
|
|
76
|
-
const storageSlot = reader.readField();
|
|
77
|
-
const newValue = reader.readField();
|
|
78
|
-
return new ContractStorageUpdateRequest(storageSlot, newValue, reader.readU32());
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
4
|
-
import { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
-
import { Gas } from '../gas/gas.js';
|
|
6
|
-
import { CallContext } from '../tx/call_context.js';
|
|
7
|
-
import { RevertCode } from './revert_code.js';
|
|
8
|
-
/**
|
|
9
|
-
* Compressed call stack item on a public call.
|
|
10
|
-
*/
|
|
11
|
-
export declare class PublicCallStackItemCompressed {
|
|
12
|
-
contractAddress: AztecAddress;
|
|
13
|
-
callContext: CallContext;
|
|
14
|
-
argsHash: Fr;
|
|
15
|
-
returnsHash: Fr;
|
|
16
|
-
revertCode: RevertCode;
|
|
17
|
-
/** How much gas was available for execution. */
|
|
18
|
-
startGasLeft: Gas;
|
|
19
|
-
/** How much gas was left after execution. */
|
|
20
|
-
endGasLeft: Gas;
|
|
21
|
-
constructor(contractAddress: AztecAddress, callContext: CallContext, argsHash: Fr, returnsHash: Fr, revertCode: RevertCode,
|
|
22
|
-
/** How much gas was available for execution. */
|
|
23
|
-
startGasLeft: Gas,
|
|
24
|
-
/** How much gas was left after execution. */
|
|
25
|
-
endGasLeft: Gas);
|
|
26
|
-
static getFields(fields: FieldsOf<PublicCallStackItemCompressed>): readonly [AztecAddress, CallContext, Fr, Fr, RevertCode, Gas, Gas];
|
|
27
|
-
toFields(): Fr[];
|
|
28
|
-
toBuffer(): Buffer<ArrayBufferLike>;
|
|
29
|
-
/**
|
|
30
|
-
* Deserializes from a buffer or reader.
|
|
31
|
-
* @param buffer - Buffer or reader to read from.
|
|
32
|
-
* @returns The deserialized instance.
|
|
33
|
-
*/
|
|
34
|
-
static fromBuffer(buffer: Buffer | BufferReader): PublicCallStackItemCompressed;
|
|
35
|
-
static fromFields(fields: Fr[] | FieldReader): PublicCallStackItemCompressed;
|
|
36
|
-
/**
|
|
37
|
-
* Returns a new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
38
|
-
* @returns A new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
39
|
-
*/
|
|
40
|
-
static empty(): PublicCallStackItemCompressed;
|
|
41
|
-
isEmpty(): boolean;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljX2NhbGxfc3RhY2tfaXRlbV9jb21wcmVzc2VkLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXZtL3B1YmxpY19jYWxsX3N0YWNrX2l0ZW1fY29tcHJlc3NlZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQXdDLE1BQU0sNkJBQTZCLENBQUM7QUFDOUcsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFeEQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ3pELE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDcEMsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQztBQUc5Qzs7R0FFRztBQUNILHFCQUFhLDZCQUE2QjtJQUUvQixlQUFlLEVBQUUsWUFBWTtJQUM3QixXQUFXLEVBQUUsV0FBVztJQUN4QixRQUFRLEVBQUUsRUFBRTtJQUNaLFdBQVcsRUFBRS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Reader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
4
|
-
import { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
-
import { Gas } from '../gas/gas.js';
|
|
6
|
-
import { CallContext } from '../tx/call_context.js';
|
|
7
|
-
import { RevertCode } from './revert_code.js';
|
|
8
|
-
// TO BE REMOVED
|
|
9
|
-
/**
|
|
10
|
-
* Compressed call stack item on a public call.
|
|
11
|
-
*/ export class PublicCallStackItemCompressed {
|
|
12
|
-
contractAddress;
|
|
13
|
-
callContext;
|
|
14
|
-
argsHash;
|
|
15
|
-
returnsHash;
|
|
16
|
-
revertCode;
|
|
17
|
-
startGasLeft;
|
|
18
|
-
endGasLeft;
|
|
19
|
-
constructor(contractAddress, callContext, argsHash, returnsHash, revertCode, /** How much gas was available for execution. */ startGasLeft, /** How much gas was left after execution. */ endGasLeft){
|
|
20
|
-
this.contractAddress = contractAddress;
|
|
21
|
-
this.callContext = callContext;
|
|
22
|
-
this.argsHash = argsHash;
|
|
23
|
-
this.returnsHash = returnsHash;
|
|
24
|
-
this.revertCode = revertCode;
|
|
25
|
-
this.startGasLeft = startGasLeft;
|
|
26
|
-
this.endGasLeft = endGasLeft;
|
|
27
|
-
}
|
|
28
|
-
static getFields(fields) {
|
|
29
|
-
return [
|
|
30
|
-
fields.contractAddress,
|
|
31
|
-
fields.callContext,
|
|
32
|
-
fields.argsHash,
|
|
33
|
-
fields.returnsHash,
|
|
34
|
-
fields.revertCode,
|
|
35
|
-
fields.startGasLeft,
|
|
36
|
-
fields.endGasLeft
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
toFields() {
|
|
40
|
-
const fields = serializeToFields(...PublicCallStackItemCompressed.getFields(this));
|
|
41
|
-
if (fields.length !== PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH) {
|
|
42
|
-
throw new Error(`Invalid number of fields for PublicCallStackItemCompressed. Expected ${PUBLIC_CALL_STACK_ITEM_COMPRESSED_LENGTH}, got ${fields.length}`);
|
|
43
|
-
}
|
|
44
|
-
return fields;
|
|
45
|
-
}
|
|
46
|
-
toBuffer() {
|
|
47
|
-
return serializeToBuffer(...PublicCallStackItemCompressed.getFields(this));
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Deserializes from a buffer or reader.
|
|
51
|
-
* @param buffer - Buffer or reader to read from.
|
|
52
|
-
* @returns The deserialized instance.
|
|
53
|
-
*/ static fromBuffer(buffer) {
|
|
54
|
-
const reader = BufferReader.asReader(buffer);
|
|
55
|
-
return new PublicCallStackItemCompressed(reader.readObject(AztecAddress), reader.readObject(CallContext), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(RevertCode), reader.readObject(Gas), reader.readObject(Gas));
|
|
56
|
-
}
|
|
57
|
-
static fromFields(fields) {
|
|
58
|
-
const reader = FieldReader.asReader(fields);
|
|
59
|
-
return new PublicCallStackItemCompressed(AztecAddress.fromFields(reader), CallContext.fromFields(reader), reader.readField(), reader.readField(), RevertCode.fromFields(reader), Gas.fromFields(reader), Gas.fromFields(reader));
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Returns a new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
63
|
-
* @returns A new instance of PublicCallStackItem with zero contract address, function data and public inputs.
|
|
64
|
-
*/ static empty() {
|
|
65
|
-
return new PublicCallStackItemCompressed(AztecAddress.ZERO, CallContext.empty(), Fr.ZERO, Fr.ZERO, RevertCode.OK, Gas.empty(), Gas.empty());
|
|
66
|
-
}
|
|
67
|
-
isEmpty() {
|
|
68
|
-
return this.contractAddress.isZero() && this.callContext.isEmpty() && this.argsHash.isEmpty() && this.returnsHash.isEmpty() && this.revertCode.equals(RevertCode.OK) && this.startGasLeft.isEmpty() && this.endGasLeft.isEmpty();
|
|
69
|
-
}
|
|
70
|
-
}
|