@aztec/stdlib 3.0.0-nightly.20250917 → 3.0.0-nightly.20250918
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 +6 -0
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +6 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.js +11 -6
- package/dest/avm/avm_proving_request.d.ts +7 -0
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/body.d.ts +4 -1
- package/dest/block/body.d.ts.map +1 -1
- package/dest/block/body.js +16 -5
- package/dest/block/index.d.ts +1 -0
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -0
- package/dest/block/l2_block.d.ts +8 -5
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +14 -7
- package/dest/block/l2_block_code_to_purge.d.ts +3 -14
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +23 -13
- package/dest/block/l2_block_header.d.ts +100 -0
- package/dest/block/l2_block_header.d.ts.map +1 -0
- package/dest/block/l2_block_header.js +146 -0
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +1 -1
- package/dest/block/published_l2_block.d.ts +2 -2
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +1 -3
- package/dest/interfaces/block-builder.d.ts +1 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/epoch-prover.d.ts +25 -8
- package/dest/interfaces/epoch-prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +170 -61
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +101 -39
- package/dest/interfaces/server_circuit_prover.d.ts +19 -16
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +3 -2
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +4 -4
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +7 -7
- package/dest/kernel/private_context_inputs.d.ts +2 -2
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +4 -4
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +1 -1
- package/dest/p2p/consensus_payload.d.ts +7 -6
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +7 -6
- package/dest/parity/root_parity_input.d.ts +1 -1
- package/dest/proofs/proof_data.d.ts +1 -1
- package/dest/proofs/proof_data.d.ts.map +1 -1
- package/dest/proofs/proof_data.js +2 -2
- package/dest/proofs/proving_request_type.d.ts +13 -8
- package/dest/proofs/proving_request_type.d.ts.map +1 -1
- package/dest/proofs/proving_request_type.js +13 -8
- package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts +1 -1
- package/dest/rollup/base_or_merge_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/base_or_merge_rollup_public_inputs.js +1 -1
- package/dest/rollup/base_rollup_hints.d.ts +12 -3
- package/dest/rollup/base_rollup_hints.d.ts.map +1 -1
- package/dest/rollup/base_rollup_hints.js +11 -5
- package/dest/rollup/block_constant_data.d.ts +20 -6
- package/dest/rollup/block_constant_data.d.ts.map +1 -1
- package/dest/rollup/block_constant_data.js +15 -7
- package/dest/rollup/block_merge_rollup.d.ts +10 -9
- package/dest/rollup/block_merge_rollup.d.ts.map +1 -1
- package/dest/rollup/block_merge_rollup.js +14 -13
- package/dest/rollup/block_rollup_public_inputs.d.ts +124 -0
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -0
- package/dest/rollup/block_rollup_public_inputs.js +85 -0
- package/dest/rollup/block_root_rollup.d.ts +148 -184
- package/dest/rollup/block_root_rollup.d.ts.map +1 -1
- package/dest/rollup/block_root_rollup.js +211 -260
- package/dest/rollup/checkpoint_constant_data.d.ts +54 -0
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -0
- package/dest/rollup/checkpoint_constant_data.js +55 -0
- package/dest/{tx/proposed_block_header.d.ts → rollup/checkpoint_header.d.ts} +11 -12
- package/dest/rollup/checkpoint_header.d.ts.map +1 -0
- package/dest/{tx/proposed_block_header.js → rollup/checkpoint_header.js} +9 -9
- package/dest/rollup/checkpoint_merge_rollup.d.ts +30 -0
- package/dest/rollup/checkpoint_merge_rollup.d.ts.map +1 -0
- package/dest/rollup/checkpoint_merge_rollup.js +37 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +105 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.js +105 -0
- package/dest/rollup/checkpoint_root_rollup.d.ts +117 -0
- package/dest/rollup/checkpoint_root_rollup.d.ts.map +1 -0
- package/dest/rollup/checkpoint_root_rollup.js +178 -0
- package/dest/rollup/epoch_constant_data.d.ts +19 -2
- package/dest/rollup/epoch_constant_data.d.ts.map +1 -1
- package/dest/rollup/epoch_constant_data.js +20 -7
- package/dest/rollup/index.d.ts +8 -5
- package/dest/rollup/index.d.ts.map +1 -1
- package/dest/rollup/index.js +8 -5
- package/dest/rollup/rollup_proof_data.d.ts +10 -0
- package/dest/rollup/rollup_proof_data.d.ts.map +1 -0
- package/dest/rollup/rollup_proof_data.js +1 -0
- package/dest/rollup/root_rollup.d.ts +26 -23
- package/dest/rollup/root_rollup.d.ts.map +1 -1
- package/dest/rollup/root_rollup.js +28 -39
- package/dest/stats/stats.d.ts +1 -1
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +15 -40
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +70 -78
- package/dest/tests/mocks.d.ts +3 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -3
- package/dest/tx/block_header.d.ts +12 -13
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +16 -21
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +0 -1
- package/dest/tx/index.d.ts +0 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_execution_result.d.ts +2 -2
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -3
- package/dest/tx/tx_constant_data.d.ts +4 -4
- package/dest/tx/tx_constant_data.d.ts.map +1 -1
- package/dest/tx/tx_constant_data.js +6 -6
- package/dest/tx/tx_effect.d.ts +0 -3
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +2 -7
- package/package.json +8 -8
- package/src/avm/avm_circuit_public_inputs.ts +10 -0
- package/src/block/body.ts +23 -6
- package/src/block/index.ts +1 -0
- package/src/block/l2_block.ts +18 -8
- package/src/block/l2_block_code_to_purge.ts +30 -31
- package/src/block/l2_block_header.ts +232 -0
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +1 -1
- package/src/block/test/l2_tips_store_test_suite.ts +1 -2
- package/src/interfaces/block-builder.ts +1 -6
- package/src/interfaces/epoch-prover.ts +34 -10
- package/src/interfaces/proving-job.ts +166 -51
- package/src/interfaces/server_circuit_prover.ts +65 -29
- package/src/interfaces/validator.ts +3 -2
- package/src/kernel/private_circuit_public_inputs.ts +5 -5
- package/src/kernel/private_context_inputs.ts +2 -2
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +1 -1
- package/src/p2p/consensus_payload.ts +8 -7
- package/src/proofs/proof_data.ts +1 -6
- package/src/proofs/proving_request_type.ts +8 -3
- package/src/rollup/base_or_merge_rollup_public_inputs.ts +1 -1
- package/src/rollup/base_rollup_hints.ts +9 -1
- package/src/rollup/block_constant_data.ts +13 -3
- package/src/rollup/block_merge_rollup.ts +13 -11
- package/src/rollup/block_rollup_public_inputs.ts +123 -0
- package/src/rollup/block_root_rollup.ts +209 -264
- package/src/rollup/checkpoint_constant_data.ts +84 -0
- package/src/{tx/proposed_block_header.ts → rollup/checkpoint_header.ts} +16 -17
- package/src/rollup/checkpoint_merge_rollup.ts +50 -0
- package/src/rollup/{block_root_or_block_merge_public_inputs.ts → checkpoint_rollup_public_inputs.ts} +26 -52
- package/src/rollup/checkpoint_root_rollup.ts +216 -0
- package/src/rollup/epoch_constant_data.ts +32 -8
- package/src/rollup/index.ts +8 -5
- package/src/rollup/rollup_proof_data.ts +12 -0
- package/src/rollup/root_rollup.ts +30 -41
- package/src/stats/stats.ts +8 -3
- package/src/tests/factories.ts +124 -135
- package/src/tests/mocks.ts +6 -13
- package/src/tx/block_header.ts +17 -32
- package/src/tx/global_variables.ts +0 -1
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +3 -3
- package/src/tx/tx_constant_data.ts +4 -4
- package/src/tx/tx_effect.ts +2 -7
- package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts +0 -134
- package/dest/rollup/block_root_or_block_merge_public_inputs.d.ts.map +0 -1
- package/dest/rollup/block_root_or_block_merge_public_inputs.js +0 -125
- package/dest/rollup/empty_block_root_rollup_inputs.d.ts +0 -51
- package/dest/rollup/empty_block_root_rollup_inputs.d.ts.map +0 -1
- package/dest/rollup/empty_block_root_rollup_inputs.js +0 -65
- package/dest/rollup/padding_block_root_rollup_inputs.d.ts +0 -20
- package/dest/rollup/padding_block_root_rollup_inputs.d.ts.map +0 -1
- package/dest/rollup/padding_block_root_rollup_inputs.js +0 -39
- package/dest/rollup/previous_rollup_block_data.d.ts +0 -47
- package/dest/rollup/previous_rollup_block_data.d.ts.map +0 -1
- package/dest/rollup/previous_rollup_block_data.js +0 -37
- package/dest/tx/proposed_block_header.d.ts.map +0 -1
- package/src/rollup/empty_block_root_rollup_inputs.ts +0 -80
- package/src/rollup/padding_block_root_rollup_inputs.ts +0 -47
- package/src/rollup/previous_rollup_block_data.ts +0 -48
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
2
3
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Makes header.
|
|
7
|
-
*/
|
|
8
|
-
export declare function makeHeader(seed?: number, blockNumber?: number, slotNumber?: number, inHash?: Fr): BlockHeader;
|
|
4
|
+
import { L2BlockHeader } from './l2_block_header.js';
|
|
5
|
+
export declare function makeL2BlockHeader(seed?: number, blockNumber?: number, slotNumber?: number, overrides?: Partial<FieldsOf<L2BlockHeader>>, inHash?: Fr): L2BlockHeader;
|
|
9
6
|
/**
|
|
10
7
|
* Makes arbitrary append only tree snapshot.
|
|
11
8
|
* @param seed - The seed to use for generating the append only tree snapshot.
|
|
12
9
|
* @returns An append only tree snapshot.
|
|
13
10
|
*/
|
|
14
11
|
export declare function makeAppendOnlyTreeSnapshot(seed?: number): AppendOnlyTreeSnapshot;
|
|
15
|
-
/**
|
|
16
|
-
* Makes global variables.
|
|
17
|
-
* @param seed - The seed to use for generating the global variables.
|
|
18
|
-
* @param blockNumber - The block number to use for generating the global variables.
|
|
19
|
-
* If blockNumber is undefined, it will be set to seed + 2.
|
|
20
|
-
* @returns Global variables.
|
|
21
|
-
*/
|
|
22
|
-
export declare function makeGlobalVariables(seed?: number, blockNumber?: number | undefined, slotNumber?: number | undefined): GlobalVariables;
|
|
23
12
|
//# sourceMappingURL=l2_block_code_to_purge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l2_block_code_to_purge.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_code_to_purge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"l2_block_code_to_purge.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_code_to_purge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAK/E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,wBAAgB,iBAAiB,CAC/B,IAAI,SAAI,EACR,WAAW,CAAC,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,SAAS,GAAE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAM,EAChD,MAAM,CAAC,EAAE,EAAE,iBAcZ;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,SAAI,GAAG,sBAAsB,CAE3E"}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
import { compact } from '@aztec/foundation/collection';
|
|
1
2
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
5
|
import { GasFees } from '../gas/gas_fees.js';
|
|
5
6
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
6
|
-
import { BlockHeader } from '../tx/block_header.js';
|
|
7
7
|
import { ContentCommitment } from '../tx/content_commitment.js';
|
|
8
8
|
import { GlobalVariables } from '../tx/global_variables.js';
|
|
9
9
|
import { PartialStateReference } from '../tx/partial_state_reference.js';
|
|
10
10
|
import { StateReference } from '../tx/state_reference.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
import { L2BlockHeader } from './l2_block_header.js';
|
|
12
|
+
export function makeL2BlockHeader(seed = 0, blockNumber, slotNumber, overrides = {}, inHash) {
|
|
13
|
+
return new L2BlockHeader(makeAppendOnlyTreeSnapshot(seed + 0x100), overrides?.contentCommitment ?? makeContentCommitment(seed + 0x200, inHash), overrides?.state ?? makeStateReference(seed + 0x600), makeGlobalVariables(seed += 0x700, {
|
|
14
|
+
...blockNumber ? {
|
|
15
|
+
blockNumber
|
|
16
|
+
} : {},
|
|
17
|
+
...slotNumber ? {
|
|
18
|
+
slotNumber: new Fr(slotNumber)
|
|
19
|
+
} : {}
|
|
20
|
+
}), new Fr(seed + 0x800), new Fr(seed + 0x900), new Fr(seed + 0xa00));
|
|
15
21
|
}
|
|
16
22
|
/**
|
|
17
23
|
* Makes arbitrary append only tree snapshot.
|
|
@@ -39,12 +45,16 @@ import { StateReference } from '../tx/state_reference.js';
|
|
|
39
45
|
*/ function makePartialStateReference(seed = 0) {
|
|
40
46
|
return new PartialStateReference(makeAppendOnlyTreeSnapshot(seed), makeAppendOnlyTreeSnapshot(seed + 1), makeAppendOnlyTreeSnapshot(seed + 2));
|
|
41
47
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
function makeGlobalVariables(seed = 1, overrides = {}) {
|
|
49
|
+
return GlobalVariables.from({
|
|
50
|
+
chainId: new Fr(seed),
|
|
51
|
+
version: new Fr(seed + 1),
|
|
52
|
+
blockNumber: seed + 2,
|
|
53
|
+
slotNumber: new Fr(seed + 3),
|
|
54
|
+
timestamp: BigInt(seed + 4),
|
|
55
|
+
coinbase: EthAddress.fromField(new Fr(seed + 5)),
|
|
56
|
+
feeRecipient: AztecAddress.fromField(new Fr(seed + 6)),
|
|
57
|
+
gasFees: new GasFees(seed + 7, seed + 8),
|
|
58
|
+
...compact(overrides)
|
|
59
|
+
});
|
|
50
60
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { type ZodFor } from '@aztec/foundation/schemas';
|
|
3
|
+
import { BufferReader, FieldReader } from '@aztec/foundation/serialize';
|
|
4
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
|
+
import { inspect } from 'util';
|
|
6
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
7
|
+
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
8
|
+
import { BlockHeader, ContentCommitment, GlobalVariables, StateReference } from '../tx/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* TO BE DELETED
|
|
11
|
+
*
|
|
12
|
+
* A header of an L2 block combining the block header and the checkpoint header.
|
|
13
|
+
* This is a temporary workaround to avoid changing too many things before building in chunks is properly implemented.
|
|
14
|
+
* This works for now because we only have one block per checkpoint.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Use BlockHeader or CheckpointHeader instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare class L2BlockHeader {
|
|
19
|
+
/** Snapshot of archive before the block is applied. */
|
|
20
|
+
lastArchive: AppendOnlyTreeSnapshot;
|
|
21
|
+
/** Hash of the body of an L2 block. */
|
|
22
|
+
contentCommitment: ContentCommitment;
|
|
23
|
+
/** State reference. */
|
|
24
|
+
state: StateReference;
|
|
25
|
+
/** Global variables of an L2 block. */
|
|
26
|
+
globalVariables: GlobalVariables;
|
|
27
|
+
/** Total fees in the block, computed by the root rollup circuit */
|
|
28
|
+
totalFees: Fr;
|
|
29
|
+
/** Total mana used in the block, computed by the root rollup circuit */
|
|
30
|
+
totalManaUsed: Fr;
|
|
31
|
+
/** Hash of the sponge blob of the block. */
|
|
32
|
+
spongeBlobHash: Fr;
|
|
33
|
+
constructor(
|
|
34
|
+
/** Snapshot of archive before the block is applied. */
|
|
35
|
+
lastArchive: AppendOnlyTreeSnapshot,
|
|
36
|
+
/** Hash of the body of an L2 block. */
|
|
37
|
+
contentCommitment: ContentCommitment,
|
|
38
|
+
/** State reference. */
|
|
39
|
+
state: StateReference,
|
|
40
|
+
/** Global variables of an L2 block. */
|
|
41
|
+
globalVariables: GlobalVariables,
|
|
42
|
+
/** Total fees in the block, computed by the root rollup circuit */
|
|
43
|
+
totalFees: Fr,
|
|
44
|
+
/** Total mana used in the block, computed by the root rollup circuit */
|
|
45
|
+
totalManaUsed: Fr,
|
|
46
|
+
/** Hash of the sponge blob of the block. */
|
|
47
|
+
spongeBlobHash: Fr);
|
|
48
|
+
static get schema(): ZodFor<L2BlockHeader>;
|
|
49
|
+
static getFields(fields: FieldsOf<L2BlockHeader>): readonly [AppendOnlyTreeSnapshot, ContentCommitment, StateReference, GlobalVariables, Fr, Fr, Fr];
|
|
50
|
+
static from(fields: FieldsOf<L2BlockHeader>): L2BlockHeader;
|
|
51
|
+
getSlot(): bigint;
|
|
52
|
+
getBlockNumber(): number;
|
|
53
|
+
getSize(): number;
|
|
54
|
+
toBuffer(): Buffer<ArrayBufferLike>;
|
|
55
|
+
toFields(): Fr[];
|
|
56
|
+
clone(): L2BlockHeader;
|
|
57
|
+
static fromBuffer(buffer: Buffer | BufferReader): L2BlockHeader;
|
|
58
|
+
static fromFields(fields: Fr[] | FieldReader): L2BlockHeader;
|
|
59
|
+
static empty(fields?: Partial<FieldsOf<L2BlockHeader>>): L2BlockHeader;
|
|
60
|
+
isEmpty(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Serializes this instance into a string.
|
|
63
|
+
* @returns Encoded string.
|
|
64
|
+
*/
|
|
65
|
+
toString(): `0x${string}`;
|
|
66
|
+
static fromString(str: string): L2BlockHeader;
|
|
67
|
+
toCheckpointHeader(): CheckpointHeader;
|
|
68
|
+
toBlockHeader(): BlockHeader;
|
|
69
|
+
toInspect(): {
|
|
70
|
+
lastArchive: `0x${string}`;
|
|
71
|
+
contentCommitment: {
|
|
72
|
+
blobsHash: `0x${string}`;
|
|
73
|
+
inHash: `0x${string}`;
|
|
74
|
+
outHash: `0x${string}`;
|
|
75
|
+
};
|
|
76
|
+
state: {
|
|
77
|
+
l1ToL2MessageTree: `0x${string}`;
|
|
78
|
+
noteHashTree: `0x${string}`;
|
|
79
|
+
nullifierTree: `0x${string}`;
|
|
80
|
+
publicDataTree: `0x${string}`;
|
|
81
|
+
};
|
|
82
|
+
globalVariables: {
|
|
83
|
+
chainId: number;
|
|
84
|
+
version: number;
|
|
85
|
+
blockNumber: number;
|
|
86
|
+
slotNumber: number;
|
|
87
|
+
timestamp: bigint;
|
|
88
|
+
coinbase: `0x${string}`;
|
|
89
|
+
feeRecipient: `0x${string}`;
|
|
90
|
+
feePerDaGas: number;
|
|
91
|
+
feePerL2Gas: number;
|
|
92
|
+
};
|
|
93
|
+
totalFees: bigint;
|
|
94
|
+
totalManaUsed: bigint;
|
|
95
|
+
spongeBlobHash: `0x${string}`;
|
|
96
|
+
};
|
|
97
|
+
[inspect.custom](): string;
|
|
98
|
+
equals(other: this): boolean;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=l2_block_header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"l2_block_header.d.ts","sourceRoot":"","sources":["../../src/block/l2_block_header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAE9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEjG;;;;;;;;GAQG;AACH,qBAAa,aAAa;IAEtB,uDAAuD;IAChD,WAAW,EAAE,sBAAsB;IAC1C,uCAAuC;IAChC,iBAAiB,EAAE,iBAAiB;IAC3C,uBAAuB;IAChB,KAA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
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
3
|
+
import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from '@aztec/foundation/serialize';
|
|
4
|
+
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
5
|
+
import { inspect } from 'util';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
8
|
+
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
9
|
+
import { BlockHeader, ContentCommitment, GlobalVariables, StateReference } from '../tx/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* TO BE DELETED
|
|
12
|
+
*
|
|
13
|
+
* A header of an L2 block combining the block header and the checkpoint header.
|
|
14
|
+
* This is a temporary workaround to avoid changing too many things before building in chunks is properly implemented.
|
|
15
|
+
* This works for now because we only have one block per checkpoint.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Use BlockHeader or CheckpointHeader instead.
|
|
18
|
+
*/ export class L2BlockHeader {
|
|
19
|
+
lastArchive;
|
|
20
|
+
contentCommitment;
|
|
21
|
+
state;
|
|
22
|
+
globalVariables;
|
|
23
|
+
totalFees;
|
|
24
|
+
totalManaUsed;
|
|
25
|
+
spongeBlobHash;
|
|
26
|
+
constructor(/** Snapshot of archive before the block is applied. */ lastArchive, /** Hash of the body of an L2 block. */ contentCommitment, /** State reference. */ state, /** Global variables of an L2 block. */ globalVariables, /** Total fees in the block, computed by the root rollup circuit */ totalFees, /** Total mana used in the block, computed by the root rollup circuit */ totalManaUsed, /** Hash of the sponge blob of the block. */ spongeBlobHash){
|
|
27
|
+
this.lastArchive = lastArchive;
|
|
28
|
+
this.contentCommitment = contentCommitment;
|
|
29
|
+
this.state = state;
|
|
30
|
+
this.globalVariables = globalVariables;
|
|
31
|
+
this.totalFees = totalFees;
|
|
32
|
+
this.totalManaUsed = totalManaUsed;
|
|
33
|
+
this.spongeBlobHash = spongeBlobHash;
|
|
34
|
+
}
|
|
35
|
+
static get schema() {
|
|
36
|
+
return z.object({
|
|
37
|
+
lastArchive: AppendOnlyTreeSnapshot.schema,
|
|
38
|
+
contentCommitment: ContentCommitment.schema,
|
|
39
|
+
state: StateReference.schema,
|
|
40
|
+
globalVariables: GlobalVariables.schema,
|
|
41
|
+
totalFees: schemas.Fr,
|
|
42
|
+
totalManaUsed: schemas.Fr,
|
|
43
|
+
spongeBlobHash: schemas.Fr
|
|
44
|
+
}).transform(L2BlockHeader.from);
|
|
45
|
+
}
|
|
46
|
+
static getFields(fields) {
|
|
47
|
+
return [
|
|
48
|
+
fields.lastArchive,
|
|
49
|
+
fields.contentCommitment,
|
|
50
|
+
fields.state,
|
|
51
|
+
fields.globalVariables,
|
|
52
|
+
fields.totalFees,
|
|
53
|
+
fields.totalManaUsed,
|
|
54
|
+
fields.spongeBlobHash
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
static from(fields) {
|
|
58
|
+
return new L2BlockHeader(...L2BlockHeader.getFields(fields));
|
|
59
|
+
}
|
|
60
|
+
getSlot() {
|
|
61
|
+
return this.globalVariables.slotNumber.toBigInt();
|
|
62
|
+
}
|
|
63
|
+
getBlockNumber() {
|
|
64
|
+
return this.globalVariables.blockNumber;
|
|
65
|
+
}
|
|
66
|
+
getSize() {
|
|
67
|
+
return this.lastArchive.getSize() + this.contentCommitment.getSize() + this.state.getSize() + this.globalVariables.getSize() + this.totalFees.size + this.totalManaUsed.size + this.spongeBlobHash.size;
|
|
68
|
+
}
|
|
69
|
+
toBuffer() {
|
|
70
|
+
return serializeToBuffer(...L2BlockHeader.getFields(this));
|
|
71
|
+
}
|
|
72
|
+
toFields() {
|
|
73
|
+
return serializeToFields(...L2BlockHeader.getFields(this));
|
|
74
|
+
}
|
|
75
|
+
clone() {
|
|
76
|
+
return L2BlockHeader.fromBuffer(this.toBuffer());
|
|
77
|
+
}
|
|
78
|
+
static fromBuffer(buffer) {
|
|
79
|
+
const reader = BufferReader.asReader(buffer);
|
|
80
|
+
return new L2BlockHeader(reader.readObject(AppendOnlyTreeSnapshot), reader.readObject(ContentCommitment), reader.readObject(StateReference), reader.readObject(GlobalVariables), reader.readObject(Fr), reader.readObject(Fr), reader.readObject(Fr));
|
|
81
|
+
}
|
|
82
|
+
static fromFields(fields) {
|
|
83
|
+
const reader = FieldReader.asReader(fields);
|
|
84
|
+
return new L2BlockHeader(AppendOnlyTreeSnapshot.fromFields(reader), ContentCommitment.fromFields(reader), StateReference.fromFields(reader), GlobalVariables.fromFields(reader), reader.readField(), reader.readField(), reader.readField());
|
|
85
|
+
}
|
|
86
|
+
static empty(fields = {}) {
|
|
87
|
+
return L2BlockHeader.from({
|
|
88
|
+
lastArchive: AppendOnlyTreeSnapshot.empty(),
|
|
89
|
+
contentCommitment: ContentCommitment.empty(),
|
|
90
|
+
state: StateReference.empty(),
|
|
91
|
+
globalVariables: GlobalVariables.empty(),
|
|
92
|
+
totalFees: Fr.ZERO,
|
|
93
|
+
totalManaUsed: Fr.ZERO,
|
|
94
|
+
spongeBlobHash: Fr.ZERO,
|
|
95
|
+
...fields
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
isEmpty() {
|
|
99
|
+
return this.lastArchive.isEmpty() && this.contentCommitment.isEmpty() && this.state.isEmpty() && this.globalVariables.isEmpty() && this.totalFees.isZero() && this.totalManaUsed.isZero() && this.spongeBlobHash.isZero();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Serializes this instance into a string.
|
|
103
|
+
* @returns Encoded string.
|
|
104
|
+
*/ toString() {
|
|
105
|
+
return bufferToHex(this.toBuffer());
|
|
106
|
+
}
|
|
107
|
+
static fromString(str) {
|
|
108
|
+
return L2BlockHeader.fromBuffer(hexToBuffer(str));
|
|
109
|
+
}
|
|
110
|
+
toCheckpointHeader() {
|
|
111
|
+
return new CheckpointHeader(this.lastArchive.root, this.contentCommitment, this.globalVariables.slotNumber, this.globalVariables.timestamp, this.globalVariables.coinbase, this.globalVariables.feeRecipient, this.globalVariables.gasFees, this.totalManaUsed);
|
|
112
|
+
}
|
|
113
|
+
toBlockHeader() {
|
|
114
|
+
return new BlockHeader(this.lastArchive, this.state, this.spongeBlobHash, this.globalVariables, this.totalFees, this.totalManaUsed);
|
|
115
|
+
}
|
|
116
|
+
toInspect() {
|
|
117
|
+
return {
|
|
118
|
+
lastArchive: this.lastArchive.root.toString(),
|
|
119
|
+
contentCommitment: this.contentCommitment.toInspect(),
|
|
120
|
+
state: this.state.toInspect(),
|
|
121
|
+
globalVariables: this.globalVariables.toInspect(),
|
|
122
|
+
totalFees: this.totalFees.toBigInt(),
|
|
123
|
+
totalManaUsed: this.totalManaUsed.toBigInt(),
|
|
124
|
+
spongeBlobHash: this.spongeBlobHash.toString()
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
[inspect.custom]() {
|
|
128
|
+
return `L2BlockHeader {
|
|
129
|
+
lastArchive: ${inspect(this.lastArchive)},
|
|
130
|
+
contentCommitment.blobsHash: ${inspect(this.contentCommitment.blobsHash)},
|
|
131
|
+
contentCommitment.inHash: ${inspect(this.contentCommitment.inHash)},
|
|
132
|
+
contentCommitment.outHash: ${inspect(this.contentCommitment.outHash)},
|
|
133
|
+
state.l1ToL2MessageTree: ${inspect(this.state.l1ToL2MessageTree)},
|
|
134
|
+
state.noteHashTree: ${inspect(this.state.partial.noteHashTree)},
|
|
135
|
+
state.nullifierTree: ${inspect(this.state.partial.nullifierTree)},
|
|
136
|
+
state.publicDataTree: ${inspect(this.state.partial.publicDataTree)},
|
|
137
|
+
globalVariables: ${inspect(this.globalVariables)},
|
|
138
|
+
totalFees: ${this.totalFees},
|
|
139
|
+
totalManaUsed: ${this.totalManaUsed},
|
|
140
|
+
spongeBlobHash: ${this.spongeBlobHash},
|
|
141
|
+
}`;
|
|
142
|
+
}
|
|
143
|
+
equals(other) {
|
|
144
|
+
return this.contentCommitment.equals(other.contentCommitment) && this.state.equals(other.state) && this.globalVariables.equals(other.globalVariables) && this.totalFees.equals(other.totalFees) && this.totalManaUsed.equals(other.totalManaUsed) && this.lastArchive.equals(other.lastArchive) && this.spongeBlobHash.equals(other.spongeBlobHash);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -45,11 +45,11 @@ export declare class PublishedL2Block {
|
|
|
45
45
|
root: string;
|
|
46
46
|
nextAvailableLeafIndex: string | number | bigint;
|
|
47
47
|
}>;
|
|
48
|
-
header: import("@aztec/foundation/schemas").ZodFor<import("
|
|
48
|
+
header: import("@aztec/foundation/schemas").ZodFor<import("./l2_block_header.js").L2BlockHeader>;
|
|
49
49
|
body: import("@aztec/foundation/schemas").ZodFor<import("./body.js").Body>;
|
|
50
50
|
}, "strip", z.ZodTypeAny, {
|
|
51
51
|
archive: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
|
|
52
|
-
header: import("
|
|
52
|
+
header: import("./l2_block_header.js").L2BlockHeader;
|
|
53
53
|
body: import("./body.js").Body;
|
|
54
54
|
}, {
|
|
55
55
|
archive: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l2_tips_store_test_suite.d.ts","sourceRoot":"","sources":["../../../src/block/test/l2_tips_store_test_suite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"l2_tips_store_test_suite.d.ts","sourceRoot":"","sources":["../../../src/block/test/l2_tips_store_test_suite.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE/D,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,QA8ExE"}
|
|
@@ -10,9 +10,7 @@ export function testL2TipsStore(makeTipsStore) {
|
|
|
10
10
|
const makeBlock = (number)=>PublishedL2Block.fromFields({
|
|
11
11
|
block: {
|
|
12
12
|
number,
|
|
13
|
-
|
|
14
|
-
hash: ()=>Promise.resolve(new Fr(number))
|
|
15
|
-
}
|
|
13
|
+
hash: ()=>Promise.resolve(new Fr(number))
|
|
16
14
|
},
|
|
17
15
|
l1: {
|
|
18
16
|
blockNumber: BigInt(number),
|
|
@@ -17,9 +17,8 @@ export interface IBlockFactory extends ProcessedTxHandler {
|
|
|
17
17
|
* Prepares to build a new block. Updates the L1 to L2 message tree.
|
|
18
18
|
* @param globalVariables - The global variables for this block.
|
|
19
19
|
* @param l1ToL2Messages - The set of L1 to L2 messages to be included in this block.
|
|
20
|
-
* @param previousBlockHeader - The header of the previous block.
|
|
21
20
|
*/
|
|
22
|
-
startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[]
|
|
21
|
+
startNewBlock(globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void>;
|
|
23
22
|
/**
|
|
24
23
|
* Adds all processed txs to the block. Updates world state with the effects from this tx.
|
|
25
24
|
* @param txs - The transactions to be added.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-builder.d.ts","sourceRoot":"","sources":["../../src/interfaces/block-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ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AC;IAEhE,UAAU,CACR,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,EAAE,CAAC,EACrC,cAAc,EAAE,EAAE,EAAE,EACpB,eAAe,EAAE,eAAe,EAChC,OAAO,EAAE,qBAAqB,EAC9B,IAAI,CAAC,EAAE,yBAAyB,GAC/B,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE7B,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAClE"}
|
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import type { Proof } from '../proofs/proof.js';
|
|
5
|
+
import type { CheckpointConstantData } from '../rollup/checkpoint_constant_data.js';
|
|
5
6
|
import type { RootRollupPublicInputs } from '../rollup/root_rollup.js';
|
|
6
7
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
7
8
|
import type { Tx } from '../tx/tx.js';
|
|
9
|
+
import type { UInt64 } from '../types/index.js';
|
|
8
10
|
import type { IBlockFactory } from './block-builder.js';
|
|
9
11
|
/** Coordinates the proving of an entire epoch. */
|
|
10
|
-
export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted'> {
|
|
12
|
+
export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted' | 'startNewBlock'> {
|
|
11
13
|
/**
|
|
12
14
|
* Starts a new epoch. Must be the first method to be called.
|
|
13
15
|
* @param epochNumber - The epoch number.
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
+
* @param firstCheckpointNumber - The number of the first checkpoint in the epoch. Used to determine the correct order when checkpoints are added.
|
|
17
|
+
* @param totalNumCheckpoints - The total number of checkpoints expected in the epoch (must be at least one).
|
|
18
|
+
* @param finalBlobBatchingChallenges - The final blob batching challenges for the epoch.
|
|
16
19
|
**/
|
|
17
|
-
startNewEpoch(epochNumber: number,
|
|
20
|
+
startNewEpoch(epochNumber: number, firstCheckpointNumber: Fr, totalNumCheckpoints: number, finalBlobBatchingChallenges: FinalBlobBatchingChallenges): void;
|
|
21
|
+
/**
|
|
22
|
+
* Starts a new checkpoint.
|
|
23
|
+
* @param constants - The constants for this checkpoint.
|
|
24
|
+
* @param l1ToL2Messages - The set of L1 to L2 messages to be included in this checkpoint.
|
|
25
|
+
* @param totalNumBlocks - The total number of blocks expected in the checkpoint (must be at least one).
|
|
26
|
+
* @param totalNumBlobFields - The total number of blob fields expected in the checkpoint.
|
|
27
|
+
* @param headerOfLastBlockInPreviousCheckpoint - The header of the last block in the previous checkpoint.
|
|
28
|
+
*/
|
|
29
|
+
startNewCheckpoint(constants: CheckpointConstantData, l1ToL2Messages: Fr[], totalNumBlocks: number, totalNumBlobFields: number, headerOfLastBlockInPreviousCheckpoint: BlockHeader): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Starts a new block.
|
|
32
|
+
* @param blockNumber - The block number.
|
|
33
|
+
* @param timestamp - The timestamp of the block.
|
|
34
|
+
* @param totalNumTxs - The total number of txs in the block.
|
|
35
|
+
*/
|
|
36
|
+
startNewBlock(blockNumber: number, timestamp: UInt64, totalNumTxs: number): Promise<void>;
|
|
18
37
|
/**
|
|
19
38
|
* Kickstarts tube circuits for the specified txs. These will be used during epoch proving.
|
|
20
39
|
* Note that if the tube circuits are not started this way, they will be started nontheless after processing.
|
|
21
40
|
*/
|
|
22
41
|
startTubeCircuits(txs: Tx[]): Promise<void>;
|
|
23
42
|
/** Returns the block. */
|
|
24
|
-
setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<
|
|
43
|
+
setBlockCompleted(blockNumber: number, expectedBlockHeader?: BlockHeader): Promise<BlockHeader>;
|
|
25
44
|
/** Pads the epoch with empty block roots if needed and blocks until proven. Throws if proving has failed. */
|
|
26
45
|
finalizeEpoch(): Promise<{
|
|
27
46
|
publicInputs: RootRollupPublicInputs;
|
|
@@ -32,8 +51,6 @@ export interface EpochProver extends Omit<IBlockFactory, 'setBlockCompleted'> {
|
|
|
32
51
|
cancel(): void;
|
|
33
52
|
/** Returns an identifier for the prover or zero if not set. */
|
|
34
53
|
getProverId(): EthAddress;
|
|
35
|
-
/** Returns the block assembled at a given index (zero-based) within the epoch. */
|
|
36
|
-
getBlock(index: number): L2Block;
|
|
37
54
|
/** Called when no longer required, cleans up internal resources */
|
|
38
55
|
stop(): Promise<void>;
|
|
39
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch-prover.d.ts","sourceRoot":"","sources":["../../src/interfaces/epoch-prover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"epoch-prover.d.ts","sourceRoot":"","sources":["../../src/interfaces/epoch-prover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD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