@aztec/stdlib 3.0.0-nightly.20251112 → 3.0.0-nightly.20251113
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 +8 -8
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +2 -2
- package/dest/abi/contract_artifact.js +3 -3
- package/dest/avm/avm.d.ts +539 -769
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +196 -2
- package/dest/avm/avm_accumulated_data.d.ts +22 -6
- package/dest/avm/avm_accumulated_data.d.ts.map +1 -1
- package/dest/avm/avm_accumulated_data.js +18 -0
- package/dest/avm/avm_circuit_public_inputs.d.ts +35 -27
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +9 -0
- package/dest/avm/avm_proving_request.d.ts +134 -290
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/avm/public_data_write.d.ts +10 -2
- package/dest/avm/public_data_write.d.ts.map +1 -1
- package/dest/avm/public_data_write.js +9 -0
- package/dest/avm/revert_code.d.ts +8 -0
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +16 -0
- package/dest/aztec-address/index.d.ts +9 -0
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +16 -0
- package/dest/block/l2_block.d.ts +1 -1
- package/dest/block/l2_block_info.d.ts +3 -3
- package/dest/block/proposal/attestations_and_signers.d.ts +1 -1
- package/dest/block/proposal/committee_attestation.d.ts +1 -1
- package/dest/block/published_l2_block.d.ts +2 -2
- package/dest/block/validate_block_result.d.ts +12 -12
- package/dest/contract/contract_deployment_data.d.ts +10 -2
- package/dest/contract/contract_deployment_data.d.ts.map +1 -1
- package/dest/contract/contract_deployment_data.js +12 -0
- package/dest/contract/interfaces/contract_class.d.ts +19 -19
- package/dest/contract/interfaces/contract_instance.d.ts +32 -200
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/database-version/version_manager.d.ts +1 -1
- package/dest/gas/gas.d.ts +8 -0
- package/dest/gas/gas.d.ts.map +1 -1
- package/dest/gas/gas.js +12 -0
- package/dest/gas/gas_fees.d.ts +8 -0
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +12 -0
- package/dest/gas/gas_settings.d.ts +8 -0
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +12 -0
- package/dest/gas/gas_used.d.ts +12 -1
- package/dest/gas/gas_used.d.ts.map +1 -1
- package/dest/gas/gas_used.js +19 -1
- package/dest/interfaces/aztec-node-admin.d.ts +8 -5
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +5 -0
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/proving-job.d.ts +162 -318
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/slasher.d.ts +3 -3
- package/dest/interfaces/validator.d.ts +12 -4
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +2 -1
- package/dest/kernel/private_to_avm_accumulated_data.d.ts +20 -4
- package/dest/kernel/private_to_avm_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_to_avm_accumulated_data.js +18 -0
- package/dest/kernel/public_call_request.d.ts +17 -1
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +18 -0
- package/dest/keys/public_keys.d.ts +20 -84
- package/dest/keys/public_keys.d.ts.map +1 -1
- package/dest/keys/public_keys.js +12 -0
- package/dest/logs/contract_class_log.d.ts +18 -2
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +24 -0
- package/dest/logs/debug_log.d.ts +9 -1
- package/dest/logs/debug_log.d.ts.map +1 -1
- package/dest/logs/debug_log.js +13 -0
- package/dest/logs/directional_app_tagging_secret.d.ts +1 -1
- package/dest/logs/pre_tag.d.ts +1 -1
- package/dest/logs/private_log.d.ts +9 -1
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/private_log.js +12 -0
- package/dest/logs/public_log.d.ts +8 -0
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +9 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +1 -1
- package/dest/messaging/l2_to_l1_message.d.ts +24 -8
- package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_message.js +18 -0
- package/dest/noir/index.d.ts +1 -1
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/noir/index.js +1 -2
- package/dest/p2p/consensus_payload.d.ts +5 -5
- package/dest/snapshots/types.d.ts +2 -2
- package/dest/trees/append_only_tree_snapshot.d.ts +9 -1
- package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
- package/dest/trees/append_only_tree_snapshot.js +9 -0
- package/dest/trees/nullifier_leaf.d.ts +20 -4
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_leaf.js +24 -0
- package/dest/trees/nullifier_membership_witness.d.ts +2 -2
- package/dest/trees/public_data_leaf.d.ts +23 -7
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +24 -0
- package/dest/trees/public_data_witness.d.ts +3 -3
- package/dest/tx/content_commitment.d.ts +3 -3
- package/dest/tx/execution_payload.d.ts +45 -0
- package/dest/tx/execution_payload.d.ts.map +1 -0
- package/dest/tx/execution_payload.js +40 -0
- package/dest/tx/global_variables.d.ts +8 -0
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +9 -0
- package/dest/tx/index.d.ts +1 -0
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/partial_state_reference.d.ts +3 -3
- package/dest/tx/profiling.d.ts +3 -3
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +5 -4
- package/dest/tx/protocol_contracts.d.ts +8 -0
- package/dest/tx/protocol_contracts.d.ts.map +1 -1
- package/dest/tx/protocol_contracts.js +9 -0
- package/dest/tx/public_call_request_with_calldata.d.ts +8 -0
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -1
- package/dest/tx/public_call_request_with_calldata.js +12 -0
- package/dest/tx/simulated_tx.d.ts +28 -148
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/state_reference.d.ts +4 -4
- package/dest/tx/tree_snapshots.d.ts +12 -4
- package/dest/tx/tree_snapshots.d.ts.map +1 -1
- package/dest/tx/tree_snapshots.js +9 -0
- package/dest/tx/tx_context.d.ts +2 -2
- package/dest/validators/schemas.d.ts +3 -3
- package/package.json +8 -8
- package/src/abi/abi.ts +4 -4
- package/src/abi/contract_artifact.ts +3 -3
- package/src/avm/avm.ts +350 -3
- package/src/avm/avm_accumulated_data.ts +40 -0
- package/src/avm/avm_circuit_public_inputs.ts +40 -0
- package/src/avm/public_data_write.ts +11 -0
- package/src/avm/revert_code.ts +18 -0
- package/src/aztec-address/index.ts +18 -0
- package/src/contract/contract_deployment_data.ts +17 -0
- package/src/gas/gas.ts +14 -0
- package/src/gas/gas_fees.ts +14 -0
- package/src/gas/gas_settings.ts +19 -0
- package/src/gas/gas_used.ts +22 -1
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/validator.ts +4 -0
- package/src/kernel/private_to_avm_accumulated_data.ts +35 -0
- package/src/kernel/public_call_request.ts +27 -0
- package/src/keys/public_keys.ts +19 -0
- package/src/logs/contract_class_log.ts +32 -0
- package/src/logs/debug_log.ts +20 -1
- package/src/logs/private_log.ts +17 -0
- package/src/logs/public_log.ts +14 -0
- package/src/messaging/l2_to_l1_message.ts +25 -0
- package/src/noir/index.ts +1 -2
- package/src/trees/append_only_tree_snapshot.ts +11 -0
- package/src/trees/nullifier_leaf.ts +32 -0
- package/src/trees/public_data_leaf.ts +32 -0
- package/src/tx/execution_payload.ts +60 -0
- package/src/tx/global_variables.ts +20 -0
- package/src/tx/index.ts +1 -0
- package/src/tx/profiling.ts +4 -6
- package/src/tx/protocol_contracts.ts +16 -0
- package/src/tx/public_call_request_with_calldata.ts +17 -0
- package/src/tx/tree_snapshots.ts +16 -0
package/src/gas/gas_fees.ts
CHANGED
|
@@ -65,6 +65,20 @@ export class GasFees {
|
|
|
65
65
|
return new GasFees(fields.feePerDaGas, fields.feePerL2Gas);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Creates a GasFees instance from a plain object without Zod validation.
|
|
70
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
71
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
72
|
+
* @param obj - Plain object containing GasFees fields
|
|
73
|
+
* @returns A GasFees instance
|
|
74
|
+
*/
|
|
75
|
+
static fromPlainObject(obj: any): GasFees {
|
|
76
|
+
if (obj instanceof GasFees) {
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
return GasFees.from(obj);
|
|
80
|
+
}
|
|
81
|
+
|
|
68
82
|
static random() {
|
|
69
83
|
return new GasFees(Math.floor(Math.random() * 1e9), Math.floor(Math.random() * 1e9));
|
|
70
84
|
}
|
package/src/gas/gas_settings.ts
CHANGED
|
@@ -54,6 +54,25 @@ export class GasSettings {
|
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Creates a GasSettings instance from a plain object without Zod validation.
|
|
59
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
60
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
61
|
+
* @param obj - Plain object containing GasSettings fields
|
|
62
|
+
* @returns A GasSettings instance
|
|
63
|
+
*/
|
|
64
|
+
static fromPlainObject(obj: any): GasSettings {
|
|
65
|
+
if (obj instanceof GasSettings) {
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
return new GasSettings(
|
|
69
|
+
Gas.fromPlainObject(obj.gasLimits),
|
|
70
|
+
Gas.fromPlainObject(obj.teardownGasLimits),
|
|
71
|
+
GasFees.fromPlainObject(obj.maxFeesPerGas),
|
|
72
|
+
GasFees.fromPlainObject(obj.maxPriorityFeesPerGas),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
57
76
|
clone() {
|
|
58
77
|
return new GasSettings(
|
|
59
78
|
this.gasLimits.clone(),
|
package/src/gas/gas_used.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Gas } from './gas.js';
|
|
2
2
|
|
|
3
3
|
export interface GasUsed {
|
|
4
4
|
/**
|
|
@@ -21,3 +21,24 @@ export interface GasUsed {
|
|
|
21
21
|
*/
|
|
22
22
|
billedGas: Gas;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates a GasUsed from a plain object without Zod validation.
|
|
27
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
28
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
29
|
+
* @param obj - Plain object containing GasUsed fields
|
|
30
|
+
* @returns A GasUsed object
|
|
31
|
+
*/
|
|
32
|
+
export function gasUsedFromPlainObject(obj: any): GasUsed {
|
|
33
|
+
return {
|
|
34
|
+
totalGas: Gas.fromPlainObject(obj.totalGas),
|
|
35
|
+
publicGas: Gas.fromPlainObject(obj.publicGas),
|
|
36
|
+
teardownGas: Gas.fromPlainObject(obj.teardownGas),
|
|
37
|
+
billedGas: Gas.fromPlainObject(obj.billedGas),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Export as a namespace to match the pattern
|
|
42
|
+
export const GasUsed = {
|
|
43
|
+
fromPlainObject: gasUsedFromPlainObject,
|
|
44
|
+
};
|
|
@@ -56,6 +56,8 @@ export interface SequencerConfig {
|
|
|
56
56
|
broadcastInvalidBlockProposal?: boolean;
|
|
57
57
|
/** Inject a fake attestation (for testing only) */
|
|
58
58
|
injectFakeAttestation?: boolean;
|
|
59
|
+
/** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing */
|
|
60
|
+
fishermanMode?: boolean;
|
|
59
61
|
/** Shuffle attestation ordering to create invalid ordering (for testing only) */
|
|
60
62
|
shuffleAttestationOrdering?: boolean;
|
|
61
63
|
}
|
|
@@ -83,5 +85,6 @@ export const SequencerConfigSchema = z.object({
|
|
|
83
85
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
|
|
84
86
|
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
85
87
|
injectFakeAttestation: z.boolean().optional(),
|
|
88
|
+
fishermanMode: z.boolean().optional(),
|
|
86
89
|
shuffleAttestationOrdering: z.boolean().optional(),
|
|
87
90
|
}) satisfies ZodFor<SequencerConfig>;
|
|
@@ -41,6 +41,9 @@ export interface ValidatorClientConfig {
|
|
|
41
41
|
|
|
42
42
|
/** Whether to always reexecute block proposals, even for non-validator nodes or when out of the currnet committee */
|
|
43
43
|
alwaysReexecuteBlockProposals?: boolean;
|
|
44
|
+
|
|
45
|
+
/** Whether to run in fisherman mode: validates all proposals and attestations but does not broadcast attestations or participate in consensus */
|
|
46
|
+
fishermanMode?: boolean;
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
export type ValidatorClientFullConfig = ValidatorClientConfig &
|
|
@@ -61,6 +64,7 @@ export const ValidatorClientConfigSchema = z.object({
|
|
|
61
64
|
validatorReexecute: z.boolean(),
|
|
62
65
|
validatorReexecuteDeadlineMs: z.number().min(0),
|
|
63
66
|
alwaysReexecuteBlockProposals: z.boolean().optional(),
|
|
67
|
+
fishermanMode: z.boolean().optional(),
|
|
64
68
|
}) satisfies ZodFor<Omit<ValidatorClientConfig, 'validatorPrivateKeys'>>;
|
|
65
69
|
|
|
66
70
|
export const ValidatorClientFullConfigSchema = ValidatorClientConfigSchema.extend({
|
|
@@ -112,6 +112,30 @@ export class PrivateToAvmAccumulatedData {
|
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Creates a PrivateToAvmAccumulatedData instance from a plain object without Zod validation.
|
|
117
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
118
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
119
|
+
* @param obj - Plain object containing PrivateToAvmAccumulatedData fields
|
|
120
|
+
* @returns A PrivateToAvmAccumulatedData instance
|
|
121
|
+
*/
|
|
122
|
+
static fromPlainObject(obj: any): PrivateToAvmAccumulatedData {
|
|
123
|
+
return new PrivateToAvmAccumulatedData(
|
|
124
|
+
assertLength(
|
|
125
|
+
obj.noteHashes.map((h: any) => Fr.fromPlainObject(h)),
|
|
126
|
+
MAX_NOTE_HASHES_PER_TX,
|
|
127
|
+
),
|
|
128
|
+
assertLength(
|
|
129
|
+
obj.nullifiers.map((n: any) => Fr.fromPlainObject(n)),
|
|
130
|
+
MAX_NULLIFIERS_PER_TX,
|
|
131
|
+
),
|
|
132
|
+
assertLength(
|
|
133
|
+
obj.l2ToL1Msgs.map((m: any) => ScopedL2ToL1Message.fromPlainObject(m)),
|
|
134
|
+
MAX_L2_TO_L1_MSGS_PER_TX,
|
|
135
|
+
),
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
115
139
|
[inspect.custom]() {
|
|
116
140
|
return `PrivateToAvmAccumulatedData {
|
|
117
141
|
noteHashes: [${this.noteHashes
|
|
@@ -184,6 +208,17 @@ export class PrivateToAvmAccumulatedDataArrayLengths {
|
|
|
184
208
|
return new PrivateToAvmAccumulatedDataArrayLengths(0, 0, 0);
|
|
185
209
|
}
|
|
186
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Creates a PrivateToAvmAccumulatedDataArrayLengths instance from a plain object without Zod validation.
|
|
213
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
214
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
215
|
+
* @param obj - Plain object containing PrivateToAvmAccumulatedDataArrayLengths fields
|
|
216
|
+
* @returns A PrivateToAvmAccumulatedDataArrayLengths instance
|
|
217
|
+
*/
|
|
218
|
+
static fromPlainObject(obj: any): PrivateToAvmAccumulatedDataArrayLengths {
|
|
219
|
+
return new PrivateToAvmAccumulatedDataArrayLengths(obj.noteHashes, obj.nullifiers, obj.l2ToL1Msgs);
|
|
220
|
+
}
|
|
221
|
+
|
|
187
222
|
[inspect.custom]() {
|
|
188
223
|
return `PrivateToAvmAccumulatedDataArrayLengths {
|
|
189
224
|
noteHashes: ${this.noteHashes},
|
|
@@ -97,6 +97,22 @@ export class PublicCallRequest {
|
|
|
97
97
|
return new PublicCallRequest(AztecAddress.ZERO, AztecAddress.ZERO, false, Fr.ZERO);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Creates a PublicCallRequest instance from a plain object without Zod validation.
|
|
102
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
103
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
104
|
+
* @param obj - Plain object containing PublicCallRequest fields
|
|
105
|
+
* @returns A PublicCallRequest instance
|
|
106
|
+
*/
|
|
107
|
+
static fromPlainObject(obj: any): PublicCallRequest {
|
|
108
|
+
return new PublicCallRequest(
|
|
109
|
+
AztecAddress.fromPlainObject(obj.msgSender),
|
|
110
|
+
AztecAddress.fromPlainObject(obj.contractAddress),
|
|
111
|
+
obj.isStaticCall,
|
|
112
|
+
Fr.fromPlainObject(obj.calldataHash),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
100
116
|
isEmpty(): boolean {
|
|
101
117
|
return (
|
|
102
118
|
this.msgSender.isZero() && this.contractAddress.isZero() && !this.isStaticCall && this.calldataHash.isEmpty()
|
|
@@ -180,6 +196,17 @@ export class PublicCallRequestArrayLengths {
|
|
|
180
196
|
return new PublicCallRequestArrayLengths(0, 0, false);
|
|
181
197
|
}
|
|
182
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Creates a PublicCallRequestArrayLengths instance from a plain object without Zod validation.
|
|
201
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
202
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
203
|
+
* @param obj - Plain object containing PublicCallRequestArrayLengths fields
|
|
204
|
+
* @returns A PublicCallRequestArrayLengths instance
|
|
205
|
+
*/
|
|
206
|
+
static fromPlainObject(obj: any): PublicCallRequestArrayLengths {
|
|
207
|
+
return new PublicCallRequestArrayLengths(obj.setupCalls, obj.appLogicCalls, obj.teardownCall);
|
|
208
|
+
}
|
|
209
|
+
|
|
183
210
|
[inspect.custom]() {
|
|
184
211
|
return `PublicCallRequestArrayLengths {
|
|
185
212
|
setupCalls: ${this.setupCalls}
|
package/src/keys/public_keys.ts
CHANGED
|
@@ -52,6 +52,25 @@ export class PublicKeys {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Creates a PublicKeys from a plain object without Zod validation.
|
|
57
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
58
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
59
|
+
* @param obj - Plain object containing PublicKeys fields
|
|
60
|
+
* @returns A PublicKeys instance
|
|
61
|
+
*/
|
|
62
|
+
static fromPlainObject(obj: any): PublicKeys {
|
|
63
|
+
if (obj instanceof PublicKeys) {
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
return new PublicKeys(
|
|
67
|
+
Point.fromPlainObject(obj.masterNullifierPublicKey),
|
|
68
|
+
Point.fromPlainObject(obj.masterIncomingViewingPublicKey),
|
|
69
|
+
Point.fromPlainObject(obj.masterOutgoingViewingPublicKey),
|
|
70
|
+
Point.fromPlainObject(obj.masterTaggingPublicKey),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
55
74
|
hash() {
|
|
56
75
|
return this.isEmpty()
|
|
57
76
|
? Fr.ZERO
|
|
@@ -29,6 +29,20 @@ export class ContractClassLogFields {
|
|
|
29
29
|
.transform(({ fields }) => new ContractClassLogFields(fields));
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Creates a ContractClassLogFields from a plain object without Zod validation.
|
|
34
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
35
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
36
|
+
* @param obj - Plain object containing ContractClassLogFields fields
|
|
37
|
+
* @returns A ContractClassLogFields instance
|
|
38
|
+
*/
|
|
39
|
+
static fromPlainObject(obj: any): ContractClassLogFields {
|
|
40
|
+
if (obj instanceof ContractClassLogFields) {
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
return new ContractClassLogFields(obj.fields.map((f: any) => Fr.fromPlainObject(f)));
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
toFields(): Fr[] {
|
|
33
47
|
return this.fields;
|
|
34
48
|
}
|
|
@@ -191,6 +205,24 @@ export class ContractClassLog {
|
|
|
191
205
|
.transform(ContractClassLog.from);
|
|
192
206
|
}
|
|
193
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Creates a ContractClassLog from a plain object without Zod validation.
|
|
210
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
211
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
212
|
+
* @param obj - Plain object containing ContractClassLog fields
|
|
213
|
+
* @returns A ContractClassLog instance
|
|
214
|
+
*/
|
|
215
|
+
static fromPlainObject(obj: any): ContractClassLog {
|
|
216
|
+
if (obj instanceof ContractClassLog) {
|
|
217
|
+
return obj;
|
|
218
|
+
}
|
|
219
|
+
return new ContractClassLog(
|
|
220
|
+
AztecAddress.fromPlainObject(obj.contractAddress),
|
|
221
|
+
ContractClassLogFields.fromPlainObject(obj.fields),
|
|
222
|
+
obj.emittedLength,
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
194
226
|
[inspect.custom](): string {
|
|
195
227
|
return `ContractClassLog {
|
|
196
228
|
contractAddress: ${this.contractAddress.toString()},
|
package/src/logs/debug_log.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { type LogLevel, LogLevels } from '@aztec/foundation/log';
|
|
3
3
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
4
4
|
|
|
@@ -29,4 +29,23 @@ export class DebugLog {
|
|
|
29
29
|
({ contractAddress, level, message, fields }) => new DebugLog(contractAddress, level, message, fields),
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates a DebugLog from a plain object without Zod validation.
|
|
35
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
36
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
37
|
+
* @param obj - Plain object containing DebugLog fields
|
|
38
|
+
* @returns A DebugLog instance
|
|
39
|
+
*/
|
|
40
|
+
static fromPlainObject(obj: any): DebugLog {
|
|
41
|
+
if (obj instanceof DebugLog) {
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
return new DebugLog(
|
|
45
|
+
AztecAddress.fromPlainObject(obj.contractAddress),
|
|
46
|
+
obj.level,
|
|
47
|
+
obj.message,
|
|
48
|
+
obj.fields.map((f: any) => Fr.fromPlainObject(f)),
|
|
49
|
+
);
|
|
50
|
+
}
|
|
32
51
|
}
|
package/src/logs/private_log.ts
CHANGED
|
@@ -92,6 +92,23 @@ export class PrivateLog {
|
|
|
92
92
|
.transform(({ fields, emittedLength }) => PrivateLog.fromFields(fields.concat(new Fr(emittedLength))));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Creates a PrivateLog from a plain object without Zod validation.
|
|
97
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
98
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
99
|
+
* @param obj - Plain object containing PrivateLog fields
|
|
100
|
+
* @returns A PrivateLog instance
|
|
101
|
+
*/
|
|
102
|
+
static fromPlainObject(obj: any): PrivateLog {
|
|
103
|
+
if (obj instanceof PrivateLog) {
|
|
104
|
+
return obj;
|
|
105
|
+
}
|
|
106
|
+
return new PrivateLog(
|
|
107
|
+
obj.fields.map((f: any) => Fr.fromPlainObject(f)),
|
|
108
|
+
obj.emittedLength,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
95
112
|
equals(other: PrivateLog) {
|
|
96
113
|
return this.fields.every((field, i) => field.equals(other.fields[i])) && this.emittedLength === other.emittedLength;
|
|
97
114
|
}
|
package/src/logs/public_log.ts
CHANGED
|
@@ -99,6 +99,20 @@ export class FlatPublicLogs {
|
|
|
99
99
|
return new FlatPublicLogs(0, Array(FLAT_PUBLIC_LOGS_PAYLOAD_LENGTH).fill(Fr.ZERO));
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Creates a FlatPublicLogs instance from a plain object without Zod validation.
|
|
104
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
105
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
106
|
+
* @param obj - Plain object containing FlatPublicLogs fields
|
|
107
|
+
* @returns A FlatPublicLogs instance
|
|
108
|
+
*/
|
|
109
|
+
static fromPlainObject(obj: any): FlatPublicLogs {
|
|
110
|
+
return new FlatPublicLogs(
|
|
111
|
+
obj.length,
|
|
112
|
+
obj.payload.map((p: any) => Fr.fromPlainObject(p)),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
102
116
|
isEmpty() {
|
|
103
117
|
return this.length === 0;
|
|
104
118
|
}
|
|
@@ -30,6 +30,17 @@ export class L2ToL1Message {
|
|
|
30
30
|
return new L2ToL1Message(EthAddress.ZERO, Fr.zero());
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Creates an L2ToL1Message instance from a plain object without Zod validation.
|
|
35
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
36
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
37
|
+
* @param obj - Plain object containing L2ToL1Message fields
|
|
38
|
+
* @returns An L2ToL1Message instance
|
|
39
|
+
*/
|
|
40
|
+
static fromPlainObject(obj: any): L2ToL1Message {
|
|
41
|
+
return new L2ToL1Message(EthAddress.fromPlainObject(obj.recipient), Fr.fromPlainObject(obj.content));
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
/**
|
|
34
45
|
* Checks if another L2ToL1Message is equal to this instance.
|
|
35
46
|
* @param other Another L2ToL1Message instance to compare with.
|
|
@@ -149,6 +160,20 @@ export class ScopedL2ToL1Message {
|
|
|
149
160
|
return new ScopedL2ToL1Message(L2ToL1Message.empty(), AztecAddress.ZERO);
|
|
150
161
|
}
|
|
151
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Creates a ScopedL2ToL1Message instance from a plain object without Zod validation.
|
|
165
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
166
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
167
|
+
* @param obj - Plain object containing ScopedL2ToL1Message fields
|
|
168
|
+
* @returns A ScopedL2ToL1Message instance
|
|
169
|
+
*/
|
|
170
|
+
static fromPlainObject(obj: any): ScopedL2ToL1Message {
|
|
171
|
+
return new ScopedL2ToL1Message(
|
|
172
|
+
L2ToL1Message.fromPlainObject(obj.message),
|
|
173
|
+
AztecAddress.fromPlainObject(obj.contractAddress),
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
152
177
|
isEmpty(): boolean {
|
|
153
178
|
return this.message.isEmpty() && this.contractAddress.isZero();
|
|
154
179
|
}
|
package/src/noir/index.ts
CHANGED
|
@@ -11,8 +11,7 @@ import type {
|
|
|
11
11
|
export const AZTEC_PRIVATE_ATTRIBUTE = 'abi_private';
|
|
12
12
|
export const AZTEC_PUBLIC_ATTRIBUTE = 'abi_public';
|
|
13
13
|
export const AZTEC_UTILITY_ATTRIBUTE = 'abi_utility';
|
|
14
|
-
|
|
15
|
-
export const AZTEC_INTERNAL_ATTRIBUTE = 'abi_only_self';
|
|
14
|
+
export const AZTEC_ONLY_SELF_ATTRIBUTE = 'abi_only_self';
|
|
16
15
|
export const AZTEC_INITIALIZER_ATTRIBUTE = 'abi_initializer';
|
|
17
16
|
export const AZTEC_VIEW_ATTRIBUTE = 'abi_view';
|
|
18
17
|
|
|
@@ -91,6 +91,17 @@ export class AppendOnlyTreeSnapshot {
|
|
|
91
91
|
return new AppendOnlyTreeSnapshot(Fr.ZERO, 0);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Creates an AppendOnlyTreeSnapshot instance from a plain object without Zod validation.
|
|
96
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
97
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
98
|
+
* @param obj - Plain object containing AppendOnlyTreeSnapshot fields
|
|
99
|
+
* @returns An AppendOnlyTreeSnapshot instance
|
|
100
|
+
*/
|
|
101
|
+
static fromPlainObject(obj: any): AppendOnlyTreeSnapshot {
|
|
102
|
+
return new AppendOnlyTreeSnapshot(Fr.fromPlainObject(obj.root), obj.nextAvailableLeafIndex);
|
|
103
|
+
}
|
|
104
|
+
|
|
94
105
|
isEmpty(): boolean {
|
|
95
106
|
return this.root.isZero() && this.nextAvailableLeafIndex === 0;
|
|
96
107
|
}
|
|
@@ -36,6 +36,24 @@ export class NullifierLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
36
36
|
.transform(({ leaf, nextKey, nextIndex }) => new NullifierLeafPreimage(leaf, nextKey, nextIndex));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Creates a NullifierLeafPreimage from a plain object without Zod validation.
|
|
41
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
42
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
43
|
+
* @param obj - Plain object containing NullifierLeafPreimage fields
|
|
44
|
+
* @returns A NullifierLeafPreimage instance
|
|
45
|
+
*/
|
|
46
|
+
static fromPlainObject(obj: any): NullifierLeafPreimage {
|
|
47
|
+
if (obj instanceof NullifierLeafPreimage) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
return new NullifierLeafPreimage(
|
|
51
|
+
NullifierLeaf.fromPlainObject(obj.leaf),
|
|
52
|
+
Fr.fromPlainObject(obj.nextKey),
|
|
53
|
+
typeof obj.nextIndex === 'bigint' ? obj.nextIndex : BigInt(obj.nextIndex),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
static get leafSchema() {
|
|
40
58
|
return NullifierLeaf.schema;
|
|
41
59
|
}
|
|
@@ -157,4 +175,18 @@ export class NullifierLeaf implements IndexedTreeLeaf {
|
|
|
157
175
|
static get schema() {
|
|
158
176
|
return z.object({ nullifier: schemas.Fr }).transform(({ nullifier }) => new NullifierLeaf(nullifier));
|
|
159
177
|
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Creates a NullifierLeaf from a plain object without Zod validation.
|
|
181
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
182
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
183
|
+
* @param obj - Plain object containing NullifierLeaf fields
|
|
184
|
+
* @returns A NullifierLeaf instance
|
|
185
|
+
*/
|
|
186
|
+
static fromPlainObject(obj: any): NullifierLeaf {
|
|
187
|
+
if (obj instanceof NullifierLeaf) {
|
|
188
|
+
return obj;
|
|
189
|
+
}
|
|
190
|
+
return new NullifierLeaf(Fr.fromPlainObject(obj.nullifier));
|
|
191
|
+
}
|
|
160
192
|
}
|
|
@@ -36,6 +36,24 @@ export class PublicDataTreeLeafPreimage implements IndexedTreeLeafPreimage {
|
|
|
36
36
|
.transform(({ leaf, nextKey, nextIndex }) => new PublicDataTreeLeafPreimage(leaf, nextKey, nextIndex));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Creates a PublicDataTreeLeafPreimage from a plain object without Zod validation.
|
|
41
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
42
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
43
|
+
* @param obj - Plain object containing PublicDataTreeLeafPreimage fields
|
|
44
|
+
* @returns A PublicDataTreeLeafPreimage instance
|
|
45
|
+
*/
|
|
46
|
+
static fromPlainObject(obj: any): PublicDataTreeLeafPreimage {
|
|
47
|
+
if (obj instanceof PublicDataTreeLeafPreimage) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
return new PublicDataTreeLeafPreimage(
|
|
51
|
+
PublicDataTreeLeaf.fromPlainObject(obj.leaf),
|
|
52
|
+
Fr.fromPlainObject(obj.nextKey),
|
|
53
|
+
typeof obj.nextIndex === 'bigint' ? obj.nextIndex : BigInt(obj.nextIndex),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
static get leafSchema() {
|
|
40
58
|
return PublicDataTreeLeaf.schema;
|
|
41
59
|
}
|
|
@@ -172,4 +190,18 @@ export class PublicDataTreeLeaf implements IndexedTreeLeaf {
|
|
|
172
190
|
})
|
|
173
191
|
.transform(({ slot, value }) => new PublicDataTreeLeaf(slot, value));
|
|
174
192
|
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Creates a PublicDataTreeLeaf from a plain object without Zod validation.
|
|
196
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
197
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
198
|
+
* @param obj - Plain object containing PublicDataTreeLeaf fields
|
|
199
|
+
* @returns A PublicDataTreeLeaf instance
|
|
200
|
+
*/
|
|
201
|
+
static fromPlainObject(obj: any): PublicDataTreeLeaf {
|
|
202
|
+
if (obj instanceof PublicDataTreeLeaf) {
|
|
203
|
+
return obj;
|
|
204
|
+
}
|
|
205
|
+
return new PublicDataTreeLeaf(Fr.fromPlainObject(obj.slot), Fr.fromPlainObject(obj.value));
|
|
206
|
+
}
|
|
175
207
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { FunctionCall } from '../abi/function_call.js';
|
|
2
|
+
import type { AuthWitness } from '../auth_witness/auth_witness.js';
|
|
3
|
+
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
|
+
import type { Capsule } from './capsule.js';
|
|
5
|
+
import type { HashedValues } from './hashed_values.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents data necessary to perform an action in the network successfully.
|
|
9
|
+
* This class can be considered Aztec's "minimal execution unit".
|
|
10
|
+
* */
|
|
11
|
+
export class ExecutionPayload {
|
|
12
|
+
public constructor(
|
|
13
|
+
/** The function calls to be executed. */
|
|
14
|
+
public calls: FunctionCall[],
|
|
15
|
+
/** Any transient auth witnesses needed for this execution */
|
|
16
|
+
public authWitnesses: AuthWitness[],
|
|
17
|
+
/** Data passed through an oracle for this execution. */
|
|
18
|
+
public capsules: Capsule[],
|
|
19
|
+
/** Extra hashed values to be injected in the execution cache */
|
|
20
|
+
public extraHashedArgs: HashedValues[] = [],
|
|
21
|
+
/**
|
|
22
|
+
* The address that is paying for the fee in this execution payload (if any).
|
|
23
|
+
* If undefined, the wallet software executing the payload will have to add a fee payment method
|
|
24
|
+
*/
|
|
25
|
+
public feePayer?: AztecAddress,
|
|
26
|
+
) {}
|
|
27
|
+
|
|
28
|
+
static empty() {
|
|
29
|
+
return new ExecutionPayload([], [], [], [], undefined);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Merges an array ExecutionPayloads combining their calls, authWitnesses, capsules and extraArgHashes.
|
|
35
|
+
* @throws Error if multiple payloads have different fee payers set
|
|
36
|
+
*/
|
|
37
|
+
export function mergeExecutionPayloads(requests: ExecutionPayload[]): ExecutionPayload {
|
|
38
|
+
const calls = requests.map(r => r.calls).flat();
|
|
39
|
+
const combinedAuthWitnesses = requests.map(r => r.authWitnesses ?? []).flat();
|
|
40
|
+
const combinedCapsules = requests.map(r => r.capsules ?? []).flat();
|
|
41
|
+
const combinedExtraHashedArgs = requests.map(r => r.extraHashedArgs ?? []).flat();
|
|
42
|
+
|
|
43
|
+
// Collect unique fee payers
|
|
44
|
+
const uniqueFeePayers = new Set(
|
|
45
|
+
requests
|
|
46
|
+
.map(r => r.feePayer)
|
|
47
|
+
.filter((fp): fp is AztecAddress => fp !== undefined)
|
|
48
|
+
.map(fp => fp.toString()),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if (uniqueFeePayers.size > 1) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Cannot merge execution payloads with different fee payers. Found: ${Array.from(uniqueFeePayers).join(', ')}`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const feePayer = uniqueFeePayers.size === 1 ? AztecAddress.fromString(Array.from(uniqueFeePayers)[0]) : undefined;
|
|
58
|
+
|
|
59
|
+
return new ExecutionPayload(calls, combinedAuthWitnesses, combinedCapsules, combinedExtraHashedArgs, feePayer);
|
|
60
|
+
}
|
|
@@ -65,6 +65,26 @@ export class GlobalVariables {
|
|
|
65
65
|
return new GlobalVariables(...GlobalVariables.getFields(fields));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Creates a GlobalVariables instance from a plain object without Zod validation.
|
|
70
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
71
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
72
|
+
* @param obj - Plain object containing GlobalVariables fields
|
|
73
|
+
* @returns A GlobalVariables instance
|
|
74
|
+
*/
|
|
75
|
+
static fromPlainObject(obj: any): GlobalVariables {
|
|
76
|
+
return new GlobalVariables(
|
|
77
|
+
Fr.fromPlainObject(obj.chainId),
|
|
78
|
+
Fr.fromPlainObject(obj.version),
|
|
79
|
+
obj.blockNumber,
|
|
80
|
+
Fr.fromPlainObject(obj.slotNumber),
|
|
81
|
+
typeof obj.timestamp === 'bigint' ? obj.timestamp : BigInt(obj.timestamp),
|
|
82
|
+
EthAddress.fromPlainObject(obj.coinbase),
|
|
83
|
+
AztecAddress.fromPlainObject(obj.feeRecipient),
|
|
84
|
+
GasFees.fromPlainObject(obj.gasFees),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
68
88
|
static empty(fields: Partial<FieldsOf<GlobalVariables>> = {}): GlobalVariables {
|
|
69
89
|
return GlobalVariables.from({
|
|
70
90
|
blockNumber: 0,
|
package/src/tx/index.ts
CHANGED
package/src/tx/profiling.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import { type ZodFor, optional } from '@aztec/foundation/schemas';
|
|
2
|
+
import { type ZodFor, optional, schemas } from '@aztec/foundation/schemas';
|
|
3
3
|
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
import type { AbiDecoded } from '../abi/decoder.js';
|
|
7
6
|
import type { AztecNode } from '../interfaces/aztec-node.js';
|
|
8
7
|
import { type PrivateExecutionStep, PrivateExecutionStepSchema } from '../kernel/private_kernel_prover_output.js';
|
|
9
|
-
import { AbiDecodedSchema } from '../schemas/schemas.js';
|
|
10
8
|
|
|
11
9
|
export type NodeStats = Partial<Record<keyof AztecNode, { times: number[] }>>;
|
|
12
10
|
|
|
@@ -127,21 +125,21 @@ export class TxProfileResult {
|
|
|
127
125
|
|
|
128
126
|
export class UtilitySimulationResult {
|
|
129
127
|
constructor(
|
|
130
|
-
public result:
|
|
128
|
+
public result: Fr[],
|
|
131
129
|
public stats?: SimulationStats,
|
|
132
130
|
) {}
|
|
133
131
|
|
|
134
132
|
static get schema(): ZodFor<UtilitySimulationResult> {
|
|
135
133
|
return z
|
|
136
134
|
.object({
|
|
137
|
-
result:
|
|
135
|
+
result: z.array(schemas.Fr),
|
|
138
136
|
stats: optional(SimulationStatsSchema),
|
|
139
137
|
})
|
|
140
138
|
.transform(({ result, stats }) => new UtilitySimulationResult(result, stats));
|
|
141
139
|
}
|
|
142
140
|
|
|
143
141
|
static random(): UtilitySimulationResult {
|
|
144
|
-
return new UtilitySimulationResult(Fr.random()
|
|
142
|
+
return new UtilitySimulationResult([Fr.random()], {
|
|
145
143
|
nodeRPCCalls: { getBlockHeader: { times: [1] } },
|
|
146
144
|
timings: {
|
|
147
145
|
sync: 1,
|
|
@@ -50,6 +50,22 @@ export class ProtocolContracts {
|
|
|
50
50
|
return new ProtocolContracts(makeTuple(MAX_PROTOCOL_CONTRACTS, () => AztecAddress.zero()));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Creates a ProtocolContracts instance from a plain object without Zod validation.
|
|
55
|
+
* This method is optimized for performance and skips validation, making it suitable
|
|
56
|
+
* for deserializing trusted data (e.g., from C++ via MessagePack).
|
|
57
|
+
* @param obj - Plain object containing ProtocolContracts fields
|
|
58
|
+
* @returns A ProtocolContracts instance
|
|
59
|
+
*/
|
|
60
|
+
static fromPlainObject(obj: any): ProtocolContracts {
|
|
61
|
+
return new ProtocolContracts(
|
|
62
|
+
assertLength(
|
|
63
|
+
obj.derivedAddresses.map((addr: any) => AztecAddress.fromPlainObject(addr)),
|
|
64
|
+
MAX_PROTOCOL_CONTRACTS,
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
getSize() {
|
|
54
70
|
return arraySerializedSizeOfNonEmpty(this.derivedAddresses);
|
|
55
71
|
}
|