@aztec/archiver 0.0.1-commit.e2b2873ed → 0.0.1-commit.e304674f1
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 +12 -6
- package/dest/archiver.d.ts +11 -8
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +79 -114
- package/dest/config.d.ts +3 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +2 -1
- package/dest/errors.d.ts +34 -10
- package/dest/errors.d.ts.map +1 -1
- package/dest/errors.js +45 -16
- package/dest/factory.d.ts +4 -5
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +29 -26
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/l1/bin/retrieve-calldata.js +32 -28
- package/dest/l1/calldata_retriever.d.ts +73 -50
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +191 -259
- package/dest/l1/data_retrieval.d.ts +11 -11
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +35 -34
- package/dest/l1/spire_proposer.d.ts +5 -5
- package/dest/l1/spire_proposer.d.ts.map +1 -1
- package/dest/l1/spire_proposer.js +9 -17
- package/dest/modules/data_source_base.d.ts +14 -7
- package/dest/modules/data_source_base.d.ts.map +1 -1
- package/dest/modules/data_source_base.js +39 -77
- package/dest/modules/data_store_updater.d.ts +25 -12
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +125 -94
- package/dest/modules/instrumentation.d.ts +15 -2
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +19 -2
- package/dest/modules/l1_synchronizer.d.ts +7 -9
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +176 -136
- package/dest/modules/validation.d.ts +1 -1
- package/dest/modules/validation.d.ts.map +1 -1
- package/dest/modules/validation.js +2 -2
- package/dest/store/block_store.d.ts +66 -28
- package/dest/store/block_store.d.ts.map +1 -1
- package/dest/store/block_store.js +356 -135
- package/dest/store/contract_class_store.d.ts +2 -3
- package/dest/store/contract_class_store.d.ts.map +1 -1
- package/dest/store/contract_class_store.js +7 -67
- package/dest/store/contract_instance_store.d.ts +1 -1
- package/dest/store/contract_instance_store.d.ts.map +1 -1
- package/dest/store/contract_instance_store.js +6 -2
- package/dest/store/kv_archiver_store.d.ts +61 -24
- package/dest/store/kv_archiver_store.d.ts.map +1 -1
- package/dest/store/kv_archiver_store.js +75 -27
- package/dest/store/l2_tips_cache.d.ts +20 -0
- package/dest/store/l2_tips_cache.d.ts.map +1 -0
- package/dest/store/l2_tips_cache.js +109 -0
- package/dest/store/log_store.d.ts +6 -3
- package/dest/store/log_store.d.ts.map +1 -1
- package/dest/store/log_store.js +93 -16
- package/dest/store/message_store.d.ts +5 -1
- package/dest/store/message_store.d.ts.map +1 -1
- package/dest/store/message_store.js +21 -9
- package/dest/test/fake_l1_state.d.ts +21 -1
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +133 -26
- package/dest/test/mock_archiver.d.ts +1 -1
- package/dest/test/mock_archiver.d.ts.map +1 -1
- package/dest/test/mock_archiver.js +3 -2
- 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 +2 -1
- package/dest/test/mock_l2_block_source.d.ts +26 -5
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +160 -89
- package/dest/test/mock_structs.d.ts +4 -1
- package/dest/test/mock_structs.d.ts.map +1 -1
- package/dest/test/mock_structs.js +13 -1
- package/dest/test/noop_l1_archiver.d.ts +4 -1
- package/dest/test/noop_l1_archiver.d.ts.map +1 -1
- package/dest/test/noop_l1_archiver.js +5 -2
- package/package.json +13 -13
- package/src/archiver.ts +101 -138
- package/src/config.ts +8 -1
- package/src/errors.ts +70 -26
- package/src/factory.ts +30 -16
- package/src/index.ts +1 -0
- package/src/l1/README.md +25 -68
- package/src/l1/bin/retrieve-calldata.ts +40 -27
- package/src/l1/calldata_retriever.ts +250 -379
- package/src/l1/data_retrieval.ts +31 -37
- package/src/l1/spire_proposer.ts +7 -15
- package/src/modules/data_source_base.ts +78 -98
- package/src/modules/data_store_updater.ts +138 -124
- package/src/modules/instrumentation.ts +29 -2
- package/src/modules/l1_synchronizer.ts +196 -168
- package/src/modules/validation.ts +2 -2
- package/src/store/block_store.ts +451 -172
- package/src/store/contract_class_store.ts +8 -106
- package/src/store/contract_instance_store.ts +8 -5
- package/src/store/kv_archiver_store.ts +115 -41
- package/src/store/l2_tips_cache.ts +128 -0
- package/src/store/log_store.ts +126 -27
- package/src/store/message_store.ts +27 -10
- package/src/structs/inbox_message.ts +1 -1
- package/src/test/fake_l1_state.ts +178 -30
- package/src/test/mock_archiver.ts +3 -2
- package/src/test/mock_l1_to_l2_message_source.ts +1 -0
- package/src/test/mock_l2_block_source.ts +209 -82
- package/src/test/mock_structs.ts +20 -6
- package/src/test/noop_l1_archiver.ts +7 -2
package/dest/errors.js
CHANGED
|
@@ -3,16 +3,9 @@ export class NoBlobBodiesFoundError extends Error {
|
|
|
3
3
|
super(`No blob bodies found for block ${l2BlockNum}`);
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
export class InitialBlockNumberNotSequentialError extends Error {
|
|
7
|
-
newBlockNumber;
|
|
8
|
-
previousBlockNumber;
|
|
9
|
-
constructor(newBlockNumber, previousBlockNumber){
|
|
10
|
-
super(`Cannot insert new block ${newBlockNumber} given previous block number in store is ${previousBlockNumber ?? 'undefined'}`), this.newBlockNumber = newBlockNumber, this.previousBlockNumber = previousBlockNumber;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
6
|
export class BlockNumberNotSequentialError extends Error {
|
|
14
7
|
constructor(newBlockNumber, previous){
|
|
15
|
-
super(`Cannot insert new block ${newBlockNumber} given previous block number
|
|
8
|
+
super(`Cannot insert new block ${newBlockNumber} given previous block number is ${previous ?? 'undefined'}`);
|
|
16
9
|
}
|
|
17
10
|
}
|
|
18
11
|
export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
@@ -23,13 +16,8 @@ export class InitialCheckpointNumberNotSequentialError extends Error {
|
|
|
23
16
|
}
|
|
24
17
|
}
|
|
25
18
|
export class CheckpointNumberNotSequentialError extends Error {
|
|
26
|
-
constructor(newCheckpointNumber, previous){
|
|
27
|
-
super(`Cannot insert new checkpoint ${newCheckpointNumber} given previous checkpoint number
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export class CheckpointNumberNotConsistentError extends Error {
|
|
31
|
-
constructor(newCheckpointNumber, previous){
|
|
32
|
-
super(`Cannot insert block for new checkpoint ${newCheckpointNumber} given previous block was checkpoint ${previous ?? 'undefined'}`);
|
|
19
|
+
constructor(newCheckpointNumber, previous, source = 'confirmed'){
|
|
20
|
+
super(`Cannot insert new checkpoint ${newCheckpointNumber} given previous ${source} checkpoint number is ${previous ?? 'undefined'}`);
|
|
33
21
|
}
|
|
34
22
|
}
|
|
35
23
|
export class BlockIndexNotSequentialError extends Error {
|
|
@@ -52,7 +40,48 @@ export class BlockNotFoundError extends Error {
|
|
|
52
40
|
super(`Failed to find expected block number ${blockNumber}`);
|
|
53
41
|
}
|
|
54
42
|
}
|
|
55
|
-
export class
|
|
43
|
+
/** Thrown when a proposed block matches a block that was already checkpointed. This is expected for late proposals. */ export class BlockAlreadyCheckpointedError extends Error {
|
|
44
|
+
blockNumber;
|
|
45
|
+
constructor(blockNumber){
|
|
46
|
+
super(`Block ${blockNumber} has already been checkpointed with the same content`), this.blockNumber = blockNumber;
|
|
47
|
+
this.name = 'BlockAlreadyCheckpointedError';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Thrown when logs are added for a tag whose last stored log has a higher block number than the new log. */ export class OutOfOrderLogInsertionError extends Error {
|
|
51
|
+
logType;
|
|
52
|
+
tag;
|
|
53
|
+
lastBlockNumber;
|
|
54
|
+
newBlockNumber;
|
|
55
|
+
constructor(logType, tag, lastBlockNumber, newBlockNumber){
|
|
56
|
+
super(`Out-of-order ${logType} log insertion for tag ${tag}: ` + `last existing log is from block ${lastBlockNumber} but new log is from block ${newBlockNumber}`), this.logType = logType, this.tag = tag, this.lastBlockNumber = lastBlockNumber, this.newBlockNumber = newBlockNumber;
|
|
57
|
+
this.name = 'OutOfOrderLogInsertionError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Thrown when L1 to L2 messages are requested for a checkpoint whose message tree hasn't been sealed yet. */ export class L1ToL2MessagesNotReadyError extends Error {
|
|
61
|
+
checkpointNumber;
|
|
62
|
+
inboxTreeInProgress;
|
|
63
|
+
constructor(checkpointNumber, inboxTreeInProgress){
|
|
64
|
+
super(`Cannot get L1 to L2 messages for checkpoint ${checkpointNumber}: ` + `inbox tree in progress is ${inboxTreeInProgress}, messages not yet sealed`), this.checkpointNumber = checkpointNumber, this.inboxTreeInProgress = inboxTreeInProgress;
|
|
65
|
+
this.name = 'L1ToL2MessagesNotReadyError';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Thrown when a proposed checkpoint number is stale (already processed). */ export class ProposedCheckpointStaleError extends Error {
|
|
69
|
+
proposedCheckpointNumber;
|
|
70
|
+
currentProposedNumber;
|
|
71
|
+
constructor(proposedCheckpointNumber, currentProposedNumber){
|
|
72
|
+
super(`Stale proposed checkpoint ${proposedCheckpointNumber}: current proposed is ${currentProposedNumber}`), this.proposedCheckpointNumber = proposedCheckpointNumber, this.currentProposedNumber = currentProposedNumber;
|
|
73
|
+
this.name = 'ProposedCheckpointStaleError';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** Thrown when a proposed checkpoint number is not the expected confirmed + 1. */ export class ProposedCheckpointNotSequentialError extends Error {
|
|
77
|
+
proposedCheckpointNumber;
|
|
78
|
+
confirmedCheckpointNumber;
|
|
79
|
+
constructor(proposedCheckpointNumber, confirmedCheckpointNumber){
|
|
80
|
+
super(`Proposed checkpoint ${proposedCheckpointNumber} is not sequential: expected ${confirmedCheckpointNumber + 1} (confirmed + 1)`), this.proposedCheckpointNumber = proposedCheckpointNumber, this.confirmedCheckpointNumber = confirmedCheckpointNumber;
|
|
81
|
+
this.name = 'ProposedCheckpointNotSequentialError';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** Thrown when a proposed block conflicts with an already checkpointed block (different content). */ export class CannotOverwriteCheckpointedBlockError extends Error {
|
|
56
85
|
blockNumber;
|
|
57
86
|
lastCheckpointedBlock;
|
|
58
87
|
constructor(blockNumber, lastCheckpointedBlock){
|
package/dest/factory.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { DataStoreConfig } from '@aztec/kv-store
|
|
2
|
-
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
1
|
+
import type { DataStoreConfig } from '@aztec/stdlib/kv-store';
|
|
3
2
|
import { Archiver, type ArchiverDeps } from './archiver.js';
|
|
4
3
|
import { type ArchiverConfig } from './config.js';
|
|
5
4
|
import { KVArchiverDataStore } from './store/kv_archiver_store.js';
|
|
6
5
|
export declare const ARCHIVER_STORE_NAME = "archiver";
|
|
7
6
|
/** Creates an archiver store. */
|
|
8
|
-
export declare function createArchiverStore(userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> & DataStoreConfig
|
|
7
|
+
export declare function createArchiverStore(userConfig: Pick<ArchiverConfig, 'archiverStoreMapSizeKb' | 'maxLogs'> & DataStoreConfig): Promise<KVArchiverDataStore>;
|
|
9
8
|
/**
|
|
10
9
|
* Creates a local archiver.
|
|
11
10
|
* @param config - The archiver configuration.
|
|
@@ -16,6 +15,6 @@ export declare function createArchiverStore(userConfig: Pick<ArchiverConfig, 'ar
|
|
|
16
15
|
export declare function createArchiver(config: ArchiverConfig & DataStoreConfig, deps: ArchiverDeps, opts?: {
|
|
17
16
|
blockUntilSync: boolean;
|
|
18
17
|
}): Promise<Archiver>;
|
|
19
|
-
/** Registers protocol contracts in the archiver store. */
|
|
18
|
+
/** Registers protocol contracts in the archiver store. Idempotent — skips contracts that already exist (e.g. on node restart). */
|
|
20
19
|
export declare function registerProtocolContracts(store: KVArchiverDataStore): Promise<void>;
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ZhY3RvcnkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBZ0JBLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBTTlELE9BQU8sRUFBRSxRQUFRLEVBQUUsS0FBSyxZQUFZLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDNUQsT0FBTyxFQUFFLEtBQUssY0FBYyxFQUFxQixNQUFNLGFBQWEsQ0FBQztBQUdyRSxPQUFPLEVBQXVCLG1CQUFtQixFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFHeEYsZUFBTyxNQUFNLG1CQUFtQixhQUFhLENBQUM7QUFFOUMsaUNBQWlDO0FBQ2pDLHdCQUFzQixtQkFBbUIsQ0FDdkMsVUFBVSxFQUFFLElBQUksQ0FBQyxjQUFjLEVBQUUsd0JBQXdCLEdBQUcsU0FBUyxDQUFDLEdBQUcsZUFBZSxnQ0FRekY7QUFFRDs7Ozs7O0dBTUc7QUFDSCx3QkFBc0IsY0FBYyxDQUNsQyxNQUFNLEVBQUUsY0FBYyxHQUFHLGVBQWUsRUFDeEMsSUFBSSxFQUFFLFlBQVksRUFDbEIsSUFBSSxHQUFFO0lBQUUsY0FBYyxFQUFFLE9BQU8sQ0FBQTtDQUE2QixHQUMzRCxPQUFPLENBQUMsUUFBUSxDQUFDLENBdUhuQjtBQUVELG9JQUFrSTtBQUNsSSx3QkFBc0IseUJBQXlCLENBQUMsS0FBSyxFQUFFLG1CQUFtQixpQkF5QnpFIn0=
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAM9D,OAAO,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,aAAa,CAAC;AAGrE,OAAO,EAAuB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxF,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,iCAAiC;AACjC,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,wBAAwB,GAAG,SAAS,CAAC,GAAG,eAAe,gCAQzF;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,GAAG,eAAe,EACxC,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE;IAAE,cAAc,EAAE,OAAO,CAAA;CAA6B,GAC3D,OAAO,CAAC,QAAQ,CAAC,CAuHnB;AAED,oIAAkI;AAClI,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,iBAyBzE"}
|
package/dest/factory.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
2
2
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
3
|
+
import { makeL1HttpTransport } from '@aztec/ethereum/client';
|
|
3
4
|
import { InboxContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
4
5
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
5
6
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
@@ -13,20 +14,21 @@ import { FunctionType, decodeFunctionSignature } from '@aztec/stdlib/abi';
|
|
|
13
14
|
import { computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
14
15
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
15
16
|
import { EventEmitter } from 'events';
|
|
16
|
-
import { createPublicClient
|
|
17
|
+
import { createPublicClient } from 'viem';
|
|
17
18
|
import { Archiver } from './archiver.js';
|
|
18
19
|
import { mapArchiverConfig } from './config.js';
|
|
19
20
|
import { ArchiverInstrumentation } from './modules/instrumentation.js';
|
|
20
21
|
import { ArchiverL1Synchronizer } from './modules/l1_synchronizer.js';
|
|
21
22
|
import { ARCHIVER_DB_VERSION, KVArchiverDataStore } from './store/kv_archiver_store.js';
|
|
23
|
+
import { L2TipsCache } from './store/l2_tips_cache.js';
|
|
22
24
|
export const ARCHIVER_STORE_NAME = 'archiver';
|
|
23
|
-
/** Creates an archiver store. */ export async function createArchiverStore(userConfig
|
|
25
|
+
/** Creates an archiver store. */ export async function createArchiverStore(userConfig) {
|
|
24
26
|
const config = {
|
|
25
27
|
...userConfig,
|
|
26
28
|
dataStoreMapSizeKb: userConfig.archiverStoreMapSizeKb ?? userConfig.dataStoreMapSizeKb
|
|
27
29
|
};
|
|
28
30
|
const store = await createStore(ARCHIVER_STORE_NAME, ARCHIVER_DB_VERSION, config);
|
|
29
|
-
return new KVArchiverDataStore(store, config.maxLogs
|
|
31
|
+
return new KVArchiverDataStore(store, config.maxLogs);
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
32
34
|
* Creates a local archiver.
|
|
@@ -37,39 +39,39 @@ export const ARCHIVER_STORE_NAME = 'archiver';
|
|
|
37
39
|
*/ export async function createArchiver(config, deps, opts = {
|
|
38
40
|
blockUntilSync: true
|
|
39
41
|
}) {
|
|
40
|
-
const archiverStore = await createArchiverStore(config
|
|
41
|
-
epochDuration: config.aztecEpochDuration
|
|
42
|
-
});
|
|
42
|
+
const archiverStore = await createArchiverStore(config);
|
|
43
43
|
await registerProtocolContracts(archiverStore);
|
|
44
44
|
// Create Ethereum clients
|
|
45
45
|
const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
|
|
46
|
+
const httpTimeout = config.l1HttpTimeoutMS;
|
|
46
47
|
const publicClient = createPublicClient({
|
|
47
48
|
chain: chain.chainInfo,
|
|
48
|
-
transport:
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
transport: makeL1HttpTransport(config.l1RpcUrls, {
|
|
50
|
+
timeout: httpTimeout
|
|
51
|
+
}),
|
|
51
52
|
pollingInterval: config.viemPollingIntervalMS
|
|
52
53
|
});
|
|
53
54
|
// Create debug client using debug RPC URLs if available, otherwise fall back to regular RPC URLs
|
|
54
55
|
const debugRpcUrls = config.l1DebugRpcUrls.length > 0 ? config.l1DebugRpcUrls : config.l1RpcUrls;
|
|
55
56
|
const debugClient = createPublicClient({
|
|
56
57
|
chain: chain.chainInfo,
|
|
57
|
-
transport:
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
transport: makeL1HttpTransport(debugRpcUrls, {
|
|
59
|
+
timeout: httpTimeout
|
|
60
|
+
}),
|
|
60
61
|
pollingInterval: config.viemPollingIntervalMS
|
|
61
62
|
});
|
|
62
63
|
// Create L1 contract instances
|
|
63
64
|
const rollup = new RollupContract(publicClient, config.l1Contracts.rollupAddress);
|
|
64
65
|
const inbox = new InboxContract(publicClient, config.l1Contracts.inboxAddress);
|
|
65
66
|
// Fetch L1 constants from rollup contract
|
|
66
|
-
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress, targetCommitteeSize] = await Promise.all([
|
|
67
|
+
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress, targetCommitteeSize, rollupManaLimit] = await Promise.all([
|
|
67
68
|
rollup.getL1StartBlock(),
|
|
68
69
|
rollup.getL1GenesisTime(),
|
|
69
70
|
rollup.getProofSubmissionEpochs(),
|
|
70
71
|
rollup.getGenesisArchiveTreeRoot(),
|
|
71
72
|
rollup.getSlashingProposerAddress(),
|
|
72
|
-
rollup.getTargetCommitteeSize()
|
|
73
|
+
rollup.getTargetCommitteeSize(),
|
|
74
|
+
rollup.getManaLimit()
|
|
73
75
|
]);
|
|
74
76
|
const l1StartBlockHash = await publicClient.getBlock({
|
|
75
77
|
blockNumber: l1StartBlock,
|
|
@@ -85,7 +87,8 @@ export const ARCHIVER_STORE_NAME = 'archiver';
|
|
|
85
87
|
ethereumSlotDuration,
|
|
86
88
|
proofSubmissionEpochs: Number(proofSubmissionEpochs),
|
|
87
89
|
targetCommitteeSize,
|
|
88
|
-
genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString())
|
|
90
|
+
genesisArchiveRoot: Fr.fromString(genesisArchiveRoot.toString()),
|
|
91
|
+
rollupManaLimit: Number(rollupManaLimit)
|
|
89
92
|
};
|
|
90
93
|
const archiverConfig = merge({
|
|
91
94
|
pollingIntervalMs: 10_000,
|
|
@@ -98,35 +101,35 @@ export const ARCHIVER_STORE_NAME = 'archiver';
|
|
|
98
101
|
const instrumentation = await ArchiverInstrumentation.new(telemetry, ()=>archiverStore.estimateSize());
|
|
99
102
|
// Create the event emitter that will be shared by archiver and synchronizer
|
|
100
103
|
const events = new EventEmitter();
|
|
104
|
+
// Create L2 tips cache shared by archiver and synchronizer
|
|
105
|
+
const l2TipsCache = new L2TipsCache(archiverStore.blockStore);
|
|
101
106
|
// Create the L1 synchronizer
|
|
102
|
-
const synchronizer = new ArchiverL1Synchronizer(publicClient, debugClient, rollup, inbox,
|
|
103
|
-
...config.l1Contracts,
|
|
104
|
-
slashingProposerAddress
|
|
105
|
-
}, archiverStore, archiverConfig, deps.blobClient, epochCache, deps.dateProvider ?? new DateProvider(), instrumentation, l1Constants, events, instrumentation.tracer);
|
|
107
|
+
const synchronizer = new ArchiverL1Synchronizer(publicClient, debugClient, rollup, inbox, archiverStore, archiverConfig, deps.blobClient, epochCache, deps.dateProvider ?? new DateProvider(), instrumentation, l1Constants, events, instrumentation.tracer, l2TipsCache, undefined);
|
|
106
108
|
const archiver = new Archiver(publicClient, debugClient, rollup, {
|
|
107
109
|
...config.l1Contracts,
|
|
108
110
|
slashingProposerAddress
|
|
109
|
-
}, archiverStore, archiverConfig, deps.blobClient, instrumentation, l1Constants, synchronizer, events);
|
|
111
|
+
}, archiverStore, archiverConfig, deps.blobClient, instrumentation, l1Constants, synchronizer, events, l2TipsCache);
|
|
110
112
|
await archiver.start(opts.blockUntilSync);
|
|
111
113
|
return archiver;
|
|
112
114
|
}
|
|
113
|
-
/** Registers protocol contracts in the archiver store. */ export async function registerProtocolContracts(store) {
|
|
115
|
+
/** Registers protocol contracts in the archiver store. Idempotent — skips contracts that already exist (e.g. on node restart). */ export async function registerProtocolContracts(store) {
|
|
114
116
|
const blockNumber = 0;
|
|
115
117
|
for (const name of protocolContractNames){
|
|
116
118
|
const provider = new BundledProtocolContractsProvider();
|
|
117
119
|
const contract = await provider.getProtocolContractArtifact(name);
|
|
120
|
+
// Skip if already registered (happens on node restart with a persisted store).
|
|
121
|
+
if (await store.getContractClass(contract.contractClass.id)) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
const publicBytecodeCommitment = await computePublicBytecodeCommitment(contract.contractClass.packedBytecode);
|
|
118
125
|
const contractClassPublic = {
|
|
119
126
|
...contract.contractClass,
|
|
120
|
-
|
|
121
|
-
utilityFunctions: []
|
|
127
|
+
publicBytecodeCommitment
|
|
122
128
|
};
|
|
123
129
|
const publicFunctionSignatures = contract.artifact.functions.filter((fn)=>fn.functionType === FunctionType.PUBLIC).map((fn)=>decodeFunctionSignature(fn.name, fn.parameters));
|
|
124
130
|
await store.registerContractFunctionSignatures(publicFunctionSignatures);
|
|
125
|
-
const bytecodeCommitment = await computePublicBytecodeCommitment(contractClassPublic.packedBytecode);
|
|
126
131
|
await store.addContractClasses([
|
|
127
132
|
contractClassPublic
|
|
128
|
-
], [
|
|
129
|
-
bytecodeCommitment
|
|
130
133
|
], BlockNumber(blockNumber));
|
|
131
134
|
await store.addContractInstances([
|
|
132
135
|
contract.instance
|
package/dest/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export * from './config.js';
|
|
|
7
7
|
export { type L1PublishedData } from './structs/published.js';
|
|
8
8
|
export { KVArchiverDataStore, ARCHIVER_DB_VERSION } from './store/kv_archiver_store.js';
|
|
9
9
|
export { ContractInstanceStore } from './store/contract_instance_store.js';
|
|
10
|
+
export { L2TipsCache } from './store/l2_tips_cache.js';
|
|
10
11
|
export { retrieveCheckpointsFromRollup, retrieveL2ProofVerifiedEvents } from './l1/data_retrieval.js';
|
|
11
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyxpQ0FBaUMsQ0FBQztBQUNoRCxjQUFjLGFBQWEsQ0FBQztBQUU1QixPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUM5RCxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUN4RixPQUFPLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxvQ0FBb0MsQ0FBQztBQUMzRSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFFdkQsT0FBTyxFQUFFLDZCQUE2QixFQUFFLDZCQUE2QixFQUFFLE1BQU0sd0JBQXdCLENBQUMifQ==
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,aAAa,CAAC;AAE5B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export * from './modules/data_store_updater.js';
|
|
|
6
6
|
export * from './config.js';
|
|
7
7
|
export { KVArchiverDataStore, ARCHIVER_DB_VERSION } from './store/kv_archiver_store.js';
|
|
8
8
|
export { ContractInstanceStore } from './store/contract_instance_store.js';
|
|
9
|
+
export { L2TipsCache } from './store/l2_tips_cache.js';
|
|
9
10
|
export { retrieveCheckpointsFromRollup, retrieveL2ProofVerifiedEvents } from './l1/data_retrieval.js';
|
|
@@ -3,7 +3,7 @@ import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
5
5
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
6
|
-
import { createPublicClient, getAbiItem, http, toEventSelector } from 'viem';
|
|
6
|
+
import { createPublicClient, decodeEventLog, getAbiItem, http, toEventSelector } from 'viem';
|
|
7
7
|
import { mainnet } from 'viem/chains';
|
|
8
8
|
import { CalldataRetriever } from '../calldata_retriever.js';
|
|
9
9
|
const logger = createLogger('archiver:calldata-test');
|
|
@@ -74,47 +74,51 @@ async function main() {
|
|
|
74
74
|
throw new Error(`Transaction ${txHash} not found`);
|
|
75
75
|
}
|
|
76
76
|
logger.info(`Transaction found in block ${tx.blockNumber}`);
|
|
77
|
-
// For simplicity, use zero addresses for optional contract addresses
|
|
78
|
-
// In production, these would be fetched from the rollup contract or configuration
|
|
79
|
-
const slashingProposerAddress = EthAddress.ZERO;
|
|
80
|
-
const governanceProposerAddress = EthAddress.ZERO;
|
|
81
|
-
const slashFactoryAddress = undefined;
|
|
82
|
-
logger.info('Using zero addresses for governance/slashing (can be configured if needed)');
|
|
83
77
|
// Create CalldataRetriever
|
|
84
|
-
const retriever = new CalldataRetriever(publicClient, publicClient, targetCommitteeSize, undefined, logger,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
slashingProposerAddress,
|
|
88
|
-
slashFactoryAddress
|
|
89
|
-
});
|
|
90
|
-
// Extract checkpoint number from transaction logs
|
|
91
|
-
logger.info('Decoding transaction to extract checkpoint number...');
|
|
78
|
+
const retriever = new CalldataRetriever(publicClient, publicClient, targetCommitteeSize, undefined, logger, rollupAddress);
|
|
79
|
+
// Extract checkpoint number and hashes from transaction logs
|
|
80
|
+
logger.info('Decoding transaction to extract checkpoint number and hashes...');
|
|
92
81
|
const receipt = await publicClient.getTransactionReceipt({
|
|
93
82
|
hash: txHash
|
|
94
83
|
});
|
|
95
|
-
// Look for CheckpointProposed event
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
// Look for CheckpointProposed event
|
|
85
|
+
const checkpointProposedEventAbi = getAbiItem({
|
|
86
|
+
abi: RollupAbi,
|
|
87
|
+
name: 'CheckpointProposed'
|
|
88
|
+
});
|
|
89
|
+
const checkpointProposedLog = receipt.logs.find((log)=>{
|
|
99
90
|
try {
|
|
100
|
-
return log.address.toLowerCase() === rollupAddress.toString().toLowerCase() && log.topics[0] === toEventSelector(
|
|
101
|
-
abi: RollupAbi,
|
|
102
|
-
name: 'CheckpointProposed'
|
|
103
|
-
}));
|
|
91
|
+
return log.address.toLowerCase() === rollupAddress.toString().toLowerCase() && log.topics[0] === toEventSelector(checkpointProposedEventAbi);
|
|
104
92
|
} catch {
|
|
105
93
|
return false;
|
|
106
94
|
}
|
|
107
95
|
});
|
|
108
|
-
if (!
|
|
96
|
+
if (!checkpointProposedLog || checkpointProposedLog.topics[1] === undefined) {
|
|
109
97
|
throw new Error(`Checkpoint proposed event not found`);
|
|
110
98
|
}
|
|
111
|
-
const checkpointNumber = CheckpointNumber.fromBigInt(BigInt(
|
|
99
|
+
const checkpointNumber = CheckpointNumber.fromBigInt(BigInt(checkpointProposedLog.topics[1]));
|
|
100
|
+
// Decode the full event to extract attestationsHash and payloadDigest
|
|
101
|
+
const decodedEvent = decodeEventLog({
|
|
102
|
+
abi: RollupAbi,
|
|
103
|
+
data: checkpointProposedLog.data,
|
|
104
|
+
topics: checkpointProposedLog.topics
|
|
105
|
+
});
|
|
106
|
+
const eventArgs = decodedEvent.args;
|
|
107
|
+
if (!eventArgs.attestationsHash || !eventArgs.payloadDigest) {
|
|
108
|
+
throw new Error(`CheckpointProposed event missing attestationsHash or payloadDigest`);
|
|
109
|
+
}
|
|
110
|
+
const expectedHashes = {
|
|
111
|
+
attestationsHash: eventArgs.attestationsHash,
|
|
112
|
+
payloadDigest: eventArgs.payloadDigest
|
|
113
|
+
};
|
|
114
|
+
logger.info(`Checkpoint Number: ${checkpointNumber}`);
|
|
115
|
+
logger.info(`Attestations Hash: ${expectedHashes.attestationsHash}`);
|
|
116
|
+
logger.info(`Payload Digest: ${expectedHashes.payloadDigest}`);
|
|
112
117
|
logger.info('');
|
|
113
118
|
logger.info('Retrieving checkpoint from rollup transaction...');
|
|
114
119
|
logger.info('');
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
logger.info(' Successfully retrieved block header!');
|
|
120
|
+
const result = await retriever.getCheckpointFromRollupTx(txHash, [], checkpointNumber, expectedHashes);
|
|
121
|
+
logger.info(' Successfully retrieved block header!');
|
|
118
122
|
logger.info('');
|
|
119
123
|
logger.info('Block Header Details:');
|
|
120
124
|
logger.info('====================');
|
|
@@ -7,9 +7,19 @@ import { CommitteeAttestation } from '@aztec/stdlib/block';
|
|
|
7
7
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
8
8
|
import { type Hex, type Transaction } from 'viem';
|
|
9
9
|
import type { ArchiverInstrumentation } from '../modules/instrumentation.js';
|
|
10
|
+
/** Decoded checkpoint data from a propose calldata. */
|
|
11
|
+
type CheckpointData = {
|
|
12
|
+
checkpointNumber: CheckpointNumber;
|
|
13
|
+
archiveRoot: Fr;
|
|
14
|
+
header: CheckpointHeader;
|
|
15
|
+
attestations: CommitteeAttestation[];
|
|
16
|
+
blockHash: string;
|
|
17
|
+
feeAssetPriceModifier: bigint;
|
|
18
|
+
};
|
|
10
19
|
/**
|
|
11
20
|
* Extracts calldata to the `propose` method of the rollup contract from an L1 transaction
|
|
12
|
-
* in order to reconstruct an L2 block header.
|
|
21
|
+
* in order to reconstruct an L2 block header. Uses hash matching against expected hashes
|
|
22
|
+
* from the CheckpointProposed event to verify the correct propose calldata.
|
|
13
23
|
*/
|
|
14
24
|
export declare class CalldataRetriever {
|
|
15
25
|
private readonly publicClient;
|
|
@@ -17,65 +27,79 @@ export declare class CalldataRetriever {
|
|
|
17
27
|
private readonly targetCommitteeSize;
|
|
18
28
|
private readonly instrumentation;
|
|
19
29
|
private readonly logger;
|
|
20
|
-
/** Pre-computed valid contract calls for validation */
|
|
21
|
-
private readonly validContractCalls;
|
|
22
30
|
private readonly rollupAddress;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
31
|
+
/** Tx hashes we've already logged for trace+debug failure (log once per tx per process). */
|
|
32
|
+
private static readonly traceFailureWarnedTxHashes;
|
|
33
|
+
/** Clears the trace-failure warned set. For testing only. */
|
|
34
|
+
static resetTraceFailureWarnedForTesting(): void;
|
|
35
|
+
constructor(publicClient: ViemPublicClient, debugClient: ViemPublicDebugClient, targetCommitteeSize: number, instrumentation: ArchiverInstrumentation | undefined, logger: Logger, rollupAddress: EthAddress);
|
|
29
36
|
/**
|
|
30
37
|
* Gets checkpoint header and metadata from the calldata of an L1 transaction.
|
|
31
38
|
* Tries multicall3 decoding, falls back to trace-based extraction.
|
|
32
39
|
* @param txHash - Hash of the tx that published it.
|
|
33
40
|
* @param blobHashes - Blob hashes for the checkpoint.
|
|
34
41
|
* @param checkpointNumber - Checkpoint number.
|
|
35
|
-
* @param expectedHashes -
|
|
42
|
+
* @param expectedHashes - Expected hashes from the CheckpointProposed event for validation
|
|
36
43
|
* @returns Checkpoint header and metadata from the calldata, deserialized
|
|
37
44
|
*/
|
|
38
45
|
getCheckpointFromRollupTx(txHash: `0x${string}`, _blobHashes: Buffer[], checkpointNumber: CheckpointNumber, expectedHashes: {
|
|
39
|
-
attestationsHash
|
|
40
|
-
payloadDigest
|
|
41
|
-
}): Promise<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}>;
|
|
48
|
-
/** Gets rollup propose calldata from a transaction */
|
|
49
|
-
protected getProposeCallData(tx: Transaction, checkpointNumber: CheckpointNumber): Promise<Hex>;
|
|
46
|
+
attestationsHash: Hex;
|
|
47
|
+
payloadDigest: Hex;
|
|
48
|
+
}): Promise<CheckpointData>;
|
|
49
|
+
/** Gets checkpoint data from a transaction by trying decode strategies then falling back to trace. */
|
|
50
|
+
protected getCheckpointFromTx(tx: Transaction, checkpointNumber: CheckpointNumber, expectedHashes: {
|
|
51
|
+
attestationsHash: Hex;
|
|
52
|
+
payloadDigest: Hex;
|
|
53
|
+
}): Promise<CheckpointData>;
|
|
50
54
|
/**
|
|
51
55
|
* Attempts to decode a transaction as a Spire Proposer multicall wrapper.
|
|
52
|
-
* If successful,
|
|
56
|
+
* If successful, iterates all wrapped calls and validates each as either multicall3
|
|
57
|
+
* or direct propose, verifying against expected hashes.
|
|
53
58
|
* @param tx - The transaction to decode
|
|
54
|
-
* @
|
|
59
|
+
* @param expectedHashes - Expected hashes for hash-verified matching
|
|
60
|
+
* @param checkpointNumber - The checkpoint number
|
|
61
|
+
* @param blockHash - The L1 block hash
|
|
62
|
+
* @returns The checkpoint data if successfully decoded and validated, undefined otherwise
|
|
55
63
|
*/
|
|
56
|
-
protected tryDecodeSpireProposer(tx: Transaction
|
|
64
|
+
protected tryDecodeSpireProposer(tx: Transaction, expectedHashes: {
|
|
65
|
+
attestationsHash: Hex;
|
|
66
|
+
payloadDigest: Hex;
|
|
67
|
+
}, checkpointNumber: CheckpointNumber, blockHash: Hex): Promise<CheckpointData | undefined>;
|
|
57
68
|
/**
|
|
58
69
|
* Attempts to decode transaction input as multicall3 and extract propose calldata.
|
|
59
|
-
*
|
|
70
|
+
* Finds all calls matching the rollup address and propose selector, then decodes
|
|
71
|
+
* and verifies each candidate against expected hashes from the CheckpointProposed event.
|
|
60
72
|
* @param tx - The transaction-like object with to, input, and hash
|
|
61
|
-
* @
|
|
73
|
+
* @param expectedHashes - Expected hashes from CheckpointProposed event
|
|
74
|
+
* @param checkpointNumber - The checkpoint number
|
|
75
|
+
* @param blockHash - The L1 block hash
|
|
76
|
+
* @returns The checkpoint data if successfully validated, undefined otherwise
|
|
62
77
|
*/
|
|
63
78
|
protected tryDecodeMulticall3(tx: {
|
|
64
79
|
to: Hex | null | undefined;
|
|
65
80
|
input: Hex;
|
|
66
81
|
hash: Hex;
|
|
67
|
-
}
|
|
82
|
+
}, expectedHashes: {
|
|
83
|
+
attestationsHash: Hex;
|
|
84
|
+
payloadDigest: Hex;
|
|
85
|
+
}, checkpointNumber: CheckpointNumber, blockHash: Hex): CheckpointData | undefined;
|
|
68
86
|
/**
|
|
69
87
|
* Attempts to decode transaction as a direct propose call to the rollup contract.
|
|
70
|
-
*
|
|
88
|
+
* Decodes, verifies hashes, and builds checkpoint data in a single pass.
|
|
71
89
|
* @param tx - The transaction-like object with to, input, and hash
|
|
72
|
-
* @
|
|
90
|
+
* @param expectedHashes - Expected hashes from CheckpointProposed event
|
|
91
|
+
* @param checkpointNumber - The checkpoint number
|
|
92
|
+
* @param blockHash - The L1 block hash
|
|
93
|
+
* @returns The checkpoint data if successfully validated, undefined otherwise
|
|
73
94
|
*/
|
|
74
95
|
protected tryDecodeDirectPropose(tx: {
|
|
75
96
|
to: Hex | null | undefined;
|
|
76
97
|
input: Hex;
|
|
77
98
|
hash: Hex;
|
|
78
|
-
}
|
|
99
|
+
}, expectedHashes: {
|
|
100
|
+
attestationsHash: Hex;
|
|
101
|
+
payloadDigest: Hex;
|
|
102
|
+
}, checkpointNumber: CheckpointNumber, blockHash: Hex): CheckpointData | undefined;
|
|
79
103
|
/**
|
|
80
104
|
* Uses debug/trace RPC to extract the actual calldata from the successful propose call.
|
|
81
105
|
* This is the definitive fallback that works for any transaction pattern.
|
|
@@ -84,29 +108,28 @@ export declare class CalldataRetriever {
|
|
|
84
108
|
* @returns The propose calldata from the successful call
|
|
85
109
|
*/
|
|
86
110
|
protected extractCalldataViaTrace(txHash: Hex): Promise<Hex>;
|
|
111
|
+
/**
|
|
112
|
+
* Decodes propose calldata, verifies against expected hashes, and builds checkpoint data.
|
|
113
|
+
* Returns undefined on decode errors or hash mismatches (soft failure for try-based callers).
|
|
114
|
+
* @param proposeCalldata - The propose function calldata
|
|
115
|
+
* @param expectedHashes - Expected hashes from the CheckpointProposed event
|
|
116
|
+
* @param checkpointNumber - The checkpoint number
|
|
117
|
+
* @param blockHash - The L1 block hash
|
|
118
|
+
* @returns The decoded checkpoint data, or undefined on failure
|
|
119
|
+
*/
|
|
120
|
+
protected tryDecodeAndVerifyPropose(proposeCalldata: Hex, expectedHashes: {
|
|
121
|
+
attestationsHash: Hex;
|
|
122
|
+
payloadDigest: Hex;
|
|
123
|
+
}, checkpointNumber: CheckpointNumber, blockHash: Hex): CheckpointData | undefined;
|
|
124
|
+
/** Computes the keccak256 hash of ABI-encoded CommitteeAttestations. */
|
|
125
|
+
private computeAttestationsHash;
|
|
126
|
+
/** Computes the keccak256 payload digest from the checkpoint header, archive root, and fee asset price modifier. */
|
|
127
|
+
private computePayloadDigest;
|
|
87
128
|
/**
|
|
88
129
|
* Extracts the CommitteeAttestations struct definition from RollupAbi.
|
|
89
130
|
* Finds the _attestations parameter by name in the propose function.
|
|
90
|
-
* Lazy-loaded to avoid issues during module initialization.
|
|
91
131
|
*/
|
|
92
132
|
private getCommitteeAttestationsStructDef;
|
|
93
|
-
/**
|
|
94
|
-
* Decodes propose calldata and builds the checkpoint header structure.
|
|
95
|
-
* @param proposeCalldata - The propose function calldata
|
|
96
|
-
* @param blockHash - The L1 block hash containing this transaction
|
|
97
|
-
* @param checkpointNumber - The checkpoint number
|
|
98
|
-
* @param expectedHashes - Optional expected hashes from the CheckpointProposed event for validation
|
|
99
|
-
* @returns The decoded checkpoint header and metadata
|
|
100
|
-
*/
|
|
101
|
-
protected decodeAndBuildCheckpoint(proposeCalldata: Hex, blockHash: Hex, checkpointNumber: CheckpointNumber, expectedHashes: {
|
|
102
|
-
attestationsHash?: Hex;
|
|
103
|
-
payloadDigest?: Hex;
|
|
104
|
-
}): {
|
|
105
|
-
checkpointNumber: CheckpointNumber;
|
|
106
|
-
archiveRoot: Fr;
|
|
107
|
-
header: CheckpointHeader;
|
|
108
|
-
attestations: CommitteeAttestation[];
|
|
109
|
-
blockHash: string;
|
|
110
|
-
};
|
|
111
133
|
}
|
|
112
|
-
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2FsbGRhdGFfcmV0cmlldmVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbDEvY2FsbGRhdGFfcmV0cmlldmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLHFCQUFxQixFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDckYsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFFbkUsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUMzRCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVwRCxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUUzRCxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV4RCxPQUFPLEVBRUwsS0FBSyxHQUFHLEVBQ1IsS0FBSyxXQUFXLEVBT2pCLE1BQU0sTUFBTSxDQUFDO0FBRWQsT0FBTyxLQUFLLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQU03RSx1REFBdUQ7QUFDdkQsS0FBSy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|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calldata_retriever.d.ts","sourceRoot":"","sources":["../../src/l1/calldata_retriever.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"calldata_retriever.d.ts","sourceRoot":"","sources":["../../src/l1/calldata_retriever.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,WAAW,EAOjB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAM7E,uDAAuD;AACvD,KAAK,cAAc,GAAG;IACpB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,WAAW,EAAE,EAAE,CAAC;IAChB,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,qBAAa,iBAAiB;IAU1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,C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