@aztec/archiver 0.0.1-commit.ff7989d6c → 0.0.1-commit.ffe5b04ea
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.d.ts +3 -1
- package/dest/archiver.d.ts.map +1 -1
- package/dest/archiver.js +19 -8
- package/dest/factory.d.ts +2 -2
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +6 -7
- package/dest/l1/bin/retrieve-calldata.js +32 -28
- package/dest/l1/calldata_retriever.d.ts +70 -53
- package/dest/l1/calldata_retriever.d.ts.map +1 -1
- package/dest/l1/calldata_retriever.js +178 -260
- package/dest/l1/data_retrieval.d.ts +7 -8
- package/dest/l1/data_retrieval.d.ts.map +1 -1
- package/dest/l1/data_retrieval.js +18 -17
- 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_store_updater.d.ts +6 -3
- package/dest/modules/data_store_updater.d.ts.map +1 -1
- package/dest/modules/data_store_updater.js +9 -1
- package/dest/modules/instrumentation.d.ts +12 -1
- package/dest/modules/instrumentation.d.ts.map +1 -1
- package/dest/modules/instrumentation.js +10 -0
- package/dest/modules/l1_synchronizer.d.ts +3 -7
- package/dest/modules/l1_synchronizer.d.ts.map +1 -1
- package/dest/modules/l1_synchronizer.js +12 -5
- package/dest/store/message_store.js +1 -1
- package/dest/test/fake_l1_state.d.ts +3 -1
- package/dest/test/fake_l1_state.d.ts.map +1 -1
- package/dest/test/fake_l1_state.js +42 -10
- package/dest/test/mock_l2_block_source.d.ts +2 -1
- package/dest/test/mock_l2_block_source.d.ts.map +1 -1
- package/dest/test/mock_l2_block_source.js +3 -0
- 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/package.json +13 -13
- package/src/archiver.ts +31 -8
- package/src/factory.ts +4 -2
- package/src/l1/README.md +25 -68
- package/src/l1/bin/retrieve-calldata.ts +40 -27
- package/src/l1/calldata_retriever.ts +231 -383
- package/src/l1/data_retrieval.ts +20 -25
- package/src/l1/spire_proposer.ts +7 -15
- package/src/modules/data_store_updater.ts +6 -1
- package/src/modules/instrumentation.ts +20 -0
- package/src/modules/l1_synchronizer.ts +16 -9
- package/src/store/message_store.ts +1 -1
- package/src/test/fake_l1_state.ts +60 -10
- package/src/test/mock_l2_block_source.ts +6 -0
- package/src/test/mock_structs.ts +20 -6
|
@@ -5,7 +5,7 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
6
|
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
7
7
|
|
|
8
|
-
import { type Hex, createPublicClient, getAbiItem, http, toEventSelector } from 'viem';
|
|
8
|
+
import { type Hex, createPublicClient, decodeEventLog, getAbiItem, http, toEventSelector } from 'viem';
|
|
9
9
|
import { mainnet } from 'viem/chains';
|
|
10
10
|
|
|
11
11
|
import { CalldataRetriever } from '../calldata_retriever.js';
|
|
@@ -89,14 +89,6 @@ async function main() {
|
|
|
89
89
|
|
|
90
90
|
logger.info(`Transaction found in block ${tx.blockNumber}`);
|
|
91
91
|
|
|
92
|
-
// For simplicity, use zero addresses for optional contract addresses
|
|
93
|
-
// In production, these would be fetched from the rollup contract or configuration
|
|
94
|
-
const slashingProposerAddress = EthAddress.ZERO;
|
|
95
|
-
const governanceProposerAddress = EthAddress.ZERO;
|
|
96
|
-
const slashFactoryAddress = undefined;
|
|
97
|
-
|
|
98
|
-
logger.info('Using zero addresses for governance/slashing (can be configured if needed)');
|
|
99
|
-
|
|
100
92
|
// Create CalldataRetriever
|
|
101
93
|
const retriever = new CalldataRetriever(
|
|
102
94
|
publicClient as unknown as ViemPublicClient,
|
|
@@ -104,46 +96,67 @@ async function main() {
|
|
|
104
96
|
targetCommitteeSize,
|
|
105
97
|
undefined,
|
|
106
98
|
logger,
|
|
107
|
-
|
|
108
|
-
rollupAddress,
|
|
109
|
-
governanceProposerAddress,
|
|
110
|
-
slashingProposerAddress,
|
|
111
|
-
slashFactoryAddress,
|
|
112
|
-
},
|
|
99
|
+
rollupAddress,
|
|
113
100
|
);
|
|
114
101
|
|
|
115
|
-
// Extract checkpoint number from transaction logs
|
|
116
|
-
logger.info('Decoding transaction to extract checkpoint number...');
|
|
102
|
+
// Extract checkpoint number and hashes from transaction logs
|
|
103
|
+
logger.info('Decoding transaction to extract checkpoint number and hashes...');
|
|
117
104
|
const receipt = await publicClient.getTransactionReceipt({ hash: txHash });
|
|
118
105
|
|
|
119
|
-
// Look for CheckpointProposed event
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const checkpointProposedEvent = receipt.logs.find(log => {
|
|
106
|
+
// Look for CheckpointProposed event
|
|
107
|
+
const checkpointProposedEventAbi = getAbiItem({ abi: RollupAbi, name: 'CheckpointProposed' });
|
|
108
|
+
const checkpointProposedLog = receipt.logs.find(log => {
|
|
123
109
|
try {
|
|
124
110
|
return (
|
|
125
111
|
log.address.toLowerCase() === rollupAddress.toString().toLowerCase() &&
|
|
126
|
-
log.topics[0] === toEventSelector(
|
|
112
|
+
log.topics[0] === toEventSelector(checkpointProposedEventAbi)
|
|
127
113
|
);
|
|
128
114
|
} catch {
|
|
129
115
|
return false;
|
|
130
116
|
}
|
|
131
117
|
});
|
|
132
118
|
|
|
133
|
-
if (!
|
|
119
|
+
if (!checkpointProposedLog || checkpointProposedLog.topics[1] === undefined) {
|
|
134
120
|
throw new Error(`Checkpoint proposed event not found`);
|
|
135
121
|
}
|
|
136
122
|
|
|
137
|
-
const checkpointNumber = CheckpointNumber.fromBigInt(BigInt(
|
|
123
|
+
const checkpointNumber = CheckpointNumber.fromBigInt(BigInt(checkpointProposedLog.topics[1]));
|
|
124
|
+
|
|
125
|
+
// Decode the full event to extract attestationsHash and payloadDigest
|
|
126
|
+
const decodedEvent = decodeEventLog({
|
|
127
|
+
abi: RollupAbi,
|
|
128
|
+
data: checkpointProposedLog.data,
|
|
129
|
+
topics: checkpointProposedLog.topics,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const eventArgs = decodedEvent.args as {
|
|
133
|
+
checkpointNumber: bigint;
|
|
134
|
+
archive: Hex;
|
|
135
|
+
versionedBlobHashes: Hex[];
|
|
136
|
+
attestationsHash: Hex;
|
|
137
|
+
payloadDigest: Hex;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
if (!eventArgs.attestationsHash || !eventArgs.payloadDigest) {
|
|
141
|
+
throw new Error(`CheckpointProposed event missing attestationsHash or payloadDigest`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const expectedHashes = {
|
|
145
|
+
attestationsHash: eventArgs.attestationsHash,
|
|
146
|
+
payloadDigest: eventArgs.payloadDigest,
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
logger.info(`Checkpoint Number: ${checkpointNumber}`);
|
|
150
|
+
logger.info(`Attestations Hash: ${expectedHashes.attestationsHash}`);
|
|
151
|
+
logger.info(`Payload Digest: ${expectedHashes.payloadDigest}`);
|
|
138
152
|
|
|
139
153
|
logger.info('');
|
|
140
154
|
logger.info('Retrieving checkpoint from rollup transaction...');
|
|
141
155
|
logger.info('');
|
|
142
156
|
|
|
143
|
-
|
|
144
|
-
const result = await retriever.getCheckpointFromRollupTx(txHash, [], checkpointNumber, {});
|
|
157
|
+
const result = await retriever.getCheckpointFromRollupTx(txHash, [], checkpointNumber, expectedHashes);
|
|
145
158
|
|
|
146
|
-
logger.info('
|
|
159
|
+
logger.info(' Successfully retrieved block header!');
|
|
147
160
|
logger.info('');
|
|
148
161
|
logger.info('Block Header Details:');
|
|
149
162
|
logger.info('====================');
|