@aztec/archiver 0.0.1-commit.42ee6df9b → 0.0.1-commit.431c48d
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/README.md +7 -7
- package/dest/archiver.d.ts +70 -15
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +273 -71
- package/dest/config.d.ts +7 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +44 -16
- package/dest/errors.d.ts +35 -13
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +54 -16
- package/dest/factory.d.ts +18 -6
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +66 -21
- package/dest/index.d.ts +11 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +10 -2
- package/dest/l1/calldata_retriever.d.ts +9 -1
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +20 -10
- package/dest/l1/data_retrieval.d.ts +24 -10
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +13 -19
- package/dest/l1/trace_tx.d.ts +12 -66
- package/dest/l1/trace_tx.d.ts.map +1 -1
- package/dest/l1/validate_historical_logs.d.ts +23 -0
- package/dest/l1/validate_historical_logs.d.ts.map +1 -0
- package/dest/l1/validate_historical_logs.js +108 -0
- package/dest/modules/contract_data_source_adapter.d.ts +25 -0
- package/dest/modules/contract_data_source_adapter.d.ts.map +1 -0
- package/dest/modules/contract_data_source_adapter.js +32 -0
- package/dest/modules/data_source_base.d.ts +71 -50
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +250 -150
- package/dest/modules/data_store_updater.d.ts +28 -9
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +129 -64
- package/dest/modules/instrumentation.d.ts +15 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +48 -9
- package/dest/modules/l1_synchronizer.d.ts +11 -7
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +347 -118
- package/dest/modules/outbox_trees_resolver.d.ts +64 -0
- package/dest/modules/outbox_trees_resolver.d.ts.map +1 -0
- package/dest/modules/outbox_trees_resolver.js +184 -0
- package/dest/modules/validation.d.ts +30 -7
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +33 -15
- package/dest/store/block_store.d.ts +169 -94
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +618 -270
- package/dest/store/contract_class_store.d.ts +17 -3
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +36 -2
- package/dest/store/contract_instance_store.d.ts +28 -1
- package/dest/store/contract_instance_store.d.ts.map +1 -1
- package/dest/store/contract_instance_store.js +53 -5
- package/dest/store/data_stores.d.ts +68 -0
- package/dest/store/data_stores.d.ts.map +1 -0
- package/dest/store/data_stores.js +54 -0
- package/dest/store/function_names_cache.d.ts +17 -0
- package/dest/store/function_names_cache.d.ts.map +1 -0
- package/dest/store/function_names_cache.js +30 -0
- package/dest/store/l2_tips_cache.d.ts +13 -8
- package/dest/store/l2_tips_cache.d.ts.map +1 -1
- package/dest/store/l2_tips_cache.js +13 -96
- package/dest/store/log_store.d.ts +42 -40
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +257 -480
- package/dest/store/log_store_codec.d.ts +78 -0
- package/dest/store/log_store_codec.d.ts.map +1 -0
- package/dest/store/log_store_codec.js +110 -0
- package/dest/store/message_store.d.ts +9 -3
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +31 -1
- package/dest/test/fake_l1_state.d.ts +14 -3
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +58 -18
- package/dest/test/mock_l1_to_l2_message_source.d.ts +1 -1
- package/dest/test/mock_l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/test/mock_l1_to_l2_message_source.js +1 -2
- package/dest/test/mock_l2_block_source.d.ts +47 -54
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +229 -205
- package/dest/test/mock_structs.d.ts +1 -1
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +2 -2
- package/dest/test/noop_l1_archiver.d.ts +14 -6
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +26 -10
- package/package.json +15 -14
- package/src/archiver.ts +355 -77
- package/src/config.ts +51 -20
- package/src/errors.ts +80 -23
- package/src/factory.ts +80 -19
- package/src/index.ts +18 -2
- package/src/l1/calldata_retriever.ts +27 -10
- package/src/l1/data_retrieval.ts +38 -36
- package/src/l1/validate_historical_logs.ts +140 -0
- package/src/modules/contract_data_source_adapter.ts +46 -0
- package/src/modules/data_source_base.ts +319 -200
- package/src/modules/data_store_updater.ts +156 -65
- package/src/modules/instrumentation.ts +43 -10
- package/src/modules/l1_synchronizer.ts +499 -136
- package/src/modules/outbox_trees_resolver.ts +220 -0
- package/src/modules/validation.ts +78 -21
- package/src/store/block_store.ts +741 -333
- package/src/store/contract_class_store.ts +47 -3
- package/src/store/contract_instance_store.ts +67 -7
- package/src/store/data_stores.ts +104 -0
- package/src/store/function_names_cache.ts +37 -0
- package/src/store/l2_tips_cache.ts +16 -109
- package/src/store/log_store.ts +296 -652
- package/src/store/log_store_codec.ts +143 -0
- package/src/store/message_store.ts +35 -2
- package/src/test/fake_l1_state.ts +65 -27
- package/src/test/mock_l1_to_l2_message_source.ts +0 -1
- package/src/test/mock_l2_block_source.ts +276 -258
- package/src/test/mock_structs.ts +5 -2
- package/src/test/noop_l1_archiver.ts +54 -11
- package/dest/store/kv_archiver_store.d.ts +0 -377
- package/dest/store/kv_archiver_store.d.ts.map +0 -1
- package/dest/store/kv_archiver_store.js +0 -494
- package/src/store/kv_archiver_store.ts +0 -713
package/src/config.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { type BlobClientConfig, blobClientConfigMapping } from '@aztec/blob-client/client/config';
|
|
2
2
|
import { type L1ContractsConfig, l1ContractsConfigMappings } from '@aztec/ethereum/config';
|
|
3
|
-
import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
|
|
4
3
|
import { type L1ReaderConfig, l1ReaderConfigMappings } from '@aztec/ethereum/l1-reader';
|
|
5
4
|
import {
|
|
6
5
|
type ConfigMappingsType,
|
|
7
6
|
booleanConfigHelper,
|
|
8
7
|
getConfigFromMappings,
|
|
9
8
|
numberConfigHelper,
|
|
9
|
+
optionalNumberConfigHelper,
|
|
10
10
|
} from '@aztec/foundation/config';
|
|
11
|
-
import {
|
|
12
|
-
type ChainConfig,
|
|
13
|
-
type PipelineConfig,
|
|
14
|
-
chainConfigMappings,
|
|
15
|
-
pipelineConfigMappings,
|
|
16
|
-
} from '@aztec/stdlib/config';
|
|
11
|
+
import { type ChainConfig, type SequencerConfig, chainConfigMappings } from '@aztec/stdlib/config';
|
|
17
12
|
import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
|
|
13
|
+
import { DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE } from '@aztec/stdlib/timetable';
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
16
|
* The archiver configuration.
|
|
@@ -26,13 +22,12 @@ import type { ArchiverSpecificConfig } from '@aztec/stdlib/interfaces/server';
|
|
|
26
22
|
export type ArchiverConfig = ArchiverSpecificConfig &
|
|
27
23
|
L1ReaderConfig &
|
|
28
24
|
L1ContractsConfig &
|
|
29
|
-
PipelineConfig & // required to pass through to epoch cache
|
|
30
25
|
BlobClientConfig &
|
|
31
|
-
ChainConfig
|
|
26
|
+
ChainConfig &
|
|
27
|
+
Pick<SequencerConfig, 'blockDurationMs' | 'checkpointProposalSyncGraceSeconds'>;
|
|
32
28
|
|
|
33
29
|
export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
34
30
|
...blobClientConfigMapping,
|
|
35
|
-
...pipelineConfigMappings,
|
|
36
31
|
archiverPollingIntervalMS: {
|
|
37
32
|
env: 'ARCHIVER_POLLING_INTERVAL_MS',
|
|
38
33
|
description: 'The polling interval in ms for retrieving new L2 blocks and encrypted logs.',
|
|
@@ -43,20 +38,31 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
|
43
38
|
description: 'The number of L2 blocks the archiver will attempt to download at a time.',
|
|
44
39
|
...numberConfigHelper(100),
|
|
45
40
|
},
|
|
46
|
-
maxLogs: {
|
|
47
|
-
env: 'ARCHIVER_MAX_LOGS',
|
|
48
|
-
description: 'The max number of logs that can be obtained in 1 "getPublicLogs" call.',
|
|
49
|
-
...numberConfigHelper(1_000),
|
|
50
|
-
},
|
|
51
41
|
archiverStoreMapSizeKb: {
|
|
52
42
|
env: 'ARCHIVER_STORE_MAP_SIZE_KB',
|
|
53
|
-
|
|
43
|
+
...optionalNumberConfigHelper(),
|
|
54
44
|
description: 'The maximum possible size of the archiver DB in KB. Overwrites the general dataStoreMapSizeKb.',
|
|
55
45
|
},
|
|
46
|
+
blockDurationMs: {
|
|
47
|
+
env: 'SEQ_BLOCK_DURATION_MS',
|
|
48
|
+
description:
|
|
49
|
+
'Duration per block in milliseconds when building multiple blocks per slot. Used to derive orphan proposed block pruning timing.',
|
|
50
|
+
...optionalNumberConfigHelper(),
|
|
51
|
+
},
|
|
52
|
+
checkpointProposalSyncGraceSeconds: {
|
|
53
|
+
env: 'CHECKPOINT_PROPOSAL_SYNC_GRACE_SECONDS',
|
|
54
|
+
description:
|
|
55
|
+
'Consensus grace in seconds for a received checkpoint proposal to materialize into local proposed state.',
|
|
56
|
+
...optionalNumberConfigHelper(),
|
|
57
|
+
},
|
|
56
58
|
skipValidateCheckpointAttestations: {
|
|
57
59
|
description: 'Skip validating checkpoint attestations (for testing purposes only)',
|
|
58
60
|
...booleanConfigHelper(false),
|
|
59
61
|
},
|
|
62
|
+
skipPromoteProposedCheckpointDuringL1Sync: {
|
|
63
|
+
description: 'Skip promoting proposed checkpoints during L1 sync (for testing purposes only)',
|
|
64
|
+
...booleanConfigHelper(false),
|
|
65
|
+
},
|
|
60
66
|
maxAllowedEthClientDriftSeconds: {
|
|
61
67
|
env: 'MAX_ALLOWED_ETH_CLIENT_DRIFT_SECONDS',
|
|
62
68
|
description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
|
|
@@ -67,6 +73,31 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
|
67
73
|
description: 'Whether to allow starting the archiver without debug/trace method support on Ethereum hosts',
|
|
68
74
|
...booleanConfigHelper(true),
|
|
69
75
|
},
|
|
76
|
+
archiverSkipHistoricalLogsCheck: {
|
|
77
|
+
env: 'ARCHIVER_SKIP_HISTORICAL_LOGS_CHECK',
|
|
78
|
+
description:
|
|
79
|
+
'Skip the startup check that probes the L1 RPC for historical Rollup contract logs. ' +
|
|
80
|
+
'Set to true to bypass the check when the connected RPC node is known to prune old logs.',
|
|
81
|
+
...booleanConfigHelper(false),
|
|
82
|
+
},
|
|
83
|
+
orphanPruneNoProposalTolerance: {
|
|
84
|
+
env: 'ARCHIVER_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE',
|
|
85
|
+
description: 'Local tolerance in seconds before pruning an orphan block when no checkpoint proposal was received.',
|
|
86
|
+
...numberConfigHelper(DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE),
|
|
87
|
+
},
|
|
88
|
+
skipOrphanProposedBlockPruning: {
|
|
89
|
+
env: 'ARCHIVER_SKIP_ORPHAN_PROPOSED_BLOCK_PRUNING',
|
|
90
|
+
description: 'Skip pruning orphan proposed blocks that have no matching proposed checkpoint.',
|
|
91
|
+
...booleanConfigHelper(false),
|
|
92
|
+
},
|
|
93
|
+
testPreloadStandardContracts: {
|
|
94
|
+
env: 'TEST_PRELOAD_STANDARD_CONTRACTS',
|
|
95
|
+
description:
|
|
96
|
+
'Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) into the contract store at ' +
|
|
97
|
+
'block 0. For test environments only, and only safe when genesis seeds the matching registration/deployment ' +
|
|
98
|
+
'nullifiers; otherwise a later on-chain publish would collide with the block-0 preload.',
|
|
99
|
+
...booleanConfigHelper(false),
|
|
100
|
+
},
|
|
70
101
|
...chainConfigMappings,
|
|
71
102
|
...l1ReaderConfigMappings,
|
|
72
103
|
viemPollingIntervalMS: {
|
|
@@ -75,10 +106,6 @@ export const archiverConfigMappings: ConfigMappingsType<ArchiverConfig> = {
|
|
|
75
106
|
...numberConfigHelper(1000),
|
|
76
107
|
},
|
|
77
108
|
...l1ContractsConfigMappings,
|
|
78
|
-
l1Contracts: {
|
|
79
|
-
description: 'The deployed L1 contract addresses',
|
|
80
|
-
nested: l1ContractAddressesMapping,
|
|
81
|
-
},
|
|
82
109
|
};
|
|
83
110
|
|
|
84
111
|
/**
|
|
@@ -96,7 +123,11 @@ export function mapArchiverConfig(config: Partial<ArchiverConfig>) {
|
|
|
96
123
|
pollingIntervalMs: config.archiverPollingIntervalMS,
|
|
97
124
|
batchSize: config.archiverBatchSize,
|
|
98
125
|
skipValidateCheckpointAttestations: config.skipValidateCheckpointAttestations,
|
|
126
|
+
skipPromoteProposedCheckpointDuringL1Sync: config.skipPromoteProposedCheckpointDuringL1Sync,
|
|
99
127
|
maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds,
|
|
100
128
|
ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts,
|
|
129
|
+
skipHistoricalLogsCheck: config.archiverSkipHistoricalLogsCheck,
|
|
130
|
+
orphanPruneNoProposalTolerance: config.orphanPruneNoProposalTolerance,
|
|
131
|
+
skipOrphanProposedBlockPruning: config.skipOrphanProposedBlockPruning,
|
|
101
132
|
};
|
|
102
133
|
}
|
package/src/errors.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/schemas';
|
|
2
3
|
|
|
3
4
|
export class NoBlobBodiesFoundError extends Error {
|
|
4
5
|
constructor(l2BlockNum: number) {
|
|
5
6
|
super(`No blob bodies found for block ${l2BlockNum}`);
|
|
7
|
+
this.name = 'NoBlobBodiesFoundError';
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export class BlockNumberNotSequentialError extends Error {
|
|
10
12
|
constructor(newBlockNumber: number, previous: number | undefined) {
|
|
11
13
|
super(`Cannot insert new block ${newBlockNumber} given previous block number is ${previous ?? 'undefined'}`);
|
|
14
|
+
this.name = 'BlockNumberNotSequentialError';
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
|
|
@@ -22,18 +25,35 @@ export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
|
22
25
|
previousCheckpointNumber ?? 'undefined'
|
|
23
26
|
}`,
|
|
24
27
|
);
|
|
28
|
+
this.name = 'InitialCheckpointNumberNotSequentialError';
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
export class CheckpointNumberNotSequentialError extends Error {
|
|
29
33
|
constructor(
|
|
30
|
-
newCheckpointNumber:
|
|
31
|
-
|
|
32
|
-
source
|
|
34
|
+
public readonly newCheckpointNumber: CheckpointNumber,
|
|
35
|
+
public readonly previousCheckpointNumber: CheckpointNumber | undefined,
|
|
36
|
+
source?: 'proposed' | 'confirmed',
|
|
33
37
|
) {
|
|
38
|
+
const qualifier = source ? `${source} ` : '';
|
|
34
39
|
super(
|
|
35
|
-
`Cannot insert new checkpoint ${newCheckpointNumber} given previous ${
|
|
40
|
+
`Cannot insert new checkpoint ${newCheckpointNumber} given previous ${qualifier}checkpoint number is ${previousCheckpointNumber ?? 'undefined'}`,
|
|
36
41
|
);
|
|
42
|
+
this.name = 'CheckpointNumberNotSequentialError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Thrown when a proposed block carries a checkpoint number that does not follow the latest one. */
|
|
47
|
+
export class BlockCheckpointNumberNotSequentialError extends Error {
|
|
48
|
+
constructor(
|
|
49
|
+
blockNumber: BlockNumber,
|
|
50
|
+
blockCheckpointNumber: CheckpointNumber,
|
|
51
|
+
previous: CheckpointNumber | undefined,
|
|
52
|
+
) {
|
|
53
|
+
super(
|
|
54
|
+
`Cannot insert new block ${blockNumber} for checkpoint ${blockCheckpointNumber} given previous checkpoint number is ${previous ?? 'undefined'}`,
|
|
55
|
+
);
|
|
56
|
+
this.name = 'BlockCheckpointNumberNotSequentialError';
|
|
37
57
|
}
|
|
38
58
|
}
|
|
39
59
|
|
|
@@ -42,6 +62,7 @@ export class BlockIndexNotSequentialError extends Error {
|
|
|
42
62
|
super(
|
|
43
63
|
`Cannot insert new block at checkpoint index ${newBlockIndex} given previous block index is ${previousBlockIndex ?? 'undefined'}`,
|
|
44
64
|
);
|
|
65
|
+
this.name = 'BlockIndexNotSequentialError';
|
|
45
66
|
}
|
|
46
67
|
}
|
|
47
68
|
|
|
@@ -55,18 +76,21 @@ export class BlockArchiveNotConsistentError extends Error {
|
|
|
55
76
|
super(
|
|
56
77
|
`Cannot insert new block number ${newBlockNumber} with archive ${newBlockArchive.toString()} previous block number is ${previousBlockNumber ?? 'undefined'}, previous archive is ${previousBlockArchive?.toString() ?? 'undefined'}`,
|
|
57
78
|
);
|
|
79
|
+
this.name = 'BlockArchiveNotConsistentError';
|
|
58
80
|
}
|
|
59
81
|
}
|
|
60
82
|
|
|
61
83
|
export class CheckpointNotFoundError extends Error {
|
|
62
84
|
constructor(checkpointNumber: number) {
|
|
63
85
|
super(`Failed to find expected checkpoint number ${checkpointNumber}`);
|
|
86
|
+
this.name = 'CheckpointNotFoundError';
|
|
64
87
|
}
|
|
65
88
|
}
|
|
66
89
|
|
|
67
90
|
export class BlockNotFoundError extends Error {
|
|
68
91
|
constructor(blockNumber: number) {
|
|
69
92
|
super(`Failed to find expected block number ${blockNumber}`);
|
|
93
|
+
this.name = 'BlockNotFoundError';
|
|
70
94
|
}
|
|
71
95
|
}
|
|
72
96
|
|
|
@@ -78,22 +102,6 @@ export class BlockAlreadyCheckpointedError extends Error {
|
|
|
78
102
|
}
|
|
79
103
|
}
|
|
80
104
|
|
|
81
|
-
/** Thrown when logs are added for a tag whose last stored log has a higher block number than the new log. */
|
|
82
|
-
export class OutOfOrderLogInsertionError extends Error {
|
|
83
|
-
constructor(
|
|
84
|
-
public readonly logType: 'private' | 'public',
|
|
85
|
-
public readonly tag: string,
|
|
86
|
-
public readonly lastBlockNumber: number,
|
|
87
|
-
public readonly newBlockNumber: number,
|
|
88
|
-
) {
|
|
89
|
-
super(
|
|
90
|
-
`Out-of-order ${logType} log insertion for tag ${tag}: ` +
|
|
91
|
-
`last existing log is from block ${lastBlockNumber} but new log is from block ${newBlockNumber}`,
|
|
92
|
-
);
|
|
93
|
-
this.name = 'OutOfOrderLogInsertionError';
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
105
|
/** Thrown when L1 to L2 messages are requested for a checkpoint whose message tree hasn't been sealed yet. */
|
|
98
106
|
export class L1ToL2MessagesNotReadyError extends Error {
|
|
99
107
|
constructor(
|
|
@@ -119,19 +127,68 @@ export class ProposedCheckpointStaleError extends Error {
|
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
/** Thrown when a proposed checkpoint number is not the expected
|
|
130
|
+
/** Thrown when a proposed checkpoint number is not the expected latestTip + 1. */
|
|
123
131
|
export class ProposedCheckpointNotSequentialError extends Error {
|
|
124
132
|
constructor(
|
|
125
133
|
public readonly proposedCheckpointNumber: number,
|
|
126
|
-
public readonly
|
|
134
|
+
public readonly latestTipNumber: number,
|
|
127
135
|
) {
|
|
128
136
|
super(
|
|
129
|
-
`Proposed checkpoint ${proposedCheckpointNumber} is not sequential: expected ${
|
|
137
|
+
`Proposed checkpoint ${proposedCheckpointNumber} is not sequential: expected ${latestTipNumber + 1} (latest tip + 1, where tip is highest of confirmed or pending)`,
|
|
130
138
|
);
|
|
131
139
|
this.name = 'ProposedCheckpointNotSequentialError';
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
|
|
143
|
+
/** Thrown when a proposed checkpoint or block L2 slot has already expired on L1. */
|
|
144
|
+
export class BlockOrCheckpointSlotExpiredError extends Error {
|
|
145
|
+
constructor(
|
|
146
|
+
public readonly slot: number,
|
|
147
|
+
public readonly nextSlotStart: bigint,
|
|
148
|
+
public readonly l1TimestampSynced: bigint | undefined,
|
|
149
|
+
) {
|
|
150
|
+
super(
|
|
151
|
+
`Checkpoint or block for slot ${slot} is expired: L1 synced to ${l1TimestampSynced} which is past the next slot start ${nextSlotStart}. ` +
|
|
152
|
+
`If the checkpoint still lands via a late L1 tx, the archiver will pick it up via normal L1-sync (not the pending-queue shortcut).`,
|
|
153
|
+
);
|
|
154
|
+
this.name = 'BlockOrCheckpointSlotExpiredError';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Thrown when attempting to promote a proposed checkpoint but no proposed checkpoint exists in the store. */
|
|
159
|
+
export class NoProposedCheckpointToPromoteError extends Error {
|
|
160
|
+
constructor() {
|
|
161
|
+
super('Cannot promote proposed checkpoint: no proposed checkpoint exists');
|
|
162
|
+
this.name = 'NoProposedCheckpointToPromoteError';
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Thrown when the archive root of the proposed checkpoint does not match the expected one. */
|
|
167
|
+
export class ProposedCheckpointArchiveRootMismatchError extends Error {
|
|
168
|
+
constructor(
|
|
169
|
+
public readonly expectedArchiveRoot: Fr,
|
|
170
|
+
public readonly actualArchiveRoot: Fr,
|
|
171
|
+
) {
|
|
172
|
+
super(
|
|
173
|
+
`Cannot promote proposed checkpoint: archive root mismatch (expected ${expectedArchiveRoot}, got ${actualArchiveRoot})`,
|
|
174
|
+
);
|
|
175
|
+
this.name = 'ProposedCheckpointArchiveRootMismatchError';
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Thrown when the proposed checkpoint does not directly follow the latest confirmed checkpoint. */
|
|
180
|
+
export class ProposedCheckpointPromotionNotSequentialError extends Error {
|
|
181
|
+
constructor(
|
|
182
|
+
public readonly proposedCheckpointNumber: number,
|
|
183
|
+
public readonly latestCheckpointNumber: number,
|
|
184
|
+
) {
|
|
185
|
+
super(
|
|
186
|
+
`Cannot promote proposed checkpoint: not sequential (latest ${latestCheckpointNumber}, proposed ${proposedCheckpointNumber})`,
|
|
187
|
+
);
|
|
188
|
+
this.name = 'ProposedCheckpointPromotionNotSequentialError';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
135
192
|
/** Thrown when a proposed block conflicts with an already checkpointed block (different content). */
|
|
136
193
|
export class CannotOverwriteCheckpointedBlockError extends Error {
|
|
137
194
|
constructor(
|
package/src/factory.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
2
2
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
3
|
import { makeL1HttpTransport } from '@aztec/ethereum/client';
|
|
4
|
-
import { InboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
4
|
+
import { InboxContract, OutboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
5
|
+
import { pickL1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
5
6
|
import type { ViemPublicDebugClient } from '@aztec/ethereum/types';
|
|
6
7
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
7
8
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
@@ -11,10 +12,17 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
11
12
|
import { createStore } from '@aztec/kv-store/lmdb-v2';
|
|
12
13
|
import { protocolContractNames } from '@aztec/protocol-contracts';
|
|
13
14
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
15
|
+
import { getPublishableStandardContracts } from '@aztec/standard-contracts';
|
|
14
16
|
import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
15
|
-
import type { ArchiverEmitter } from '@aztec/stdlib/block';
|
|
17
|
+
import type { ArchiverEmitter, BlockHash } from '@aztec/stdlib/block';
|
|
18
|
+
import { DEFAULT_BLOCK_DURATION_MS } from '@aztec/stdlib/config';
|
|
16
19
|
import { type ContractClassPublicWithCommitment, computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
17
20
|
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
21
|
+
import {
|
|
22
|
+
DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE,
|
|
23
|
+
getDefaultCheckpointProposalSyncGrace,
|
|
24
|
+
} from '@aztec/stdlib/timetable';
|
|
25
|
+
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
18
26
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
19
27
|
|
|
20
28
|
import { EventEmitter } from 'events';
|
|
@@ -24,21 +32,22 @@ import { Archiver, type ArchiverDeps } from './archiver.js';
|
|
|
24
32
|
import { type ArchiverConfig, mapArchiverConfig } from './config.js';
|
|
25
33
|
import { ArchiverInstrumentation } from './modules/instrumentation.js';
|
|
26
34
|
import { ArchiverL1Synchronizer } from './modules/l1_synchronizer.js';
|
|
27
|
-
import { ARCHIVER_DB_VERSION,
|
|
35
|
+
import { ARCHIVER_DB_VERSION, type ArchiverDataStores, createArchiverDataStores } from './store/data_stores.js';
|
|
28
36
|
import { L2TipsCache } from './store/l2_tips_cache.js';
|
|
29
37
|
|
|
30
38
|
export const ARCHIVER_STORE_NAME = 'archiver';
|
|
31
39
|
|
|
32
40
|
/** Creates an archiver store. */
|
|
33
41
|
export async function createArchiverStore(
|
|
34
|
-
userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb'
|
|
35
|
-
|
|
42
|
+
userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb'> & DataStoreConfig,
|
|
43
|
+
genesisBlockHash: BlockHash,
|
|
44
|
+
): Promise<ArchiverDataStores> {
|
|
36
45
|
const config = {
|
|
37
46
|
...userConfig,
|
|
38
47
|
dataStoreMapSizeKb: userConfig.archiverStoreMapSizeKb ?? userConfig.dataStoreMapSizeKb,
|
|
39
48
|
};
|
|
40
49
|
const store = await createStore(ARCHIVER_STORE_NAME, ARCHIVER_DB_VERSION, config);
|
|
41
|
-
return
|
|
50
|
+
return createArchiverDataStores(store, genesisBlockHash);
|
|
42
51
|
}
|
|
43
52
|
|
|
44
53
|
/**
|
|
@@ -46,15 +55,23 @@ export async function createArchiverStore(
|
|
|
46
55
|
* @param config - The archiver configuration.
|
|
47
56
|
* @param deps - The archiver dependencies (blobClient, epochCache, dateProvider, telemetry).
|
|
48
57
|
* @param opts - The options.
|
|
58
|
+
* @param initialHeader - The genesis block header from world-state, used to answer block-0 queries.
|
|
59
|
+
* @param initialBlockHash - Precomputed hash of `initialHeader`. Hoisted to the caller so the archiver
|
|
60
|
+
* can expose `getGenesisBlockHash()` synchronously.
|
|
49
61
|
* @returns The local archiver.
|
|
50
62
|
*/
|
|
51
63
|
export async function createArchiver(
|
|
52
64
|
config: ArchiverConfig & DataStoreConfig,
|
|
53
65
|
deps: ArchiverDeps,
|
|
54
66
|
opts: { blockUntilSync: boolean } = { blockUntilSync: true },
|
|
67
|
+
initialHeader: BlockHeader,
|
|
68
|
+
initialBlockHash: BlockHash,
|
|
55
69
|
): Promise<Archiver> {
|
|
56
|
-
const archiverStore = await createArchiverStore(config);
|
|
70
|
+
const archiverStore = await createArchiverStore(config, initialBlockHash);
|
|
57
71
|
await registerProtocolContracts(archiverStore);
|
|
72
|
+
if (config.testPreloadStandardContracts) {
|
|
73
|
+
await registerStandardContracts(archiverStore);
|
|
74
|
+
}
|
|
58
75
|
|
|
59
76
|
// Create Ethereum clients
|
|
60
77
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
@@ -74,8 +91,9 @@ export async function createArchiver(
|
|
|
74
91
|
}) as ViemPublicDebugClient;
|
|
75
92
|
|
|
76
93
|
// Create L1 contract instances
|
|
77
|
-
const rollup = new RollupContract(publicClient, config.
|
|
78
|
-
const inbox = new InboxContract(publicClient, config.
|
|
94
|
+
const rollup = new RollupContract(publicClient, config.rollupAddress);
|
|
95
|
+
const inbox = new InboxContract(publicClient, config.inboxAddress);
|
|
96
|
+
const outbox = new OutboxContract(publicClient, config.outboxAddress);
|
|
79
97
|
|
|
80
98
|
// Fetch L1 constants from rollup contract
|
|
81
99
|
const [
|
|
@@ -121,19 +139,28 @@ export async function createArchiver(
|
|
|
121
139
|
batchSize: 100,
|
|
122
140
|
maxAllowedEthClientDriftSeconds: 300,
|
|
123
141
|
ethereumAllowNoDebugHosts: false,
|
|
142
|
+
skipHistoricalLogsCheck: false,
|
|
143
|
+
checkpointProposalSyncGrace:
|
|
144
|
+
config.checkpointProposalSyncGraceSeconds ??
|
|
145
|
+
getDefaultCheckpointProposalSyncGrace((config.blockDurationMs ?? DEFAULT_BLOCK_DURATION_MS) / 1000),
|
|
146
|
+
orphanPruneNoProposalTolerance: DEFAULT_ORPHAN_PRUNE_NO_PROPOSAL_TOLERANCE,
|
|
147
|
+
skipOrphanProposedBlockPruning: false,
|
|
148
|
+
blockDuration: (config.blockDurationMs ?? DEFAULT_BLOCK_DURATION_MS) / 1000,
|
|
124
149
|
},
|
|
125
150
|
mapArchiverConfig(config),
|
|
126
151
|
);
|
|
127
152
|
|
|
128
|
-
const epochCache = deps.epochCache ?? (await EpochCache.create(config.
|
|
153
|
+
const epochCache = deps.epochCache ?? (await EpochCache.create(config.rollupAddress, config, deps));
|
|
129
154
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
130
|
-
const instrumentation = await ArchiverInstrumentation.new(telemetry, () => archiverStore.estimateSize());
|
|
155
|
+
const instrumentation = await ArchiverInstrumentation.new(telemetry, () => archiverStore.db.estimateSize());
|
|
131
156
|
|
|
132
157
|
// Create the event emitter that will be shared by archiver and synchronizer
|
|
133
158
|
const events = new EventEmitter() as ArchiverEmitter;
|
|
134
159
|
|
|
135
|
-
// Create L2 tips cache shared by archiver and synchronizer
|
|
136
|
-
|
|
160
|
+
// Create L2 tips cache shared by archiver and synchronizer. The genesis block hash is dynamic —
|
|
161
|
+
// it depends on the injected initial header (genesisTimestamp + prefilled state). Hoisted to the
|
|
162
|
+
// caller so we can pass the same value to the archiver and expose it via `getGenesisBlockHash()`.
|
|
163
|
+
const l2TipsCache = new L2TipsCache(archiverStore.blocks, initialBlockHash);
|
|
137
164
|
|
|
138
165
|
// Create the L1 synchronizer
|
|
139
166
|
const synchronizer = new ArchiverL1Synchronizer(
|
|
@@ -158,7 +185,8 @@ export async function createArchiver(
|
|
|
158
185
|
publicClient,
|
|
159
186
|
debugClient,
|
|
160
187
|
rollup,
|
|
161
|
-
|
|
188
|
+
outbox,
|
|
189
|
+
{ ...pickL1ContractAddresses(config), slashingProposerAddress },
|
|
162
190
|
archiverStore,
|
|
163
191
|
archiverConfig,
|
|
164
192
|
deps.blobClient,
|
|
@@ -166,7 +194,10 @@ export async function createArchiver(
|
|
|
166
194
|
l1Constants,
|
|
167
195
|
synchronizer,
|
|
168
196
|
events,
|
|
197
|
+
initialHeader,
|
|
198
|
+
initialBlockHash,
|
|
169
199
|
l2TipsCache,
|
|
200
|
+
deps.dateProvider ?? new DateProvider(),
|
|
170
201
|
);
|
|
171
202
|
|
|
172
203
|
await archiver.start(opts.blockUntilSync);
|
|
@@ -174,14 +205,44 @@ export async function createArchiver(
|
|
|
174
205
|
}
|
|
175
206
|
|
|
176
207
|
/** Registers protocol contracts in the archiver store. Idempotent — skips contracts that already exist (e.g. on node restart). */
|
|
177
|
-
export async function registerProtocolContracts(
|
|
208
|
+
export async function registerProtocolContracts(stores: ArchiverDataStores) {
|
|
178
209
|
const blockNumber = 0;
|
|
179
210
|
for (const name of protocolContractNames) {
|
|
180
211
|
const provider = new BundledProtocolContractsProvider();
|
|
181
212
|
const contract = await provider.getProtocolContractArtifact(name);
|
|
182
213
|
|
|
183
214
|
// Skip if already registered (happens on node restart with a persisted store).
|
|
184
|
-
if (await
|
|
215
|
+
if (await stores.contractClasses.getContractClass(contract.contractClass.id)) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(contract.contractClass.packedBytecode);
|
|
220
|
+
const contractClassPublic: ContractClassPublicWithCommitment = {
|
|
221
|
+
...contract.contractClass,
|
|
222
|
+
publicBytecodeCommitment,
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const publicFunctionSignatures = contract.artifact.functions
|
|
226
|
+
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
227
|
+
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
228
|
+
|
|
229
|
+
await stores.functionNames.register(publicFunctionSignatures);
|
|
230
|
+
await stores.contractClasses.addContractClasses([contractClassPublic], BlockNumber(blockNumber));
|
|
231
|
+
await stores.contractInstances.addContractInstances([contract.instance], BlockNumber(blockNumber));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Preloads the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) into the archiver store at block 0,
|
|
237
|
+
* mirroring {@link registerProtocolContracts}. Only invoked for test environments (via `testPreloadStandardContracts`),
|
|
238
|
+
* which also seed the matching registration/deployment nullifiers into the genesis nullifier tree so the store and tree
|
|
239
|
+
* stay consistent. Idempotent — skips contracts that already exist (e.g. on node restart).
|
|
240
|
+
*/
|
|
241
|
+
export async function registerStandardContracts(stores: ArchiverDataStores) {
|
|
242
|
+
const blockNumber = 0;
|
|
243
|
+
for (const contract of await getPublishableStandardContracts()) {
|
|
244
|
+
// Skip if already registered (happens on node restart with a persisted store).
|
|
245
|
+
if (await stores.contractClasses.getContractClass(contract.contractClass.id)) {
|
|
185
246
|
continue;
|
|
186
247
|
}
|
|
187
248
|
|
|
@@ -195,8 +256,8 @@ export async function registerProtocolContracts(store: KVArchiverDataStore) {
|
|
|
195
256
|
.filter(fn => fn.functionType === FunctionType.PUBLIC)
|
|
196
257
|
.map(fn => decodeFunctionSignature(fn.name, fn.parameters));
|
|
197
258
|
|
|
198
|
-
await
|
|
199
|
-
await
|
|
200
|
-
await
|
|
259
|
+
await stores.functionNames.register(publicFunctionSignatures);
|
|
260
|
+
await stores.contractClasses.addContractClasses([contractClassPublic], BlockNumber(blockNumber));
|
|
261
|
+
await stores.contractInstances.addContractInstances([contract.instance], BlockNumber(blockNumber));
|
|
201
262
|
}
|
|
202
263
|
}
|
package/src/index.ts
CHANGED
|
@@ -4,10 +4,26 @@ export * from './archiver.js';
|
|
|
4
4
|
export * from './modules/data_source_base.js';
|
|
5
5
|
export * from './modules/data_store_updater.js';
|
|
6
6
|
export * from './config.js';
|
|
7
|
+
export * from './errors.js';
|
|
7
8
|
|
|
8
9
|
export { type L1PublishedData } from './structs/published.js';
|
|
9
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
ARCHIVER_DB_VERSION,
|
|
12
|
+
type ArchiverDataStores,
|
|
13
|
+
type ArchiverL1SynchPoint,
|
|
14
|
+
backupArchiverDataStores,
|
|
15
|
+
createArchiverDataStores,
|
|
16
|
+
createContractDataSource,
|
|
17
|
+
getArchiverSynchPoint,
|
|
18
|
+
} from './store/data_stores.js';
|
|
19
|
+
export { FunctionNamesCache } from './store/function_names_cache.js';
|
|
20
|
+
export { ArchiverContractDataSourceAdapter } from './modules/contract_data_source_adapter.js';
|
|
21
|
+
export { BlockStore } from './store/block_store.js';
|
|
22
|
+
export { LogStore } from './store/log_store.js';
|
|
23
|
+
export { MessageStore } from './store/message_store.js';
|
|
24
|
+
export { ContractClassStore } from './store/contract_class_store.js';
|
|
10
25
|
export { ContractInstanceStore } from './store/contract_instance_store.js';
|
|
11
26
|
export { L2TipsCache } from './store/l2_tips_cache.js';
|
|
12
27
|
|
|
13
|
-
export {
|
|
28
|
+
export { retrieveL2ProofVerifiedEvents } from './l1/data_retrieval.js';
|
|
29
|
+
export { CalldataRetriever } from './l1/calldata_retriever.js';
|
|
@@ -7,7 +7,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
7
7
|
import type { Logger } from '@aztec/foundation/log';
|
|
8
8
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
9
9
|
import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
10
|
-
import {
|
|
10
|
+
import { computeCheckpointPayloadDigest } from '@aztec/stdlib/checkpoint';
|
|
11
11
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
12
12
|
|
|
13
13
|
import {
|
|
@@ -34,6 +34,12 @@ type CheckpointData = {
|
|
|
34
34
|
archiveRoot: Fr;
|
|
35
35
|
header: CheckpointHeader;
|
|
36
36
|
attestations: CommitteeAttestation[];
|
|
37
|
+
/**
|
|
38
|
+
* The exact packed `CommitteeAttestations` tuple as it appears in the propose calldata, preserved
|
|
39
|
+
* verbatim (never re-derived from {@link attestations}) so invalidation evidence stays byte-faithful to
|
|
40
|
+
* the on-chain `attestationsHash`.
|
|
41
|
+
*/
|
|
42
|
+
verbatimAttestations: ViemCommitteeAttestations;
|
|
37
43
|
blockHash: string;
|
|
38
44
|
feeAssetPriceModifier: bigint;
|
|
39
45
|
};
|
|
@@ -61,6 +67,13 @@ export class CalldataRetriever {
|
|
|
61
67
|
private readonly rollupAddress: EthAddress,
|
|
62
68
|
) {}
|
|
63
69
|
|
|
70
|
+
private getSignatureContext() {
|
|
71
|
+
return {
|
|
72
|
+
chainId: this.publicClient.chain.id,
|
|
73
|
+
rollupAddress: this.rollupAddress,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
64
77
|
/**
|
|
65
78
|
* Gets checkpoint header and metadata from the calldata of an L1 transaction.
|
|
66
79
|
* Tries multicall3 decoding, falls back to trace-based extraction.
|
|
@@ -399,14 +412,14 @@ export class CalldataRetriever {
|
|
|
399
412
|
return undefined;
|
|
400
413
|
}
|
|
401
414
|
|
|
402
|
-
const [decodedArgs,
|
|
415
|
+
const [decodedArgs, verbatimAttestations] = args! as readonly [
|
|
403
416
|
{ archive: Hex; oracleInput: { feeAssetPriceModifier: bigint }; header: ViemHeader },
|
|
404
417
|
ViemCommitteeAttestations,
|
|
405
418
|
...unknown[],
|
|
406
419
|
];
|
|
407
420
|
|
|
408
421
|
// Verify attestationsHash
|
|
409
|
-
const computedAttestationsHash = this.computeAttestationsHash(
|
|
422
|
+
const computedAttestationsHash = this.computeAttestationsHash(verbatimAttestations);
|
|
410
423
|
if (
|
|
411
424
|
!Buffer.from(hexToBytes(computedAttestationsHash)).equals(
|
|
412
425
|
Buffer.from(hexToBytes(expectedHashes.attestationsHash)),
|
|
@@ -434,7 +447,7 @@ export class CalldataRetriever {
|
|
|
434
447
|
return undefined;
|
|
435
448
|
}
|
|
436
449
|
|
|
437
|
-
const attestations = CommitteeAttestation.fromPacked(
|
|
450
|
+
const attestations = CommitteeAttestation.fromPacked(verbatimAttestations, this.targetCommitteeSize);
|
|
438
451
|
|
|
439
452
|
this.logger.trace(`Validated and decoded propose calldata for checkpoint ${checkpointNumber}`, {
|
|
440
453
|
checkpointNumber,
|
|
@@ -442,7 +455,7 @@ export class CalldataRetriever {
|
|
|
442
455
|
header: decodedArgs.header,
|
|
443
456
|
l1BlockHash: blockHash,
|
|
444
457
|
attestations,
|
|
445
|
-
|
|
458
|
+
verbatimAttestations,
|
|
446
459
|
targetCommitteeSize: this.targetCommitteeSize,
|
|
447
460
|
});
|
|
448
461
|
|
|
@@ -451,6 +464,7 @@ export class CalldataRetriever {
|
|
|
451
464
|
archiveRoot,
|
|
452
465
|
header,
|
|
453
466
|
attestations,
|
|
467
|
+
verbatimAttestations,
|
|
454
468
|
blockHash,
|
|
455
469
|
feeAssetPriceModifier,
|
|
456
470
|
};
|
|
@@ -460,15 +474,18 @@ export class CalldataRetriever {
|
|
|
460
474
|
}
|
|
461
475
|
|
|
462
476
|
/** Computes the keccak256 hash of ABI-encoded CommitteeAttestations. */
|
|
463
|
-
private computeAttestationsHash(
|
|
464
|
-
return keccak256(encodeAbiParameters([this.getCommitteeAttestationsStructDef()], [
|
|
477
|
+
private computeAttestationsHash(verbatimAttestations: ViemCommitteeAttestations): Hex {
|
|
478
|
+
return keccak256(encodeAbiParameters([this.getCommitteeAttestationsStructDef()], [verbatimAttestations]));
|
|
465
479
|
}
|
|
466
480
|
|
|
467
481
|
/** Computes the keccak256 payload digest from the checkpoint header, archive root, and fee asset price modifier. */
|
|
468
482
|
private computePayloadDigest(header: CheckpointHeader, archiveRoot: Fr, feeAssetPriceModifier: bigint): Hex {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
483
|
+
return computeCheckpointPayloadDigest({
|
|
484
|
+
header,
|
|
485
|
+
archiveRoot,
|
|
486
|
+
feeAssetPriceModifier,
|
|
487
|
+
signatureContext: this.getSignatureContext(),
|
|
488
|
+
}).toString();
|
|
472
489
|
}
|
|
473
490
|
|
|
474
491
|
/**
|