@aztec/txe 0.0.1-commit.f146247c → 0.0.1-commit.f1b29a41e
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/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +88 -54
- package/dest/oracle/interfaces.d.ts +29 -28
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +13 -13
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +12 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts +23 -23
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +126 -51
- package/dest/rpc_translator.d.ts +88 -83
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +303 -158
- package/dest/state_machine/archiver.d.ts +3 -3
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +9 -8
- package/dest/state_machine/dummy_p2p_client.d.ts +18 -13
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +33 -18
- package/dest/state_machine/global_variable_builder.d.ts +3 -3
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +1 -1
- package/dest/state_machine/index.d.ts +8 -5
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +19 -10
- package/dest/state_machine/mock_epoch_cache.d.ts +19 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +36 -2
- package/dest/state_machine/synchronizer.d.ts +5 -5
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +3 -3
- package/dest/txe_session.d.ts +10 -6
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +93 -25
- package/dest/util/encoding.d.ts +69 -1
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.d.ts +2 -3
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +6 -25
- 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 +3 -1
- package/package.json +15 -15
- package/src/index.ts +89 -52
- package/src/oracle/interfaces.ts +32 -31
- package/src/oracle/txe_oracle_public_context.ts +12 -12
- package/src/oracle/txe_oracle_top_level_context.ts +143 -97
- package/src/rpc_translator.ts +344 -175
- package/src/state_machine/archiver.ts +8 -5
- package/src/state_machine/dummy_p2p_client.ts +46 -24
- package/src/state_machine/global_variable_builder.ts +7 -1
- package/src/state_machine/index.ts +33 -9
- package/src/state_machine/mock_epoch_cache.ts +47 -3
- package/src/state_machine/synchronizer.ts +4 -4
- package/src/txe_session.ts +106 -72
- package/src/util/txe_public_contract_data_source.ts +10 -38
- package/src/utils/block_creation.ts +3 -1
- package/dest/util/txe_contract_store.d.ts +0 -12
- package/dest/util/txe_contract_store.d.ts.map +0 -1
- package/dest/util/txe_contract_store.js +0 -22
- package/src/util/txe_contract_store.ts +0 -36
|
@@ -17,7 +17,7 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
17
17
|
private readonly updater = new ArchiverDataStoreUpdater(this.store);
|
|
18
18
|
|
|
19
19
|
constructor(db: AztecAsyncKVStore) {
|
|
20
|
-
const store = new KVArchiverDataStore(db, 9999
|
|
20
|
+
const store = new KVArchiverDataStore(db, 9999);
|
|
21
21
|
super(store);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -59,6 +59,8 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
59
59
|
if (!checkpointedBlock) {
|
|
60
60
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
|
|
61
61
|
}
|
|
62
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
63
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
62
64
|
const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
63
65
|
if (checkpoint.length === 0) {
|
|
64
66
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
@@ -74,15 +76,16 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
74
76
|
proven: tipId,
|
|
75
77
|
finalized: tipId,
|
|
76
78
|
checkpointed: tipId,
|
|
79
|
+
proposedCheckpoint: tipId,
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
public
|
|
81
|
-
throw new Error('TXE Archiver does not implement "
|
|
83
|
+
public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
84
|
+
throw new Error('TXE Archiver does not implement "getSyncedL2SlotNumber"');
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
public
|
|
85
|
-
throw new Error('TXE Archiver does not implement "
|
|
87
|
+
public getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
|
|
88
|
+
throw new Error('TXE Archiver does not implement "getSyncedL2EpochNumber"');
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
|
|
@@ -6,6 +6,8 @@ import type {
|
|
|
6
6
|
P2PBlockReceivedCallback,
|
|
7
7
|
P2PCheckpointReceivedCallback,
|
|
8
8
|
P2PConfig,
|
|
9
|
+
P2PDuplicateAttestationCallback,
|
|
10
|
+
P2PDuplicateProposalCallback,
|
|
9
11
|
P2PSyncState,
|
|
10
12
|
PeerId,
|
|
11
13
|
ReqRespSubProtocol,
|
|
@@ -14,12 +16,12 @@ import type {
|
|
|
14
16
|
StatusMessage,
|
|
15
17
|
} from '@aztec/p2p';
|
|
16
18
|
import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
|
|
17
|
-
import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
18
|
-
import type { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
|
|
19
|
-
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
19
|
+
import type { ITxProvider, PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
20
|
+
import type { BlockProposal, CheckpointAttestation, CheckpointProposal, TopicType } from '@aztec/stdlib/p2p';
|
|
21
|
+
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
20
22
|
|
|
21
23
|
export class DummyP2P implements P2P {
|
|
22
|
-
public
|
|
24
|
+
public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
|
|
23
25
|
return Promise.resolve();
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -39,6 +41,10 @@ export class DummyP2P implements P2P {
|
|
|
39
41
|
throw new Error('DummyP2P does not implement "getPeers"');
|
|
40
42
|
}
|
|
41
43
|
|
|
44
|
+
public getGossipMeshPeerCount(_topicType: TopicType): Promise<number> {
|
|
45
|
+
return Promise.resolve(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
public broadcastProposal(_proposal: BlockProposal): Promise<void> {
|
|
43
49
|
throw new Error('DummyP2P does not implement "broadcastProposal"');
|
|
44
50
|
}
|
|
@@ -55,8 +61,12 @@ export class DummyP2P implements P2P {
|
|
|
55
61
|
throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
|
|
56
62
|
}
|
|
57
63
|
|
|
58
|
-
public
|
|
59
|
-
throw new Error('DummyP2P does not implement "
|
|
64
|
+
public registerValidatorCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
|
|
65
|
+
throw new Error('DummyP2P does not implement "registerValidatorCheckpointProposalHandler"');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public registerAllNodesCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
|
|
69
|
+
throw new Error('DummyP2P does not implement "registerAllNodesCheckpointProposalHandler"');
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
@@ -71,8 +81,8 @@ export class DummyP2P implements P2P {
|
|
|
71
81
|
throw new Error('DummyP2P does not implement "sendTx"');
|
|
72
82
|
}
|
|
73
83
|
|
|
74
|
-
public
|
|
75
|
-
throw new Error('DummyP2P does not implement "
|
|
84
|
+
public handleFailedExecution(_txHashes: TxHash[]): Promise<void> {
|
|
85
|
+
throw new Error('DummyP2P does not implement "handleFailedExecution"');
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
public getTxByHashFromPool(_txHash: TxHash): Promise<Tx | undefined> {
|
|
@@ -97,6 +107,10 @@ export class DummyP2P implements P2P {
|
|
|
97
107
|
throw new Error('DummyP2P does not implement "iteratePendingTxs"');
|
|
98
108
|
}
|
|
99
109
|
|
|
110
|
+
public iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
|
|
111
|
+
throw new Error('DummyP2P does not implement "iterateEligiblePendingTxs"');
|
|
112
|
+
}
|
|
113
|
+
|
|
100
114
|
public getPendingTxCount(): Promise<number> {
|
|
101
115
|
throw new Error('DummyP2P does not implement "getPendingTxCount"');
|
|
102
116
|
}
|
|
@@ -125,6 +139,10 @@ export class DummyP2P implements P2P {
|
|
|
125
139
|
throw new Error('DummyP2P does not implement "isP2PClient"');
|
|
126
140
|
}
|
|
127
141
|
|
|
142
|
+
public getTxProvider(): ITxProvider {
|
|
143
|
+
throw new Error('DummyP2P does not implement "getTxProvider"');
|
|
144
|
+
}
|
|
145
|
+
|
|
128
146
|
public getTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
129
147
|
throw new Error('DummyP2P does not implement "getTxsByHash"');
|
|
130
148
|
}
|
|
@@ -133,8 +151,8 @@ export class DummyP2P implements P2P {
|
|
|
133
151
|
throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
|
|
134
152
|
}
|
|
135
153
|
|
|
136
|
-
public
|
|
137
|
-
throw new Error('DummyP2P does not implement "
|
|
154
|
+
public addOwnCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
|
|
155
|
+
throw new Error('DummyP2P does not implement "addOwnCheckpointAttestations"');
|
|
138
156
|
}
|
|
139
157
|
|
|
140
158
|
public getL2BlockHash(_number: number): Promise<string | undefined> {
|
|
@@ -157,14 +175,6 @@ export class DummyP2P implements P2P {
|
|
|
157
175
|
throw new Error('DummyP2P does not implement "sync"');
|
|
158
176
|
}
|
|
159
177
|
|
|
160
|
-
public requestTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
161
|
-
throw new Error('DummyP2P does not implement "requestTxsByHash"');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
public getTxs(_filter: 'all' | 'pending' | 'mined'): Promise<Tx[]> {
|
|
165
|
-
throw new Error('DummyP2P does not implement "getTxs"');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
178
|
public getTxsByHashFromPool(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
169
179
|
throw new Error('DummyP2P does not implement "getTxsByHashFromPool"');
|
|
170
180
|
}
|
|
@@ -173,10 +183,6 @@ export class DummyP2P implements P2P {
|
|
|
173
183
|
throw new Error('DummyP2P does not implement "hasTxsInPool"');
|
|
174
184
|
}
|
|
175
185
|
|
|
176
|
-
public addTxsToPool(_txs: Tx[]): Promise<number> {
|
|
177
|
-
throw new Error('DummyP2P does not implement "addTxs"');
|
|
178
|
-
}
|
|
179
|
-
|
|
180
186
|
public getSyncedLatestBlockNum(): Promise<number> {
|
|
181
187
|
throw new Error('DummyP2P does not implement "getSyncedLatestBlockNum"');
|
|
182
188
|
}
|
|
@@ -189,8 +195,12 @@ export class DummyP2P implements P2P {
|
|
|
189
195
|
throw new Error('DummyP2P does not implement "getSyncedLatestSlot"');
|
|
190
196
|
}
|
|
191
197
|
|
|
192
|
-
|
|
193
|
-
throw new Error('DummyP2P does not implement "
|
|
198
|
+
protectTxs(_txHashes: TxHash[], _blockHeader: BlockHeader): Promise<TxHash[]> {
|
|
199
|
+
throw new Error('DummyP2P does not implement "protectTxs".');
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
prepareForSlot(_slotNumber: SlotNumber): Promise<void> {
|
|
203
|
+
return Promise.resolve();
|
|
194
204
|
}
|
|
195
205
|
|
|
196
206
|
addReqRespSubProtocol(
|
|
@@ -206,4 +216,16 @@ export class DummyP2P implements P2P {
|
|
|
206
216
|
|
|
207
217
|
//This is no-op
|
|
208
218
|
public registerThisValidatorAddresses(_address: EthAddress[]): void {}
|
|
219
|
+
|
|
220
|
+
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {
|
|
221
|
+
throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
|
|
225
|
+
throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
public hasBlockProposalsForSlot(_slot: SlotNumber): Promise<boolean> {
|
|
229
|
+
throw new Error('DummyP2P does not implement "hasBlockProposalsForSlot"');
|
|
230
|
+
}
|
|
209
231
|
}
|
|
@@ -3,7 +3,12 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
4
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
5
5
|
import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type BuildCheckpointGlobalVariablesOpts,
|
|
8
|
+
type CheckpointGlobalVariables,
|
|
9
|
+
type GlobalVariableBuilder,
|
|
10
|
+
GlobalVariables,
|
|
11
|
+
} from '@aztec/stdlib/tx';
|
|
7
12
|
|
|
8
13
|
export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
9
14
|
public getCurrentMinFees(): Promise<GasFees> {
|
|
@@ -23,6 +28,7 @@ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
|
23
28
|
_coinbase: EthAddress,
|
|
24
29
|
_feeRecipient: AztecAddress,
|
|
25
30
|
_slotNumber: SlotNumber,
|
|
31
|
+
_opts?: BuildCheckpointGlobalVariablesOpts,
|
|
26
32
|
): Promise<CheckpointGlobalVariables> {
|
|
27
33
|
const vars = makeGlobalVariables();
|
|
28
34
|
return Promise.resolve({
|
|
@@ -3,8 +3,9 @@ import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
|
3
3
|
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import type {
|
|
7
|
-
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
6
|
+
import type { KeyStore } from '@aztec/key-store';
|
|
7
|
+
import { type AnchorBlockStore, type ContractStore, ContractSyncService, type NoteStore } from '@aztec/pxe/server';
|
|
8
|
+
import { MessageContextService } from '@aztec/pxe/simulator';
|
|
8
9
|
import { L2Block } from '@aztec/stdlib/block';
|
|
9
10
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
10
11
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -26,13 +27,18 @@ export class TXEStateMachine {
|
|
|
26
27
|
public synchronizer: TXESynchronizer,
|
|
27
28
|
public archiver: TXEArchiver,
|
|
28
29
|
public anchorBlockStore: AnchorBlockStore,
|
|
30
|
+
public contractSyncService: ContractSyncService,
|
|
31
|
+
public messageContextService: MessageContextService,
|
|
29
32
|
) {}
|
|
30
33
|
|
|
31
|
-
public static async create(
|
|
32
|
-
|
|
34
|
+
public static async create(
|
|
35
|
+
archiver: TXEArchiver,
|
|
36
|
+
anchorBlockStore: AnchorBlockStore,
|
|
37
|
+
contractStore: ContractStore,
|
|
38
|
+
noteStore: NoteStore,
|
|
39
|
+
keyStore: KeyStore,
|
|
40
|
+
) {
|
|
33
41
|
const synchronizer = await TXESynchronizer.create();
|
|
34
|
-
const anchorBlockStore = new AnchorBlockStore(db);
|
|
35
|
-
|
|
36
42
|
const aztecNodeConfig = {} as AztecNodeConfig;
|
|
37
43
|
|
|
38
44
|
const log = createLogger('txe_node');
|
|
@@ -48,21 +54,36 @@ export class TXEStateMachine {
|
|
|
48
54
|
undefined,
|
|
49
55
|
undefined,
|
|
50
56
|
undefined,
|
|
57
|
+
undefined,
|
|
51
58
|
VERSION,
|
|
52
59
|
CHAIN_ID,
|
|
53
60
|
new TXEGlobalVariablesBuilder(),
|
|
54
61
|
new MockEpochCache(),
|
|
55
62
|
getPackageVersion() ?? '',
|
|
56
63
|
new TestCircuitVerifier(),
|
|
64
|
+
new TestCircuitVerifier(),
|
|
57
65
|
undefined,
|
|
58
66
|
log,
|
|
59
67
|
);
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
const contractSyncService = new ContractSyncService(
|
|
70
|
+
node,
|
|
71
|
+
contractStore,
|
|
72
|
+
noteStore,
|
|
73
|
+
() => keyStore.getAccounts(),
|
|
74
|
+
createLogger('txe:contract_sync'),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const messageContextService = new MessageContextService(node);
|
|
78
|
+
|
|
79
|
+
return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService, messageContextService);
|
|
62
80
|
}
|
|
63
81
|
|
|
64
82
|
public async handleL2Block(block: L2Block) {
|
|
65
|
-
// Create a checkpoint from the block manually
|
|
83
|
+
// Create a checkpoint from the block manually.
|
|
84
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
85
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
86
|
+
const checkpointNumber = CheckpointNumber.fromBlockNumber(block.number);
|
|
66
87
|
const checkpoint = new Checkpoint(
|
|
67
88
|
block.archive,
|
|
68
89
|
CheckpointHeader.from({
|
|
@@ -79,7 +100,7 @@ export class TXEStateMachine {
|
|
|
79
100
|
totalManaUsed: block.header.totalManaUsed,
|
|
80
101
|
}),
|
|
81
102
|
[block],
|
|
82
|
-
|
|
103
|
+
checkpointNumber,
|
|
83
104
|
);
|
|
84
105
|
|
|
85
106
|
const publishedCheckpoint = new PublishedCheckpoint(
|
|
@@ -91,6 +112,9 @@ export class TXEStateMachine {
|
|
|
91
112
|
),
|
|
92
113
|
[],
|
|
93
114
|
);
|
|
115
|
+
// Wipe contract sync cache when anchor block changes (mirrors BlockSynchronizer behavior)
|
|
116
|
+
this.contractSyncService.wipe();
|
|
117
|
+
|
|
94
118
|
await Promise.all([
|
|
95
119
|
this.synchronizer.handleL2Block(block),
|
|
96
120
|
this.archiver.addCheckpoints([publishedCheckpoint], undefined),
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { EpochAndSlot, EpochCacheInterface, EpochCommitteeInfo, SlotTag } from '@aztec/epoch-cache';
|
|
2
2
|
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Mock implementation of the EpochCacheInterface used to satisfy dependencies of AztecNodeService.
|
|
7
8
|
* Since in TXE we don't validate transactions, mock suffices here.
|
|
8
9
|
*/
|
|
9
10
|
export class MockEpochCache implements EpochCacheInterface {
|
|
10
|
-
getCommittee(): Promise<EpochCommitteeInfo> {
|
|
11
|
+
getCommittee(_slot: SlotTag = 'now'): Promise<EpochCommitteeInfo> {
|
|
11
12
|
return Promise.resolve({
|
|
12
13
|
committee: undefined,
|
|
13
14
|
seed: 0n,
|
|
@@ -16,6 +17,22 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
16
17
|
});
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
getSlotNow(): SlotNumber {
|
|
21
|
+
return SlotNumber(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
getTargetSlot(): SlotNumber {
|
|
25
|
+
return SlotNumber(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getEpochNow(): EpochNumber {
|
|
29
|
+
return EpochNumber.ZERO;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getTargetEpoch(): EpochNumber {
|
|
33
|
+
return EpochNumber.ZERO;
|
|
34
|
+
}
|
|
35
|
+
|
|
19
36
|
getEpochAndSlotNow(): EpochAndSlot & { nowMs: bigint } {
|
|
20
37
|
return {
|
|
21
38
|
epoch: EpochNumber.ZERO,
|
|
@@ -25,15 +42,23 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
25
42
|
};
|
|
26
43
|
}
|
|
27
44
|
|
|
28
|
-
getEpochAndSlotInNextL1Slot(): EpochAndSlot & {
|
|
45
|
+
getEpochAndSlotInNextL1Slot(): EpochAndSlot & { nowSeconds: bigint } {
|
|
29
46
|
return {
|
|
30
47
|
epoch: EpochNumber.ZERO,
|
|
31
48
|
slot: SlotNumber(0),
|
|
32
49
|
ts: 0n,
|
|
33
|
-
|
|
50
|
+
nowSeconds: 0n,
|
|
34
51
|
};
|
|
35
52
|
}
|
|
36
53
|
|
|
54
|
+
getTargetEpochAndSlotInNextL1Slot(): EpochAndSlot & { nowSeconds: bigint } {
|
|
55
|
+
return this.getEpochAndSlotInNextL1Slot();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
isProposerPipeliningEnabled(): boolean {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
37
62
|
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
|
|
38
63
|
return '0x00';
|
|
39
64
|
}
|
|
@@ -49,6 +74,13 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
49
74
|
};
|
|
50
75
|
}
|
|
51
76
|
|
|
77
|
+
getTargetAndNextSlot(): { targetSlot: SlotNumber; nextSlot: SlotNumber } {
|
|
78
|
+
return {
|
|
79
|
+
targetSlot: SlotNumber(0),
|
|
80
|
+
nextSlot: SlotNumber(0),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
52
84
|
getProposerAttesterAddressInSlot(_slot: SlotNumber): Promise<EthAddress | undefined> {
|
|
53
85
|
return Promise.resolve(undefined);
|
|
54
86
|
}
|
|
@@ -64,4 +96,16 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
64
96
|
filterInCommittee(_slot: SlotTag, _validators: EthAddress[]): Promise<EthAddress[]> {
|
|
65
97
|
return Promise.resolve([]);
|
|
66
98
|
}
|
|
99
|
+
|
|
100
|
+
isEscapeHatchOpen(_epoch: EpochNumber): Promise<boolean> {
|
|
101
|
+
return Promise.resolve(false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
isEscapeHatchOpenAtSlot(_slot: SlotTag): Promise<boolean> {
|
|
105
|
+
return Promise.resolve(false);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
getL1Constants(): L1RollupConstants {
|
|
109
|
+
return EmptyL1RollupConstants;
|
|
110
|
+
}
|
|
67
111
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
2
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import type { L2Block } from '@aztec/stdlib/block';
|
|
4
|
+
import type { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
5
5
|
import type {
|
|
6
6
|
MerkleTreeReadOperations,
|
|
7
7
|
MerkleTreeWriteOperations,
|
|
@@ -33,12 +33,12 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* Forces an immediate sync to an optionally provided minimum block number
|
|
36
|
+
* Forces an immediate sync to an optionally provided minimum block number.
|
|
37
37
|
* @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
|
|
38
|
-
* @param
|
|
38
|
+
* @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash.
|
|
39
39
|
* @returns A promise that resolves with the block number the world state was synced to
|
|
40
40
|
*/
|
|
41
|
-
public syncImmediate(_minBlockNumber?: BlockNumber,
|
|
41
|
+
public syncImmediate(_minBlockNumber?: BlockNumber, _blockHash?: BlockHash): Promise<BlockNumber> {
|
|
42
42
|
return Promise.resolve(this.blockNumber);
|
|
43
43
|
}
|
|
44
44
|
|