@aztec/stdlib 3.0.0-nightly.20251128 → 3.0.0-nightly.20251202
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 +17 -9
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +5 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_proving_request.d.ts +9 -5
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/in_block.d.ts +7 -5
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/l2_block.d.ts +3 -2
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -1
- package/dest/block/l2_block_code_to_purge.d.ts +1 -1
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +3 -2
- package/dest/block/l2_block_header.d.ts +4 -3
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_header.js +1 -1
- package/dest/block/l2_block_source.d.ts +4 -4
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +13 -10
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +4 -4
- package/dest/checkpoint/published_checkpoint.d.ts +5 -3
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/epoch-helpers/index.d.ts +7 -7
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +9 -9
- package/dest/interfaces/archiver.js +1 -1
- package/dest/interfaces/aztec-node.d.ts +10 -4
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -1
- package/dest/interfaces/p2p.d.ts +3 -2
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +1 -1
- package/dest/interfaces/proving-job.d.ts +9 -5
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +3 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/private_call_data.d.ts +62 -5
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +105 -4
- package/dest/note/note_dao.d.ts +6 -3
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +10 -6
- package/dest/note/notes_filter.d.ts +3 -1
- package/dest/note/notes_filter.d.ts.map +1 -1
- package/dest/note/notes_filter.js +1 -0
- package/dest/p2p/block_attestation.d.ts +4 -9
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_proposal.d.ts +3 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/consensus_payload.d.ts +4 -182
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +14 -25
- package/dest/rollup/checkpoint_constant_data.d.ts +11 -5
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +11 -4
- package/dest/rollup/checkpoint_header.d.ts +11 -5
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +18 -11
- package/dest/schemas/schemas.d.ts +6 -1
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +2 -0
- package/dest/slashing/empire.js +2 -2
- package/dest/slashing/helpers.d.ts +5 -5
- package/dest/slashing/helpers.d.ts.map +1 -1
- package/dest/slashing/helpers.js +7 -6
- package/dest/slashing/interfaces.d.ts +3 -2
- package/dest/slashing/interfaces.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +5 -4
- package/dest/tests/mocks.d.ts +2 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +6 -12
- package/dest/trees/append_only_tree_snapshot.d.ts +1 -4
- package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
- package/dest/trees/append_only_tree_snapshot.js +0 -9
- package/dest/tx/block_header.d.ts +4 -3
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +1 -1
- package/dest/tx/global_variable_builder.d.ts +3 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +26 -8
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +27 -10
- package/dest/tx/indexed_tx_effect.d.ts +3 -3
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/partial_state_reference.d.ts +1 -4
- package/dest/tx/partial_state_reference.d.ts.map +1 -1
- package/dest/tx/partial_state_reference.js +0 -10
- package/dest/tx/state_reference.d.ts +1 -4
- package/dest/tx/state_reference.d.ts.map +1 -1
- package/dest/tx/state_reference.js +0 -9
- package/dest/tx/tx.d.ts +2 -2
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +1 -0
- package/dest/validators/errors.d.ts +6 -7
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +2 -4
- package/dest/validators/schemas.d.ts +102 -48
- package/dest/validators/schemas.d.ts.map +1 -1
- package/dest/validators/schemas.js +6 -6
- package/dest/validators/types.d.ts +9 -9
- package/dest/validators/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/block/in_block.ts +8 -5
- package/src/block/l2_block.ts +8 -2
- package/src/block/l2_block_code_to_purge.ts +3 -2
- package/src/block/l2_block_header.ts +3 -2
- package/src/block/l2_block_source.ts +3 -3
- package/src/checkpoint/checkpoint.ts +5 -5
- package/src/epoch-helpers/index.ts +19 -14
- package/src/interfaces/archiver.ts +1 -1
- package/src/interfaces/aztec-node.ts +14 -5
- package/src/interfaces/p2p.ts +4 -2
- package/src/interfaces/validator.ts +1 -2
- package/src/kernel/private_call_data.ts +130 -3
- package/src/note/note_dao.ts +11 -2
- package/src/note/notes_filter.ts +3 -0
- package/src/p2p/block_attestation.ts +2 -1
- package/src/p2p/block_proposal.ts +3 -2
- package/src/p2p/consensus_payload.ts +12 -28
- package/src/rollup/checkpoint_constant_data.ts +24 -5
- package/src/rollup/checkpoint_header.ts +21 -12
- package/src/schemas/schemas.ts +7 -0
- package/src/slashing/empire.ts +2 -2
- package/src/slashing/helpers.ts +12 -9
- package/src/slashing/interfaces.ts +3 -1
- package/src/tests/factories.ts +5 -4
- package/src/tests/mocks.ts +2 -16
- package/src/trees/append_only_tree_snapshot.ts +0 -12
- package/src/tx/block_header.ts +3 -2
- package/src/tx/global_variable_builder.ts +2 -1
- package/src/tx/global_variables.ts +30 -11
- package/src/tx/indexed_tx_effect.ts +2 -2
- package/src/tx/partial_state_reference.ts +0 -17
- package/src/tx/state_reference.ts +0 -15
- package/src/tx/tx.ts +2 -1
- package/src/validators/errors.ts +3 -4
- package/src/validators/schemas.ts +6 -6
- package/src/validators/types.ts +8 -8
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
export type ValidatorStatusType = 'block' | 'attestation';
|
|
4
4
|
export type ValidatorStatusInSlot = 'block-mined' | 'block-proposed' | 'block-missed' | 'attestation-sent' | 'attestation-missed';
|
|
5
5
|
export type ValidatorStatusHistory = {
|
|
6
|
-
slot:
|
|
6
|
+
slot: SlotNumber;
|
|
7
7
|
status: ValidatorStatusInSlot;
|
|
8
8
|
}[];
|
|
9
9
|
export type ValidatorMissedStats = {
|
|
@@ -16,12 +16,12 @@ export type ValidatorStats = {
|
|
|
16
16
|
address: EthAddress;
|
|
17
17
|
lastProposal?: {
|
|
18
18
|
timestamp: bigint;
|
|
19
|
-
slot:
|
|
19
|
+
slot: SlotNumber;
|
|
20
20
|
date: string;
|
|
21
21
|
};
|
|
22
22
|
lastAttestation?: {
|
|
23
23
|
timestamp: bigint;
|
|
24
|
-
slot:
|
|
24
|
+
slot: SlotNumber;
|
|
25
25
|
date: string;
|
|
26
26
|
};
|
|
27
27
|
totalSlots: number;
|
|
@@ -31,8 +31,8 @@ export type ValidatorStats = {
|
|
|
31
31
|
};
|
|
32
32
|
export type ValidatorsStats = {
|
|
33
33
|
stats: Record<string, ValidatorStats>;
|
|
34
|
-
lastProcessedSlot?:
|
|
35
|
-
initialSlot?:
|
|
34
|
+
lastProcessedSlot?: SlotNumber;
|
|
35
|
+
initialSlot?: SlotNumber;
|
|
36
36
|
slotWindow: number;
|
|
37
37
|
};
|
|
38
38
|
export type ValidatorsEpochPerformance = Record<`0x${string}`, {
|
|
@@ -46,8 +46,8 @@ export type SingleValidatorStats = {
|
|
|
46
46
|
total: number;
|
|
47
47
|
epoch: EpochNumber;
|
|
48
48
|
}[];
|
|
49
|
-
lastProcessedSlot?:
|
|
50
|
-
initialSlot?:
|
|
49
|
+
lastProcessedSlot?: SlotNumber;
|
|
50
|
+
initialSlot?: SlotNumber;
|
|
51
51
|
slotWindow: number;
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
53
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy92YWxpZGF0b3JzL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxVQUFVLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMvRSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUVoRSxNQUFNLE1BQU0sbUJBQW1CLEdBQUcsT0FBTyxHQUFHLGFBQWEsQ0FBQztBQUUxRCxNQUFNLE1BQU0scUJBQXFCLEdBQzdCLGFBQWEsR0FDYixnQkFBZ0IsR0FDaEIsY0FBYyxHQUNkLGtCQUFrQixHQUNsQixvQkFBb0IsQ0FBQztBQUV6QixNQUFNLE1BQU0sc0JBQXNCLEdBQUc7SUFBRSxJQUFJLEVBQUUsVUFBVSxDQUFDO0lBQUMsTUFBTSxFQUFFLHFCQUFxQixDQUFBO0NBQUUsRUFBRSxDQUFDO0FBRTNGLE1BQU0sTUFBTSxvQkFBb0IsR0FBRztJQUNqQyxhQUFhLEVBQUUsTUFBTSxDQUFDO0lBQ3RCLElBQUksQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNkLEtBQUssRUFBRSxNQUFNLENBQUM7SUFDZCxLQUFLLEVBQUUsTUFBTSxDQUFDO0NBQ2YsQ0FBQztBQUVGLE1BQU0sTUFBTSxjQUFjLEdBQUc7SUFDM0IsT0FBTyxFQUFFLFVBQVUsQ0FBQztJQUNwQixZQUFZLENBQUMsRUFBRTtRQUFFLFNBQVMsRUFBRSxNQUFNLENBQUM7UUFBQyxJQUFJLEVBQUUsVUFBVSxDQUFDO1FBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQTtLQUFFLENBQUM7SUFDckUsZUFBZSxDQUFDLEVBQUU7UUFBRSxTQUFTLEVBQUUsTUFBTSxDQUFDO1FBQUMsSUFBSSxFQUFFLFVBQVUsQ0FBQztRQUFDLElBQUksRUFBRSxNQUFNLENBQUE7S0FBRSxDQUFDO0lBQ3hFLFVBQVUsRUFBRSxNQUFNLENBQUM7SUFDbkIsZUFBZSxFQUFFLG9CQUFvQixDQUFDO0lBQ3RDLGtCQUFrQixFQUFFLG9CQUFvQixDQUFDO0lBQ3pDLE9BQU8sRUFBRSxzQkFBc0IsQ0FBQztDQUNqQyxDQUFDO0FBRUYsTUFBTSxNQUFNLGVBQWUsR0FBRztJQUM1QixLQUFLLEVBQUUsTUFBTSxDQUFDLE1BQU0sRUFBRSxjQUFjLENBQUMsQ0FBQztJQUN0QyxpQkFBaUIsQ0FBQyxFQUFFLFVBQVUsQ0FBQztJQUMvQixXQUFXLENBQUMsRUFBRSxVQUFVLENBQUM7SUFDekIsVUFBVSxFQUFFLE1BQU0sQ0FBQztDQUNwQixDQUFDO0FBRUYsTUFBTSxNQUFNLDBCQUEwQixHQUFHLE1BQU0sQ0FBQyxLQUFLLE1BQU0sRUFBRSxFQUFFO0lBQUUsTUFBTSxFQUFFLE1BQU0sQ0FBQztJQUFDLEtBQUssRUFBRSxNQUFNLENBQUE7Q0FBRSxDQUFDLENBQUM7QUFFbEcsTUFBTSxNQUFNLG9CQUFvQixHQUFHO0lBQ2pDLFNBQVMsRUFBRSxjQUFjLENBQUM7SUFDMUIsd0JBQXdCLEVBQUU7UUFBRSxNQUFNLEVBQUUsTUFBTSxDQUFDO1FBQUMsS0FBSyxFQUFFLE1BQU0sQ0FBQztRQUFDLEtBQUssRUFBRSxXQUFXLENBQUE7S0FBRSxFQUFFLENBQUM7SUFDbEYsaUJBQWlCLENBQUMsRUFBRSxVQUFVLENBQUM7SUFDL0IsV0FBVyxDQUFDLEVBQUUsVUFBVSxDQUFDO0lBQ3pCLFVBQVUsRUFBRSxNQUFNLENBQUM7Q0FDcEIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/validators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,aAAa,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,EAAE,CAAC;AAE3F,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,eAAe,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,oBAAoB,CAAC;IACtC,kBAAkB,EAAE,oBAAoB,CAAC;IACzC,OAAO,EAAE,sBAAsB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAElG,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,cAAc,CAAC;IAC1B,wBAAwB,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;IAClF,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
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.20251202",
|
|
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.20251202",
|
|
76
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251202",
|
|
77
|
+
"@aztec/constants": "3.0.0-nightly.20251202",
|
|
78
|
+
"@aztec/ethereum": "3.0.0-nightly.20251202",
|
|
79
|
+
"@aztec/foundation": "3.0.0-nightly.20251202",
|
|
80
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251202",
|
|
81
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251202",
|
|
82
82
|
"@google-cloud/storage": "^7.15.0",
|
|
83
83
|
"axios": "^1.12.0",
|
|
84
84
|
"json-stringify-deterministic": "1.0.12",
|
package/src/block/in_block.ts
CHANGED
|
@@ -4,14 +4,17 @@ import { schemas } from '../schemas/index.js';
|
|
|
4
4
|
import { L2BlockHash } from './block_hash.js';
|
|
5
5
|
import type { L2Block } from './l2_block.js';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
export type InBlock<T> = {
|
|
7
|
+
export type InBlock = {
|
|
9
8
|
l2BlockNumber: number;
|
|
10
9
|
l2BlockHash: L2BlockHash;
|
|
11
|
-
data: T;
|
|
12
10
|
};
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
// Note: If you expand this type with indexInBlock, then delete `IndexedTxEffect` and use this type instead.
|
|
13
|
+
export type DataInBlock<T> = {
|
|
14
|
+
data: T;
|
|
15
|
+
} & InBlock;
|
|
16
|
+
|
|
17
|
+
export function randomInBlock<T>(data: T): DataInBlock<T> {
|
|
15
18
|
return {
|
|
16
19
|
data,
|
|
17
20
|
l2BlockNumber: Math.floor(Math.random() * 1000),
|
|
@@ -19,7 +22,7 @@ export function randomInBlock<T>(data: T): InBlock<T> {
|
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
export async function wrapInBlock<T>(data: T, block: L2Block): Promise<
|
|
25
|
+
export async function wrapInBlock<T>(data: T, block: L2Block): Promise<DataInBlock<T>> {
|
|
23
26
|
return {
|
|
24
27
|
data,
|
|
25
28
|
l2BlockNumber: block.number,
|
package/src/block/l2_block.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BlockBlobData, encodeBlockBlobData, encodeCheckpointBlobDataFromBlocks } from '@aztec/blob-lib/encoding';
|
|
2
|
+
import { CheckpointNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
5
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
@@ -117,7 +118,7 @@ export class L2Block {
|
|
|
117
118
|
return this.header.getBlockNumber();
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
get slot():
|
|
121
|
+
get slot(): SlotNumber {
|
|
121
122
|
return this.header.getSlot();
|
|
122
123
|
}
|
|
123
124
|
|
|
@@ -155,7 +156,12 @@ export class L2Block {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
public toCheckpoint() {
|
|
158
|
-
return new Checkpoint(
|
|
159
|
+
return new Checkpoint(
|
|
160
|
+
this.archive,
|
|
161
|
+
this.getCheckpointHeader(),
|
|
162
|
+
[this.toL2Block()],
|
|
163
|
+
CheckpointNumber.fromBlockNumber(this.number),
|
|
164
|
+
);
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
static fromCheckpoint(checkpoint: Checkpoint) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { compact } from '@aztec/foundation/collection';
|
|
2
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -25,7 +26,7 @@ export function makeL2BlockHeader(
|
|
|
25
26
|
overrides?.state ?? makeStateReference(seed + 0x600),
|
|
26
27
|
makeGlobalVariables((seed += 0x700), {
|
|
27
28
|
...(blockNumber ? { blockNumber } : {}),
|
|
28
|
-
...(slotNumber ? { slotNumber:
|
|
29
|
+
...(slotNumber ? { slotNumber: SlotNumber(slotNumber) } : {}),
|
|
29
30
|
}),
|
|
30
31
|
new Fr(seed + 0x300),
|
|
31
32
|
new Fr(seed + 0x800),
|
|
@@ -77,7 +78,7 @@ function makeGlobalVariables(seed = 1, overrides: Partial<FieldsOf<GlobalVariabl
|
|
|
77
78
|
chainId: new Fr(seed),
|
|
78
79
|
version: new Fr(seed + 1),
|
|
79
80
|
blockNumber: seed + 2,
|
|
80
|
-
slotNumber:
|
|
81
|
+
slotNumber: SlotNumber(seed + 3),
|
|
81
82
|
timestamp: BigInt(seed + 4),
|
|
82
83
|
coinbase: EthAddress.fromField(new Fr(seed + 5)),
|
|
83
84
|
feeRecipient: AztecAddress.fromField(new Fr(seed + 6)),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
3
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
3
4
|
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
@@ -72,8 +73,8 @@ export class L2BlockHeader {
|
|
|
72
73
|
return new L2BlockHeader(...L2BlockHeader.getFields(fields));
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
getSlot() {
|
|
76
|
-
return this.globalVariables.slotNumber
|
|
76
|
+
getSlot(): SlotNumber {
|
|
77
|
+
return this.globalVariables.slotNumber;
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
getBlockNumber() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
@@ -113,7 +113,7 @@ export interface L2BlockSource {
|
|
|
113
113
|
/**
|
|
114
114
|
* Returns the current L2 slot number based on the currently synced L1 timestamp.
|
|
115
115
|
*/
|
|
116
|
-
getL2SlotNumber(): Promise<
|
|
116
|
+
getL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* Returns the current L2 epoch number based on the currently synced L1 timestamp.
|
|
@@ -232,7 +232,7 @@ export enum L2BlockSourceEvents {
|
|
|
232
232
|
export type L2BlockProvenEvent = {
|
|
233
233
|
type: 'l2BlockProven';
|
|
234
234
|
blockNumber: bigint;
|
|
235
|
-
slotNumber:
|
|
235
|
+
slotNumber: SlotNumber;
|
|
236
236
|
epochNumber: EpochNumber;
|
|
237
237
|
};
|
|
238
238
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { encodeCheckpointBlobDataFromBlocks } from '@aztec/blob-lib/encoding';
|
|
2
|
+
import { CheckpointNumber, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { schemas } from '@aztec/foundation/schemas';
|
|
4
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
5
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ export class Checkpoint {
|
|
|
19
19
|
/** L2 blocks in the checkpoint. */
|
|
20
20
|
public blocks: L2BlockNew[],
|
|
21
21
|
/** Number of the checkpoint. */
|
|
22
|
-
public number:
|
|
22
|
+
public number: CheckpointNumber,
|
|
23
23
|
) {}
|
|
24
24
|
|
|
25
25
|
static get schema() {
|
|
@@ -28,7 +28,7 @@ export class Checkpoint {
|
|
|
28
28
|
archive: AppendOnlyTreeSnapshot.schema,
|
|
29
29
|
header: CheckpointHeader.schema,
|
|
30
30
|
blocks: z.array(L2BlockNew.schema),
|
|
31
|
-
number:
|
|
31
|
+
number: CheckpointNumberSchema,
|
|
32
32
|
})
|
|
33
33
|
.transform(({ archive, header, blocks, number }) => new Checkpoint(archive, header, blocks, number));
|
|
34
34
|
}
|
|
@@ -47,7 +47,7 @@ export class Checkpoint {
|
|
|
47
47
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
48
48
|
reader.readObject(CheckpointHeader),
|
|
49
49
|
reader.readVector(L2BlockNew),
|
|
50
|
-
reader.readNumber(),
|
|
50
|
+
CheckpointNumber(reader.readNumber()),
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -69,7 +69,7 @@ export class Checkpoint {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
static async random(
|
|
72
|
-
checkpointNumber = 1,
|
|
72
|
+
checkpointNumber = CheckpointNumber(1),
|
|
73
73
|
{
|
|
74
74
|
numBlocks = 1,
|
|
75
75
|
startBlockNumber = 1,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -33,15 +33,20 @@ export const L1RollupConstantsSchema = z.object({
|
|
|
33
33
|
|
|
34
34
|
/** Returns the timestamp for a given L2 slot. */
|
|
35
35
|
export function getTimestampForSlot(
|
|
36
|
-
slot:
|
|
36
|
+
slot: SlotNumber,
|
|
37
37
|
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>,
|
|
38
38
|
) {
|
|
39
|
-
return constants.l1GenesisTime + slot * BigInt(constants.slotDuration);
|
|
39
|
+
return constants.l1GenesisTime + BigInt(slot) * BigInt(constants.slotDuration);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/** Returns the slot number for a given timestamp. */
|
|
43
|
-
export function getSlotAtTimestamp(
|
|
44
|
-
|
|
43
|
+
export function getSlotAtTimestamp(
|
|
44
|
+
ts: bigint,
|
|
45
|
+
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>,
|
|
46
|
+
): SlotNumber {
|
|
47
|
+
return ts < constants.l1GenesisTime
|
|
48
|
+
? SlotNumber.ZERO
|
|
49
|
+
: SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
/** Returns the epoch number for a given timestamp. */
|
|
@@ -53,17 +58,17 @@ export function getEpochNumberAtTimestamp(
|
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
/** Returns the epoch number for a given slot. */
|
|
56
|
-
export function getEpochAtSlot(slot:
|
|
57
|
-
return EpochNumber.fromBigInt(slot / BigInt(constants.epochDuration));
|
|
61
|
+
export function getEpochAtSlot(slot: SlotNumber, constants: Pick<L1RollupConstants, 'epochDuration'>): EpochNumber {
|
|
62
|
+
return EpochNumber.fromBigInt(BigInt(slot) / BigInt(constants.epochDuration));
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
/** Returns the range of L2 slots (inclusive) for a given epoch number. */
|
|
61
66
|
export function getSlotRangeForEpoch(
|
|
62
67
|
epochNumber: EpochNumber,
|
|
63
68
|
constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
64
|
-
): [
|
|
65
|
-
const startSlot =
|
|
66
|
-
return [startSlot, startSlot +
|
|
69
|
+
): [SlotNumber, SlotNumber] {
|
|
70
|
+
const startSlot = SlotNumber(epochNumber * constants.epochDuration);
|
|
71
|
+
return [startSlot, SlotNumber(startSlot + constants.epochDuration - 1)];
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
/**
|
|
@@ -77,9 +82,9 @@ export function getTimestampRangeForEpoch(
|
|
|
77
82
|
const [startSlot, endSlot] = getSlotRangeForEpoch(epochNumber, constants);
|
|
78
83
|
const ethereumSlotsPerL2Slot = constants.slotDuration / constants.ethereumSlotDuration;
|
|
79
84
|
return [
|
|
80
|
-
constants.l1GenesisTime + startSlot * BigInt(constants.slotDuration),
|
|
85
|
+
constants.l1GenesisTime + BigInt(startSlot) * BigInt(constants.slotDuration),
|
|
81
86
|
constants.l1GenesisTime +
|
|
82
|
-
endSlot * BigInt(constants.slotDuration) +
|
|
87
|
+
BigInt(endSlot) * BigInt(constants.slotDuration) +
|
|
83
88
|
BigInt((ethereumSlotsPerL2Slot - 1) * constants.ethereumSlotDuration),
|
|
84
89
|
];
|
|
85
90
|
}
|
|
@@ -123,8 +128,8 @@ export function getProofSubmissionDeadlineTimestamp(
|
|
|
123
128
|
|
|
124
129
|
/** Returns the timestamp to start building a block for a given L2 slot. Computed as the start timestamp of the slot minus one L1 slot duration. */
|
|
125
130
|
export function getSlotStartBuildTimestamp(
|
|
126
|
-
slotNumber:
|
|
131
|
+
slotNumber: SlotNumber,
|
|
127
132
|
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>,
|
|
128
133
|
): number {
|
|
129
|
-
return Number(constants.l1GenesisTime) +
|
|
134
|
+
return Number(constants.l1GenesisTime) + slotNumber * constants.slotDuration - constants.ethereumSlotDuration;
|
|
130
135
|
}
|
|
@@ -94,7 +94,7 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
94
94
|
getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
95
95
|
getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
|
|
96
96
|
getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
|
|
97
|
-
getL2SlotNumber: z.function().args().returns(schemas.
|
|
97
|
+
getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
|
|
98
98
|
getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
|
|
99
99
|
getBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(L2Block.schema)),
|
|
100
100
|
getBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PUBLIC_DATA_TREE_HEIGHT,
|
|
8
8
|
} from '@aztec/constants';
|
|
9
9
|
import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
|
|
10
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
10
11
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
11
12
|
import type { Fr } from '@aztec/foundation/fields';
|
|
12
13
|
import { createSafeJsonRpcClient, makeFetch } from '@aztec/foundation/json-rpc/client';
|
|
@@ -15,7 +16,7 @@ import { MembershipWitness, SiblingPath } from '@aztec/foundation/trees';
|
|
|
15
16
|
import { z } from 'zod';
|
|
16
17
|
|
|
17
18
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
18
|
-
import { type
|
|
19
|
+
import { type DataInBlock, inBlockSchemaFor } from '../block/in_block.js';
|
|
19
20
|
import { L2Block } from '../block/l2_block.js';
|
|
20
21
|
import { type L2BlockNumber, L2BlockNumberSchema } from '../block/l2_block_number.js';
|
|
21
22
|
import { type L2BlockSource, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
@@ -90,7 +91,7 @@ export interface AztecNode
|
|
|
90
91
|
blockNumber: L2BlockNumber,
|
|
91
92
|
treeId: MerkleTreeId,
|
|
92
93
|
leafValues: Fr[],
|
|
93
|
-
): Promise<(
|
|
94
|
+
): Promise<(DataInBlock<bigint> | undefined)[]>;
|
|
94
95
|
|
|
95
96
|
/**
|
|
96
97
|
* Returns a sibling path for the given index in the nullifier tree.
|
|
@@ -278,6 +279,12 @@ export interface AztecNode
|
|
|
278
279
|
*/
|
|
279
280
|
getCurrentBaseFees(): Promise<GasFees>;
|
|
280
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Method to fetch the current max priority fee of txs in the mempool.
|
|
284
|
+
* @returns The current max priority fees.
|
|
285
|
+
*/
|
|
286
|
+
getMaxPriorityFees(): Promise<GasFees>;
|
|
287
|
+
|
|
281
288
|
/**
|
|
282
289
|
* Method to fetch the version of the package.
|
|
283
290
|
* @returns The node package version
|
|
@@ -434,8 +441,8 @@ export interface AztecNode
|
|
|
434
441
|
/** Returns stats for a single validator if enabled. */
|
|
435
442
|
getValidatorStats(
|
|
436
443
|
validatorAddress: EthAddress,
|
|
437
|
-
fromSlot?:
|
|
438
|
-
toSlot?:
|
|
444
|
+
fromSlot?: SlotNumber,
|
|
445
|
+
toSlot?: SlotNumber,
|
|
439
446
|
): Promise<SingleValidatorStats | undefined>;
|
|
440
447
|
|
|
441
448
|
/**
|
|
@@ -575,6 +582,8 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
575
582
|
|
|
576
583
|
getCurrentBaseFees: z.function().returns(GasFees.schema),
|
|
577
584
|
|
|
585
|
+
getMaxPriorityFees: z.function().returns(GasFees.schema),
|
|
586
|
+
|
|
578
587
|
getNodeVersion: z.function().returns(z.string()),
|
|
579
588
|
|
|
580
589
|
getVersion: z.function().returns(z.number()),
|
|
@@ -636,7 +645,7 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
636
645
|
|
|
637
646
|
getValidatorStats: z
|
|
638
647
|
.function()
|
|
639
|
-
.args(schemas.EthAddress, optional(schemas.
|
|
648
|
+
.args(schemas.EthAddress, optional(schemas.SlotNumber), optional(schemas.SlotNumber))
|
|
640
649
|
.returns(SingleValidatorStatsSchema.optional()),
|
|
641
650
|
|
|
642
651
|
simulatePublicCalls: z.function().args(Tx.schema, optional(z.boolean())).returns(PublicSimulationOutput.schema),
|
package/src/interfaces/p2p.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
|
|
3
5
|
import { BlockAttestation } from '../p2p/block_attestation.js';
|
|
@@ -56,7 +58,7 @@ export interface P2PApiWithAttestations extends P2PApiWithoutAttestations {
|
|
|
56
58
|
* @param proposalId - the proposal id to query, or undefined to query all proposals for the slot
|
|
57
59
|
* @returns BlockAttestations
|
|
58
60
|
*/
|
|
59
|
-
getAttestationsForSlot(slot:
|
|
61
|
+
getAttestationsForSlot(slot: SlotNumber, proposalId?: string): Promise<BlockAttestation[]>;
|
|
60
62
|
|
|
61
63
|
/** Deletes a given attestation manually from the p2p client attestation pool. */
|
|
62
64
|
deleteAttestation(attestation: BlockAttestation): Promise<void>;
|
|
@@ -78,7 +80,7 @@ export type P2PApiFull<T extends P2PClientType = P2PClientType.Full> = T extends
|
|
|
78
80
|
export const P2PApiSchema: ApiSchemaFor<P2PApi> = {
|
|
79
81
|
getAttestationsForSlot: z
|
|
80
82
|
.function()
|
|
81
|
-
.args(schemas.
|
|
83
|
+
.args(schemas.SlotNumber, optional(z.string()))
|
|
82
84
|
.returns(z.array(BlockAttestation.schema)),
|
|
83
85
|
getPendingTxs: z
|
|
84
86
|
.function()
|
|
@@ -5,7 +5,7 @@ import { Fr } from '@aztec/foundation/fields';
|
|
|
5
5
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
6
6
|
import type { SequencerConfig, SlasherConfig } from '@aztec/stdlib/interfaces/server';
|
|
7
7
|
import type { BlockAttestation, BlockProposal, BlockProposalOptions } from '@aztec/stdlib/p2p';
|
|
8
|
-
import type {
|
|
8
|
+
import type { Tx } from '@aztec/stdlib/tx';
|
|
9
9
|
|
|
10
10
|
import type { PeerId } from '@libp2p/interface';
|
|
11
11
|
import { z } from 'zod';
|
|
@@ -83,7 +83,6 @@ export interface Validator {
|
|
|
83
83
|
blockNumber: number,
|
|
84
84
|
header: CheckpointHeader,
|
|
85
85
|
archive: Fr,
|
|
86
|
-
stateReference: StateReference,
|
|
87
86
|
txs: Tx[],
|
|
88
87
|
proposerAddress: EthAddress | undefined,
|
|
89
88
|
options: BlockProposalOptions,
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FUNCTION_TREE_HEIGHT,
|
|
3
|
+
MAX_CONTRACT_CLASS_LOGS_PER_CALL,
|
|
4
|
+
MAX_ENQUEUED_CALLS_PER_CALL,
|
|
5
|
+
MAX_L2_TO_L1_MSGS_PER_CALL,
|
|
6
|
+
MAX_NOTE_HASHES_PER_CALL,
|
|
7
|
+
MAX_NOTE_HASH_READ_REQUESTS_PER_CALL,
|
|
8
|
+
MAX_NULLIFIERS_PER_CALL,
|
|
9
|
+
MAX_NULLIFIER_READ_REQUESTS_PER_CALL,
|
|
10
|
+
MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL,
|
|
11
|
+
MAX_PRIVATE_LOGS_PER_CALL,
|
|
12
|
+
PUBLIC_DATA_TREE_HEIGHT,
|
|
13
|
+
TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL,
|
|
14
|
+
UPDATES_VALUE_SIZE,
|
|
15
|
+
} from '@aztec/constants';
|
|
2
16
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
17
|
+
import { BufferReader, type Tuple, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
18
|
import { MembershipWitness } from '@aztec/foundation/trees';
|
|
5
19
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
6
20
|
|
|
7
21
|
import { DelayedPublicMutableValues } from '../delayed_public_mutable/delayed_public_mutable_values.js';
|
|
8
22
|
import { PublicKeys } from '../keys/public_keys.js';
|
|
9
23
|
import { PublicDataTreeLeafPreimage } from '../trees/index.js';
|
|
24
|
+
import type { UInt32 } from '../types/shared.js';
|
|
10
25
|
import { VerificationKeyAsFields } from '../vks/verification_key.js';
|
|
11
26
|
import { PrivateCircuitPublicInputs } from './private_circuit_public_inputs.js';
|
|
12
27
|
|
|
@@ -29,6 +44,11 @@ export class PrivateCallData {
|
|
|
29
44
|
* Hints for the validation of the vk
|
|
30
45
|
*/
|
|
31
46
|
public verificationKeyHints: PrivateVerificationKeyHints,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Hints for validating the uniqueness of the side effects.
|
|
50
|
+
*/
|
|
51
|
+
public sideEffectUniquenessHints: SideEffectUniquenessHints,
|
|
32
52
|
) {}
|
|
33
53
|
|
|
34
54
|
/**
|
|
@@ -37,7 +57,7 @@ export class PrivateCallData {
|
|
|
37
57
|
* @returns The array.
|
|
38
58
|
*/
|
|
39
59
|
static getFields(fields: FieldsOf<PrivateCallData>) {
|
|
40
|
-
return [fields.publicInputs, fields.vk, fields.verificationKeyHints] as const;
|
|
60
|
+
return [fields.publicInputs, fields.vk, fields.verificationKeyHints, fields.sideEffectUniquenessHints] as const;
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
static from(fields: FieldsOf<PrivateCallData>): PrivateCallData {
|
|
@@ -63,6 +83,7 @@ export class PrivateCallData {
|
|
|
63
83
|
reader.readObject(PrivateCircuitPublicInputs),
|
|
64
84
|
reader.readObject(VerificationKeyAsFields),
|
|
65
85
|
reader.readObject(PrivateVerificationKeyHints),
|
|
86
|
+
reader.readObject(SideEffectUniquenessHints),
|
|
66
87
|
);
|
|
67
88
|
}
|
|
68
89
|
}
|
|
@@ -180,3 +201,109 @@ export class UpdatedClassIdHints {
|
|
|
180
201
|
);
|
|
181
202
|
}
|
|
182
203
|
}
|
|
204
|
+
|
|
205
|
+
export class SideEffectUniquenessHints {
|
|
206
|
+
constructor(
|
|
207
|
+
public sideEffectRanges: Tuple<SideEffectCounterRange, typeof TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL>,
|
|
208
|
+
public noteHashReadRequestIndices: Tuple<UInt32, typeof MAX_NOTE_HASH_READ_REQUESTS_PER_CALL>,
|
|
209
|
+
public nullifierReadRequestIndices: Tuple<UInt32, typeof MAX_NULLIFIER_READ_REQUESTS_PER_CALL>,
|
|
210
|
+
public noteHashesIndices: Tuple<UInt32, typeof MAX_NOTE_HASHES_PER_CALL>,
|
|
211
|
+
public nullifiersIndices: Tuple<UInt32, typeof MAX_NULLIFIERS_PER_CALL>,
|
|
212
|
+
public privateCallRequestsIndices: Tuple<UInt32, typeof MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL>,
|
|
213
|
+
public publicCallRequestsIndices: Tuple<UInt32, typeof MAX_ENQUEUED_CALLS_PER_CALL>,
|
|
214
|
+
public l2ToL1MsgsIndices: Tuple<UInt32, typeof MAX_L2_TO_L1_MSGS_PER_CALL>,
|
|
215
|
+
public privateLogsIndices: Tuple<UInt32, typeof MAX_PRIVATE_LOGS_PER_CALL>,
|
|
216
|
+
public contractClassLogsHashesIndices: Tuple<UInt32, typeof MAX_CONTRACT_CLASS_LOGS_PER_CALL>,
|
|
217
|
+
) {}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Serialize into a field array. Low-level utility.
|
|
221
|
+
* @param fields - Object with fields.
|
|
222
|
+
* @returns The array.
|
|
223
|
+
*/
|
|
224
|
+
static getFields(fields: FieldsOf<SideEffectUniquenessHints>) {
|
|
225
|
+
return [
|
|
226
|
+
fields.sideEffectRanges,
|
|
227
|
+
fields.noteHashReadRequestIndices,
|
|
228
|
+
fields.nullifierReadRequestIndices,
|
|
229
|
+
fields.noteHashesIndices,
|
|
230
|
+
fields.nullifiersIndices,
|
|
231
|
+
fields.privateCallRequestsIndices,
|
|
232
|
+
fields.publicCallRequestsIndices,
|
|
233
|
+
fields.l2ToL1MsgsIndices,
|
|
234
|
+
fields.privateLogsIndices,
|
|
235
|
+
fields.contractClassLogsHashesIndices,
|
|
236
|
+
] as const;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
static from(fields: FieldsOf<SideEffectUniquenessHints>): SideEffectUniquenessHints {
|
|
240
|
+
return new SideEffectUniquenessHints(...SideEffectUniquenessHints.getFields(fields));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Serialize this as a buffer.
|
|
245
|
+
* @returns The buffer.
|
|
246
|
+
*/
|
|
247
|
+
toBuffer(): Buffer {
|
|
248
|
+
return serializeToBuffer(...SideEffectUniquenessHints.getFields(this));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Deserializes from a buffer or reader.
|
|
253
|
+
* @param buffer - Buffer or reader to read from.
|
|
254
|
+
* @returns The deserialized instance.
|
|
255
|
+
*/
|
|
256
|
+
static fromBuffer(buffer: Buffer | BufferReader): SideEffectUniquenessHints {
|
|
257
|
+
const reader = BufferReader.asReader(buffer);
|
|
258
|
+
return new SideEffectUniquenessHints(
|
|
259
|
+
reader.readArray(TOTAL_COUNTED_SIDE_EFFECTS_PER_CALL, SideEffectCounterRange),
|
|
260
|
+
reader.readNumbers(MAX_NOTE_HASH_READ_REQUESTS_PER_CALL),
|
|
261
|
+
reader.readNumbers(MAX_NULLIFIER_READ_REQUESTS_PER_CALL),
|
|
262
|
+
reader.readNumbers(MAX_NOTE_HASHES_PER_CALL),
|
|
263
|
+
reader.readNumbers(MAX_NULLIFIERS_PER_CALL),
|
|
264
|
+
reader.readNumbers(MAX_PRIVATE_CALL_STACK_LENGTH_PER_CALL),
|
|
265
|
+
reader.readNumbers(MAX_ENQUEUED_CALLS_PER_CALL),
|
|
266
|
+
reader.readNumbers(MAX_L2_TO_L1_MSGS_PER_CALL),
|
|
267
|
+
reader.readNumbers(MAX_PRIVATE_LOGS_PER_CALL),
|
|
268
|
+
reader.readNumbers(MAX_CONTRACT_CLASS_LOGS_PER_CALL),
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export class SideEffectCounterRange {
|
|
274
|
+
constructor(
|
|
275
|
+
public start: UInt32,
|
|
276
|
+
public end: UInt32,
|
|
277
|
+
public sideEffectGlobalIndex: UInt32,
|
|
278
|
+
) {}
|
|
279
|
+
|
|
280
|
+
static getFields(fields: FieldsOf<SideEffectCounterRange>) {
|
|
281
|
+
return [fields.start, fields.end, fields.sideEffectGlobalIndex] as const;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
static from(fields: FieldsOf<SideEffectCounterRange>): SideEffectCounterRange {
|
|
285
|
+
return new SideEffectCounterRange(...SideEffectCounterRange.getFields(fields));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
static empty(): SideEffectCounterRange {
|
|
289
|
+
return new SideEffectCounterRange(0, 0, 0);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Serialize this as a buffer.
|
|
294
|
+
* @returns The buffer.
|
|
295
|
+
*/
|
|
296
|
+
toBuffer(): Buffer {
|
|
297
|
+
return serializeToBuffer(...SideEffectCounterRange.getFields(this));
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Deserializes from a buffer or reader.
|
|
302
|
+
* @param buffer - Buffer or reader to read from.
|
|
303
|
+
* @returns The deserialized instance.
|
|
304
|
+
*/
|
|
305
|
+
static fromBuffer(buffer: Buffer | BufferReader): SideEffectCounterRange {
|
|
306
|
+
const reader = BufferReader.asReader(buffer);
|
|
307
|
+
return new SideEffectCounterRange(reader.readNumber(), reader.readNumber(), reader.readNumber());
|
|
308
|
+
}
|
|
309
|
+
}
|