@aztec/txe 0.0.1-commit.e558bd1c → 0.0.1-commit.e5a3663dd
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 +34 -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 +31 -23
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +159 -66
- package/dest/rpc_translator.d.ts +129 -83
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +479 -165
- 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 +12 -12
- package/dest/state_machine/dummy_p2p_client.d.ts +16 -12
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +28 -16
- package/dest/state_machine/global_variable_builder.d.ts +9 -4
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +9 -3
- package/dest/state_machine/index.d.ts +4 -2
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +8 -4
- package/dest/state_machine/mock_epoch_cache.d.ts +20 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +39 -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 +54 -6
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +152 -27
- package/dest/util/encoding.d.ts +71 -1
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/encoding.js +4 -0
- 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/package.json +15 -15
- package/src/index.ts +89 -52
- package/src/oracle/interfaces.ts +35 -32
- package/src/oracle/txe_oracle_public_context.ts +12 -12
- package/src/oracle/txe_oracle_top_level_context.ts +168 -117
- package/src/rpc_translator.ts +571 -196
- package/src/state_machine/archiver.ts +9 -9
- package/src/state_machine/dummy_p2p_client.ts +39 -22
- package/src/state_machine/global_variable_builder.ts +18 -3
- package/src/state_machine/index.ts +10 -2
- package/src/state_machine/mock_epoch_cache.ts +51 -3
- package/src/state_machine/synchronizer.ts +4 -4
- package/src/txe_session.ts +216 -76
- package/src/util/encoding.ts +5 -0
- package/src/util/txe_public_contract_data_source.ts +10 -38
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArchiverDataSourceBase, ArchiverDataStoreUpdater,
|
|
1
|
+
import { ArchiverDataSourceBase, ArchiverDataStoreUpdater, createArchiverDataStores } from '@aztec/archiver';
|
|
2
2
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
3
3
|
import { CheckpointNumber, type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -14,11 +14,10 @@ import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
|
14
14
|
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
15
15
|
*/
|
|
16
16
|
export class TXEArchiver extends ArchiverDataSourceBase {
|
|
17
|
-
private readonly updater = new ArchiverDataStoreUpdater(this.
|
|
17
|
+
private readonly updater = new ArchiverDataStoreUpdater(this.stores);
|
|
18
18
|
|
|
19
19
|
constructor(db: AztecAsyncKVStore) {
|
|
20
|
-
|
|
21
|
-
super(store);
|
|
20
|
+
super(createArchiverDataStores(db, { logsMaxPageSize: 9999 }));
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
public async addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void> {
|
|
@@ -61,7 +60,7 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
61
60
|
}
|
|
62
61
|
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
63
62
|
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
64
|
-
const checkpoint = await this.
|
|
63
|
+
const checkpoint = await this.stores.blocks.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
65
64
|
if (checkpoint.length === 0) {
|
|
66
65
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
67
66
|
}
|
|
@@ -76,15 +75,16 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
76
75
|
proven: tipId,
|
|
77
76
|
finalized: tipId,
|
|
78
77
|
checkpointed: tipId,
|
|
78
|
+
proposedCheckpoint: tipId,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
public
|
|
83
|
-
throw new Error('TXE Archiver does not implement "
|
|
82
|
+
public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
83
|
+
throw new Error('TXE Archiver does not implement "getSyncedL2SlotNumber"');
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
public
|
|
87
|
-
throw new Error('TXE Archiver does not implement "
|
|
86
|
+
public getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
|
|
87
|
+
throw new Error('TXE Archiver does not implement "getSyncedL2EpochNumber"');
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
P2PBlockReceivedCallback,
|
|
7
7
|
P2PCheckpointReceivedCallback,
|
|
8
8
|
P2PConfig,
|
|
9
|
+
P2PDuplicateAttestationCallback,
|
|
9
10
|
P2PDuplicateProposalCallback,
|
|
10
11
|
P2PSyncState,
|
|
11
12
|
PeerId,
|
|
@@ -15,12 +16,12 @@ import type {
|
|
|
15
16
|
StatusMessage,
|
|
16
17
|
} from '@aztec/p2p';
|
|
17
18
|
import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
|
|
18
|
-
import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
19
|
-
import type { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
|
|
20
|
-
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';
|
|
21
22
|
|
|
22
23
|
export class DummyP2P implements P2P {
|
|
23
|
-
public
|
|
24
|
+
public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
|
|
24
25
|
return Promise.resolve();
|
|
25
26
|
}
|
|
26
27
|
|
|
@@ -40,6 +41,10 @@ export class DummyP2P implements P2P {
|
|
|
40
41
|
throw new Error('DummyP2P does not implement "getPeers"');
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
public getGossipMeshPeerCount(_topicType: TopicType): Promise<number> {
|
|
45
|
+
return Promise.resolve(0);
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
public broadcastProposal(_proposal: BlockProposal): Promise<void> {
|
|
44
49
|
throw new Error('DummyP2P does not implement "broadcastProposal"');
|
|
45
50
|
}
|
|
@@ -56,8 +61,12 @@ export class DummyP2P implements P2P {
|
|
|
56
61
|
throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
|
|
57
62
|
}
|
|
58
63
|
|
|
59
|
-
public
|
|
60
|
-
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"');
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
@@ -72,8 +81,8 @@ export class DummyP2P implements P2P {
|
|
|
72
81
|
throw new Error('DummyP2P does not implement "sendTx"');
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
public
|
|
76
|
-
throw new Error('DummyP2P does not implement "
|
|
84
|
+
public handleFailedExecution(_txHashes: TxHash[]): Promise<void> {
|
|
85
|
+
throw new Error('DummyP2P does not implement "handleFailedExecution"');
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
public getTxByHashFromPool(_txHash: TxHash): Promise<Tx | undefined> {
|
|
@@ -98,6 +107,10 @@ export class DummyP2P implements P2P {
|
|
|
98
107
|
throw new Error('DummyP2P does not implement "iteratePendingTxs"');
|
|
99
108
|
}
|
|
100
109
|
|
|
110
|
+
public iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
|
|
111
|
+
throw new Error('DummyP2P does not implement "iterateEligiblePendingTxs"');
|
|
112
|
+
}
|
|
113
|
+
|
|
101
114
|
public getPendingTxCount(): Promise<number> {
|
|
102
115
|
throw new Error('DummyP2P does not implement "getPendingTxCount"');
|
|
103
116
|
}
|
|
@@ -126,6 +139,10 @@ export class DummyP2P implements P2P {
|
|
|
126
139
|
throw new Error('DummyP2P does not implement "isP2PClient"');
|
|
127
140
|
}
|
|
128
141
|
|
|
142
|
+
public getTxProvider(): ITxProvider {
|
|
143
|
+
throw new Error('DummyP2P does not implement "getTxProvider"');
|
|
144
|
+
}
|
|
145
|
+
|
|
129
146
|
public getTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
130
147
|
throw new Error('DummyP2P does not implement "getTxsByHash"');
|
|
131
148
|
}
|
|
@@ -158,14 +175,6 @@ export class DummyP2P implements P2P {
|
|
|
158
175
|
throw new Error('DummyP2P does not implement "sync"');
|
|
159
176
|
}
|
|
160
177
|
|
|
161
|
-
public requestTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
162
|
-
throw new Error('DummyP2P does not implement "requestTxsByHash"');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
public getTxs(_filter: 'all' | 'pending' | 'mined'): Promise<Tx[]> {
|
|
166
|
-
throw new Error('DummyP2P does not implement "getTxs"');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
178
|
public getTxsByHashFromPool(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
170
179
|
throw new Error('DummyP2P does not implement "getTxsByHashFromPool"');
|
|
171
180
|
}
|
|
@@ -174,10 +183,6 @@ export class DummyP2P implements P2P {
|
|
|
174
183
|
throw new Error('DummyP2P does not implement "hasTxsInPool"');
|
|
175
184
|
}
|
|
176
185
|
|
|
177
|
-
public addTxsToPool(_txs: Tx[]): Promise<number> {
|
|
178
|
-
throw new Error('DummyP2P does not implement "addTxs"');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
186
|
public getSyncedLatestBlockNum(): Promise<number> {
|
|
182
187
|
throw new Error('DummyP2P does not implement "getSyncedLatestBlockNum"');
|
|
183
188
|
}
|
|
@@ -190,8 +195,12 @@ export class DummyP2P implements P2P {
|
|
|
190
195
|
throw new Error('DummyP2P does not implement "getSyncedLatestSlot"');
|
|
191
196
|
}
|
|
192
197
|
|
|
193
|
-
|
|
194
|
-
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();
|
|
195
204
|
}
|
|
196
205
|
|
|
197
206
|
addReqRespSubProtocol(
|
|
@@ -211,4 +220,12 @@ export class DummyP2P implements P2P {
|
|
|
211
220
|
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {
|
|
212
221
|
throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
|
|
213
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
|
+
}
|
|
214
231
|
}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
+
import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
|
|
1
2
|
import { BlockNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { times } from '@aztec/foundation/collection';
|
|
2
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { GasFees } from '@aztec/stdlib/gas';
|
|
6
|
+
import { FEE_ORACLE_LAG, GasFees } from '@aztec/stdlib/gas';
|
|
5
7
|
import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
6
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
type CheckpointGlobalVariables,
|
|
10
|
+
type FeeProvider,
|
|
11
|
+
type GlobalVariableBuilder,
|
|
12
|
+
GlobalVariables,
|
|
13
|
+
} from '@aztec/stdlib/tx';
|
|
7
14
|
|
|
8
|
-
|
|
15
|
+
/** Simple FeeProvider for TXE that returns zero fees. */
|
|
16
|
+
export class TXEFeeProvider implements FeeProvider {
|
|
9
17
|
public getCurrentMinFees(): Promise<GasFees> {
|
|
10
18
|
return Promise.resolve(new GasFees(0, 0));
|
|
11
19
|
}
|
|
12
20
|
|
|
21
|
+
public getPredictedMinFees(): Promise<GasFees[]> {
|
|
22
|
+
return Promise.resolve(times(FEE_ORACLE_LAG, () => new GasFees(0, 0)));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
13
27
|
public buildGlobalVariables(
|
|
14
28
|
_blockNumber: BlockNumber,
|
|
15
29
|
_coinbase: EthAddress,
|
|
@@ -23,6 +37,7 @@ export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
|
23
37
|
_coinbase: EthAddress,
|
|
24
38
|
_feeRecipient: AztecAddress,
|
|
25
39
|
_slotNumber: SlotNumber,
|
|
40
|
+
_simulationOverridesPlan?: SimulationOverridesPlan,
|
|
26
41
|
): Promise<CheckpointGlobalVariables> {
|
|
27
42
|
const vars = makeGlobalVariables();
|
|
28
43
|
return Promise.resolve({
|
|
@@ -4,6 +4,7 @@ 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
6
|
import { type AnchorBlockStore, type ContractStore, ContractSyncService, type NoteStore } from '@aztec/pxe/server';
|
|
7
|
+
import { MessageContextService } from '@aztec/pxe/simulator';
|
|
7
8
|
import { L2Block } from '@aztec/stdlib/block';
|
|
8
9
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
9
10
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -12,7 +13,7 @@ import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
|
12
13
|
|
|
13
14
|
import { TXEArchiver } from './archiver.js';
|
|
14
15
|
import { DummyP2P } from './dummy_p2p_client.js';
|
|
15
|
-
import { TXEGlobalVariablesBuilder } from './global_variable_builder.js';
|
|
16
|
+
import { TXEFeeProvider, TXEGlobalVariablesBuilder } from './global_variable_builder.js';
|
|
16
17
|
import { MockEpochCache } from './mock_epoch_cache.js';
|
|
17
18
|
import { TXESynchronizer } from './synchronizer.js';
|
|
18
19
|
|
|
@@ -26,6 +27,7 @@ export class TXEStateMachine {
|
|
|
26
27
|
public archiver: TXEArchiver,
|
|
27
28
|
public anchorBlockStore: AnchorBlockStore,
|
|
28
29
|
public contractSyncService: ContractSyncService,
|
|
30
|
+
public messageContextService: MessageContextService,
|
|
29
31
|
) {}
|
|
30
32
|
|
|
31
33
|
public static async create(
|
|
@@ -50,12 +52,16 @@ export class TXEStateMachine {
|
|
|
50
52
|
undefined,
|
|
51
53
|
undefined,
|
|
52
54
|
undefined,
|
|
55
|
+
undefined,
|
|
56
|
+
undefined,
|
|
53
57
|
VERSION,
|
|
54
58
|
CHAIN_ID,
|
|
55
59
|
new TXEGlobalVariablesBuilder(),
|
|
60
|
+
new TXEFeeProvider(),
|
|
56
61
|
new MockEpochCache(),
|
|
57
62
|
getPackageVersion() ?? '',
|
|
58
63
|
new TestCircuitVerifier(),
|
|
64
|
+
new TestCircuitVerifier(),
|
|
59
65
|
undefined,
|
|
60
66
|
log,
|
|
61
67
|
);
|
|
@@ -67,7 +73,9 @@ export class TXEStateMachine {
|
|
|
67
73
|
createLogger('txe:contract_sync'),
|
|
68
74
|
);
|
|
69
75
|
|
|
70
|
-
|
|
76
|
+
const messageContextService = new MessageContextService(node);
|
|
77
|
+
|
|
78
|
+
return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService, messageContextService);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
public async handleL2Block(block: L2Block) {
|
|
@@ -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,27 @@ 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
|
+
|
|
62
|
+
pipeliningOffset(): number {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
37
66
|
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
|
|
38
67
|
return '0x00';
|
|
39
68
|
}
|
|
@@ -49,6 +78,13 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
49
78
|
};
|
|
50
79
|
}
|
|
51
80
|
|
|
81
|
+
getTargetAndNextSlot(): { targetSlot: SlotNumber; nextSlot: SlotNumber } {
|
|
82
|
+
return {
|
|
83
|
+
targetSlot: SlotNumber(0),
|
|
84
|
+
nextSlot: SlotNumber(0),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
52
88
|
getProposerAttesterAddressInSlot(_slot: SlotNumber): Promise<EthAddress | undefined> {
|
|
53
89
|
return Promise.resolve(undefined);
|
|
54
90
|
}
|
|
@@ -64,4 +100,16 @@ export class MockEpochCache implements EpochCacheInterface {
|
|
|
64
100
|
filterInCommittee(_slot: SlotTag, _validators: EthAddress[]): Promise<EthAddress[]> {
|
|
65
101
|
return Promise.resolve([]);
|
|
66
102
|
}
|
|
103
|
+
|
|
104
|
+
isEscapeHatchOpen(_epoch: EpochNumber): Promise<boolean> {
|
|
105
|
+
return Promise.resolve(false);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
isEscapeHatchOpenAtSlot(_slot: SlotTag): Promise<boolean> {
|
|
109
|
+
return Promise.resolve(false);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
getL1Constants(): L1RollupConstants {
|
|
113
|
+
return EmptyL1RollupConstants;
|
|
114
|
+
}
|
|
67
115
|
}
|
|
@@ -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
|
|