@aztec/stdlib 3.0.0-nightly.20251106 → 3.0.0-nightly.20251107
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/avm/avm.d.ts +596 -455
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +69 -1
- package/dest/avm/avm_proving_request.d.ts +184 -184
- package/dest/avm/message_pack.d.ts +1 -1
- package/dest/avm/message_pack.d.ts.map +1 -1
- package/dest/avm/message_pack.js +3 -0
- package/dest/avm/revert_code.d.ts +2 -2
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.d.ts +15 -4
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +14 -0
- package/dest/interfaces/aztec-node-admin.d.ts +3 -0
- 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 +2 -1
- package/dest/interfaces/proving-job.d.ts +184 -184
- package/dest/schemas/schemas.d.ts +77 -0
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +8 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -5
- package/package.json +8 -8
- package/src/avm/avm.ts +99 -1
- package/src/avm/message_pack.ts +4 -1
- package/src/avm/revert_code.ts +2 -1
- package/src/block/proposal/attestations_and_signers.ts +20 -1
- package/src/interfaces/configs.ts +3 -0
- package/src/schemas/schemas.ts +8 -0
- package/src/tests/mocks.ts +3 -3
|
@@ -8,6 +8,7 @@ import { EventSelector } from '../abi/event_selector.js';
|
|
|
8
8
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
9
9
|
import { NoteSelector } from '../abi/note_selector.js';
|
|
10
10
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
11
|
+
import { Gas } from '../gas/gas.js';
|
|
11
12
|
/**
|
|
12
13
|
* Validation schemas for common types. Every schema must match its toJSON.
|
|
13
14
|
* Foundation schemas are repeated here to aid type inference
|
|
@@ -57,6 +58,82 @@ export declare const schemas: {
|
|
|
57
58
|
FunctionSelector: ZodFor<FunctionSelector>;
|
|
58
59
|
/** Accepts a hex string. */
|
|
59
60
|
EventSelector: z.ZodType<EventSelector, any, string>;
|
|
61
|
+
GasUsed: z.ZodObject<{
|
|
62
|
+
totalGas: z.ZodEffects<z.ZodObject<{
|
|
63
|
+
daGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
64
|
+
l2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
daGas: number;
|
|
67
|
+
l2Gas: number;
|
|
68
|
+
}, {
|
|
69
|
+
daGas: string | number | bigint;
|
|
70
|
+
l2Gas: string | number | bigint;
|
|
71
|
+
}>, Gas, {
|
|
72
|
+
daGas: string | number | bigint;
|
|
73
|
+
l2Gas: string | number | bigint;
|
|
74
|
+
}>;
|
|
75
|
+
teardownGas: z.ZodEffects<z.ZodObject<{
|
|
76
|
+
daGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
77
|
+
l2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
daGas: number;
|
|
80
|
+
l2Gas: number;
|
|
81
|
+
}, {
|
|
82
|
+
daGas: string | number | bigint;
|
|
83
|
+
l2Gas: string | number | bigint;
|
|
84
|
+
}>, Gas, {
|
|
85
|
+
daGas: string | number | bigint;
|
|
86
|
+
l2Gas: string | number | bigint;
|
|
87
|
+
}>;
|
|
88
|
+
publicGas: z.ZodEffects<z.ZodObject<{
|
|
89
|
+
daGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
90
|
+
l2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
daGas: number;
|
|
93
|
+
l2Gas: number;
|
|
94
|
+
}, {
|
|
95
|
+
daGas: string | number | bigint;
|
|
96
|
+
l2Gas: string | number | bigint;
|
|
97
|
+
}>, Gas, {
|
|
98
|
+
daGas: string | number | bigint;
|
|
99
|
+
l2Gas: string | number | bigint;
|
|
100
|
+
}>;
|
|
101
|
+
billedGas: z.ZodEffects<z.ZodObject<{
|
|
102
|
+
daGas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
103
|
+
l2Gas: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
daGas: number;
|
|
106
|
+
l2Gas: number;
|
|
107
|
+
}, {
|
|
108
|
+
daGas: string | number | bigint;
|
|
109
|
+
l2Gas: string | number | bigint;
|
|
110
|
+
}>, Gas, {
|
|
111
|
+
daGas: string | number | bigint;
|
|
112
|
+
l2Gas: string | number | bigint;
|
|
113
|
+
}>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
totalGas: Gas;
|
|
116
|
+
teardownGas: Gas;
|
|
117
|
+
publicGas: Gas;
|
|
118
|
+
billedGas: Gas;
|
|
119
|
+
}, {
|
|
120
|
+
totalGas: {
|
|
121
|
+
daGas: string | number | bigint;
|
|
122
|
+
l2Gas: string | number | bigint;
|
|
123
|
+
};
|
|
124
|
+
teardownGas: {
|
|
125
|
+
daGas: string | number | bigint;
|
|
126
|
+
l2Gas: string | number | bigint;
|
|
127
|
+
};
|
|
128
|
+
publicGas: {
|
|
129
|
+
daGas: string | number | bigint;
|
|
130
|
+
l2Gas: string | number | bigint;
|
|
131
|
+
};
|
|
132
|
+
billedGas: {
|
|
133
|
+
daGas: string | number | bigint;
|
|
134
|
+
l2Gas: string | number | bigint;
|
|
135
|
+
};
|
|
136
|
+
}>;
|
|
60
137
|
};
|
|
61
138
|
export declare const AbiDecodedSchema: ZodFor<AbiDecoded>;
|
|
62
139
|
export { type ZodFor, bufferSchema, hexSchema, hexSchemaFor, bufferSchemaFor, type ApiSchemaFor, optional, mapSchema, pickFromSchema, } from '@aztec/foundation/schemas';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,KAAK,MAAM,EAAgC,MAAM,2BAA2B,CAAC;AAEtF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,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ACZ,eAAe,EACf,KAAK,YAAY,EACjB,QAAQ,EACR,SAAS,EACT,cAAc,GACf,MAAM,2BAA2B,CAAC"}
|
package/dest/schemas/schemas.js
CHANGED
|
@@ -4,6 +4,7 @@ import { EventSelector } from '../abi/event_selector.js';
|
|
|
4
4
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
5
5
|
import { NoteSelector } from '../abi/note_selector.js';
|
|
6
6
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
+
import { Gas } from '../gas/gas.js';
|
|
7
8
|
/**
|
|
8
9
|
* Validation schemas for common types. Every schema must match its toJSON.
|
|
9
10
|
* Foundation schemas are repeated here to aid type inference
|
|
@@ -23,7 +24,13 @@ import { AztecAddress } from '../aztec-address/index.js';
|
|
|
23
24
|
/** Accepts a hex string. */ AztecAddress: AztecAddress.schema,
|
|
24
25
|
/** Accepts a hex string. */ NoteSelector: NoteSelector.schema,
|
|
25
26
|
/** Accepts a hex string. */ FunctionSelector: FunctionSelector.schema,
|
|
26
|
-
/** Accepts a hex string. */ EventSelector: EventSelector.schema
|
|
27
|
+
/** Accepts a hex string. */ EventSelector: EventSelector.schema,
|
|
28
|
+
GasUsed: z.object({
|
|
29
|
+
totalGas: Gas.schema,
|
|
30
|
+
teardownGas: Gas.schema,
|
|
31
|
+
publicGas: Gas.schema,
|
|
32
|
+
billedGas: Gas.schema
|
|
33
|
+
})
|
|
27
34
|
};
|
|
28
35
|
export const AbiDecodedSchema = z.union([
|
|
29
36
|
schemas.BigInt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAe,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM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consensus_payload.js';
|
|
|
25
25
|
import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
|
|
26
26
|
import { ChonkProof } from '../proofs/chonk_proof.js';
|
|
27
27
|
import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx } from '../tx/index.js';
|
|
28
|
-
import { PublicSimulationOutput } from '../tx/public_simulation_output.js';
|
|
29
|
-
import { TxSimulationResult
|
|
28
|
+
import { NestedProcessReturnValues, PublicSimulationOutput } from '../tx/public_simulation_output.js';
|
|
29
|
+
import { TxSimulationResult } from '../tx/simulated_tx.js';
|
|
30
30
|
import { TxEffect } from '../tx/tx_effect.js';
|
|
31
31
|
import { TxHash } from '../tx/tx_hash.js';
|
|
32
32
|
import { makeGas, makeGlobalVariables, makeL2BlockHeader, makePublicCallRequest } from './factories.js';
|
|
@@ -93,9 +93,7 @@ const emptyPrivateExecutionResult = ()=>new PrivateExecutionResult(emptyPrivateC
|
|
|
93
93
|
export const mockSimulatedTx = async (seed = 1)=>{
|
|
94
94
|
const privateExecutionResult = emptyPrivateExecutionResult();
|
|
95
95
|
const tx = await mockTx(seed);
|
|
96
|
-
const output = new PublicSimulationOutput(undefined, makeGlobalVariables(), await TxEffect.random(),
|
|
97
|
-
accumulatePrivateReturnValues(privateExecutionResult)
|
|
98
|
-
], {
|
|
96
|
+
const output = new PublicSimulationOutput(undefined, makeGlobalVariables(), await TxEffect.random(), times(2, ()=>NestedProcessReturnValues.random(2)), {
|
|
99
97
|
totalGas: makeGas(),
|
|
100
98
|
teardownGas: makeGas(),
|
|
101
99
|
publicGas: makeGas(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251107",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
75
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
76
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
77
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
78
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
79
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
80
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
81
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
75
|
+
"@aztec/bb.js": "3.0.0-nightly.20251107",
|
|
76
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251107",
|
|
77
|
+
"@aztec/constants": "3.0.0-nightly.20251107",
|
|
78
|
+
"@aztec/ethereum": "3.0.0-nightly.20251107",
|
|
79
|
+
"@aztec/foundation": "3.0.0-nightly.20251107",
|
|
80
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251107",
|
|
81
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251107",
|
|
82
82
|
"@google-cloud/storage": "^7.15.0",
|
|
83
83
|
"axios": "^1.12.0",
|
|
84
84
|
"json-stringify-deterministic": "1.0.12",
|
package/src/avm/avm.ts
CHANGED
|
@@ -1,31 +1,37 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
-
import { schemas } from '@aztec/foundation/schemas';
|
|
4
3
|
|
|
5
4
|
import { z } from 'zod';
|
|
6
5
|
|
|
7
6
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
8
7
|
import { AllContractDeploymentData, ContractDeploymentData } from '../contract/index.js';
|
|
8
|
+
import type { SimulationError } from '../errors/simulation_error.js';
|
|
9
9
|
import { computeEffectiveGasFees } from '../fees/transaction_fee.js';
|
|
10
10
|
import { Gas } from '../gas/gas.js';
|
|
11
11
|
import { GasFees } from '../gas/gas_fees.js';
|
|
12
12
|
import { GasSettings } from '../gas/gas_settings.js';
|
|
13
|
+
import type { GasUsed } from '../gas/gas_used.js';
|
|
13
14
|
import { PublicKeys } from '../keys/public_keys.js';
|
|
15
|
+
import type { DebugLog } from '../logs/debug_log.js';
|
|
14
16
|
import { ScopedL2ToL1Message } from '../messaging/l2_to_l1_message.js';
|
|
17
|
+
import { schemas } from '../schemas/schemas.js';
|
|
15
18
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
16
19
|
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
17
20
|
import { NullifierLeafPreimage } from '../trees/nullifier_leaf.js';
|
|
18
21
|
import { PublicDataTreeLeafPreimage } from '../trees/public_data_leaf.js';
|
|
19
22
|
import {
|
|
20
23
|
GlobalVariables,
|
|
24
|
+
NestedProcessReturnValues,
|
|
21
25
|
ProtocolContracts,
|
|
22
26
|
PublicCallRequestWithCalldata,
|
|
23
27
|
TreeSnapshots,
|
|
24
28
|
type Tx,
|
|
29
|
+
TxExecutionPhase,
|
|
25
30
|
} from '../tx/index.js';
|
|
26
31
|
import { WorldStateRevision } from '../world-state/world_state_revision.js';
|
|
27
32
|
import { AvmCircuitPublicInputs } from './avm_circuit_public_inputs.js';
|
|
28
33
|
import { serializeWithMessagePack } from './message_pack.js';
|
|
34
|
+
import { RevertCode } from './revert_code.js';
|
|
29
35
|
|
|
30
36
|
////////////////////////////////////////////////////////////////////////////
|
|
31
37
|
// Hints (contracts)
|
|
@@ -701,6 +707,98 @@ export class AvmCircuitInputs {
|
|
|
701
707
|
}
|
|
702
708
|
}
|
|
703
709
|
|
|
710
|
+
export type ProcessedPhase = {
|
|
711
|
+
phase: TxExecutionPhase;
|
|
712
|
+
durationMs?: number;
|
|
713
|
+
returnValues: NestedProcessReturnValues[];
|
|
714
|
+
reverted: boolean;
|
|
715
|
+
revertReason?: SimulationError;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
export class PublicTxResult {
|
|
719
|
+
constructor(
|
|
720
|
+
// Simulation result.
|
|
721
|
+
public gasUsed: GasUsed,
|
|
722
|
+
public revertCode: RevertCode,
|
|
723
|
+
public revertReason: SimulationError | undefined, // Revert reason, if any
|
|
724
|
+
// These are only guaranteed to be present in "client initiated simulation" mode.
|
|
725
|
+
public processedPhases: ProcessedPhase[] | undefined,
|
|
726
|
+
public logs: DebugLog[] | undefined,
|
|
727
|
+
// For the proving request.
|
|
728
|
+
public hints: AvmExecutionHints | undefined,
|
|
729
|
+
public publicInputs: AvmCircuitPublicInputs,
|
|
730
|
+
) {}
|
|
731
|
+
|
|
732
|
+
static empty() {
|
|
733
|
+
return new PublicTxResult(
|
|
734
|
+
{
|
|
735
|
+
totalGas: Gas.empty(),
|
|
736
|
+
teardownGas: Gas.empty(),
|
|
737
|
+
publicGas: Gas.empty(),
|
|
738
|
+
billedGas: Gas.empty(),
|
|
739
|
+
},
|
|
740
|
+
RevertCode.OK,
|
|
741
|
+
/*revertReason=*/ undefined,
|
|
742
|
+
/*processedPhases=*/ [],
|
|
743
|
+
/*logs=*/ [],
|
|
744
|
+
/*hints=*/ AvmExecutionHints.empty(),
|
|
745
|
+
/*publicInputs=*/ AvmCircuitPublicInputs.empty(),
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/*
|
|
750
|
+
static get schema(): ZodFor<PublicTxResult> {
|
|
751
|
+
return z
|
|
752
|
+
.object({
|
|
753
|
+
gasUsed: schemas.GasUsed,
|
|
754
|
+
revertCode: RevertCode.schema,
|
|
755
|
+
revertReason: SimulationError.schema.optional(),
|
|
756
|
+
appLogicReturnValue: Fr.schema.array().optional(),
|
|
757
|
+
logs: DebugLog.schema.array(),
|
|
758
|
+
hints: AvmExecutionHints.schema.optional(),
|
|
759
|
+
publicInputs: AvmCircuitPublicInputs.schema,
|
|
760
|
+
})
|
|
761
|
+
.transform(
|
|
762
|
+
({ gasUsed, revertCode, revertReason, appLogicReturnValue, logs, hints, publicInputs }) =>
|
|
763
|
+
new PublicTxResult(
|
|
764
|
+
gasUsed,
|
|
765
|
+
revertCode as RevertCode,
|
|
766
|
+
revertReason,
|
|
767
|
+
appLogicReturnValue,
|
|
768
|
+
logs,
|
|
769
|
+
hints,
|
|
770
|
+
publicInputs,
|
|
771
|
+
),
|
|
772
|
+
);
|
|
773
|
+
}*/
|
|
774
|
+
|
|
775
|
+
// TODO(fcarreiro): complete this.
|
|
776
|
+
static get partialSchema() {
|
|
777
|
+
return z.object({
|
|
778
|
+
gasUsed: schemas.GasUsed,
|
|
779
|
+
revertCode: RevertCode.schema,
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
static fromJSON(json: any) {
|
|
783
|
+
// console.log('json', json);
|
|
784
|
+
// console.log('PI.globalVariables.gasFees', json.publicInputs.globalVariables.gasFees);
|
|
785
|
+
const r = PublicTxResult.partialSchema.parse(json);
|
|
786
|
+
// console.log('after parse', r);
|
|
787
|
+
return r as {
|
|
788
|
+
gasUsed: GasUsed;
|
|
789
|
+
revertCode: RevertCode;
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
export type PublicTxSimulatorConfig = {
|
|
795
|
+
proverId: Fr;
|
|
796
|
+
doMerkleOperations: boolean;
|
|
797
|
+
skipFeeEnforcement: boolean;
|
|
798
|
+
clientInitiatedSimulation: boolean;
|
|
799
|
+
maxDebugLogMemoryReads: number;
|
|
800
|
+
};
|
|
801
|
+
|
|
704
802
|
export class AvmFastSimulationInputs {
|
|
705
803
|
constructor(
|
|
706
804
|
public readonly wsRevision: WorldStateRevision,
|
package/src/avm/message_pack.ts
CHANGED
|
@@ -18,7 +18,10 @@ export function serializeWithMessagePack(obj: any): Buffer {
|
|
|
18
18
|
return encoder.encode(obj);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// This deserializes into a JS object. If you want a specific
|
|
22
|
+
// class, you need to use zod to parse it into the specific class.
|
|
23
|
+
// You can use T.schema.parse() for that.
|
|
24
|
+
export function deserializeFromMessagePack(buffer: Buffer): any {
|
|
22
25
|
setUpMessagePackExtensions();
|
|
23
26
|
const decoder = new Decoder({
|
|
24
27
|
useRecords: false,
|
package/src/avm/revert_code.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
2
3
|
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
3
4
|
|
|
4
5
|
import { inspect } from 'util';
|
|
@@ -64,7 +65,7 @@ export class RevertCode {
|
|
|
64
65
|
return this.code;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
static get schema() {
|
|
68
|
+
static get schema(): ZodFor<RevertCode> {
|
|
68
69
|
return z.nativeEnum(RevertCodeEnum).transform(value => new RevertCode(value));
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -5,7 +5,7 @@ import { encodeAbiParameters, parseAbiParameters } from 'viem';
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
7
|
import type { Signable, SignatureDomainSeparator } from '../../p2p/signature_utils.js';
|
|
8
|
-
import { CommitteeAttestation } from './committee_attestation.js';
|
|
8
|
+
import { CommitteeAttestation, EthAddress } from './committee_attestation.js';
|
|
9
9
|
|
|
10
10
|
export class CommitteeAttestationsAndSigners implements Signable {
|
|
11
11
|
constructor(public attestations: CommitteeAttestation[]) {}
|
|
@@ -119,3 +119,22 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Malicious extension of CommitteeAttestationsAndSigners that keeps separate attestations and
|
|
125
|
+
* signers. Used for tricking the L1 contract into accepting attestations by reconstructing
|
|
126
|
+
* the correct committee commitment (which relies on the signers, ignoring the signatures)
|
|
127
|
+
* with an invalid set of attestation signatures.
|
|
128
|
+
*/
|
|
129
|
+
export class MaliciousCommitteeAttestationsAndSigners extends CommitteeAttestationsAndSigners {
|
|
130
|
+
constructor(
|
|
131
|
+
attestations: CommitteeAttestation[],
|
|
132
|
+
private signers: EthAddress[],
|
|
133
|
+
) {
|
|
134
|
+
super(attestations);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
override getSigners(): EthAddress[] {
|
|
138
|
+
return this.signers;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -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
|
+
/** Shuffle attestation ordering to create invalid ordering (for testing only) */
|
|
60
|
+
shuffleAttestationOrdering?: boolean;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export const SequencerConfigSchema = z.object({
|
|
@@ -81,4 +83,5 @@ export const SequencerConfigSchema = z.object({
|
|
|
81
83
|
secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
|
|
82
84
|
broadcastInvalidBlockProposal: z.boolean().optional(),
|
|
83
85
|
injectFakeAttestation: z.boolean().optional(),
|
|
86
|
+
shuffleAttestationOrdering: z.boolean().optional(),
|
|
84
87
|
}) satisfies ZodFor<SequencerConfig>;
|
package/src/schemas/schemas.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { EventSelector } from '../abi/event_selector.js';
|
|
|
10
10
|
import { FunctionSelector } from '../abi/function_selector.js';
|
|
11
11
|
import { NoteSelector } from '../abi/note_selector.js';
|
|
12
12
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
13
|
+
import { Gas } from '../gas/gas.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Validation schemas for common types. Every schema must match its toJSON.
|
|
@@ -63,6 +64,13 @@ export const schemas = {
|
|
|
63
64
|
|
|
64
65
|
/** Accepts a hex string. */
|
|
65
66
|
EventSelector: EventSelector.schema,
|
|
67
|
+
|
|
68
|
+
GasUsed: z.object({
|
|
69
|
+
totalGas: Gas.schema,
|
|
70
|
+
teardownGas: Gas.schema,
|
|
71
|
+
publicGas: Gas.schema,
|
|
72
|
+
billedGas: Gas.schema,
|
|
73
|
+
}),
|
|
66
74
|
};
|
|
67
75
|
|
|
68
76
|
export const AbiDecodedSchema: ZodFor<AbiDecoded> = z.union([
|
package/src/tests/mocks.ts
CHANGED
|
@@ -32,8 +32,8 @@ import { ConsensusPayload } from '../p2p/consensus_payload.js';
|
|
|
32
32
|
import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
|
|
33
33
|
import { ChonkProof } from '../proofs/chonk_proof.js';
|
|
34
34
|
import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, StateReference, Tx } from '../tx/index.js';
|
|
35
|
-
import { PublicSimulationOutput } from '../tx/public_simulation_output.js';
|
|
36
|
-
import { TxSimulationResult
|
|
35
|
+
import { NestedProcessReturnValues, PublicSimulationOutput } from '../tx/public_simulation_output.js';
|
|
36
|
+
import { TxSimulationResult } from '../tx/simulated_tx.js';
|
|
37
37
|
import { TxEffect } from '../tx/tx_effect.js';
|
|
38
38
|
import { TxHash } from '../tx/tx_hash.js';
|
|
39
39
|
import { makeGas, makeGlobalVariables, makeL2BlockHeader, makePublicCallRequest } from './factories.js';
|
|
@@ -184,7 +184,7 @@ export const mockSimulatedTx = async (seed = 1) => {
|
|
|
184
184
|
undefined,
|
|
185
185
|
makeGlobalVariables(),
|
|
186
186
|
await TxEffect.random(),
|
|
187
|
-
|
|
187
|
+
times(2, () => NestedProcessReturnValues.random(2)),
|
|
188
188
|
{
|
|
189
189
|
totalGas: makeGas(),
|
|
190
190
|
teardownGas: makeGas(),
|