@aztec/txe 4.0.0-nightly.20260113 → 4.0.0-nightly.20260114
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/oracle/txe_oracle_top_level_context.d.ts +1 -1
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +2 -1
- package/dest/rpc_translator.js +1 -1
- package/dest/state_machine/archiver.d.ts +21 -67
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +39 -175
- package/dest/utils/block_creation.d.ts +1 -1
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +1 -1
- package/package.json +15 -15
- package/src/oracle/txe_oracle_top_level_context.ts +2 -1
- package/src/rpc_translator.ts +1 -1
- package/src/state_machine/archiver.ts +39 -217
- package/src/utils/block_creation.ts +1 -0
|
@@ -62,4 +62,4 @@ export declare class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecut
|
|
|
62
62
|
close(): [bigint, Map<string, AuthWitness>];
|
|
63
63
|
private getLastBlockNumber;
|
|
64
64
|
}
|
|
65
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
65
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX29yYWNsZV90b3BfbGV2ZWxfY29udGV4dC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL29yYWNsZS90eGVfb3JhY2xlX3RvcF9sZXZlbF9jb250ZXh0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFHcEQsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQ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Y,EAClB,qBAAqB,EAAE,YAAY,EACnC,QAAQ,EAAE,EAAE,EAAE,EACd,YAAY,EAAE,OAAO,iBAyItB;IAEK,0BAA0B,CAC9B,qBAAqB,EAAE,YAAY,EACnC,gBAAgB,EAAE,gBAAgB,EAClC,IAAI,EAAE,EAAE,EAAE,iBAwBX;YAEa,kBAAkB;IAoDhC,KAAK,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAG1C;YAEa,kBAAkB;CAIjC"}
|
|
@@ -97,7 +97,8 @@ export class TXEOracleTopLevelContext {
|
|
|
97
97
|
return (await this.stateMachine.node.getBlockHeader('latest')).globalVariables.timestamp;
|
|
98
98
|
}
|
|
99
99
|
async txeGetLastTxEffects() {
|
|
100
|
-
const
|
|
100
|
+
const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
|
|
101
|
+
const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
|
|
101
102
|
if (block.body.txEffects.length != 1) {
|
|
102
103
|
// Note that calls like env.mine() will result in blocks with no transactions, hitting this
|
|
103
104
|
throw new Error(`Expected a single transaction in the last block, found ${block.body.txEffects.length}`);
|
package/dest/rpc_translator.js
CHANGED
|
@@ -261,7 +261,7 @@ export class RPCTranslator {
|
|
|
261
261
|
randomness: noteData.randomness,
|
|
262
262
|
storageSlot: noteData.storageSlot,
|
|
263
263
|
noteNonce: noteData.noteNonce,
|
|
264
|
-
|
|
264
|
+
isPending: noteData.isPending,
|
|
265
265
|
note: noteData.note
|
|
266
266
|
}));
|
|
267
267
|
// Now we convert each sub-array to an array of ForeignCallSingles
|
|
@@ -1,80 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ArchiveSourceBase } from '@aztec/archiver';
|
|
2
|
+
import { type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
|
-
import type
|
|
7
|
-
import {
|
|
8
|
-
import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
9
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
6
|
+
import { L2Block, type L2Tips, type ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
7
|
+
import { Checkpoint, type PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
10
8
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
11
9
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* TXE Archiver implementation.
|
|
12
|
+
* Provides most of the endpoints needed by the node for reading from and writing to state,
|
|
13
|
+
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
14
|
+
*/
|
|
15
|
+
export declare class TXEArchiver extends ArchiveSourceBase {
|
|
14
16
|
constructor(db: AztecAsyncKVStore);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
25
|
-
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
26
|
-
*/
|
|
27
|
-
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
28
|
-
/**
|
|
29
|
-
* Gets a published l2 block. If a negative number is passed, the block returned is the most recent.
|
|
30
|
-
* @param number - The block number to return (inclusive).
|
|
31
|
-
* @returns The requested L2 block.
|
|
32
|
-
*/
|
|
33
|
-
getPublishedBlock(number: number): Promise<PublishedL2Block | undefined>;
|
|
34
|
-
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]>;
|
|
35
|
-
getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
36
|
-
private retrievePublishedBlocks;
|
|
37
|
-
/**
|
|
38
|
-
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
39
|
-
* @param number - The block number to return (inclusive).
|
|
40
|
-
* @returns The requested L2 block.
|
|
41
|
-
*/
|
|
42
|
-
getL2Block(number: BlockNumber | 'latest'): Promise<L2Block | undefined>;
|
|
43
|
-
/**
|
|
44
|
-
* Gets an L2 block (new format).
|
|
45
|
-
* @param number - The block number to return.
|
|
46
|
-
* @returns The requested L2 block.
|
|
47
|
-
*/
|
|
48
|
-
getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
|
|
49
|
-
/**
|
|
50
|
-
* Gets an l2 block header.
|
|
51
|
-
* @param number - The block number to return or 'latest' for the most recent one.
|
|
52
|
-
* @returns The requested L2 block header.
|
|
53
|
-
*/
|
|
54
|
-
getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined>;
|
|
55
|
-
getBlockRange(from: number, limit: number, _proven?: boolean): Promise<L2Block[]>;
|
|
56
|
-
getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]>;
|
|
57
|
-
getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined>;
|
|
17
|
+
addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<boolean>;
|
|
18
|
+
getRollupAddress(): Promise<EthAddress>;
|
|
19
|
+
getRegistryAddress(): Promise<EthAddress>;
|
|
20
|
+
getL1Constants(): Promise<L1RollupConstants>;
|
|
21
|
+
getGenesisValues(): Promise<{
|
|
22
|
+
genesisArchiveRoot: Fr;
|
|
23
|
+
}>;
|
|
24
|
+
getL1Timestamp(): Promise<bigint | undefined>;
|
|
25
|
+
getL2Tips(): Promise<L2Tips>;
|
|
58
26
|
getL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
59
|
-
getL2EpochNumber(): Promise<EpochNumber>;
|
|
27
|
+
getL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
60
28
|
getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]>;
|
|
61
29
|
getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]>;
|
|
62
30
|
getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]>;
|
|
63
31
|
isEpochComplete(_epochNumber: EpochNumber): Promise<boolean>;
|
|
64
|
-
getL2Tips(): Promise<L2Tips>;
|
|
65
|
-
getL1Constants(): Promise<L1RollupConstants>;
|
|
66
|
-
getGenesisValues(): Promise<{
|
|
67
|
-
genesisArchiveRoot: Fr;
|
|
68
|
-
}>;
|
|
69
32
|
syncImmediate(): Promise<void>;
|
|
70
|
-
getContract(_address: AztecAddress, _timestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined>;
|
|
71
|
-
getRollupAddress(): Promise<EthAddress>;
|
|
72
|
-
getRegistryAddress(): Promise<EthAddress>;
|
|
73
|
-
getL1Timestamp(): Promise<bigint>;
|
|
74
|
-
isPendingChainInvalid(): Promise<boolean>;
|
|
75
|
-
getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
|
|
76
|
-
getPublishedBlockByHash(_blockHash: Fr): Promise<PublishedL2Block | undefined>;
|
|
77
|
-
getPublishedBlockByArchive(_archive: Fr): Promise<PublishedL2Block | undefined>;
|
|
78
|
-
getCheckpointedBlocks(_from: BlockNumber, _limit: number, _proven?: boolean): Promise<never[]>;
|
|
79
33
|
}
|
|
80
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGF0ZV9tYWNoaW5lL2FyY2hpdmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxpQkFBa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QUFPLENBQUM7UUFBRSxrQkFBa0IsRUFBRSxFQUFFLENBQUE7S0FBRSxDQUFDLENBRTdEO0lBRU0sY0FBYyxJQUFJLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRW5EO0lBRVksU0FBUyxJQUFJLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0E4QnhDO0lBRU0sZUFBZSxJQUFJLE9BQU8sQ0FBQyxVQUFVLEdBQUcsU0FBUyxDQUFDLENBRXhEO0lBRU0sZ0JBQWdCLElBQUksT0FBTyxDQUFDLFdBQVcsR0FBRyxTQUFTLENBQUMsQ0FFMUQ7SUFFTSxzQkFBc0IsQ0FBQyxZQUFZLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxVQUFVLEVBQUUsQ0FBQyxDQUU5RTtJQUVNLGlCQUFpQixDQUFDLFlBQVksRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBRXRFO0lBRU0sdUJBQXVCLENBQUMsWUFBWSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUMsQ0FFaEY7SUFFTSxlQUFlLENBQUMsWUFBWSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBRWxFO0lBRU0sYUFBYSxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFcEM7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/state_machine/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/state_machine/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAuD,MAAM,iBAAiB,CAAC;AAEzG,OAAO,EAAoB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CA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,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEtE;IAEM,uBAAuB,CAAC,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAEhF;IAEM,eAAe,CAAC,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAElE;IAEM,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;CACF"}
|
|
@@ -1,154 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchiveSourceBase, KVArchiverDataStore, addCheckpointsWithContractData } from '@aztec/archiver';
|
|
2
2
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
3
|
-
import {
|
|
3
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
// requires (i.e. an L1 client)
|
|
11
|
-
export class TXEArchiver extends ArchiverStoreHelper {
|
|
5
|
+
/**
|
|
6
|
+
* TXE Archiver implementation.
|
|
7
|
+
* Provides most of the endpoints needed by the node for reading from and writing to state,
|
|
8
|
+
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
9
|
+
*/ export class TXEArchiver extends ArchiveSourceBase {
|
|
12
10
|
constructor(db){
|
|
13
|
-
|
|
11
|
+
const store = new KVArchiverDataStore(db, 9999);
|
|
12
|
+
super(store);
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const publishedBlocks = await this.getPublishedBlocks(number, 1);
|
|
20
|
-
if (publishedBlocks.length === 0) {
|
|
21
|
-
return undefined;
|
|
22
|
-
}
|
|
23
|
-
return publishedBlocks[0].block;
|
|
24
|
-
}
|
|
25
|
-
async getBlocks(from, limit, proven) {
|
|
26
|
-
const publishedBlocks = await this.getPublishedBlocks(from, limit, proven);
|
|
27
|
-
return publishedBlocks.map((x)=>x.block);
|
|
28
|
-
}
|
|
29
|
-
async addCheckpoints(checkpoints, _result) {
|
|
30
|
-
const allBlocks = checkpoints.flatMap((ch)=>ch.checkpoint.blocks);
|
|
31
|
-
const opResults = await Promise.all([
|
|
32
|
-
this.store.addLogs(allBlocks),
|
|
33
|
-
this.store.addCheckpoints(checkpoints)
|
|
34
|
-
]);
|
|
35
|
-
return opResults.every(Boolean);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
39
|
-
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
40
|
-
*/ getBlockNumber() {
|
|
41
|
-
return this.store.getLatestBlockNumber();
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
45
|
-
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
46
|
-
*/ getProvenBlockNumber() {
|
|
47
|
-
return this.store.getProvenBlockNumber();
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Gets a published l2 block. If a negative number is passed, the block returned is the most recent.
|
|
51
|
-
* @param number - The block number to return (inclusive).
|
|
52
|
-
* @returns The requested L2 block.
|
|
53
|
-
*/ async getPublishedBlock(number) {
|
|
54
|
-
// If the number provided is -ve, then return the latest block.
|
|
55
|
-
if (number < 0) {
|
|
56
|
-
number = await this.store.getLatestBlockNumber();
|
|
57
|
-
}
|
|
58
|
-
if (number == 0) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const publishedBlocks = await this.retrievePublishedBlocks(BlockNumber(number), 1);
|
|
62
|
-
return publishedBlocks.length === 0 ? undefined : publishedBlocks[0];
|
|
63
|
-
}
|
|
64
|
-
getPublishedBlocks(from, limit, proven) {
|
|
65
|
-
return this.retrievePublishedBlocks(from, limit, proven);
|
|
66
|
-
}
|
|
67
|
-
async getL2BlocksNew(from, limit, proven) {
|
|
68
|
-
const blocks = await this.store.getBlocks(from, limit);
|
|
69
|
-
if (proven === true) {
|
|
70
|
-
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
71
|
-
return blocks.filter((b)=>b.number <= provenBlockNumber);
|
|
72
|
-
}
|
|
73
|
-
return blocks;
|
|
74
|
-
}
|
|
75
|
-
async retrievePublishedBlocks(from, limit, proven) {
|
|
76
|
-
const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
|
|
77
|
-
const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
|
|
78
|
-
const blocks = (await Promise.all(checkpoints.map((ch)=>this.store.getBlocksForCheckpoint(ch.checkpointNumber)))).filter(isDefined);
|
|
79
|
-
const olbBlocks = [];
|
|
80
|
-
for(let i = 0; i < checkpoints.length; i++){
|
|
81
|
-
const blockForCheckpoint = blocks[i][0];
|
|
82
|
-
const checkpoint = checkpoints[i];
|
|
83
|
-
if (proven === true && checkpoint.checkpointNumber > provenCheckpointNumber) {
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
const oldCheckpoint = new Checkpoint(blockForCheckpoint.archive, checkpoint.header, [
|
|
87
|
-
blockForCheckpoint
|
|
88
|
-
], checkpoint.checkpointNumber);
|
|
89
|
-
const oldBlock = L2Block.fromCheckpoint(oldCheckpoint);
|
|
90
|
-
const publishedBlock = new PublishedL2Block(oldBlock, checkpoint.l1, checkpoint.attestations.map((x)=>CommitteeAttestation.fromBuffer(x)));
|
|
91
|
-
olbBlocks.push(publishedBlock);
|
|
92
|
-
}
|
|
93
|
-
return olbBlocks;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
97
|
-
* @param number - The block number to return (inclusive).
|
|
98
|
-
* @returns The requested L2 block.
|
|
99
|
-
*/ getL2Block(number) {
|
|
100
|
-
return this.getPublishedBlock(number != 'latest' ? number : -1).then((b)=>b?.block);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Gets an L2 block (new format).
|
|
104
|
-
* @param number - The block number to return.
|
|
105
|
-
* @returns The requested L2 block.
|
|
106
|
-
*/ getL2BlockNew(number) {
|
|
107
|
-
if (number === 0) {
|
|
108
|
-
return Promise.resolve(undefined);
|
|
109
|
-
}
|
|
110
|
-
return this.store.getBlock(number);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Gets an l2 block header.
|
|
114
|
-
* @param number - The block number to return or 'latest' for the most recent one.
|
|
115
|
-
* @returns The requested L2 block header.
|
|
116
|
-
*/ async getBlockHeader(number) {
|
|
117
|
-
if (number === 'latest') {
|
|
118
|
-
number = await this.store.getLatestBlockNumber();
|
|
119
|
-
}
|
|
120
|
-
if (number === 0) {
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
|
|
124
|
-
return headers.length === 0 ? undefined : headers[0];
|
|
125
|
-
}
|
|
126
|
-
getBlockRange(from, limit, _proven) {
|
|
127
|
-
return this.getPublishedBlocks(BlockNumber(from), limit).then((blocks)=>blocks.map((b)=>b.block));
|
|
14
|
+
// TXE-specific method for adding checkpoints
|
|
15
|
+
addCheckpoints(checkpoints, result) {
|
|
16
|
+
return addCheckpointsWithContractData(this.store, checkpoints, result);
|
|
128
17
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
getCheckpointByArchive(_archive) {
|
|
133
|
-
throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
|
|
134
|
-
}
|
|
135
|
-
getL2SlotNumber() {
|
|
136
|
-
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
137
|
-
}
|
|
138
|
-
getL2EpochNumber() {
|
|
139
|
-
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
18
|
+
// Abstract method implementations
|
|
19
|
+
getRollupAddress() {
|
|
20
|
+
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
140
21
|
}
|
|
141
|
-
|
|
142
|
-
throw new Error('TXE Archiver does not implement "
|
|
22
|
+
getRegistryAddress() {
|
|
23
|
+
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
143
24
|
}
|
|
144
|
-
|
|
145
|
-
throw new Error('TXE Archiver does not implement "
|
|
25
|
+
getL1Constants() {
|
|
26
|
+
throw new Error('TXE Archiver does not implement "getL1Constants"');
|
|
146
27
|
}
|
|
147
|
-
|
|
148
|
-
|
|
28
|
+
getGenesisValues() {
|
|
29
|
+
return Promise.resolve({
|
|
30
|
+
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT)
|
|
31
|
+
});
|
|
149
32
|
}
|
|
150
|
-
|
|
151
|
-
throw new Error('TXE Archiver does not implement "
|
|
33
|
+
getL1Timestamp() {
|
|
34
|
+
throw new Error('TXE Archiver does not implement "getL1Timestamp"');
|
|
152
35
|
}
|
|
153
36
|
async getL2Tips() {
|
|
154
37
|
// In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
|
|
@@ -186,44 +69,25 @@ export class TXEArchiver extends ArchiverStoreHelper {
|
|
|
186
69
|
checkpointed: tipId
|
|
187
70
|
};
|
|
188
71
|
}
|
|
189
|
-
|
|
190
|
-
throw new Error('TXE Archiver does not implement "
|
|
191
|
-
}
|
|
192
|
-
getGenesisValues() {
|
|
193
|
-
return Promise.resolve({
|
|
194
|
-
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT)
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
syncImmediate() {
|
|
198
|
-
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
199
|
-
}
|
|
200
|
-
getContract(_address, _timestamp) {
|
|
201
|
-
throw new Error('TXE Archiver does not implement "getContract"');
|
|
202
|
-
}
|
|
203
|
-
getRollupAddress() {
|
|
204
|
-
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
205
|
-
}
|
|
206
|
-
getRegistryAddress() {
|
|
207
|
-
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
72
|
+
getL2SlotNumber() {
|
|
73
|
+
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
208
74
|
}
|
|
209
|
-
|
|
210
|
-
throw new Error('TXE Archiver does not implement "
|
|
75
|
+
getL2EpochNumber() {
|
|
76
|
+
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
211
77
|
}
|
|
212
|
-
|
|
213
|
-
|
|
78
|
+
getCheckpointsForEpoch(_epochNumber) {
|
|
79
|
+
throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
|
|
214
80
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
valid: true
|
|
218
|
-
});
|
|
81
|
+
getBlocksForEpoch(_epochNumber) {
|
|
82
|
+
throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
|
|
219
83
|
}
|
|
220
|
-
|
|
221
|
-
throw new Error('
|
|
84
|
+
getBlockHeadersForEpoch(_epochNumber) {
|
|
85
|
+
throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
|
|
222
86
|
}
|
|
223
|
-
|
|
224
|
-
throw new Error('
|
|
87
|
+
isEpochComplete(_epochNumber) {
|
|
88
|
+
throw new Error('TXE Archiver does not implement "isEpochComplete"');
|
|
225
89
|
}
|
|
226
|
-
|
|
227
|
-
throw new Error('TXE Archiver does not implement "
|
|
90
|
+
syncImmediate() {
|
|
91
|
+
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
228
92
|
}
|
|
229
93
|
}
|
|
@@ -25,4 +25,4 @@ export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations
|
|
|
25
25
|
* @returns The created L2Block with proper archive chaining
|
|
26
26
|
*/
|
|
27
27
|
export declare function makeTXEBlock(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables, txEffects: TxEffect[]): Promise<L2Block>;
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMapp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EIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAQ,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAwC,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,CAExE;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAQ,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAwC,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,CAExE;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,aAAa,CAAC,CAgBxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAWlB"}
|
|
@@ -19,7 +19,7 @@ export async function insertTxEffectIntoWorldTrees(txEffect, worldTrees) {
|
|
|
19
19
|
export async function makeTXEBlockHeader(worldTrees, globalVariables) {
|
|
20
20
|
const stateReference = await worldTrees.getStateReference();
|
|
21
21
|
const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
22
|
-
return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), Fr.ZERO, Fr.ZERO, stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
|
|
22
|
+
return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), Fr.ZERO, Fr.ZERO, Fr.ZERO, stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Creates an L2Block with proper archive chaining.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260114",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/accounts": "4.0.0-nightly.
|
|
65
|
-
"@aztec/archiver": "4.0.0-nightly.
|
|
66
|
-
"@aztec/aztec-node": "4.0.0-nightly.
|
|
67
|
-
"@aztec/aztec.js": "4.0.0-nightly.
|
|
68
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
69
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
70
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
71
|
-
"@aztec/key-store": "4.0.0-nightly.
|
|
72
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
73
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
74
|
-
"@aztec/pxe": "4.0.0-nightly.
|
|
75
|
-
"@aztec/simulator": "4.0.0-nightly.
|
|
76
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
77
|
-
"@aztec/world-state": "4.0.0-nightly.
|
|
64
|
+
"@aztec/accounts": "4.0.0-nightly.20260114",
|
|
65
|
+
"@aztec/archiver": "4.0.0-nightly.20260114",
|
|
66
|
+
"@aztec/aztec-node": "4.0.0-nightly.20260114",
|
|
67
|
+
"@aztec/aztec.js": "4.0.0-nightly.20260114",
|
|
68
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260114",
|
|
69
|
+
"@aztec/constants": "4.0.0-nightly.20260114",
|
|
70
|
+
"@aztec/foundation": "4.0.0-nightly.20260114",
|
|
71
|
+
"@aztec/key-store": "4.0.0-nightly.20260114",
|
|
72
|
+
"@aztec/kv-store": "4.0.0-nightly.20260114",
|
|
73
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260114",
|
|
74
|
+
"@aztec/pxe": "4.0.0-nightly.20260114",
|
|
75
|
+
"@aztec/simulator": "4.0.0-nightly.20260114",
|
|
76
|
+
"@aztec/stdlib": "4.0.0-nightly.20260114",
|
|
77
|
+
"@aztec/world-state": "4.0.0-nightly.20260114",
|
|
78
78
|
"zod": "^3.23.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
@@ -156,7 +156,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
async txeGetLastTxEffects() {
|
|
159
|
-
const
|
|
159
|
+
const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
|
|
160
|
+
const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
|
|
160
161
|
|
|
161
162
|
if (block!.body.txEffects.length != 1) {
|
|
162
163
|
// Note that calls like env.mine() will result in blocks with no transactions, hitting this
|
package/src/rpc_translator.ts
CHANGED
|
@@ -1,216 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchiveSourceBase, KVArchiverDataStore, addCheckpointsWithContractData } from '@aztec/archiver';
|
|
2
2
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
3
|
-
import {
|
|
3
|
+
import { CheckpointNumber, type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
6
|
-
import { isDefined } from '@aztec/foundation/types';
|
|
7
6
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
8
|
-
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
7
|
import {
|
|
10
8
|
type CheckpointId,
|
|
11
|
-
CommitteeAttestation,
|
|
12
9
|
L2Block,
|
|
13
10
|
type L2BlockId,
|
|
14
|
-
type L2BlockNew,
|
|
15
|
-
type L2BlockSource,
|
|
16
11
|
type L2TipId,
|
|
17
12
|
type L2Tips,
|
|
18
|
-
PublishedL2Block,
|
|
19
13
|
type ValidateCheckpointResult,
|
|
20
14
|
} from '@aztec/stdlib/block';
|
|
21
|
-
import { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
22
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
15
|
+
import { Checkpoint, type PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
23
16
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
24
17
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
25
|
-
import type { UInt64 } from '@aztec/stdlib/types';
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
/**
|
|
20
|
+
* TXE Archiver implementation.
|
|
21
|
+
* Provides most of the endpoints needed by the node for reading from and writing to state,
|
|
22
|
+
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
23
|
+
*/
|
|
24
|
+
export class TXEArchiver extends ArchiveSourceBase {
|
|
31
25
|
constructor(db: AztecAsyncKVStore) {
|
|
32
|
-
|
|
26
|
+
const store = new KVArchiverDataStore(db, 9999);
|
|
27
|
+
super(store);
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
const publishedBlocks = await this.getPublishedBlocks(number, 1);
|
|
40
|
-
if (publishedBlocks.length === 0) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
return publishedBlocks[0].block;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public async getBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<L2Block[]> {
|
|
47
|
-
const publishedBlocks = await this.getPublishedBlocks(from, limit, proven);
|
|
48
|
-
return publishedBlocks.map(x => x.block);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public override async addCheckpoints(
|
|
52
|
-
checkpoints: PublishedCheckpoint[],
|
|
53
|
-
_result?: ValidateCheckpointResult,
|
|
54
|
-
): Promise<boolean> {
|
|
55
|
-
const allBlocks = checkpoints.flatMap(ch => ch.checkpoint.blocks);
|
|
56
|
-
const opResults = await Promise.all([this.store.addLogs(allBlocks), this.store.addCheckpoints(checkpoints)]);
|
|
57
|
-
|
|
58
|
-
return opResults.every(Boolean);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Gets the number of the latest L2 block processed by the block source implementation.
|
|
63
|
-
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
64
|
-
*/
|
|
65
|
-
public getBlockNumber(): Promise<BlockNumber> {
|
|
66
|
-
return this.store.getLatestBlockNumber();
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
71
|
-
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
72
|
-
*/
|
|
73
|
-
public override getProvenBlockNumber(): Promise<BlockNumber> {
|
|
74
|
-
return this.store.getProvenBlockNumber();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Gets a published l2 block. If a negative number is passed, the block returned is the most recent.
|
|
79
|
-
* @param number - The block number to return (inclusive).
|
|
80
|
-
* @returns The requested L2 block.
|
|
81
|
-
*/
|
|
82
|
-
public async getPublishedBlock(number: number): Promise<PublishedL2Block | undefined> {
|
|
83
|
-
// If the number provided is -ve, then return the latest block.
|
|
84
|
-
if (number < 0) {
|
|
85
|
-
number = await this.store.getLatestBlockNumber();
|
|
86
|
-
}
|
|
87
|
-
if (number == 0) {
|
|
88
|
-
return undefined;
|
|
89
|
-
}
|
|
90
|
-
const publishedBlocks = await this.retrievePublishedBlocks(BlockNumber(number), 1);
|
|
91
|
-
return publishedBlocks.length === 0 ? undefined : publishedBlocks[0];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<PublishedL2Block[]> {
|
|
95
|
-
return this.retrievePublishedBlocks(from, limit, proven);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
async getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]> {
|
|
99
|
-
const blocks = await this.store.getBlocks(from, limit);
|
|
100
|
-
|
|
101
|
-
if (proven === true) {
|
|
102
|
-
const provenBlockNumber = await this.store.getProvenBlockNumber();
|
|
103
|
-
return blocks.filter(b => b.number <= provenBlockNumber);
|
|
104
|
-
}
|
|
105
|
-
return blocks;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private async retrievePublishedBlocks(
|
|
109
|
-
from: BlockNumber,
|
|
110
|
-
limit: number,
|
|
111
|
-
proven?: boolean,
|
|
112
|
-
): Promise<PublishedL2Block[]> {
|
|
113
|
-
const checkpoints = await this.store.getRangeOfCheckpoints(CheckpointNumber(from), limit);
|
|
114
|
-
const provenCheckpointNumber = await this.store.getProvenCheckpointNumber();
|
|
115
|
-
const blocks = (
|
|
116
|
-
await Promise.all(checkpoints.map(ch => this.store.getBlocksForCheckpoint(ch.checkpointNumber)))
|
|
117
|
-
).filter(isDefined);
|
|
118
|
-
|
|
119
|
-
const olbBlocks: PublishedL2Block[] = [];
|
|
120
|
-
for (let i = 0; i < checkpoints.length; i++) {
|
|
121
|
-
const blockForCheckpoint = blocks[i][0];
|
|
122
|
-
const checkpoint = checkpoints[i];
|
|
123
|
-
if (proven === true && checkpoint.checkpointNumber > provenCheckpointNumber) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const oldCheckpoint = new Checkpoint(
|
|
127
|
-
blockForCheckpoint.archive,
|
|
128
|
-
checkpoint.header,
|
|
129
|
-
[blockForCheckpoint],
|
|
130
|
-
checkpoint.checkpointNumber,
|
|
131
|
-
);
|
|
132
|
-
const oldBlock = L2Block.fromCheckpoint(oldCheckpoint);
|
|
133
|
-
const publishedBlock = new PublishedL2Block(
|
|
134
|
-
oldBlock,
|
|
135
|
-
checkpoint.l1,
|
|
136
|
-
checkpoint.attestations.map(x => CommitteeAttestation.fromBuffer(x)),
|
|
137
|
-
);
|
|
138
|
-
olbBlocks.push(publishedBlock);
|
|
139
|
-
}
|
|
140
|
-
return olbBlocks;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
145
|
-
* @param number - The block number to return (inclusive).
|
|
146
|
-
* @returns The requested L2 block.
|
|
147
|
-
*/
|
|
148
|
-
public getL2Block(number: BlockNumber | 'latest'): Promise<L2Block | undefined> {
|
|
149
|
-
return this.getPublishedBlock(number != 'latest' ? number : -1).then(b => b?.block);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Gets an L2 block (new format).
|
|
154
|
-
* @param number - The block number to return.
|
|
155
|
-
* @returns The requested L2 block.
|
|
156
|
-
*/
|
|
157
|
-
public getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined> {
|
|
158
|
-
if (number === 0) {
|
|
159
|
-
return Promise.resolve(undefined);
|
|
160
|
-
}
|
|
161
|
-
return this.store.getBlock(number);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Gets an l2 block header.
|
|
166
|
-
* @param number - The block number to return or 'latest' for the most recent one.
|
|
167
|
-
* @returns The requested L2 block header.
|
|
168
|
-
*/
|
|
169
|
-
public async getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined> {
|
|
170
|
-
if (number === 'latest') {
|
|
171
|
-
number = await this.store.getLatestBlockNumber();
|
|
172
|
-
}
|
|
173
|
-
if (number === 0) {
|
|
174
|
-
return undefined;
|
|
175
|
-
}
|
|
176
|
-
const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
|
|
177
|
-
return headers.length === 0 ? undefined : headers[0];
|
|
30
|
+
// TXE-specific method for adding checkpoints
|
|
31
|
+
public addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<boolean> {
|
|
32
|
+
return addCheckpointsWithContractData(this.store, checkpoints, result);
|
|
178
33
|
}
|
|
179
34
|
|
|
180
|
-
|
|
181
|
-
return this.getPublishedBlocks(BlockNumber(from), limit).then(blocks => blocks.map(b => b.block));
|
|
182
|
-
}
|
|
35
|
+
// Abstract method implementations
|
|
183
36
|
|
|
184
|
-
public
|
|
185
|
-
throw new Error('TXE Archiver does not implement "
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
public getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined> {
|
|
189
|
-
throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
public getL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
193
|
-
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
public getL2EpochNumber(): Promise<EpochNumber> {
|
|
197
|
-
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
37
|
+
public getRollupAddress(): Promise<EthAddress> {
|
|
38
|
+
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
198
39
|
}
|
|
199
40
|
|
|
200
|
-
public
|
|
201
|
-
throw new Error('TXE Archiver does not implement "
|
|
41
|
+
public getRegistryAddress(): Promise<EthAddress> {
|
|
42
|
+
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
202
43
|
}
|
|
203
44
|
|
|
204
|
-
public
|
|
205
|
-
throw new Error('TXE Archiver does not implement "
|
|
45
|
+
public getL1Constants(): Promise<L1RollupConstants> {
|
|
46
|
+
throw new Error('TXE Archiver does not implement "getL1Constants"');
|
|
206
47
|
}
|
|
207
48
|
|
|
208
|
-
public
|
|
209
|
-
|
|
49
|
+
public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
|
|
50
|
+
return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
|
|
210
51
|
}
|
|
211
52
|
|
|
212
|
-
public
|
|
213
|
-
throw new Error('TXE Archiver does not implement "
|
|
53
|
+
public getL1Timestamp(): Promise<bigint | undefined> {
|
|
54
|
+
throw new Error('TXE Archiver does not implement "getL1Timestamp"');
|
|
214
55
|
}
|
|
215
56
|
|
|
216
57
|
public async getL2Tips(): Promise<L2Tips> {
|
|
@@ -245,50 +86,31 @@ export class TXEArchiver extends ArchiverStoreHelper implements L2BlockSource {
|
|
|
245
86
|
};
|
|
246
87
|
}
|
|
247
88
|
|
|
248
|
-
public
|
|
249
|
-
throw new Error('TXE Archiver does not implement "
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
|
|
253
|
-
return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
public syncImmediate(): Promise<void> {
|
|
257
|
-
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
public getContract(_address: AztecAddress, _timestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined> {
|
|
261
|
-
throw new Error('TXE Archiver does not implement "getContract"');
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
public getRollupAddress(): Promise<EthAddress> {
|
|
265
|
-
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
89
|
+
public getL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
90
|
+
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
266
91
|
}
|
|
267
92
|
|
|
268
|
-
public
|
|
269
|
-
throw new Error('TXE Archiver does not implement "
|
|
93
|
+
public getL2EpochNumber(): Promise<EpochNumber | undefined> {
|
|
94
|
+
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
270
95
|
}
|
|
271
96
|
|
|
272
|
-
public
|
|
273
|
-
throw new Error('TXE Archiver does not implement "
|
|
97
|
+
public getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]> {
|
|
98
|
+
throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
|
|
274
99
|
}
|
|
275
100
|
|
|
276
|
-
public
|
|
277
|
-
|
|
101
|
+
public getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]> {
|
|
102
|
+
throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
|
|
278
103
|
}
|
|
279
104
|
|
|
280
|
-
public
|
|
281
|
-
|
|
105
|
+
public getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]> {
|
|
106
|
+
throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
|
|
282
107
|
}
|
|
283
108
|
|
|
284
|
-
|
|
285
|
-
throw new Error('
|
|
286
|
-
}
|
|
287
|
-
getPublishedBlockByArchive(_archive: Fr): Promise<PublishedL2Block | undefined> {
|
|
288
|
-
throw new Error('Method not implemented.');
|
|
109
|
+
public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
|
|
110
|
+
throw new Error('TXE Archiver does not implement "isEpochComplete"');
|
|
289
111
|
}
|
|
290
112
|
|
|
291
|
-
|
|
292
|
-
throw new Error('TXE Archiver does not implement "
|
|
113
|
+
public syncImmediate(): Promise<void> {
|
|
114
|
+
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
293
115
|
}
|
|
294
116
|
}
|