@aztec/txe 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0
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/AuthRegistry-QVGDDH5X.js +3 -0
- package/dest/AuthRegistry-QVGDDH5X.js.map +7 -0
- package/dest/ContractClassRegistry-VWR3F42P.js +3 -0
- package/dest/ContractClassRegistry-VWR3F42P.js.map +7 -0
- package/dest/ContractInstanceRegistry-FHIWE33X.js +3 -0
- package/dest/ContractInstanceRegistry-FHIWE33X.js.map +7 -0
- package/dest/FeeJuice-SAOWVGG7.js +3 -0
- package/dest/FeeJuice-SAOWVGG7.js.map +7 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js +3 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js.map +7 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js +3 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js.map +7 -0
- package/dest/SchnorrAccount-NME3E45O.js +3 -0
- package/dest/SchnorrAccount-NME3E45O.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-WTGXU6SW.js +3 -0
- package/dest/SchnorrInitializerlessAccount-WTGXU6SW.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.d.ts +2 -0
- package/dest/bin/check_txe_oracle_version.d.ts.map +1 -0
- package/dest/bin/check_txe_oracle_version.js +53 -0
- package/dest/bin/index.js +3 -30
- package/dest/bin/index.js.map +7 -0
- package/dest/bin/oracle_test_server.d.ts +3 -0
- package/dest/bin/oracle_test_server.d.ts.map +1 -0
- package/dest/bin/oracle_test_server.js +41 -0
- package/dest/chunk-32UHX7YY.js +3 -0
- package/dest/chunk-32UHX7YY.js.map +7 -0
- package/dest/chunk-GSUKUCKV.js +260 -0
- package/dest/chunk-GSUKUCKV.js.map +7 -0
- package/dest/chunk-UP4KKUVA.js +304 -0
- package/dest/chunk-UP4KKUVA.js.map +7 -0
- package/dest/constants.d.ts +7 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +10 -0
- package/dest/dispatcher_pool.d.ts +67 -0
- package/dest/dispatcher_pool.d.ts.map +1 -0
- package/dest/dispatcher_pool.js +286 -0
- package/dest/index.d.ts +51 -7
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +75 -158
- package/dest/metafile.json +38759 -0
- package/dest/msgpackr_fr_extension.d.ts +2 -0
- package/dest/msgpackr_fr_extension.d.ts.map +1 -0
- package/dest/msgpackr_fr_extension.js +21 -0
- package/dest/oracle/interfaces.d.ts +71 -30
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
- package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
- package/dest/oracle/tagging_secret_strategy.js +12 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts +16 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
- package/dest/oracle/test-resolver/default_fixtures.js +200 -0
- package/dest/oracle/test-resolver/index.d.ts +9 -0
- package/dest/oracle/test-resolver/index.d.ts.map +1 -0
- package/dest/oracle/test-resolver/index.js +32 -0
- package/dest/oracle/test-resolver/resolver.d.ts +48 -0
- package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
- package/dest/oracle/test-resolver/resolver.js +181 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +40 -16
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +69 -23
- package/dest/oracle/txe_oracle_registry.d.ts +172 -0
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_registry.js +767 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +79 -30
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +653 -285
- package/dest/oracle/txe_oracle_version.d.ts +17 -0
- package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_version.js +14 -0
- package/dest/oracle/txe_private_execution_oracle.d.ts +17 -0
- package/dest/oracle/txe_private_execution_oracle.d.ts.map +1 -0
- package/dest/oracle/txe_private_execution_oracle.js +15 -0
- package/dest/rpc_server.d.ts +14 -0
- package/dest/rpc_server.d.ts.map +1 -0
- package/dest/rpc_server.js +78 -0
- package/dest/rpc_translator.d.ts +115 -216
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +901 -560
- package/dest/server.bundle.js +3 -0
- package/dest/server.bundle.js.map +7 -0
- package/dest/state_machine/archiver.d.ts +23 -58
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +76 -112
- package/dest/state_machine/dummy_p2p_client.d.ts +31 -17
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +63 -25
- package/dest/state_machine/global_variable_builder.d.ts +10 -5
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +20 -5
- package/dest/state_machine/index.d.ts +14 -8
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +84 -27
- package/dest/state_machine/mock_epoch_cache.d.ts +24 -8
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +43 -9
- package/dest/state_machine/synchronizer.d.ts +14 -6
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +23 -10
- package/dest/txe_session.d.ts +102 -20
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +442 -75
- package/dest/utils/block_creation.d.ts +20 -6
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +40 -6
- package/dest/utils/encoding.d.ts +192 -0
- package/dest/utils/encoding.d.ts.map +1 -0
- package/dest/{util → utils}/encoding.js +8 -3
- package/dest/{util → utils}/expected_failure_error.d.ts +1 -1
- package/dest/utils/expected_failure_error.d.ts.map +1 -0
- package/dest/utils/tx_effect_creation.d.ts +2 -3
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +3 -7
- package/dest/utils/txe_account_store.d.ts +10 -0
- package/dest/utils/txe_account_store.d.ts.map +1 -0
- package/dest/{util/txe_account_data_provider.js → utils/txe_account_store.js} +1 -1
- package/dest/utils/txe_artifact_resolver.d.ts +37 -0
- package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
- package/dest/utils/txe_artifact_resolver.js +161 -0
- package/dest/utils/txe_public_contract_data_source.d.ts +20 -0
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -0
- package/dest/utils/txe_public_contract_data_source.js +51 -0
- package/dest/worker.bundle.js +3 -0
- package/dest/worker.bundle.js.map +7 -0
- package/dest/worker.d.ts +2 -0
- package/dest/worker.d.ts.map +1 -0
- package/dest/worker.js +92 -0
- package/package.json +39 -22
- package/src/bin/check_txe_oracle_version.ts +67 -0
- package/src/bin/index.ts +11 -2
- package/src/bin/oracle_test_server.ts +51 -0
- package/src/constants.ts +13 -0
- package/src/dispatcher_pool.ts +317 -0
- package/src/index.ts +113 -201
- package/src/msgpackr_fr_extension.ts +23 -0
- package/src/oracle/interfaces.ts +77 -35
- package/src/oracle/tagging_secret_strategy.ts +25 -0
- package/src/oracle/test-resolver/default_fixtures.ts +271 -0
- package/src/oracle/test-resolver/index.ts +44 -0
- package/src/oracle/test-resolver/resolver.ts +245 -0
- package/src/oracle/txe_oracle_public_context.ts +82 -27
- package/src/oracle/txe_oracle_registry.ts +556 -0
- package/src/oracle/txe_oracle_top_level_context.ts +555 -189
- package/src/oracle/txe_oracle_version.ts +17 -0
- package/src/oracle/txe_private_execution_oracle.ts +30 -0
- package/src/rpc_server.ts +87 -0
- package/src/rpc_translator.ts +1115 -923
- package/src/state_machine/archiver.ts +81 -132
- package/src/state_machine/dummy_p2p_client.ts +96 -38
- package/src/state_machine/global_variable_builder.ts +28 -10
- package/src/state_machine/index.ts +118 -44
- package/src/state_machine/mock_epoch_cache.ts +53 -14
- package/src/state_machine/synchronizer.ts +32 -12
- package/src/txe_session.ts +727 -123
- package/src/utils/block_creation.ts +50 -16
- package/src/{util → utils}/encoding.ts +9 -3
- package/src/utils/tx_effect_creation.ts +3 -13
- package/src/{util/txe_account_data_provider.ts → utils/txe_account_store.ts} +1 -1
- package/src/utils/txe_artifact_resolver.ts +217 -0
- package/src/utils/txe_public_contract_data_source.ts +60 -0
- package/src/worker.ts +98 -0
- package/dest/util/encoding.d.ts +0 -121
- package/dest/util/encoding.d.ts.map +0 -1
- package/dest/util/expected_failure_error.d.ts.map +0 -1
- package/dest/util/txe_account_data_provider.d.ts +0 -10
- package/dest/util/txe_account_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.d.ts +0 -12
- package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.js +0 -22
- package/dest/util/txe_public_contract_data_source.d.ts +0 -21
- package/dest/util/txe_public_contract_data_source.d.ts.map +0 -1
- package/dest/util/txe_public_contract_data_source.js +0 -67
- package/src/util/txe_contract_data_provider.ts +0 -36
- package/src/util/txe_public_contract_data_source.ts +0 -86
- /package/dest/{util → utils}/expected_failure_error.js +0 -0
- /package/src/{util → utils}/expected_failure_error.ts +0 -0
|
@@ -1,169 +1,118 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchiverDataSourceBase, ArchiverDataStoreUpdater, createArchiverDataStores } 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
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
5
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
6
6
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
import {
|
|
8
|
+
type CheckpointId,
|
|
9
|
+
GENESIS_BLOCK_HEADER_HASH,
|
|
10
|
+
type L2BlockId,
|
|
11
|
+
type L2TipId,
|
|
12
|
+
type L2Tips,
|
|
13
|
+
type ValidateCheckpointResult,
|
|
14
|
+
} from '@aztec/stdlib/block';
|
|
15
|
+
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
16
|
+
import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
17
|
+
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
18
|
+
|
|
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 ArchiverDataSourceBase {
|
|
25
|
+
private readonly updater = new ArchiverDataStoreUpdater(this.stores);
|
|
26
|
+
|
|
19
27
|
constructor(db: AztecAsyncKVStore) {
|
|
20
|
-
super(
|
|
28
|
+
super(
|
|
29
|
+
createArchiverDataStores(db, GENESIS_BLOCK_HEADER_HASH),
|
|
30
|
+
undefined,
|
|
31
|
+
BlockHeader.empty(),
|
|
32
|
+
GENESIS_BLOCK_HEADER_HASH,
|
|
33
|
+
new Fr(GENESIS_ARCHIVE_ROOT),
|
|
34
|
+
);
|
|
21
35
|
}
|
|
22
36
|
|
|
23
|
-
public
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.store.addBlocks(blocks),
|
|
27
|
-
]);
|
|
37
|
+
public async addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void> {
|
|
38
|
+
await this.updater.addCheckpoints(checkpoints, result);
|
|
39
|
+
}
|
|
28
40
|
|
|
29
|
-
|
|
41
|
+
public getRollupAddress(): Promise<EthAddress> {
|
|
42
|
+
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
30
43
|
}
|
|
31
44
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
35
|
-
*/
|
|
36
|
-
public getBlockNumber(): Promise<BlockNumber> {
|
|
37
|
-
return this.store.getSynchedL2BlockNumber();
|
|
45
|
+
public getRegistryAddress(): Promise<EthAddress> {
|
|
46
|
+
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
38
47
|
}
|
|
39
48
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
public getProvenBlockNumber(): Promise<BlockNumber> {
|
|
45
|
-
return this.store.getSynchedL2BlockNumber();
|
|
49
|
+
public getL1Constants(): Promise<L1RollupConstants> {
|
|
50
|
+
// The TXE has no L1, so it serves the empty constants (epochDuration=1) used throughout the TXE state machine
|
|
51
|
+
// (see mock_epoch_cache). The node calls this when assembling a mined tx receipt to derive the epoch number.
|
|
52
|
+
return Promise.resolve(EmptyL1RollupConstants);
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* @param number - The block number to return (inclusive).
|
|
51
|
-
* @returns The requested L2 block.
|
|
52
|
-
*/
|
|
53
|
-
public override async getPublishedBlock(number: number): Promise<PublishedL2Block | undefined> {
|
|
54
|
-
// If the number provided is -ve, then return the latest block.
|
|
55
|
-
if (number < 0) {
|
|
56
|
-
number = await this.store.getSynchedL2BlockNumber();
|
|
57
|
-
}
|
|
58
|
-
if (number == 0) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
const blocks = await this.store.getPublishedBlocks(BlockNumber(number), 1);
|
|
62
|
-
return blocks.length === 0 ? undefined : blocks[0];
|
|
55
|
+
public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
|
|
56
|
+
return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
* @param number - The block number to return (inclusive).
|
|
68
|
-
* @returns The requested L2 block.
|
|
69
|
-
*/
|
|
70
|
-
public getBlock(number: number | 'latest'): Promise<L2Block | undefined> {
|
|
71
|
-
return this.getPublishedBlock(number != 'latest' ? number : -1).then(block => block?.block);
|
|
59
|
+
public getL1Timestamp(): Promise<bigint | undefined> {
|
|
60
|
+
throw new Error('TXE Archiver does not implement "getL1Timestamp"');
|
|
72
61
|
}
|
|
73
62
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (number === 'latest') {
|
|
81
|
-
number = await this.store.getSynchedL2BlockNumber();
|
|
63
|
+
public async getL2Tips(): Promise<L2Tips> {
|
|
64
|
+
// In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
|
|
65
|
+
// and 'finalized' to the latest block.
|
|
66
|
+
const latestBlockNumber = await this.stores.blocks.getLatestL2BlockNumber();
|
|
67
|
+
if (latestBlockNumber === 0) {
|
|
68
|
+
throw new Error('L2Tips requested from TXE Archiver but no block found');
|
|
82
69
|
}
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
const latestBlockData = await this.stores.blocks.getBlockData({ number: latestBlockNumber });
|
|
71
|
+
if (!latestBlockData) {
|
|
72
|
+
throw new Error('L2Tips requested from TXE Archiver but no block header found');
|
|
85
73
|
}
|
|
86
|
-
const headers = await this.store.getBlockHeaders(BlockNumber(number), 1);
|
|
87
|
-
return headers.length === 0 ? undefined : headers[0];
|
|
88
|
-
}
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]> {
|
|
95
|
-
throw new Error('TXE Archiver does not implement "getPublishedCheckpoints"');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
public getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined> {
|
|
99
|
-
throw new Error('TXE Archiver does not implement "getCheckpointByArchive"');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public getL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
103
|
-
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
public getL2EpochNumber(): Promise<EpochNumber> {
|
|
107
|
-
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
108
|
-
}
|
|
75
|
+
const number = latestBlockData.header.globalVariables.blockNumber;
|
|
76
|
+
const hash = latestBlockData.blockHash.toString();
|
|
109
77
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
78
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
79
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
80
|
+
const checkpoint = await this.stores.blocks.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
81
|
+
if (checkpoint.length === 0) {
|
|
82
|
+
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
83
|
+
}
|
|
84
|
+
const blockId: L2BlockId = { number, hash };
|
|
85
|
+
const checkpointId: CheckpointId = {
|
|
86
|
+
number: checkpoint[0].checkpointNumber,
|
|
87
|
+
hash: checkpoint[0].header.hash().toString(),
|
|
88
|
+
};
|
|
89
|
+
const tipId: L2TipId = { block: blockId, checkpoint: checkpointId };
|
|
90
|
+
return {
|
|
91
|
+
proposed: blockId,
|
|
92
|
+
proven: tipId,
|
|
93
|
+
finalized: tipId,
|
|
94
|
+
checkpointed: tipId,
|
|
95
|
+
};
|
|
116
96
|
}
|
|
117
97
|
|
|
118
|
-
public
|
|
119
|
-
throw new Error('TXE Archiver does not implement "
|
|
98
|
+
public getSyncedL2SlotNumber(): Promise<SlotNumber | undefined> {
|
|
99
|
+
throw new Error('TXE Archiver does not implement "getSyncedL2SlotNumber"');
|
|
120
100
|
}
|
|
121
101
|
|
|
122
|
-
public
|
|
123
|
-
throw new Error('TXE Archiver does not implement "
|
|
102
|
+
public getSyncedL2EpochNumber(): Promise<EpochNumber | undefined> {
|
|
103
|
+
throw new Error('TXE Archiver does not implement "getSyncedL2EpochNumber"');
|
|
124
104
|
}
|
|
125
105
|
|
|
126
106
|
public isEpochComplete(_epochNumber: EpochNumber): Promise<boolean> {
|
|
127
107
|
throw new Error('TXE Archiver does not implement "isEpochComplete"');
|
|
128
108
|
}
|
|
129
109
|
|
|
130
|
-
public getL2Tips(): Promise<L2Tips> {
|
|
131
|
-
throw new Error('TXE Archiver does not implement "getL2Tips"');
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
public getL1Constants(): Promise<L1RollupConstants> {
|
|
135
|
-
throw new Error('TXE Archiver does not implement "getL2Constants"');
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
public getGenesisValues(): Promise<{ genesisArchiveRoot: Fr }> {
|
|
139
|
-
return Promise.resolve({ genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT) });
|
|
140
|
-
}
|
|
141
|
-
|
|
142
110
|
public syncImmediate(): Promise<void> {
|
|
143
111
|
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
144
112
|
}
|
|
145
113
|
|
|
146
|
-
public
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
public getRollupAddress(): Promise<EthAddress> {
|
|
151
|
-
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
public getRegistryAddress(): Promise<EthAddress> {
|
|
155
|
-
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
public getL1Timestamp(): Promise<bigint> {
|
|
159
|
-
throw new Error('TXE Archiver does not implement "getL1Timestamp"');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
public isPendingChainInvalid(): Promise<boolean> {
|
|
163
|
-
return Promise.resolve(false);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
public override getPendingChainValidationStatus(): Promise<ValidateBlockResult> {
|
|
167
|
-
return Promise.resolve({ valid: true });
|
|
114
|
+
public getL2ToL1MembershipWitness(): Promise<undefined> {
|
|
115
|
+
// TXE doesn't drive the L2-to-L1 message flow through this archiver.
|
|
116
|
+
return Promise.resolve(undefined);
|
|
168
117
|
}
|
|
169
118
|
}
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { CheckpointProposalHash, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type {
|
|
3
3
|
AuthRequest,
|
|
4
4
|
ENR,
|
|
5
5
|
P2P,
|
|
6
6
|
P2PBlockReceivedCallback,
|
|
7
|
+
P2PCheckpointAttestationCallback,
|
|
8
|
+
P2PCheckpointReceivedCallback,
|
|
7
9
|
P2PConfig,
|
|
10
|
+
P2PDuplicateAttestationCallback,
|
|
11
|
+
P2PDuplicateProposalCallback,
|
|
12
|
+
P2POversizedProposalCallback,
|
|
8
13
|
P2PSyncState,
|
|
9
14
|
PeerId,
|
|
10
15
|
ReqRespSubProtocol,
|
|
11
16
|
ReqRespSubProtocolHandler,
|
|
12
|
-
ReqRespSubProtocolValidators,
|
|
13
17
|
StatusMessage,
|
|
14
18
|
} from '@aztec/p2p';
|
|
15
19
|
import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
|
|
16
|
-
import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
17
|
-
import type {
|
|
18
|
-
|
|
20
|
+
import type { ITxProvider, PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
21
|
+
import type {
|
|
22
|
+
BlockProposal,
|
|
23
|
+
CheckpointAttestation,
|
|
24
|
+
CheckpointProposal,
|
|
25
|
+
CheckpointProposalCore,
|
|
26
|
+
TopicType,
|
|
27
|
+
} from '@aztec/stdlib/p2p';
|
|
28
|
+
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
19
29
|
|
|
20
30
|
export class DummyP2P implements P2P {
|
|
21
|
-
public
|
|
22
|
-
return Promise.resolve();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public validate(_txs: Tx[]): Promise<void> {
|
|
31
|
+
public validateTxsReceivedInBlockProposal(_txs: Tx[]): Promise<void> {
|
|
26
32
|
return Promise.resolve();
|
|
27
33
|
}
|
|
28
34
|
|
|
@@ -42,14 +48,34 @@ export class DummyP2P implements P2P {
|
|
|
42
48
|
throw new Error('DummyP2P does not implement "getPeers"');
|
|
43
49
|
}
|
|
44
50
|
|
|
51
|
+
public getGossipMeshPeerCount(_topicType: TopicType): Promise<number> {
|
|
52
|
+
return Promise.resolve(0);
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
public broadcastProposal(_proposal: BlockProposal): Promise<void> {
|
|
46
56
|
throw new Error('DummyP2P does not implement "broadcastProposal"');
|
|
47
57
|
}
|
|
48
58
|
|
|
59
|
+
public broadcastCheckpointProposal(_proposal: CheckpointProposal): Promise<void> {
|
|
60
|
+
throw new Error('DummyP2P does not implement "broadcastCheckpointProposal"');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public broadcastCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
|
|
64
|
+
throw new Error('DummyP2P does not implement "broadcastCheckpointAttestations"');
|
|
65
|
+
}
|
|
66
|
+
|
|
49
67
|
public registerBlockProposalHandler(_handler: P2PBlockReceivedCallback): void {
|
|
50
68
|
throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
|
|
51
69
|
}
|
|
52
70
|
|
|
71
|
+
public registerValidatorCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
|
|
72
|
+
throw new Error('DummyP2P does not implement "registerValidatorCheckpointProposalHandler"');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public registerAllNodesCheckpointProposalHandler(_handler: P2PCheckpointReceivedCallback): void {
|
|
76
|
+
throw new Error('DummyP2P does not implement "registerAllNodesCheckpointProposalHandler"');
|
|
77
|
+
}
|
|
78
|
+
|
|
53
79
|
public requestTxs(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
54
80
|
throw new Error('DummyP2P does not implement "requestTxs"');
|
|
55
81
|
}
|
|
@@ -62,8 +88,8 @@ export class DummyP2P implements P2P {
|
|
|
62
88
|
throw new Error('DummyP2P does not implement "sendTx"');
|
|
63
89
|
}
|
|
64
90
|
|
|
65
|
-
public
|
|
66
|
-
throw new Error('DummyP2P does not implement "
|
|
91
|
+
public handleFailedExecution(_txHashes: TxHash[]): Promise<void> {
|
|
92
|
+
throw new Error('DummyP2P does not implement "handleFailedExecution"');
|
|
67
93
|
}
|
|
68
94
|
|
|
69
95
|
public getTxByHashFromPool(_txHash: TxHash): Promise<Tx | undefined> {
|
|
@@ -79,17 +105,27 @@ export class DummyP2P implements P2P {
|
|
|
79
105
|
}
|
|
80
106
|
|
|
81
107
|
public getTxStatus(_txHash: TxHash): Promise<'pending' | 'mined' | undefined> {
|
|
82
|
-
|
|
108
|
+
// In TXE there is no concept of transactions but we need to implement this because of tagging. We return 'mined'
|
|
109
|
+
// tx status for any tx hash.
|
|
110
|
+
return Promise.resolve('mined');
|
|
83
111
|
}
|
|
84
112
|
|
|
85
113
|
public iteratePendingTxs(): AsyncIterableIterator<Tx> {
|
|
86
114
|
throw new Error('DummyP2P does not implement "iteratePendingTxs"');
|
|
87
115
|
}
|
|
88
116
|
|
|
117
|
+
public iterateEligiblePendingTxs(): AsyncIterableIterator<Tx> {
|
|
118
|
+
throw new Error('DummyP2P does not implement "iterateEligiblePendingTxs"');
|
|
119
|
+
}
|
|
120
|
+
|
|
89
121
|
public getPendingTxCount(): Promise<number> {
|
|
90
122
|
throw new Error('DummyP2P does not implement "getPendingTxCount"');
|
|
91
123
|
}
|
|
92
124
|
|
|
125
|
+
public hasEligiblePendingTxs(_minCount: number): Promise<boolean> {
|
|
126
|
+
throw new Error('DummyP2P does not implement "hasEligiblePendingTxs"');
|
|
127
|
+
}
|
|
128
|
+
|
|
93
129
|
public start(): Promise<void> {
|
|
94
130
|
throw new Error('DummyP2P does not implement "start"');
|
|
95
131
|
}
|
|
@@ -114,20 +150,34 @@ export class DummyP2P implements P2P {
|
|
|
114
150
|
throw new Error('DummyP2P does not implement "isP2PClient"');
|
|
115
151
|
}
|
|
116
152
|
|
|
153
|
+
public getTxProvider(): ITxProvider {
|
|
154
|
+
throw new Error('DummyP2P does not implement "getTxProvider"');
|
|
155
|
+
}
|
|
156
|
+
|
|
117
157
|
public getTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
118
158
|
throw new Error('DummyP2P does not implement "getTxsByHash"');
|
|
119
159
|
}
|
|
120
160
|
|
|
121
|
-
public
|
|
122
|
-
|
|
161
|
+
public getCheckpointAttestationsForSlot(
|
|
162
|
+
_slot: SlotNumber,
|
|
163
|
+
_proposalPayloadHash?: CheckpointProposalHash,
|
|
164
|
+
): Promise<CheckpointAttestation[]> {
|
|
165
|
+
throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
|
|
123
166
|
}
|
|
124
167
|
|
|
125
|
-
public
|
|
126
|
-
|
|
168
|
+
public addOwnCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
|
|
169
|
+
throw new Error('DummyP2P does not implement "addOwnCheckpointAttestations"');
|
|
127
170
|
}
|
|
128
171
|
|
|
129
|
-
public
|
|
130
|
-
|
|
172
|
+
public getProposalsForSlot(_slot: SlotNumber): Promise<{
|
|
173
|
+
blockProposals: BlockProposal[];
|
|
174
|
+
checkpointProposals: CheckpointProposalCore[];
|
|
175
|
+
}> {
|
|
176
|
+
return Promise.resolve({ blockProposals: [], checkpointProposals: [] });
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
public hasCheckpointProposalForSlot(_slot: SlotNumber): Promise<boolean> {
|
|
180
|
+
return Promise.resolve(false);
|
|
131
181
|
}
|
|
132
182
|
|
|
133
183
|
public getL2BlockHash(_number: number): Promise<string | undefined> {
|
|
@@ -150,14 +200,6 @@ export class DummyP2P implements P2P {
|
|
|
150
200
|
throw new Error('DummyP2P does not implement "sync"');
|
|
151
201
|
}
|
|
152
202
|
|
|
153
|
-
public requestTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
154
|
-
throw new Error('DummyP2P does not implement "requestTxsByHash"');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
public getTxs(_filter: 'all' | 'pending' | 'mined'): Promise<Tx[]> {
|
|
158
|
-
throw new Error('DummyP2P does not implement "getTxs"');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
203
|
public getTxsByHashFromPool(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
162
204
|
throw new Error('DummyP2P does not implement "getTxsByHashFromPool"');
|
|
163
205
|
}
|
|
@@ -166,10 +208,6 @@ export class DummyP2P implements P2P {
|
|
|
166
208
|
throw new Error('DummyP2P does not implement "hasTxsInPool"');
|
|
167
209
|
}
|
|
168
210
|
|
|
169
|
-
public addTxsToPool(_txs: Tx[]): Promise<number> {
|
|
170
|
-
throw new Error('DummyP2P does not implement "addTxs"');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
211
|
public getSyncedLatestBlockNum(): Promise<number> {
|
|
174
212
|
throw new Error('DummyP2P does not implement "getSyncedLatestBlockNum"');
|
|
175
213
|
}
|
|
@@ -182,15 +220,15 @@ export class DummyP2P implements P2P {
|
|
|
182
220
|
throw new Error('DummyP2P does not implement "getSyncedLatestSlot"');
|
|
183
221
|
}
|
|
184
222
|
|
|
185
|
-
|
|
186
|
-
throw new Error('DummyP2P does not implement "
|
|
223
|
+
protectTxs(_txHashes: TxHash[], _blockHeader: BlockHeader): Promise<TxHash[]> {
|
|
224
|
+
throw new Error('DummyP2P does not implement "protectTxs".');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
prepareForSlot(_slotNumber: SlotNumber): Promise<void> {
|
|
228
|
+
return Promise.resolve();
|
|
187
229
|
}
|
|
188
230
|
|
|
189
|
-
addReqRespSubProtocol(
|
|
190
|
-
_subProtocol: ReqRespSubProtocol,
|
|
191
|
-
_handler: ReqRespSubProtocolHandler,
|
|
192
|
-
_validator?: ReqRespSubProtocolValidators[ReqRespSubProtocol],
|
|
193
|
-
): Promise<void> {
|
|
231
|
+
addReqRespSubProtocol(_subProtocol: ReqRespSubProtocol, _handler: ReqRespSubProtocolHandler): Promise<void> {
|
|
194
232
|
throw new Error('DummyP2P does not implement "addReqRespSubProtocol".');
|
|
195
233
|
}
|
|
196
234
|
handleAuthRequestFromPeer(_authRequest: AuthRequest, _peerId: PeerId): Promise<StatusMessage> {
|
|
@@ -199,4 +237,24 @@ export class DummyP2P implements P2P {
|
|
|
199
237
|
|
|
200
238
|
//This is no-op
|
|
201
239
|
public registerThisValidatorAddresses(_address: EthAddress[]): void {}
|
|
240
|
+
|
|
241
|
+
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {
|
|
242
|
+
throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
public registerOversizedProposalCallback(_callback: P2POversizedProposalCallback): void {
|
|
246
|
+
throw new Error('DummyP2P does not implement "registerOversizedProposalCallback"');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
|
|
250
|
+
throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
public registerCheckpointAttestationCallback(_callback: P2PCheckpointAttestationCallback): void {
|
|
254
|
+
throw new Error('DummyP2P does not implement "registerCheckpointAttestationCallback"');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public hasBlockProposalsForSlot(_slot: SlotNumber): Promise<boolean> {
|
|
258
|
+
throw new Error('DummyP2P does not implement "hasBlockProposalsForSlot"');
|
|
259
|
+
}
|
|
202
260
|
}
|
|
@@ -1,21 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SimulationOverridesPlan } from '@aztec/ethereum/contracts';
|
|
2
|
+
import 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 type { CheckpointGlobalVariables, FeeProvider, GlobalVariableBuilder } from '@aztec/stdlib/tx';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
/** Simple FeeProvider for TXE that returns zero fees. */
|
|
11
|
+
export class TXEFeeProvider implements FeeProvider {
|
|
12
|
+
public getCurrentMinFees(): Promise<GasFees> {
|
|
10
13
|
return Promise.resolve(new GasFees(0, 0));
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
public
|
|
14
|
-
|
|
16
|
+
public getPredictedMinFees(): Promise<GasFees[]> {
|
|
17
|
+
return Promise.resolve(times(FEE_ORACLE_LAG, () => new GasFees(0, 0)));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
22
|
+
public buildCheckpointGlobalVariables(
|
|
15
23
|
_coinbase: EthAddress,
|
|
16
24
|
_feeRecipient: AztecAddress,
|
|
17
|
-
_slotNumber
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
_slotNumber: SlotNumber,
|
|
26
|
+
_simulationOverridesPlan?: SimulationOverridesPlan,
|
|
27
|
+
): Promise<CheckpointGlobalVariables> {
|
|
28
|
+
const vars = makeGlobalVariables();
|
|
29
|
+
return Promise.resolve({
|
|
30
|
+
chainId: vars.chainId,
|
|
31
|
+
version: vars.version,
|
|
32
|
+
slotNumber: vars.slotNumber,
|
|
33
|
+
timestamp: vars.timestamp,
|
|
34
|
+
coinbase: vars.coinbase,
|
|
35
|
+
feeRecipient: vars.feeRecipient,
|
|
36
|
+
gasFees: vars.gasFees,
|
|
37
|
+
});
|
|
20
38
|
}
|
|
21
39
|
}
|