@aztec/txe 0.0.1-commit.b655e406 → 0.0.1-commit.b6e433891
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/bin/index.d.ts +1 -1
- package/dest/constants.d.ts +3 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +91 -56
- package/dest/oracle/interfaces.d.ts +33 -29
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +16 -16
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +20 -22
- package/dest/oracle/txe_oracle_top_level_context.d.ts +37 -27
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +228 -106
- package/dest/rpc_translator.d.ts +98 -78
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +367 -171
- package/dest/state_machine/archiver.d.ts +21 -51
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +66 -99
- package/dest/state_machine/dummy_p2p_client.d.ts +21 -14
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +42 -22
- package/dest/state_machine/global_variable_builder.d.ts +6 -4
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +13 -1
- package/dest/state_machine/index.d.ts +9 -7
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +44 -23
- package/dest/state_machine/mock_epoch_cache.d.ts +30 -12
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +53 -15
- package/dest/state_machine/synchronizer.d.ts +6 -5
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +8 -7
- package/dest/txe_session.d.ts +27 -15
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +173 -56
- package/dest/util/encoding.d.ts +615 -16
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/encoding.js +1 -1
- package/dest/util/expected_failure_error.d.ts +1 -1
- package/dest/util/expected_failure_error.d.ts.map +1 -1
- package/dest/util/txe_account_store.d.ts +10 -0
- package/dest/util/txe_account_store.d.ts.map +1 -0
- package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
- package/dest/util/txe_public_contract_data_source.d.ts +8 -8
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +12 -29
- package/dest/utils/block_creation.d.ts +21 -6
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +38 -4
- package/dest/utils/tx_effect_creation.d.ts +3 -3
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +4 -7
- package/package.json +18 -17
- package/src/constants.ts +3 -0
- package/src/index.ts +103 -63
- package/src/oracle/interfaces.ts +36 -32
- package/src/oracle/txe_oracle_public_context.ts +21 -28
- package/src/oracle/txe_oracle_top_level_context.ts +272 -145
- package/src/rpc_translator.ts +422 -194
- package/src/state_machine/archiver.ts +63 -117
- package/src/state_machine/dummy_p2p_client.ts +59 -29
- package/src/state_machine/global_variable_builder.ts +22 -4
- package/src/state_machine/index.ts +64 -21
- package/src/state_machine/mock_epoch_cache.ts +67 -23
- package/src/state_machine/synchronizer.ts +9 -8
- package/src/txe_session.ts +239 -105
- package/src/util/encoding.ts +1 -1
- package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
- package/src/util/txe_public_contract_data_source.ts +20 -45
- package/src/utils/block_creation.ts +49 -14
- package/src/utils/tx_effect_creation.ts +5 -12
- 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/src/util/txe_contract_data_provider.ts +0 -36
|
@@ -1,56 +1,88 @@
|
|
|
1
1
|
import type { EpochAndSlot, EpochCacheInterface, EpochCommitteeInfo, SlotTag } from '@aztec/epoch-cache';
|
|
2
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
+
import { EmptyL1RollupConstants, type L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Mock implementation of the EpochCacheInterface used to satisfy dependencies of AztecNodeService.
|
|
6
8
|
* Since in TXE we don't validate transactions, mock suffices here.
|
|
7
9
|
*/
|
|
8
10
|
export class MockEpochCache implements EpochCacheInterface {
|
|
9
|
-
getCommittee(): Promise<EpochCommitteeInfo> {
|
|
11
|
+
getCommittee(_slot: SlotTag = 'now'): Promise<EpochCommitteeInfo> {
|
|
10
12
|
return Promise.resolve({
|
|
11
13
|
committee: undefined,
|
|
12
14
|
seed: 0n,
|
|
13
|
-
epoch:
|
|
15
|
+
epoch: EpochNumber.ZERO,
|
|
16
|
+
isEscapeHatchOpen: false,
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
|
|
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
|
+
|
|
36
|
+
getEpochAndSlotNow(): EpochAndSlot & { nowMs: bigint } {
|
|
18
37
|
return {
|
|
19
|
-
epoch:
|
|
20
|
-
slot:
|
|
38
|
+
epoch: EpochNumber.ZERO,
|
|
39
|
+
slot: SlotNumber(0),
|
|
21
40
|
ts: 0n,
|
|
41
|
+
nowMs: 0n,
|
|
22
42
|
};
|
|
23
43
|
}
|
|
24
44
|
|
|
25
|
-
getEpochAndSlotInNextL1Slot(): EpochAndSlot & {
|
|
45
|
+
getEpochAndSlotInNextL1Slot(): EpochAndSlot & { nowSeconds: bigint } {
|
|
26
46
|
return {
|
|
27
|
-
epoch:
|
|
28
|
-
slot:
|
|
47
|
+
epoch: EpochNumber.ZERO,
|
|
48
|
+
slot: SlotNumber(0),
|
|
29
49
|
ts: 0n,
|
|
30
|
-
|
|
50
|
+
nowSeconds: 0n,
|
|
31
51
|
};
|
|
32
52
|
}
|
|
33
53
|
|
|
34
|
-
|
|
54
|
+
getTargetEpochAndSlotInNextL1Slot(): EpochAndSlot & { nowSeconds: bigint } {
|
|
55
|
+
return this.getEpochAndSlotInNextL1Slot();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
isProposerPipeliningEnabled(): boolean {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}` {
|
|
35
63
|
return '0x00';
|
|
36
64
|
}
|
|
37
65
|
|
|
38
|
-
computeProposerIndex(_slot:
|
|
66
|
+
computeProposerIndex(_slot: SlotNumber, _epoch: EpochNumber, _seed: bigint, _size: bigint): bigint {
|
|
39
67
|
return 0n;
|
|
40
68
|
}
|
|
41
69
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
nextSlot:
|
|
53
|
-
}
|
|
70
|
+
getCurrentAndNextSlot(): { currentSlot: SlotNumber; nextSlot: SlotNumber } {
|
|
71
|
+
return {
|
|
72
|
+
currentSlot: SlotNumber(0),
|
|
73
|
+
nextSlot: SlotNumber(0),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getTargetAndNextSlot(): { targetSlot: SlotNumber; nextSlot: SlotNumber } {
|
|
78
|
+
return {
|
|
79
|
+
targetSlot: SlotNumber(0),
|
|
80
|
+
nextSlot: SlotNumber(0),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getProposerAttesterAddressInSlot(_slot: SlotNumber): Promise<EthAddress | undefined> {
|
|
85
|
+
return Promise.resolve(undefined);
|
|
54
86
|
}
|
|
55
87
|
|
|
56
88
|
isInCommittee(_slot: SlotTag, _validator: EthAddress): Promise<boolean> {
|
|
@@ -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,6 +1,7 @@
|
|
|
1
1
|
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import type { BlockHash, L2Block } from '@aztec/stdlib/block';
|
|
4
5
|
import type {
|
|
5
6
|
MerkleTreeReadOperations,
|
|
6
7
|
MerkleTreeWriteOperations,
|
|
@@ -12,7 +13,7 @@ import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
|
12
13
|
|
|
13
14
|
export class TXESynchronizer implements WorldStateSynchronizer {
|
|
14
15
|
// This works when set to 1 as well.
|
|
15
|
-
private blockNumber =
|
|
16
|
+
private blockNumber = BlockNumber.ZERO;
|
|
16
17
|
|
|
17
18
|
constructor(public nativeWorldStateService: NativeWorldStateService) {}
|
|
18
19
|
|
|
@@ -32,12 +33,12 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
* Forces an immediate sync to an optionally provided minimum block number
|
|
36
|
+
* Forces an immediate sync to an optionally provided minimum block number.
|
|
36
37
|
* @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
|
|
37
|
-
* @param
|
|
38
|
+
* @param blockHash - If provided, verifies the block at targetBlockNumber matches this hash.
|
|
38
39
|
* @returns A promise that resolves with the block number the world state was synced to
|
|
39
40
|
*/
|
|
40
|
-
public syncImmediate(_minBlockNumber?:
|
|
41
|
+
public syncImmediate(_minBlockNumber?: BlockNumber, _blockHash?: BlockHash): Promise<BlockNumber> {
|
|
41
42
|
return Promise.resolve(this.blockNumber);
|
|
42
43
|
}
|
|
43
44
|
|
|
@@ -48,12 +49,12 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
48
49
|
|
|
49
50
|
/** Forks the world state at the given block number, defaulting to the latest one. */
|
|
50
51
|
public fork(block?: number): Promise<MerkleTreeWriteOperations> {
|
|
51
|
-
return this.nativeWorldStateService.fork(block);
|
|
52
|
+
return this.nativeWorldStateService.fork(block ? BlockNumber(block) : undefined);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
/** Gets a handle that allows reading the state as it was at the given block number. */
|
|
55
56
|
public getSnapshot(blockNumber: number): MerkleTreeReadOperations {
|
|
56
|
-
return this.nativeWorldStateService.getSnapshot(blockNumber);
|
|
57
|
+
return this.nativeWorldStateService.getSnapshot(BlockNumber(blockNumber));
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
/** Backups the db to the target path. */
|