@aztec/txe 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec
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/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -2
- package/dest/oracle/interfaces.d.ts +9 -6
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +5 -5
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +4 -6
- package/dest/oracle/txe_oracle_top_level_context.d.ts +20 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +95 -63
- package/dest/rpc_translator.d.ts +17 -8
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +69 -20
- package/dest/state_machine/archiver.d.ts +31 -14
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +105 -17
- package/dest/state_machine/dummy_p2p_client.d.ts +4 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +6 -1
- package/dest/state_machine/global_variable_builder.d.ts +5 -3
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +12 -0
- package/dest/state_machine/index.d.ts +5 -5
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +14 -20
- package/dest/state_machine/mock_epoch_cache.d.ts +6 -5
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +8 -7
- package/dest/state_machine/synchronizer.d.ts +5 -4
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +5 -4
- package/dest/txe_session.d.ts +19 -13
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +55 -41
- package/dest/util/encoding.d.ts +623 -24
- 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_contract_store.d.ts +12 -0
- package/dest/util/txe_contract_store.d.ts.map +1 -0
- package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
- package/dest/util/txe_public_contract_data_source.d.ts +7 -6
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +11 -11
- package/dest/utils/block_creation.d.ts +19 -4
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +24 -3
- package/dest/utils/tx_effect_creation.d.ts +4 -3
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +6 -6
- package/package.json +18 -17
- package/src/index.ts +15 -12
- package/src/oracle/interfaces.ts +8 -5
- package/src/oracle/txe_oracle_public_context.ts +6 -11
- package/src/oracle/txe_oracle_top_level_context.ts +126 -88
- package/src/rpc_translator.ts +90 -20
- package/src/state_machine/archiver.ts +141 -29
- package/src/state_machine/dummy_p2p_client.ts +9 -2
- package/src/state_machine/global_variable_builder.ts +21 -3
- package/src/state_machine/index.ts +19 -18
- package/src/state_machine/mock_epoch_cache.ts +12 -11
- package/src/state_machine/synchronizer.ts +8 -7
- package/src/txe_session.ts +113 -72
- 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_contract_data_provider.ts → txe_contract_store.ts} +3 -3
- package/src/util/txe_public_contract_data_source.ts +13 -12
- package/src/utils/block_creation.ts +35 -3
- package/src/utils/tx_effect_creation.ts +8 -7
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
3
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
4
4
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
import { TXEArchiver } from './archiver.js';
|
|
6
6
|
import { TXESynchronizer } from './synchronizer.js';
|
|
@@ -8,9 +8,9 @@ export declare class TXEStateMachine {
|
|
|
8
8
|
node: AztecNode;
|
|
9
9
|
synchronizer: TXESynchronizer;
|
|
10
10
|
archiver: TXEArchiver;
|
|
11
|
-
|
|
12
|
-
constructor(node: AztecNode, synchronizer: TXESynchronizer, archiver: TXEArchiver,
|
|
11
|
+
anchorBlockStore: AnchorBlockStore;
|
|
12
|
+
constructor(node: AztecNode, synchronizer: TXESynchronizer, archiver: TXEArchiver, anchorBlockStore: AnchorBlockStore);
|
|
13
13
|
static create(db: AztecAsyncKVStore): Promise<TXEStateMachine>;
|
|
14
14
|
handleL2Block(block: L2Block): Promise<void>;
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGF0ZV9tYWNoaW5lL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDekQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDckQsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTlDLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBR2pFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFJNUMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBS3BELHFCQUFhLGVBQWU7SUFFakIsSUFBSSxFQUFFLFNBQVM7SUFDZixZQUFZLEVBQUUsZUFBZTtJQUM3QixRQUFRLEVBQUUsV0FBVztJQUNyQixnQkFBZ0IsRUFBRSxnQkFBZ0I7SUFKM0MsWUFDUyxJQUFJLEVBQUUsU0FBUyxFQUNmLFlBQVksRUFBRSxlQUFlLEVBQzdCLFFBQVEsRUFBRSxXQUFXLEVBQ3JCLGdCQUFnQixFQUFFLGdCQUFnQixFQUN2QztJQUVKLE9BQW9CLE1BQU0sQ0FBQyxFQUFFLEVBQUUsaUJBQWlCLDRCQStCL0M7SUFFWSxhQUFhLENBQUMsS0FBSyxFQUFFLE9BQU8saUJBZ0J4QztDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state_machine/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state_machine/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAGjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,qBAAa,eAAe;IAEjB,IAAI,EAAE,SAAS;IACf,YAAY,EAAE,eAAe;IAC7B,QAAQ,EAAE,WAAW;IACrB,gBAAgB,EAAE,gBAAgB;IAJ3C,YACS,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,eAAe,EAC7B,QAAQ,EAAE,WAAW,EACrB,gBAAgB,EAAE,gBAAgB,EACvC;IAEJ,OAAoB,MAAM,CAAC,EAAE,EAAE,iBAAiB,4BA+B/C;IAEY,aAAa,CAAC,KAAK,EAAE,OAAO,iBAgBxC;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AztecNodeService } from '@aztec/aztec-node';
|
|
2
2
|
import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
5
|
+
import { L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
6
6
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
7
7
|
import { TXEArchiver } from './archiver.js';
|
|
8
8
|
import { DummyP2P } from './dummy_p2p_client.js';
|
|
@@ -15,37 +15,31 @@ export class TXEStateMachine {
|
|
|
15
15
|
node;
|
|
16
16
|
synchronizer;
|
|
17
17
|
archiver;
|
|
18
|
-
|
|
19
|
-
constructor(node, synchronizer, archiver,
|
|
18
|
+
anchorBlockStore;
|
|
19
|
+
constructor(node, synchronizer, archiver, anchorBlockStore){
|
|
20
20
|
this.node = node;
|
|
21
21
|
this.synchronizer = synchronizer;
|
|
22
22
|
this.archiver = archiver;
|
|
23
|
-
this.
|
|
23
|
+
this.anchorBlockStore = anchorBlockStore;
|
|
24
24
|
}
|
|
25
25
|
static async create(db) {
|
|
26
26
|
const archiver = new TXEArchiver(db);
|
|
27
27
|
const synchronizer = await TXESynchronizer.create();
|
|
28
|
-
const
|
|
28
|
+
const anchorBlockStore = new AnchorBlockStore(db);
|
|
29
29
|
const aztecNodeConfig = {};
|
|
30
30
|
const log = createLogger('txe_node');
|
|
31
31
|
const node = new AztecNodeService(aztecNodeConfig, new DummyP2P(), archiver, archiver, archiver, archiver, synchronizer, undefined, undefined, undefined, undefined, VERSION, CHAIN_ID, new TXEGlobalVariablesBuilder(), new MockEpochCache(), getPackageVersion() ?? '', new TestCircuitVerifier(), undefined, log);
|
|
32
|
-
return new this(node, synchronizer, archiver,
|
|
32
|
+
return new this(node, synchronizer, archiver, anchorBlockStore);
|
|
33
33
|
}
|
|
34
34
|
async handleL2Block(block) {
|
|
35
|
+
const checkpoint = block.toCheckpoint();
|
|
36
|
+
const publishedCheckpoint = new PublishedCheckpoint(checkpoint, new L1PublishedData(BigInt(block.header.globalVariables.blockNumber), block.header.globalVariables.timestamp, block.header.globalVariables.blockNumber.toString()), []);
|
|
35
37
|
await Promise.all([
|
|
36
|
-
this.synchronizer.handleL2Block(block),
|
|
37
|
-
this.archiver.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
blockHash: block.header.globalVariables.blockNumber.toString(),
|
|
42
|
-
blockNumber: BigInt(block.header.globalVariables.blockNumber),
|
|
43
|
-
timestamp: block.header.globalVariables.timestamp
|
|
44
|
-
},
|
|
45
|
-
attestations: []
|
|
46
|
-
})
|
|
47
|
-
]),
|
|
48
|
-
this.syncDataProvider.setHeader(block.getBlockHeader())
|
|
38
|
+
this.synchronizer.handleL2Block(block.toL2Block()),
|
|
39
|
+
this.archiver.addCheckpoints([
|
|
40
|
+
publishedCheckpoint
|
|
41
|
+
], undefined),
|
|
42
|
+
this.anchorBlockStore.setHeader(block.getBlockHeader())
|
|
49
43
|
]);
|
|
50
44
|
}
|
|
51
45
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
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';
|
|
3
4
|
/**
|
|
4
5
|
* Mock implementation of the EpochCacheInterface used to satisfy dependencies of AztecNodeService.
|
|
@@ -10,16 +11,16 @@ export declare class MockEpochCache implements EpochCacheInterface {
|
|
|
10
11
|
getEpochAndSlotInNextL1Slot(): EpochAndSlot & {
|
|
11
12
|
now: bigint;
|
|
12
13
|
};
|
|
13
|
-
getProposerIndexEncoding(_epoch:
|
|
14
|
-
computeProposerIndex(_slot:
|
|
14
|
+
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}`;
|
|
15
|
+
computeProposerIndex(_slot: SlotNumber, _epoch: EpochNumber, _seed: bigint, _size: bigint): bigint;
|
|
15
16
|
getProposerAttesterAddressInCurrentOrNextSlot(): Promise<{
|
|
16
17
|
currentProposer: EthAddress | undefined;
|
|
17
18
|
nextProposer: EthAddress | undefined;
|
|
18
|
-
currentSlot:
|
|
19
|
-
nextSlot:
|
|
19
|
+
currentSlot: SlotNumber;
|
|
20
|
+
nextSlot: SlotNumber;
|
|
20
21
|
}>;
|
|
21
22
|
isInCommittee(_slot: SlotTag, _validator: EthAddress): Promise<boolean>;
|
|
22
23
|
getRegisteredValidators(): Promise<EthAddress[]>;
|
|
23
24
|
filterInCommittee(_slot: SlotTag, _validators: EthAddress[]): Promise<EthAddress[]>;
|
|
24
25
|
}
|
|
25
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19lcG9jaF9jYWNoZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4v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q7SUFFRCxhQUFhLENBQUMsS0FBSyxFQUFFLE9BQU8sRUFBRSxVQUFVLEVBQUUsVUFBVSxHQUFHLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FFdEU7SUFFRCx1QkFBdUIsSUFBSSxPQUFPLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FFL0M7SUFFRCxpQkFBaUIsQ0FBQyxLQUFLLEVBQUUsT0FBTyxFQUFFLFdBQVcsRUFBRSxVQUFVLEVBQUUsR0FBRyxPQUFPLENBQUMsVUFBVSxFQUFFLENBQUMsQ0FFbEY7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_epoch_cache.d.ts","sourceRoot":"","sources":["../../src/state_machine/mock_epoch_cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,cAAe,YAAW,mBAAmB;IACxD,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"mock_epoch_cache.d.ts","sourceRoot":"","sources":["../../src/state_machine/mock_epoch_cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;GAGG;AACH,qBAAa,cAAe,YAAW,mBAAmB;IACxD,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAM1C;IAED,kBAAkB,IAAI,YAAY,CAMjC;IAED,2BAA2B,IAAI,YAAY,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAO5D;IAED,wBAAwB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAE7F;IAED,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjG;IAED,6CAA6C,IAAI,OAAO,CAAC;QACvD,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC;QACxC,YAAY,EAAE,UAAU,GAAG,SAAS,CAAC;QACrC,WAAW,EAAE,UAAU,CAAC;QACxB,QAAQ,EAAE,UAAU,CAAC;KACtB,CAAC,CAOD;IAED,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAEtE;IAED,uBAAuB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAE/C;IAED,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAElF;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
/**
|
|
2
3
|
* Mock implementation of the EpochCacheInterface used to satisfy dependencies of AztecNodeService.
|
|
3
4
|
* Since in TXE we don't validate transactions, mock suffices here.
|
|
@@ -6,20 +7,20 @@
|
|
|
6
7
|
return Promise.resolve({
|
|
7
8
|
committee: undefined,
|
|
8
9
|
seed: 0n,
|
|
9
|
-
epoch:
|
|
10
|
+
epoch: EpochNumber.ZERO
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
getEpochAndSlotNow() {
|
|
13
14
|
return {
|
|
14
|
-
epoch:
|
|
15
|
-
slot:
|
|
15
|
+
epoch: EpochNumber.ZERO,
|
|
16
|
+
slot: SlotNumber(0),
|
|
16
17
|
ts: 0n
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
getEpochAndSlotInNextL1Slot() {
|
|
20
21
|
return {
|
|
21
|
-
epoch:
|
|
22
|
-
slot:
|
|
22
|
+
epoch: EpochNumber.ZERO,
|
|
23
|
+
slot: SlotNumber(0),
|
|
23
24
|
ts: 0n,
|
|
24
25
|
now: 0n
|
|
25
26
|
};
|
|
@@ -34,8 +35,8 @@
|
|
|
34
35
|
return Promise.resolve({
|
|
35
36
|
currentProposer: undefined,
|
|
36
37
|
nextProposer: undefined,
|
|
37
|
-
currentSlot:
|
|
38
|
-
nextSlot:
|
|
38
|
+
currentSlot: SlotNumber(0),
|
|
39
|
+
nextSlot: SlotNumber(0)
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
isInCommittee(_slot, _validator) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { L2BlockNew } from '@aztec/stdlib/block';
|
|
2
3
|
import type { MerkleTreeReadOperations, MerkleTreeWriteOperations, SnapshotDataKeys, WorldStateSynchronizer, WorldStateSynchronizerStatus } from '@aztec/stdlib/interfaces/server';
|
|
3
4
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
4
5
|
export declare class TXESynchronizer implements WorldStateSynchronizer {
|
|
@@ -6,14 +7,14 @@ export declare class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
6
7
|
private blockNumber;
|
|
7
8
|
constructor(nativeWorldStateService: NativeWorldStateService);
|
|
8
9
|
static create(): Promise<TXESynchronizer>;
|
|
9
|
-
handleL2Block(block:
|
|
10
|
+
handleL2Block(block: L2BlockNew): Promise<void>;
|
|
10
11
|
/**
|
|
11
12
|
* Forces an immediate sync to an optionally provided minimum block number
|
|
12
13
|
* @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
|
|
13
14
|
* @param skipThrowIfTargetNotReached - Whether to skip throwing if the target block number is not reached.
|
|
14
15
|
* @returns A promise that resolves with the block number the world state was synced to
|
|
15
16
|
*/
|
|
16
|
-
syncImmediate(_minBlockNumber?:
|
|
17
|
+
syncImmediate(_minBlockNumber?: BlockNumber, _skipThrowIfTargetNotReached?: boolean): Promise<BlockNumber>;
|
|
17
18
|
/** Returns an instance of MerkleTreeAdminOperations that will not include uncommitted data. */
|
|
18
19
|
getCommitted(): MerkleTreeReadOperations;
|
|
19
20
|
/** Forks the world state at the given block number, defaulting to the latest one. */
|
|
@@ -29,4 +30,4 @@ export declare class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
29
30
|
resumeSync(): void;
|
|
30
31
|
clear(): Promise<void>;
|
|
31
32
|
}
|
|
32
|
-
//# sourceMappingURL=
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY2hyb25pemVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RhdGVfbWFjaGluZS9zeW5jaHJvbml6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRTlELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUNWLHdCQUF3QixFQUN4Qix5QkFBeUIsRUFDekIsZ0JBQWdCLEVBQ2hCLHNCQUFzQixFQUN0Qiw0QkFBNEIsRUFDN0IsTUFBTSxpQ0FBaUMsQ0FBQztBQUN6QyxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUVwRSxxQkFBYSxlQUFnQixZQUFXLHNCQUFzQjtJQUl6Qyx1QkFBdUIsRUFBRSx1QkFBdUI7SUFGbkUsT0FBTyxDQUFDLFdBQVcsQ0FBb0I7SUFFdkMsW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
1
|
-
{"version":3,"file":"synchronizer.d.ts","sourceRoot":"","sources":["../../src/state_machine/synchronizer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"synchronizer.d.ts","sourceRoot":"","sources":["../../src/state_machine/synchronizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EACV,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,qBAAa,eAAgB,YAAW,sBAAsB;IAIzC,uBAAuB,EAAE,uBAAuB;IAFnE,OAAO,CAAC,WAAW,CAAoB;IAEvC,YAAmB,uBAAuB,EAAE,uBAAuB,EAAI;IAEvE,OAAa,MAAM,6BAIlB;IAEY,aAAa,CAAC,KAAK,EAAE,UAAU,iBAO3C;IAED;;;;;OAKG;IACI,aAAa,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,4BAA4B,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAEhH;IAED,+FAA+F;IACxF,YAAY,IAAI,wBAAwB,CAE9C;IAED,qFAAqF;IAC9E,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAE9D;IAED,uFAAuF;IAChF,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,wBAAwB,CAEhE;IAED,yCAAyC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC,CAElH;IAEM,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;IAEM,MAAM,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAErD;IAEM,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAEM,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/B;IAEM,UAAU,IAAI,IAAI,CAExB;IAEM,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
|
-
import {
|
|
2
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
4
5
|
export class TXESynchronizer {
|
|
5
6
|
nativeWorldStateService;
|
|
@@ -7,7 +8,7 @@ export class TXESynchronizer {
|
|
|
7
8
|
blockNumber;
|
|
8
9
|
constructor(nativeWorldStateService){
|
|
9
10
|
this.nativeWorldStateService = nativeWorldStateService;
|
|
10
|
-
this.blockNumber =
|
|
11
|
+
this.blockNumber = BlockNumber.ZERO;
|
|
11
12
|
}
|
|
12
13
|
static async create() {
|
|
13
14
|
const nativeWorldStateService = await NativeWorldStateService.tmp();
|
|
@@ -29,10 +30,10 @@ export class TXESynchronizer {
|
|
|
29
30
|
return this.nativeWorldStateService.getCommitted();
|
|
30
31
|
}
|
|
31
32
|
/** Forks the world state at the given block number, defaulting to the latest one. */ fork(block) {
|
|
32
|
-
return this.nativeWorldStateService.fork(block);
|
|
33
|
+
return this.nativeWorldStateService.fork(block ? BlockNumber(block) : undefined);
|
|
33
34
|
}
|
|
34
35
|
/** Gets a handle that allows reading the state as it was at the given block number. */ getSnapshot(blockNumber) {
|
|
35
|
-
return this.nativeWorldStateService.getSnapshot(blockNumber);
|
|
36
|
+
return this.nativeWorldStateService.getSnapshot(BlockNumber(blockNumber));
|
|
36
37
|
}
|
|
37
38
|
/** Backups the db to the target path. */ backupTo(dstPath, compact) {
|
|
38
39
|
return this.nativeWorldStateService.backupTo(dstPath, compact);
|
package/dest/txe_session.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { type Logger } from '@aztec/foundation/log';
|
|
3
4
|
import { KeyStore } from '@aztec/key-store';
|
|
4
5
|
import type { ProtocolContract } from '@aztec/protocol-contracts';
|
|
5
|
-
import {
|
|
6
|
+
import { AddressStore, CapsuleStore, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
6
7
|
import { type IPrivateExecutionOracle, type IUtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
7
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
8
9
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
9
|
-
import type { UInt32 } from '@aztec/stdlib/types';
|
|
10
10
|
import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
|
|
11
11
|
import { RPCTranslator } from './rpc_translator.js';
|
|
12
12
|
import { TXEStateMachine } from './state_machine/index.js';
|
|
13
13
|
import type { ForeignCallArgs, ForeignCallResult } from './util/encoding.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { TXEAccountStore } from './util/txe_account_store.js';
|
|
15
|
+
import { TXEContractStore } from './util/txe_contract_store.js';
|
|
16
16
|
type MethodNames<T> = {
|
|
17
17
|
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
18
18
|
}[keyof T];
|
|
@@ -24,9 +24,10 @@ export type TXEOracleFunctionName = Exclude<MethodNames<RPCTranslator>, 'constru
|
|
|
24
24
|
export interface TXESessionStateHandler {
|
|
25
25
|
enterTopLevelState(): Promise<void>;
|
|
26
26
|
enterPublicState(contractAddress?: AztecAddress): Promise<void>;
|
|
27
|
-
enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?:
|
|
27
|
+
enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?: BlockNumber): Promise<PrivateContextInputs>;
|
|
28
28
|
enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
|
|
29
29
|
}
|
|
30
|
+
export declare const DEFAULT_ADDRESS: AztecAddress;
|
|
30
31
|
/**
|
|
31
32
|
* A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
|
|
32
33
|
* state, etc., independent of all other tests running in parallel.
|
|
@@ -35,17 +36,22 @@ export declare class TXESession implements TXESessionStateHandler {
|
|
|
35
36
|
private logger;
|
|
36
37
|
private stateMachine;
|
|
37
38
|
private oracleHandler;
|
|
38
|
-
private
|
|
39
|
+
private contractStore;
|
|
40
|
+
private noteStore;
|
|
39
41
|
private keyStore;
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
+
private addressStore;
|
|
43
|
+
private accountStore;
|
|
44
|
+
private senderTaggingStore;
|
|
45
|
+
private recipientTaggingStore;
|
|
46
|
+
private senderAddressBookStore;
|
|
47
|
+
private capsuleStore;
|
|
48
|
+
private privateEventStore;
|
|
42
49
|
private chainId;
|
|
43
50
|
private version;
|
|
44
51
|
private nextBlockTimestamp;
|
|
45
|
-
private pxeOracleInterface;
|
|
46
52
|
private state;
|
|
47
53
|
private authwits;
|
|
48
|
-
constructor(logger: Logger, stateMachine: TXEStateMachine, oracleHandler: IUtilityExecutionOracle | IPrivateExecutionOracle | IAvmExecutionOracle | ITxeExecutionOracle,
|
|
54
|
+
constructor(logger: Logger, stateMachine: TXEStateMachine, oracleHandler: IUtilityExecutionOracle | IPrivateExecutionOracle | IAvmExecutionOracle | ITxeExecutionOracle, contractStore: TXEContractStore, noteStore: NoteStore, keyStore: KeyStore, addressStore: AddressStore, accountStore: TXEAccountStore, senderTaggingStore: SenderTaggingStore, recipientTaggingStore: RecipientTaggingStore, senderAddressBookStore: SenderAddressBookStore, capsuleStore: CapsuleStore, privateEventStore: PrivateEventStore, chainId: Fr, version: Fr, nextBlockTimestamp: bigint);
|
|
49
55
|
static init(protocolContracts: ProtocolContract[]): Promise<TXESession>;
|
|
50
56
|
/**
|
|
51
57
|
* Processes an oracle function invoked by the Noir test associated to this session.
|
|
@@ -55,7 +61,7 @@ export declare class TXESession implements TXESessionStateHandler {
|
|
|
55
61
|
*/
|
|
56
62
|
processFunction(functionName: TXEOracleFunctionName, inputs: ForeignCallArgs): Promise<ForeignCallResult>;
|
|
57
63
|
enterTopLevelState(): Promise<void>;
|
|
58
|
-
enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?:
|
|
64
|
+
enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?: BlockNumber): Promise<PrivateContextInputs>;
|
|
59
65
|
enterPublicState(contractAddress?: AztecAddress): Promise<void>;
|
|
60
66
|
enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
|
|
61
67
|
private exitTopLevelState;
|
|
@@ -64,4 +70,4 @@ export declare class TXESession implements TXESessionStateHandler {
|
|
|
64
70
|
private exitUtilityContext;
|
|
65
71
|
}
|
|
66
72
|
export {};
|
|
67
|
-
//# sourceMappingURL=
|
|
73
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3Nlc3Npb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy90eGVfc2Vzc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDOUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUNsRSxPQUFPLEVBQUUsUUF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CQUFpQixDQUNyQixlQUFlLEdBQUUsWUFBOEIsRUFDL0MsaUJBQWlCLENBQUMsRUFBRSxXQUFXLEdBQzlCLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQWdFL0I7SUFFSyxnQkFBZ0IsQ0FBQyxlQUFlLENBQUMsRUFBRSxZQUFZLGlCQXNCcEQ7SUFFSyxpQkFBaUIsQ0FBQyxlQUFlLEdBQUUsWUFBOEIsaUJBbUN0RTtJQUVELE9BQU8sQ0FBQyxpQkFBaUI7WUFpQlgsZ0JBQWdCO1lBaUNoQixlQUFlO0lBUzdCLE9BQU8sQ0FBQyxrQkFBa0I7Q0FLM0IifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_session.d.ts","sourceRoot":"","sources":["../src/txe_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"txe_session.d.ts","sourceRoot":"","sources":["../src/txe_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,YAAY,EACZ,YAAY,EAEZ,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAG7B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAM5D,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,CAAC,EAAE,YAAY,iBAsBpD;IAEK,iBAAiB,CAAC,eAAe,GAAE,YAA8B,iBAmCtE;IAED,OAAO,CAAC,iBAAiB;YAiBX,gBAAgB;YAiChB,eAAe;IAS7B,OAAO,CAAC,kBAAkB;CAK3B"}
|
package/dest/txe_session.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { KeyStore } from '@aztec/key-store';
|
|
4
5
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
5
|
-
import {
|
|
6
|
+
import { AddressStore, CapsuleStore, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
6
7
|
import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
7
8
|
import { FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
9
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
-
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
10
10
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
11
|
-
import {
|
|
11
|
+
import { computeProtocolNullifier } from '@aztec/stdlib/hash';
|
|
12
|
+
import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
12
13
|
import { CallContext, TxContext } from '@aztec/stdlib/tx';
|
|
13
14
|
import { z } from 'zod';
|
|
14
15
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
15
16
|
import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
|
|
16
17
|
import { RPCTranslator } from './rpc_translator.js';
|
|
17
18
|
import { TXEStateMachine } from './state_machine/index.js';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees,
|
|
19
|
+
import { TXEAccountStore } from './util/txe_account_store.js';
|
|
20
|
+
import { TXEContractStore } from './util/txe_contract_store.js';
|
|
21
|
+
import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
|
|
21
22
|
import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
22
|
-
const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
23
|
+
export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
23
24
|
/**
|
|
24
25
|
* A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
|
|
25
26
|
* state, etc., independent of all other tests running in parallel.
|
|
@@ -27,28 +28,38 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
27
28
|
logger;
|
|
28
29
|
stateMachine;
|
|
29
30
|
oracleHandler;
|
|
30
|
-
|
|
31
|
+
contractStore;
|
|
32
|
+
noteStore;
|
|
31
33
|
keyStore;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
addressStore;
|
|
35
|
+
accountStore;
|
|
36
|
+
senderTaggingStore;
|
|
37
|
+
recipientTaggingStore;
|
|
38
|
+
senderAddressBookStore;
|
|
39
|
+
capsuleStore;
|
|
40
|
+
privateEventStore;
|
|
34
41
|
chainId;
|
|
35
42
|
version;
|
|
36
43
|
nextBlockTimestamp;
|
|
37
|
-
pxeOracleInterface;
|
|
38
44
|
state;
|
|
39
45
|
authwits;
|
|
40
|
-
constructor(logger, stateMachine, oracleHandler,
|
|
46
|
+
constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, chainId, version, nextBlockTimestamp){
|
|
41
47
|
this.logger = logger;
|
|
42
48
|
this.stateMachine = stateMachine;
|
|
43
49
|
this.oracleHandler = oracleHandler;
|
|
44
|
-
this.
|
|
50
|
+
this.contractStore = contractStore;
|
|
51
|
+
this.noteStore = noteStore;
|
|
45
52
|
this.keyStore = keyStore;
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
53
|
+
this.addressStore = addressStore;
|
|
54
|
+
this.accountStore = accountStore;
|
|
55
|
+
this.senderTaggingStore = senderTaggingStore;
|
|
56
|
+
this.recipientTaggingStore = recipientTaggingStore;
|
|
57
|
+
this.senderAddressBookStore = senderAddressBookStore;
|
|
58
|
+
this.capsuleStore = capsuleStore;
|
|
59
|
+
this.privateEventStore = privateEventStore;
|
|
48
60
|
this.chainId = chainId;
|
|
49
61
|
this.version = version;
|
|
50
62
|
this.nextBlockTimestamp = nextBlockTimestamp;
|
|
51
|
-
this.pxeOracleInterface = pxeOracleInterface;
|
|
52
63
|
this.state = {
|
|
53
64
|
name: 'TOP_LEVEL'
|
|
54
65
|
};
|
|
@@ -56,27 +67,28 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
56
67
|
}
|
|
57
68
|
static async init(protocolContracts) {
|
|
58
69
|
const store = await openTmpStore('txe-session');
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
const
|
|
70
|
+
const addressStore = new AddressStore(store);
|
|
71
|
+
const privateEventStore = new PrivateEventStore(store);
|
|
72
|
+
const contractStore = new TXEContractStore(store);
|
|
73
|
+
const noteStore = await NoteStore.create(store);
|
|
74
|
+
const senderTaggingStore = new SenderTaggingStore(store);
|
|
75
|
+
const recipientTaggingStore = new RecipientTaggingStore(store);
|
|
76
|
+
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
77
|
+
const capsuleStore = new CapsuleStore(store);
|
|
65
78
|
const keyStore = new KeyStore(store);
|
|
66
|
-
const
|
|
79
|
+
const accountStore = new TXEAccountStore(store);
|
|
67
80
|
// Register protocol contracts.
|
|
68
81
|
for (const { contractClass, instance, artifact } of protocolContracts){
|
|
69
|
-
await
|
|
70
|
-
await
|
|
82
|
+
await contractStore.addContractArtifact(contractClass.id, artifact);
|
|
83
|
+
await contractStore.addContractInstance(instance);
|
|
71
84
|
}
|
|
72
85
|
const stateMachine = await TXEStateMachine.create(store);
|
|
73
86
|
const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
|
|
74
87
|
const version = new Fr(await stateMachine.node.getVersion());
|
|
75
88
|
const chainId = new Fr(await stateMachine.node.getChainId());
|
|
76
|
-
const
|
|
77
|
-
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractDataProvider, keyStore, addressDataProvider, accountDataProvider, pxeOracleInterface, nextBlockTimestamp, version, chainId, new Map());
|
|
89
|
+
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map());
|
|
78
90
|
await topLevelOracleHandler.txeAdvanceBlocksBy(1);
|
|
79
|
-
return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler,
|
|
91
|
+
return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, version, chainId, nextBlockTimestamp);
|
|
80
92
|
}
|
|
81
93
|
/**
|
|
82
94
|
* Processes an oracle function invoked by the Noir test associated to this session.
|
|
@@ -125,7 +137,7 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
125
137
|
this.state;
|
|
126
138
|
}
|
|
127
139
|
}
|
|
128
|
-
this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.
|
|
140
|
+
this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
|
|
129
141
|
this.state = {
|
|
130
142
|
name: 'TOP_LEVEL'
|
|
131
143
|
};
|
|
@@ -138,22 +150,23 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
138
150
|
// we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
|
|
139
151
|
// be removed from the database.
|
|
140
152
|
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
141
|
-
await this.
|
|
153
|
+
await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore).syncNoteNullifiers(contractAddress);
|
|
142
154
|
// Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
|
|
143
155
|
// build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
|
|
144
156
|
// a single transaction with the effects of what was done in the test.
|
|
145
157
|
const anchorBlock = await this.stateMachine.node.getBlockHeader(anchorBlockNumber ?? 'latest');
|
|
146
158
|
const latestBlock = await this.stateMachine.node.getBlockHeader('latest');
|
|
147
159
|
const nextBlockGlobalVariables = makeGlobalVariables(undefined, {
|
|
148
|
-
blockNumber: latestBlock.globalVariables.blockNumber + 1,
|
|
160
|
+
blockNumber: BlockNumber(latestBlock.globalVariables.blockNumber + 1),
|
|
149
161
|
timestamp: this.nextBlockTimestamp,
|
|
150
162
|
version: this.version,
|
|
151
163
|
chainId: this.chainId
|
|
152
164
|
});
|
|
153
165
|
const txRequestHash = getSingleTxBlockRequestHash(nextBlockGlobalVariables.blockNumber);
|
|
154
|
-
const
|
|
166
|
+
const protocolNullifier = await computeProtocolNullifier(txRequestHash);
|
|
167
|
+
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
155
168
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
156
|
-
this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.
|
|
169
|
+
this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, [], [], new HashedValuesCache(), noteCache, taggingIndexCache, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.senderTaggingStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore);
|
|
157
170
|
// We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
|
|
158
171
|
// data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
|
|
159
172
|
// difference resides in that the simulator has all information needed in order to run the simulation, while ours
|
|
@@ -162,7 +175,7 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
162
175
|
this.state = {
|
|
163
176
|
name: 'PRIVATE',
|
|
164
177
|
nextBlockGlobalVariables,
|
|
165
|
-
|
|
178
|
+
protocolNullifier,
|
|
166
179
|
noteCache,
|
|
167
180
|
taggingIndexCache
|
|
168
181
|
};
|
|
@@ -175,7 +188,7 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
175
188
|
// the test. The block therefore gets the *next* block number and timestamp.
|
|
176
189
|
const latestBlockNumber = (await this.stateMachine.node.getBlockHeader('latest')).globalVariables.blockNumber;
|
|
177
190
|
const globalVariables = makeGlobalVariables(undefined, {
|
|
178
|
-
blockNumber: latestBlockNumber + 1,
|
|
191
|
+
blockNumber: BlockNumber(latestBlockNumber + 1),
|
|
179
192
|
timestamp: this.nextBlockTimestamp,
|
|
180
193
|
version: this.version,
|
|
181
194
|
chainId: this.chainId
|
|
@@ -193,8 +206,9 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
193
206
|
// we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
|
|
194
207
|
// be removed from the database.
|
|
195
208
|
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
196
|
-
await this.
|
|
197
|
-
|
|
209
|
+
await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore).syncNoteNullifiers(contractAddress);
|
|
210
|
+
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
211
|
+
this.oracleHandler = new UtilityExecutionOracle(contractAddress, [], [], anchorBlockHeader, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore);
|
|
198
212
|
this.state = {
|
|
199
213
|
name: 'UTILITY'
|
|
200
214
|
};
|
|
@@ -224,13 +238,13 @@ const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
224
238
|
});
|
|
225
239
|
// We rely on the note cache to determine the effects of the transaction. This is incomplete as it doesn't private
|
|
226
240
|
// logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
|
|
227
|
-
const txEffect = await makeTxEffect(this.state.noteCache, this.state.
|
|
241
|
+
const txEffect = await makeTxEffect(this.state.noteCache, this.state.protocolNullifier, this.state.nextBlockGlobalVariables.blockNumber);
|
|
228
242
|
// We build a block holding just this transaction
|
|
229
243
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
230
244
|
await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
|
|
231
|
-
const block =
|
|
245
|
+
const block = await makeTXEBlock(forkedWorldTrees, this.state.nextBlockGlobalVariables, [
|
|
232
246
|
txEffect
|
|
233
|
-
])
|
|
247
|
+
]);
|
|
234
248
|
await this.stateMachine.handleL2Block(block);
|
|
235
249
|
await forkedWorldTrees.close();
|
|
236
250
|
this.logger.debug('Exited PublicContext with built block', {
|