@aztec/archiver 2.1.8 → 2.1.9
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/archiver/archiver.d.ts +6 -5
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +26 -9
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +5 -0
- package/dest/archiver/instrumentation.d.ts +2 -0
- package/dest/archiver/instrumentation.d.ts.map +1 -1
- package/dest/archiver/instrumentation.js +11 -0
- package/dest/archiver/l1/bin/retrieve-calldata.d.ts +3 -0
- package/dest/archiver/l1/bin/retrieve-calldata.d.ts.map +1 -0
- package/dest/archiver/l1/bin/retrieve-calldata.js +149 -0
- package/dest/archiver/l1/calldata_retriever.d.ts +87 -0
- package/dest/archiver/l1/calldata_retriever.d.ts.map +1 -0
- package/dest/archiver/l1/calldata_retriever.js +406 -0
- package/dest/archiver/{data_retrieval.d.ts → l1/data_retrieval.d.ts} +13 -6
- package/dest/archiver/l1/data_retrieval.d.ts.map +1 -0
- package/dest/archiver/{data_retrieval.js → l1/data_retrieval.js} +22 -99
- package/dest/archiver/l1/debug_tx.d.ts +19 -0
- package/dest/archiver/l1/debug_tx.d.ts.map +1 -0
- package/dest/archiver/l1/debug_tx.js +73 -0
- package/dest/archiver/l1/spire_proposer.d.ts +70 -0
- package/dest/archiver/l1/spire_proposer.d.ts.map +1 -0
- package/dest/archiver/l1/spire_proposer.js +157 -0
- package/dest/archiver/l1/trace_tx.d.ts +97 -0
- package/dest/archiver/l1/trace_tx.d.ts.map +1 -0
- package/dest/archiver/l1/trace_tx.js +91 -0
- package/dest/archiver/l1/types.d.ts +12 -0
- package/dest/archiver/l1/types.d.ts.map +1 -0
- package/dest/archiver/l1/types.js +3 -0
- package/dest/archiver/l1/validate_trace.d.ts +29 -0
- package/dest/archiver/l1/validate_trace.d.ts.map +1 -0
- package/dest/archiver/l1/validate_trace.js +150 -0
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -1
- package/package.json +15 -14
- package/src/archiver/archiver.ts +42 -12
- package/src/archiver/config.ts +5 -0
- package/src/archiver/instrumentation.ts +14 -0
- package/src/archiver/l1/README.md +98 -0
- package/src/archiver/l1/bin/retrieve-calldata.ts +186 -0
- package/src/archiver/l1/calldata_retriever.ts +528 -0
- package/src/archiver/{data_retrieval.ts → l1/data_retrieval.ts} +45 -155
- package/src/archiver/l1/debug_tx.ts +99 -0
- package/src/archiver/l1/spire_proposer.ts +160 -0
- package/src/archiver/l1/trace_tx.ts +128 -0
- package/src/archiver/l1/types.ts +13 -0
- package/src/archiver/l1/validate_trace.ts +211 -0
- package/src/index.ts +1 -1
- package/src/test/fixtures/debug_traceTransaction-multicall3.json +88 -0
- package/src/test/fixtures/debug_traceTransaction-multiplePropose.json +153 -0
- package/src/test/fixtures/debug_traceTransaction-proxied.json +122 -0
- package/src/test/fixtures/trace_transaction-multicall3.json +65 -0
- package/src/test/fixtures/trace_transaction-multiplePropose.json +319 -0
- package/src/test/fixtures/trace_transaction-proxied.json +128 -0
- package/src/test/fixtures/trace_transaction-randomRevert.json +216 -0
- package/dest/archiver/data_retrieval.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlobSinkClientInterface } from '@aztec/blob-sink/client';
|
|
2
2
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
3
|
-
import { type L1BlockId, type ViemPublicClient } from '@aztec/ethereum';
|
|
3
|
+
import { type L1BlockId, type L1ContractAddresses, type ViemPublicClient, type ViemPublicDebugClient } from '@aztec/ethereum';
|
|
4
4
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
5
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
6
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -43,6 +43,7 @@ declare const Archiver_base: new () => ArchiverEmitter;
|
|
|
43
43
|
*/
|
|
44
44
|
export declare class Archiver extends Archiver_base implements ArchiveSource, Traceable {
|
|
45
45
|
private readonly publicClient;
|
|
46
|
+
private readonly debugClient;
|
|
46
47
|
private readonly l1Addresses;
|
|
47
48
|
readonly dataStore: ArchiverDataStore;
|
|
48
49
|
private config;
|
|
@@ -65,6 +66,7 @@ export declare class Archiver extends Archiver_base implements ArchiveSource, Tr
|
|
|
65
66
|
/**
|
|
66
67
|
* Creates a new instance of the Archiver.
|
|
67
68
|
* @param publicClient - A client for interacting with the Ethereum node.
|
|
69
|
+
* @param debugClient - A client for interacting with the Ethereum node for debug/trace methods.
|
|
68
70
|
* @param rollupAddress - Ethereum address of the rollup contract.
|
|
69
71
|
* @param inboxAddress - Ethereum address of the inbox contract.
|
|
70
72
|
* @param registryAddress - Ethereum address of the registry contract.
|
|
@@ -72,15 +74,14 @@ export declare class Archiver extends Archiver_base implements ArchiveSource, Tr
|
|
|
72
74
|
* @param store - An archiver data store for storage & retrieval of blocks, encrypted logs & contract data.
|
|
73
75
|
* @param log - A logger.
|
|
74
76
|
*/
|
|
75
|
-
constructor(publicClient: ViemPublicClient, l1Addresses: {
|
|
76
|
-
|
|
77
|
-
inboxAddress: EthAddress;
|
|
78
|
-
registryAddress: EthAddress;
|
|
77
|
+
constructor(publicClient: ViemPublicClient, debugClient: ViemPublicDebugClient, l1Addresses: Pick<L1ContractAddresses, 'rollupAddress' | 'inboxAddress' | 'registryAddress' | 'governanceProposerAddress' | 'slashFactoryAddress'> & {
|
|
78
|
+
slashingProposerAddress: EthAddress;
|
|
79
79
|
}, dataStore: ArchiverDataStore, config: {
|
|
80
80
|
pollingIntervalMs: number;
|
|
81
81
|
batchSize: number;
|
|
82
82
|
skipValidateBlockAttestations?: boolean;
|
|
83
83
|
maxAllowedEthClientDriftSeconds: number;
|
|
84
|
+
ethereumAllowNoDebugHosts?: boolean;
|
|
84
85
|
}, blobSinkClient: BlobSinkClientInterface, epochCache: EpochCache, dateProvider: DateProvider, instrumentation: ArchiverInstrumentation, l1constants: L1RollupConstants & {
|
|
85
86
|
l1StartBlockHash: Buffer32;
|
|
86
87
|
genesisArchiveRoot: Fr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAGL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/archiver/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,mBAAmB,EAExB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAE3B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAY,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAIlE,OAAO,EAAE,YAAY,EAAkB,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAWnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,OAAO,EAEZ,KAAK,aAAa,EAElB,KAAK,MAAM,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,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,YAAY,GAAG,SAAS,CAAC;IAGzD,+BAA+B,IAAI,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAG3E,+BAA+B,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxF"}
|
|
@@ -24,16 +24,18 @@ import { getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
|
24
24
|
import { EventEmitter } from 'events';
|
|
25
25
|
import groupBy from 'lodash.groupby';
|
|
26
26
|
import { createPublicClient, fallback, http } from 'viem';
|
|
27
|
-
import { retrieveBlocksFromRollup, retrieveL1ToL2Message, retrieveL1ToL2Messages, retrievedBlockToPublishedL2Block } from './data_retrieval.js';
|
|
28
27
|
import { InitialBlockNumberNotSequentialError, NoBlobBodiesFoundError } from './errors.js';
|
|
29
28
|
import { ArchiverInstrumentation } from './instrumentation.js';
|
|
29
|
+
import { retrieveBlocksFromRollup, retrieveL1ToL2Message, retrieveL1ToL2Messages, retrievedBlockToPublishedL2Block } from './l1/data_retrieval.js';
|
|
30
|
+
import { validateAndLogTraceAvailability } from './l1/validate_trace.js';
|
|
30
31
|
import { validateBlockAttestations } from './validation.js';
|
|
31
32
|
function mapArchiverConfig(config) {
|
|
32
33
|
return {
|
|
33
34
|
pollingIntervalMs: config.archiverPollingIntervalMS,
|
|
34
35
|
batchSize: config.archiverBatchSize,
|
|
35
36
|
skipValidateBlockAttestations: config.skipValidateBlockAttestations,
|
|
36
|
-
maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds
|
|
37
|
+
maxAllowedEthClientDriftSeconds: config.maxAllowedEthClientDriftSeconds,
|
|
38
|
+
ethereumAllowNoDebugHosts: config.ethereumAllowNoDebugHosts
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
@@ -42,6 +44,7 @@ function mapArchiverConfig(config) {
|
|
|
42
44
|
* concern themselves with it.
|
|
43
45
|
*/ export class Archiver extends EventEmitter {
|
|
44
46
|
publicClient;
|
|
47
|
+
debugClient;
|
|
45
48
|
l1Addresses;
|
|
46
49
|
dataStore;
|
|
47
50
|
config;
|
|
@@ -63,14 +66,15 @@ function mapArchiverConfig(config) {
|
|
|
63
66
|
/**
|
|
64
67
|
* Creates a new instance of the Archiver.
|
|
65
68
|
* @param publicClient - A client for interacting with the Ethereum node.
|
|
69
|
+
* @param debugClient - A client for interacting with the Ethereum node for debug/trace methods.
|
|
66
70
|
* @param rollupAddress - Ethereum address of the rollup contract.
|
|
67
71
|
* @param inboxAddress - Ethereum address of the inbox contract.
|
|
68
72
|
* @param registryAddress - Ethereum address of the registry contract.
|
|
69
73
|
* @param pollingIntervalMs - The interval for polling for L1 logs (in milliseconds).
|
|
70
74
|
* @param store - An archiver data store for storage & retrieval of blocks, encrypted logs & contract data.
|
|
71
75
|
* @param log - A logger.
|
|
72
|
-
*/ constructor(publicClient, l1Addresses, dataStore, config, blobSinkClient, epochCache, dateProvider, instrumentation, l1constants, log = createLogger('archiver')){
|
|
73
|
-
super(), this.publicClient = publicClient, this.l1Addresses = l1Addresses, this.dataStore = dataStore, this.config = config, this.blobSinkClient = blobSinkClient, this.epochCache = epochCache, this.dateProvider = dateProvider, this.instrumentation = instrumentation, this.l1constants = l1constants, this.log = log, this.initialSyncComplete = false;
|
|
76
|
+
*/ constructor(publicClient, debugClient, l1Addresses, dataStore, config, blobSinkClient, epochCache, dateProvider, instrumentation, l1constants, log = createLogger('archiver')){
|
|
77
|
+
super(), this.publicClient = publicClient, this.debugClient = debugClient, this.l1Addresses = l1Addresses, this.dataStore = dataStore, this.config = config, this.blobSinkClient = blobSinkClient, this.epochCache = epochCache, this.dateProvider = dateProvider, this.instrumentation = instrumentation, this.l1constants = l1constants, this.log = log, this.initialSyncComplete = false;
|
|
74
78
|
this.tracer = instrumentation.tracer;
|
|
75
79
|
this.store = new ArchiverStoreHelper(dataStore);
|
|
76
80
|
this.rollup = new RollupContract(publicClient, l1Addresses.rollupAddress);
|
|
@@ -93,12 +97,20 @@ function mapArchiverConfig(config) {
|
|
|
93
97
|
transport: fallback(config.l1RpcUrls.map((url)=>http(url))),
|
|
94
98
|
pollingInterval: config.viemPollingIntervalMS
|
|
95
99
|
});
|
|
100
|
+
// Create debug client using debug RPC URLs if available, otherwise fall back to regular RPC URLs
|
|
101
|
+
const debugRpcUrls = config.l1DebugRpcUrls.length > 0 ? config.l1DebugRpcUrls : config.l1RpcUrls;
|
|
102
|
+
const debugClient = createPublicClient({
|
|
103
|
+
chain: chain.chainInfo,
|
|
104
|
+
transport: fallback(debugRpcUrls.map((url)=>http(url))),
|
|
105
|
+
pollingInterval: config.viemPollingIntervalMS
|
|
106
|
+
});
|
|
96
107
|
const rollup = new RollupContract(publicClient, config.l1Contracts.rollupAddress);
|
|
97
|
-
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot] = await Promise.all([
|
|
108
|
+
const [l1StartBlock, l1GenesisTime, proofSubmissionEpochs, genesisArchiveRoot, slashingProposerAddress] = await Promise.all([
|
|
98
109
|
rollup.getL1StartBlock(),
|
|
99
110
|
rollup.getL1GenesisTime(),
|
|
100
111
|
rollup.getProofSubmissionEpochs(),
|
|
101
|
-
rollup.getGenesisArchiveTreeRoot()
|
|
112
|
+
rollup.getGenesisArchiveTreeRoot(),
|
|
113
|
+
rollup.getSlashingProposerAddress()
|
|
102
114
|
]);
|
|
103
115
|
const l1StartBlockHash = await publicClient.getBlock({
|
|
104
116
|
blockNumber: l1StartBlock,
|
|
@@ -118,11 +130,15 @@ function mapArchiverConfig(config) {
|
|
|
118
130
|
const opts = merge({
|
|
119
131
|
pollingIntervalMs: 10_000,
|
|
120
132
|
batchSize: 100,
|
|
121
|
-
maxAllowedEthClientDriftSeconds: 300
|
|
133
|
+
maxAllowedEthClientDriftSeconds: 300,
|
|
134
|
+
ethereumAllowNoDebugHosts: false
|
|
122
135
|
}, mapArchiverConfig(config));
|
|
123
136
|
const epochCache = deps.epochCache ?? await EpochCache.create(config.l1Contracts.rollupAddress, config, deps);
|
|
124
137
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
125
|
-
const archiver = new Archiver(publicClient,
|
|
138
|
+
const archiver = new Archiver(publicClient, debugClient, {
|
|
139
|
+
...config.l1Contracts,
|
|
140
|
+
slashingProposerAddress
|
|
141
|
+
}, archiverStore, opts, deps.blobSinkClient, epochCache, deps.dateProvider ?? new DateProvider(), await ArchiverInstrumentation.new(telemetry, ()=>archiverStore.estimateSize()), l1Constants);
|
|
126
142
|
await archiver.start(blockUntilSynced);
|
|
127
143
|
return archiver;
|
|
128
144
|
}
|
|
@@ -138,6 +154,7 @@ function mapArchiverConfig(config) {
|
|
|
138
154
|
}
|
|
139
155
|
await this.blobSinkClient.testSources();
|
|
140
156
|
await this.testEthereumNodeSynced();
|
|
157
|
+
await validateAndLogTraceAvailability(this.debugClient, this.config.ethereumAllowNoDebugHosts ?? false);
|
|
141
158
|
// Log initial state for the archiver
|
|
142
159
|
const { l1StartBlock } = this.l1constants;
|
|
143
160
|
const { blocksSynchedTo = l1StartBlock, messagesSynchedTo = l1StartBlock } = await this.store.getSynchPoint();
|
|
@@ -617,7 +634,7 @@ function mapArchiverConfig(config) {
|
|
|
617
634
|
[searchStartBlock, searchEndBlock] = this.nextRange(searchEndBlock, currentL1BlockNumber);
|
|
618
635
|
this.log.trace(`Retrieving L2 blocks from L1 block ${searchStartBlock} to ${searchEndBlock}`);
|
|
619
636
|
// TODO(md): Retrieve from blob sink then from consensus client, then from peers
|
|
620
|
-
const retrievedBlocks = await retrieveBlocksFromRollup(this.rollup.getContract(), this.publicClient, this.blobSinkClient, searchStartBlock, searchEndBlock, this.log);
|
|
637
|
+
const retrievedBlocks = await retrieveBlocksFromRollup(this.rollup.getContract(), this.publicClient, this.debugClient, this.blobSinkClient, searchStartBlock, searchEndBlock, this.l1Addresses, this.instrumentation, this.log);
|
|
621
638
|
if (retrievedBlocks.length === 0) {
|
|
622
639
|
// We are not calling `setBlockSynchedL1BlockNumber` because it may cause sync issues if based off infura.
|
|
623
640
|
// See further details in earlier comments.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/archiver/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG,cAAc,GAAG,iBAAiB,GAAG,cAAc,GAAG,WAAW,CAAC;AAExH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/archiver/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG,cAAc,GAAG,iBAAiB,GAAG,cAAc,GAAG,WAAW,CAAC;AAExH,eAAO,MAAM,sBAAsB,EAAE,kBAAkB,CAAC,cAAc,CAgDrE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,IAAI,cAAc,CAEzD"}
|
package/dest/archiver/config.js
CHANGED
|
@@ -33,6 +33,11 @@ export const archiverConfigMappings = {
|
|
|
33
33
|
description: 'Maximum allowed drift in seconds between the Ethereum client and current time.',
|
|
34
34
|
...numberConfigHelper(300)
|
|
35
35
|
},
|
|
36
|
+
ethereumAllowNoDebugHosts: {
|
|
37
|
+
env: 'ETHEREUM_ALLOW_NO_DEBUG_HOSTS',
|
|
38
|
+
description: 'Whether to allow starting the archiver without debug/trace method support on Ethereum hosts',
|
|
39
|
+
...booleanConfigHelper(true)
|
|
40
|
+
},
|
|
36
41
|
...chainConfigMappings,
|
|
37
42
|
...l1ReaderConfigMappings,
|
|
38
43
|
viemPollingIntervalMS: {
|
|
@@ -17,6 +17,7 @@ export declare class ArchiverInstrumentation {
|
|
|
17
17
|
private txsPerBlock;
|
|
18
18
|
private syncDurationPerMessage;
|
|
19
19
|
private syncMessageCount;
|
|
20
|
+
private blockProposalTxTargetCount;
|
|
20
21
|
private log;
|
|
21
22
|
private constructor();
|
|
22
23
|
static new(telemetry: TelemetryClient, lmdbStats?: LmdbStatsCallback): Promise<ArchiverInstrumentation>;
|
|
@@ -31,5 +32,6 @@ export declare class ArchiverInstrumentation {
|
|
|
31
32
|
delay: bigint;
|
|
32
33
|
}[]): void;
|
|
33
34
|
updateL1BlockHeight(blockNumber: bigint): void;
|
|
35
|
+
recordBlockProposalTxTarget(target: string, usedTrace: boolean): void;
|
|
34
36
|
}
|
|
35
37
|
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/archiver/instrumentation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAKL,KAAK,iBAAiB,EAEtB,KAAK,eAAe,EACpB,KAAK,MAAM,EAGZ,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,uBAAuB;
|
|
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;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE;IAaxF,mBAAmB,CAAC,WAAW,EAAE,MAAM;IAIvC,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO;CAMtE"}
|
|
@@ -17,6 +17,7 @@ export class ArchiverInstrumentation {
|
|
|
17
17
|
txsPerBlock;
|
|
18
18
|
syncDurationPerMessage;
|
|
19
19
|
syncMessageCount;
|
|
20
|
+
blockProposalTxTargetCount;
|
|
20
21
|
log;
|
|
21
22
|
constructor(telemetry, lmdbStats){
|
|
22
23
|
this.telemetry = telemetry;
|
|
@@ -81,6 +82,10 @@ export class ArchiverInstrumentation {
|
|
|
81
82
|
description: 'Number of prunes detected',
|
|
82
83
|
valueType: ValueType.INT
|
|
83
84
|
});
|
|
85
|
+
this.blockProposalTxTargetCount = meter.createUpDownCounter(Metrics.ARCHIVER_BLOCK_PROPOSAL_TX_TARGET_COUNT, {
|
|
86
|
+
description: 'Number of block proposals by tx target',
|
|
87
|
+
valueType: ValueType.INT
|
|
88
|
+
});
|
|
84
89
|
this.dbMetrics = new LmdbMetrics(meter, {
|
|
85
90
|
[Attributes.DB_DATA_TYPE]: 'archiver'
|
|
86
91
|
}, lmdbStats);
|
|
@@ -137,4 +142,10 @@ export class ArchiverInstrumentation {
|
|
|
137
142
|
updateL1BlockHeight(blockNumber) {
|
|
138
143
|
this.l1BlockHeight.record(Number(blockNumber));
|
|
139
144
|
}
|
|
145
|
+
recordBlockProposalTxTarget(target, usedTrace) {
|
|
146
|
+
this.blockProposalTxTargetCount.add(1, {
|
|
147
|
+
[Attributes.L1_BLOCK_PROPOSAL_TX_TARGET]: target.toLowerCase(),
|
|
148
|
+
[Attributes.L1_BLOCK_PROPOSAL_USED_TRACE]: usedTrace
|
|
149
|
+
});
|
|
150
|
+
}
|
|
140
151
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve-calldata.d.ts","sourceRoot":"","sources":["../../../../src/archiver/l1/bin/retrieve-calldata.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
+
import { createPublicClient, http } from 'viem';
|
|
5
|
+
import { mainnet } from 'viem/chains';
|
|
6
|
+
import { CalldataRetriever } from '../calldata_retriever.js';
|
|
7
|
+
const logger = createLogger('archiver:calldata-test');
|
|
8
|
+
function parseArgs() {
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
if (args.length < 2) {
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
console.error('Usage: node index.js <rollup-address> <tx-hash> [target-committee-size]');
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error('');
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.error('Environment variables:');
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.error(' ETHEREUM_HOST or RPC_URL - Ethereum RPC endpoint');
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.error('');
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.error('Example:');
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.error(' RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR-API-KEY \\');
|
|
25
|
+
// eslint-disable-next-line no-console
|
|
26
|
+
console.error(' node index.js 0x1234... 0xabcd... 32');
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
const rollupAddress = EthAddress.fromString(args[0]);
|
|
30
|
+
const txHash = args[1];
|
|
31
|
+
const targetCommitteeSize = args[2] ? parseInt(args[2], 10) : 24;
|
|
32
|
+
const rpcUrl = process.env.ETHEREUM_HOST || process.env.RPC_URL;
|
|
33
|
+
if (!rpcUrl) {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.error('Error: ETHEREUM_HOST or RPC_URL environment variable must be set');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
if (targetCommitteeSize <= 0 || targetCommitteeSize > 256) {
|
|
39
|
+
// eslint-disable-next-line no-console
|
|
40
|
+
console.error('Error: target-committee-size must be between 1 and 256');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
rollupAddress,
|
|
45
|
+
txHash,
|
|
46
|
+
rpcUrl,
|
|
47
|
+
targetCommitteeSize
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async function main() {
|
|
51
|
+
const { rollupAddress, txHash, rpcUrl, targetCommitteeSize } = parseArgs();
|
|
52
|
+
logger.info('Calldata Retriever Test Script');
|
|
53
|
+
logger.info('===============================');
|
|
54
|
+
logger.info(`Rollup Address: ${rollupAddress.toString()}`);
|
|
55
|
+
logger.info(`Transaction Hash: ${txHash}`);
|
|
56
|
+
logger.info(`RPC URL: ${rpcUrl}`);
|
|
57
|
+
logger.info(`Target Committee Size: ${targetCommitteeSize}`);
|
|
58
|
+
logger.info('');
|
|
59
|
+
try {
|
|
60
|
+
// Create viem public client
|
|
61
|
+
const publicClient = createPublicClient({
|
|
62
|
+
chain: mainnet,
|
|
63
|
+
transport: http(rpcUrl)
|
|
64
|
+
});
|
|
65
|
+
logger.info('Fetching transaction...');
|
|
66
|
+
const tx = await publicClient.getTransaction({
|
|
67
|
+
hash: txHash
|
|
68
|
+
});
|
|
69
|
+
if (!tx) {
|
|
70
|
+
throw new Error(`Transaction ${txHash} not found`);
|
|
71
|
+
}
|
|
72
|
+
logger.info(`Transaction found in block ${tx.blockNumber}`);
|
|
73
|
+
// For simplicity, use zero addresses for optional contract addresses
|
|
74
|
+
// In production, these would be fetched from the rollup contract or configuration
|
|
75
|
+
const slashingProposerAddress = EthAddress.ZERO;
|
|
76
|
+
const governanceProposerAddress = EthAddress.ZERO;
|
|
77
|
+
const slashFactoryAddress = undefined;
|
|
78
|
+
logger.info('Using zero addresses for governance/slashing (can be configured if needed)');
|
|
79
|
+
// Create CalldataRetriever
|
|
80
|
+
const retriever = new CalldataRetriever(publicClient, publicClient, targetCommitteeSize, undefined, logger, {
|
|
81
|
+
rollupAddress,
|
|
82
|
+
governanceProposerAddress,
|
|
83
|
+
slashingProposerAddress,
|
|
84
|
+
slashFactoryAddress
|
|
85
|
+
});
|
|
86
|
+
// Extract L2 block number from transaction logs
|
|
87
|
+
logger.info('Decoding transaction to extract L2 block number...');
|
|
88
|
+
const receipt = await publicClient.getTransactionReceipt({
|
|
89
|
+
hash: txHash
|
|
90
|
+
});
|
|
91
|
+
const l2BlockProposedEvent = receipt.logs.find((log)=>{
|
|
92
|
+
try {
|
|
93
|
+
// Try to match the L2BlockProposed event
|
|
94
|
+
return log.address.toLowerCase() === rollupAddress.toString().toLowerCase() && log.topics[0] === '0x2f1d0e696fa5186494a2f2f89a0e0bcbb15d607f6c5eac4637e07e1e5e7d3c00' // L2BlockProposed event signature
|
|
95
|
+
;
|
|
96
|
+
} catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
let l2BlockNumber;
|
|
101
|
+
if (l2BlockProposedEvent && l2BlockProposedEvent.topics[1]) {
|
|
102
|
+
// L2 block number is typically the first indexed parameter
|
|
103
|
+
l2BlockNumber = Number(BigInt(l2BlockProposedEvent.topics[1]));
|
|
104
|
+
logger.info(`L2 Block Number (from event): ${l2BlockNumber}`);
|
|
105
|
+
} else {
|
|
106
|
+
// Fallback: try to extract from transaction data or use a default
|
|
107
|
+
logger.warn('Could not extract L2 block number from event, using block number as fallback');
|
|
108
|
+
l2BlockNumber = Number(tx.blockNumber);
|
|
109
|
+
}
|
|
110
|
+
logger.info('');
|
|
111
|
+
logger.info('Retrieving block header from rollup transaction...');
|
|
112
|
+
logger.info('');
|
|
113
|
+
const result = await retriever.getBlockHeaderFromRollupTx(txHash, l2BlockNumber);
|
|
114
|
+
logger.info(' Successfully retrieved block header!');
|
|
115
|
+
logger.info('');
|
|
116
|
+
logger.info('Block Header Details:');
|
|
117
|
+
logger.info('====================');
|
|
118
|
+
logger.info(`L2 Block Number: ${result.l2BlockNumber}`);
|
|
119
|
+
logger.info(`Block Hash: ${result.blockHash}`);
|
|
120
|
+
logger.info(`Archive Root: ${result.archiveRoot.toString()}`);
|
|
121
|
+
logger.info('');
|
|
122
|
+
logger.info('State Reference:');
|
|
123
|
+
logger.info(` L1 to L2 Message Tree Root: ${result.stateReference.l1ToL2MessageTree.root.toString()}`);
|
|
124
|
+
logger.info(` L1 to L2 Message Tree Next Index: ${result.stateReference.l1ToL2MessageTree.nextAvailableLeafIndex}`);
|
|
125
|
+
logger.info('');
|
|
126
|
+
logger.info('Header:');
|
|
127
|
+
logger.info(` Slot Number: ${result.header.slotNumber.toString()}`);
|
|
128
|
+
logger.info(` Timestamp: ${result.header.timestamp.toString()}`);
|
|
129
|
+
logger.info(` Coinbase: ${result.header.coinbase.toString()}`);
|
|
130
|
+
logger.info(` Fee Recipient: ${result.header.feeRecipient.toString()}`);
|
|
131
|
+
logger.info(` Total Mana Used: ${result.header.totalManaUsed.toString()}`);
|
|
132
|
+
logger.info('');
|
|
133
|
+
logger.info('Attestations:');
|
|
134
|
+
logger.info(` Count: ${result.attestations.length}`);
|
|
135
|
+
logger.info(` Non-empty attestations: ${result.attestations.filter((a)=>!a.signature.isEmpty()).length}`);
|
|
136
|
+
process.exit(0);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
logger.error('Error retrieving block header:');
|
|
139
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
140
|
+
if (error instanceof Error && error.stack) {
|
|
141
|
+
logger.debug(error.stack);
|
|
142
|
+
}
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Only run if this is the main module
|
|
147
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
148
|
+
void main();
|
|
149
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ViemPublicClient, ViemPublicDebugClient } from '@aztec/ethereum';
|
|
2
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
4
|
+
import { type Hex, type Transaction } from 'viem';
|
|
5
|
+
import type { ArchiverInstrumentation } from '../instrumentation.js';
|
|
6
|
+
import type { RetrievedL2Block } from './data_retrieval.js';
|
|
7
|
+
/**
|
|
8
|
+
* Extracts calldata to the `propose` method of the rollup contract from an L1 transaction
|
|
9
|
+
* in order to reconstruct an L2 block header.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CalldataRetriever {
|
|
12
|
+
private readonly publicClient;
|
|
13
|
+
private readonly debugClient;
|
|
14
|
+
private readonly targetCommitteeSize;
|
|
15
|
+
private readonly instrumentation;
|
|
16
|
+
private readonly logger;
|
|
17
|
+
/** Pre-computed valid contract calls for validation */
|
|
18
|
+
private readonly validContractCalls;
|
|
19
|
+
private readonly rollupAddress;
|
|
20
|
+
constructor(publicClient: ViemPublicClient, debugClient: ViemPublicDebugClient, targetCommitteeSize: number, instrumentation: ArchiverInstrumentation | undefined, logger: Logger, contractAddresses: {
|
|
21
|
+
rollupAddress: EthAddress;
|
|
22
|
+
governanceProposerAddress: EthAddress;
|
|
23
|
+
slashingProposerAddress: EthAddress;
|
|
24
|
+
slashFactoryAddress?: EthAddress;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Gets block header and metadata from the calldata of an L1 transaction.
|
|
28
|
+
* Tries multicall3 decoding, falls back to trace-based extraction.
|
|
29
|
+
* @param txHash - Hash of the tx that published it.
|
|
30
|
+
* @param l2BlockNumber - L2 block number.
|
|
31
|
+
* @returns L2 block header and metadata from the calldata, deserialized (without body)
|
|
32
|
+
*/
|
|
33
|
+
getBlockHeaderFromRollupTx(txHash: `0x${string}`, l2BlockNumber: number): Promise<Omit<RetrievedL2Block, 'l1' | 'chainId' | 'version' | 'body'> & {
|
|
34
|
+
blockHash: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** Gets rollup propose calldata from a transaction */
|
|
37
|
+
protected getProposeCallData(tx: Transaction, l2BlockNumber: number): Promise<Hex>;
|
|
38
|
+
/**
|
|
39
|
+
* Attempts to decode a transaction as a Spire Proposer multicall wrapper.
|
|
40
|
+
* If successful, extracts the wrapped call and validates it as either multicall3 or direct propose.
|
|
41
|
+
* @param tx - The transaction to decode
|
|
42
|
+
* @returns The propose calldata if successfully decoded and validated, undefined otherwise
|
|
43
|
+
*/
|
|
44
|
+
protected tryDecodeSpireProposer(tx: Transaction): Promise<Hex | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Attempts to decode transaction input as multicall3 and extract propose calldata.
|
|
47
|
+
* Returns undefined if validation fails.
|
|
48
|
+
* @param tx - The transaction-like object with to, input, and hash
|
|
49
|
+
* @returns The propose calldata if successfully validated, undefined otherwise
|
|
50
|
+
*/
|
|
51
|
+
protected tryDecodeMulticall3(tx: {
|
|
52
|
+
to: Hex | null | undefined;
|
|
53
|
+
input: Hex;
|
|
54
|
+
hash: Hex;
|
|
55
|
+
}): Hex | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Attempts to decode transaction as a direct propose call to the rollup contract.
|
|
58
|
+
* Returns undefined if validation fails.
|
|
59
|
+
* @param tx - The transaction-like object with to, input, and hash
|
|
60
|
+
* @returns The propose calldata if successfully validated, undefined otherwise
|
|
61
|
+
*/
|
|
62
|
+
protected tryDecodeDirectPropose(tx: {
|
|
63
|
+
to: Hex | null | undefined;
|
|
64
|
+
input: Hex;
|
|
65
|
+
hash: Hex;
|
|
66
|
+
}): Hex | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Uses debug/trace RPC to extract the actual calldata from the successful propose call.
|
|
69
|
+
* This is the definitive fallback that works for any transaction pattern.
|
|
70
|
+
* Tries trace_transaction first, then falls back to debug_traceTransaction.
|
|
71
|
+
* @param txHash - The transaction hash to trace
|
|
72
|
+
* @returns The propose calldata from the successful call
|
|
73
|
+
*/
|
|
74
|
+
protected extractCalldataViaTrace(txHash: Hex): Promise<Hex>;
|
|
75
|
+
/**
|
|
76
|
+
* Decodes propose calldata and builds the block header structure.
|
|
77
|
+
* @param proposeCalldata - The propose function calldata
|
|
78
|
+
* @param blockHash - The L1 block hash containing this transaction
|
|
79
|
+
* @param blobHashes - The blob hashes for this block
|
|
80
|
+
* @param l2BlockNumber - The L2 block number
|
|
81
|
+
* @returns The decoded block header and metadata
|
|
82
|
+
*/
|
|
83
|
+
protected decodeAndBuildBlockHeader(proposeCalldata: Hex, blockHash: Hex, l2BlockNumber: number): Omit<RetrievedL2Block, 'l1' | 'chainId' | 'version' | 'body'> & {
|
|
84
|
+
blockHash: string;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=calldata_retriever.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calldata_retriever.d.ts","sourceRoot":"","sources":["../../../src/archiver/l1/calldata_retriever.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAWpD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,WAAW,EAAqE,MAAM,MAAM,CAAC;AAErH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D;;;GAGG;AACH,qBAAa,iBAAiB;IAO1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,e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