@aztec/txe 0.0.1-commit.c7c42ec → 0.0.1-commit.d1f2d6c
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/constants.d.ts +3 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/oracle/interfaces.d.ts +2 -2
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +2 -2
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +3 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts +4 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +36 -22
- package/dest/rpc_translator.d.ts +14 -8
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +47 -33
- package/dest/state_machine/archiver.d.ts +20 -67
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +60 -178
- package/dest/state_machine/dummy_p2p_client.d.ts +8 -7
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +13 -10
- package/dest/state_machine/global_variable_builder.d.ts +2 -2
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +1 -1
- package/dest/state_machine/index.d.ts +1 -1
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +13 -4
- package/dest/state_machine/mock_epoch_cache.d.ts +7 -6
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +10 -7
- package/dest/state_machine/synchronizer.d.ts +3 -3
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/txe_session.d.ts +6 -4
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +55 -20
- package/dest/util/encoding.d.ts +17 -17
- package/dest/utils/block_creation.d.ts +4 -4
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +16 -5
- 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 -6
- package/package.json +16 -16
- package/src/constants.ts +3 -0
- package/src/oracle/interfaces.ts +1 -1
- package/src/oracle/txe_oracle_public_context.ts +3 -3
- package/src/oracle/txe_oracle_top_level_context.ts +53 -22
- package/src/rpc_translator.ts +51 -43
- package/src/state_machine/archiver.ts +55 -219
- package/src/state_machine/dummy_p2p_client.ts +18 -13
- package/src/state_machine/global_variable_builder.ts +1 -1
- package/src/state_machine/index.ts +12 -4
- package/src/state_machine/mock_epoch_cache.ts +10 -11
- package/src/state_machine/synchronizer.ts +2 -2
- package/src/txe_session.ts +88 -16
- package/src/utils/block_creation.ts +17 -16
- package/src/utils/tx_effect_creation.ts +3 -11
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
export class DummyP2P {
|
|
2
|
-
broadcastAttestations(_attestations) {
|
|
3
|
-
return Promise.resolve();
|
|
4
|
-
}
|
|
5
2
|
validate(_txs) {
|
|
6
3
|
return Promise.resolve();
|
|
7
4
|
}
|
|
@@ -20,9 +17,18 @@ export class DummyP2P {
|
|
|
20
17
|
broadcastProposal(_proposal) {
|
|
21
18
|
throw new Error('DummyP2P does not implement "broadcastProposal"');
|
|
22
19
|
}
|
|
20
|
+
broadcastCheckpointProposal(_proposal) {
|
|
21
|
+
throw new Error('DummyP2P does not implement "broadcastCheckpointProposal"');
|
|
22
|
+
}
|
|
23
|
+
broadcastCheckpointAttestations(_attestations) {
|
|
24
|
+
throw new Error('DummyP2P does not implement "broadcastCheckpointAttestations"');
|
|
25
|
+
}
|
|
23
26
|
registerBlockProposalHandler(_handler) {
|
|
24
27
|
throw new Error('DummyP2P does not implement "registerBlockProposalHandler"');
|
|
25
28
|
}
|
|
29
|
+
registerCheckpointProposalHandler(_handler) {
|
|
30
|
+
throw new Error('DummyP2P does not implement "registerCheckpointProposalHandler"');
|
|
31
|
+
}
|
|
26
32
|
requestTxs(_txHashes) {
|
|
27
33
|
throw new Error('DummyP2P does not implement "requestTxs"');
|
|
28
34
|
}
|
|
@@ -76,14 +82,11 @@ export class DummyP2P {
|
|
|
76
82
|
getTxsByHash(_txHashes) {
|
|
77
83
|
throw new Error('DummyP2P does not implement "getTxsByHash"');
|
|
78
84
|
}
|
|
79
|
-
|
|
80
|
-
throw new Error('DummyP2P does not implement "
|
|
81
|
-
}
|
|
82
|
-
deleteAttestation(_attestation) {
|
|
83
|
-
return Promise.resolve();
|
|
85
|
+
getCheckpointAttestationsForSlot(_slot, _proposalId) {
|
|
86
|
+
throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
throw new Error('DummyP2P does not implement "
|
|
88
|
+
addCheckpointAttestations(_attestations) {
|
|
89
|
+
throw new Error('DummyP2P does not implement "addCheckpointAttestations"');
|
|
87
90
|
}
|
|
88
91
|
getL2BlockHash(_number) {
|
|
89
92
|
throw new Error('DummyP2P does not implement "getL2BlockHash"');
|
|
@@ -4,8 +4,8 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
|
4
4
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
5
5
|
import { type CheckpointGlobalVariables, type GlobalVariableBuilder, GlobalVariables } from '@aztec/stdlib/tx';
|
|
6
6
|
export declare class TXEGlobalVariablesBuilder implements GlobalVariableBuilder {
|
|
7
|
-
|
|
7
|
+
getCurrentMinFees(): Promise<GasFees>;
|
|
8
8
|
buildGlobalVariables(_blockNumber: BlockNumber, _coinbase: EthAddress, _feeRecipient: AztecAddress, _slotNumber?: SlotNumber): Promise<GlobalVariables>;
|
|
9
9
|
buildCheckpointGlobalVariables(_coinbase: EthAddress, _feeRecipient: AztecAddress, _slotNumber: SlotNumber): Promise<CheckpointGlobalVariables>;
|
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DQUFDLHlCQUF5QixDQUFDLENBV3BDO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global_variable_builder.d.ts","sourceRoot":"","sources":["../../src/state_machine/global_variable_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,qBAAqB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE/G,qBAAa,yBAA0B,YAAW,qBAAqB;IAC9D,
|
|
1
|
+
{"version":3,"file":"global_variable_builder.d.ts","sourceRoot":"","sources":["../../src/state_machine/global_variable_builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,KAAK,yBAAyB,EAAE,KAAK,qBAAqB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAE/G,qBAAa,yBAA0B,YAAW,qBAAqB;IAC9D,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAE3C;IAEM,oBAAoB,CACzB,YAAY,EAAE,WAAW,EACzB,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,UAAU,GACvB,OAAO,CAAC,eAAe,CAAC,CAE1B;IAEM,8BAA8B,CACnC,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,YAAY,EAC3B,WAAW,EAAE,UAAU,GACtB,OAAO,CAAC,yBAAyB,CAAC,CAWpC;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GasFees } from '@aztec/stdlib/gas';
|
|
2
2
|
import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
3
3
|
export class TXEGlobalVariablesBuilder {
|
|
4
|
-
|
|
4
|
+
getCurrentMinFees() {
|
|
5
5
|
return Promise.resolve(new GasFees(0, 0));
|
|
6
6
|
}
|
|
7
7
|
buildGlobalVariables(_blockNumber, _coinbase, _feeRecipient, _slotNumber) {
|
|
@@ -13,4 +13,4 @@ export declare class TXEStateMachine {
|
|
|
13
13
|
static create(db: AztecAsyncKVStore): Promise<TXEStateMachine>;
|
|
14
14
|
handleL2Block(block: L2Block): Promise<void>;
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGF0ZV9tYWNoaW5lL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDekQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFDckQsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRTlDLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBR2pFLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFJNUMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBS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":"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,iBAwBxC;CACF"}
|
|
@@ -2,7 +2,7 @@ import { AztecNodeService } from '@aztec/aztec-node';
|
|
|
2
2
|
import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
5
|
-
import { L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
5
|
+
import { Checkpoint, 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';
|
|
@@ -32,14 +32,23 @@ export class TXEStateMachine {
|
|
|
32
32
|
return new this(node, synchronizer, archiver, anchorBlockStore);
|
|
33
33
|
}
|
|
34
34
|
async handleL2Block(block) {
|
|
35
|
-
|
|
35
|
+
// Create a checkpoint from the block - L2Block doesn't have toCheckpoint() method
|
|
36
|
+
// We need to construct the Checkpoint manually
|
|
37
|
+
const checkpoint = await Checkpoint.random(block.checkpointNumber, {
|
|
38
|
+
numBlocks: 1,
|
|
39
|
+
startBlockNumber: Number(block.number)
|
|
40
|
+
});
|
|
41
|
+
// Replace the random block with our actual block
|
|
42
|
+
checkpoint.blocks = [
|
|
43
|
+
block
|
|
44
|
+
];
|
|
36
45
|
const publishedCheckpoint = new PublishedCheckpoint(checkpoint, new L1PublishedData(BigInt(block.header.globalVariables.blockNumber), block.header.globalVariables.timestamp, block.header.globalVariables.blockNumber.toString()), []);
|
|
37
46
|
await Promise.all([
|
|
38
|
-
this.synchronizer.handleL2Block(block
|
|
47
|
+
this.synchronizer.handleL2Block(block),
|
|
39
48
|
this.archiver.addCheckpoints([
|
|
40
49
|
publishedCheckpoint
|
|
41
50
|
], undefined),
|
|
42
|
-
this.anchorBlockStore.setHeader(block.
|
|
51
|
+
this.anchorBlockStore.setHeader(block.header)
|
|
43
52
|
]);
|
|
44
53
|
}
|
|
45
54
|
}
|
|
@@ -7,20 +7,21 @@ import { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class MockEpochCache implements EpochCacheInterface {
|
|
9
9
|
getCommittee(): Promise<EpochCommitteeInfo>;
|
|
10
|
-
getEpochAndSlotNow(): EpochAndSlot
|
|
10
|
+
getEpochAndSlotNow(): EpochAndSlot & {
|
|
11
|
+
nowMs: bigint;
|
|
12
|
+
};
|
|
11
13
|
getEpochAndSlotInNextL1Slot(): EpochAndSlot & {
|
|
12
14
|
now: bigint;
|
|
13
15
|
};
|
|
14
16
|
getProposerIndexEncoding(_epoch: EpochNumber, _slot: SlotNumber, _seed: bigint): `0x${string}`;
|
|
15
17
|
computeProposerIndex(_slot: SlotNumber, _epoch: EpochNumber, _seed: bigint, _size: bigint): bigint;
|
|
16
|
-
|
|
17
|
-
currentProposer: EthAddress | undefined;
|
|
18
|
-
nextProposer: EthAddress | undefined;
|
|
18
|
+
getCurrentAndNextSlot(): {
|
|
19
19
|
currentSlot: SlotNumber;
|
|
20
20
|
nextSlot: SlotNumber;
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
|
+
getProposerAttesterAddressInSlot(_slot: SlotNumber): Promise<EthAddress | undefined>;
|
|
22
23
|
isInCommittee(_slot: SlotTag, _validator: EthAddress): Promise<boolean>;
|
|
23
24
|
getRegisteredValidators(): Promise<EthAddress[]>;
|
|
24
25
|
filterInCommittee(_slot: SlotTag, _validators: EthAddress[]): Promise<EthAddress[]>;
|
|
25
26
|
}
|
|
26
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9ja19lcG9jaF9jYWNoZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0YXRlX21hY2hpbmUvbW9ja19lcG9jaF9jYWNoZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsbUJBQW1CLEVBQUUsa0JBQWtCLEVBQUUsT0FBTyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDekcsT0FBTyxFQUFFLFdBQVcsRUFBRSxVQUFVLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUMxRSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFM0Q7OztHQUdHO0FBQ0gscUJBQWEsY0FBZSxZQUFXLG1CQUFtQjtJQUN4RCxZQUFZLElBQUksT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBTzFDO0lBRUQsa0JBQWtCLElBQUksWUFBWSxHQUFHO1FBQUUsS0FBSyxFQUFFLE1B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CAAC,CAEnF;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"}
|
|
@@ -7,14 +7,16 @@ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
7
7
|
return Promise.resolve({
|
|
8
8
|
committee: undefined,
|
|
9
9
|
seed: 0n,
|
|
10
|
-
epoch: EpochNumber.ZERO
|
|
10
|
+
epoch: EpochNumber.ZERO,
|
|
11
|
+
isEscapeHatchOpen: false
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
getEpochAndSlotNow() {
|
|
14
15
|
return {
|
|
15
16
|
epoch: EpochNumber.ZERO,
|
|
16
17
|
slot: SlotNumber(0),
|
|
17
|
-
ts: 0n
|
|
18
|
+
ts: 0n,
|
|
19
|
+
nowMs: 0n
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
getEpochAndSlotInNextL1Slot() {
|
|
@@ -31,13 +33,14 @@ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
31
33
|
computeProposerIndex(_slot, _epoch, _seed, _size) {
|
|
32
34
|
return 0n;
|
|
33
35
|
}
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
currentProposer: undefined,
|
|
37
|
-
nextProposer: undefined,
|
|
36
|
+
getCurrentAndNextSlot() {
|
|
37
|
+
return {
|
|
38
38
|
currentSlot: SlotNumber(0),
|
|
39
39
|
nextSlot: SlotNumber(0)
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
getProposerAttesterAddressInSlot(_slot) {
|
|
43
|
+
return Promise.resolve(undefined);
|
|
41
44
|
}
|
|
42
45
|
isInCommittee(_slot, _validator) {
|
|
43
46
|
return Promise.resolve(false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
3
3
|
import type { MerkleTreeReadOperations, MerkleTreeWriteOperations, SnapshotDataKeys, WorldStateSynchronizer, WorldStateSynchronizerStatus } from '@aztec/stdlib/interfaces/server';
|
|
4
4
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
5
5
|
export declare class TXESynchronizer implements WorldStateSynchronizer {
|
|
@@ -7,7 +7,7 @@ export declare class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
7
7
|
private blockNumber;
|
|
8
8
|
constructor(nativeWorldStateService: NativeWorldStateService);
|
|
9
9
|
static create(): Promise<TXESynchronizer>;
|
|
10
|
-
handleL2Block(block:
|
|
10
|
+
handleL2Block(block: L2Block): Promise<void>;
|
|
11
11
|
/**
|
|
12
12
|
* Forces an immediate sync to an optionally provided minimum block number
|
|
13
13
|
* @param targetBlockNumber - The target block number that we must sync to. Will download unproven blocks if needed to reach it.
|
|
@@ -30,4 +30,4 @@ export declare class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
30
30
|
resumeSync(): void;
|
|
31
31
|
clear(): Promise<void>;
|
|
32
32
|
}
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3luY2hyb25pemVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc3RhdGVfbWFjaGluZS9zeW5jaHJvbml6ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRTlELE9BQU8sS0FBSyxFQUFFLE9BQU8sRUFB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QUMsQ0FFbEg7SUFFTSxLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUU1QjtJQUVNLE1BQU0sSUFBSSxPQUFPLENBQUMsNEJBQTRCLENBQUMsQ0FFckQ7SUFFTSxJQUFJLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUzQjtJQUVNLFFBQVEsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBRS9CO0lBRU0sVUFBVSxJQUFJLElBQUksQ0FFeEI7SUFFTSxLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUU1QjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,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,OAAO,iBAOxC;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"}
|
package/dest/txe_session.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { type Logger } from '@aztec/foundation/log';
|
|
4
4
|
import { KeyStore } from '@aztec/key-store';
|
|
5
5
|
import type { ProtocolContract } from '@aztec/protocol-contracts';
|
|
6
|
-
import { AddressStore, CapsuleStore, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
6
|
+
import { AddressStore, CapsuleStore, JobCoordinator, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
7
7
|
import { type IPrivateExecutionOracle, type IUtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
8
8
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
9
|
import { PrivateContextInputs } from '@aztec/stdlib/kernel';
|
|
@@ -27,7 +27,6 @@ export interface TXESessionStateHandler {
|
|
|
27
27
|
enterPrivateState(contractAddress?: AztecAddress, anchorBlockNumber?: BlockNumber): Promise<PrivateContextInputs>;
|
|
28
28
|
enterUtilityState(contractAddress?: AztecAddress): Promise<void>;
|
|
29
29
|
}
|
|
30
|
-
export declare const DEFAULT_ADDRESS: AztecAddress;
|
|
31
30
|
/**
|
|
32
31
|
* A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
|
|
33
32
|
* state, etc., independent of all other tests running in parallel.
|
|
@@ -46,12 +45,14 @@ export declare class TXESession implements TXESessionStateHandler {
|
|
|
46
45
|
private senderAddressBookStore;
|
|
47
46
|
private capsuleStore;
|
|
48
47
|
private privateEventStore;
|
|
48
|
+
private jobCoordinator;
|
|
49
|
+
private currentJobId;
|
|
49
50
|
private chainId;
|
|
50
51
|
private version;
|
|
51
52
|
private nextBlockTimestamp;
|
|
52
53
|
private state;
|
|
53
54
|
private authwits;
|
|
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);
|
|
55
|
+
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, jobCoordinator: JobCoordinator, currentJobId: string, chainId: Fr, version: Fr, nextBlockTimestamp: bigint);
|
|
55
56
|
static init(protocolContracts: ProtocolContract[]): Promise<TXESession>;
|
|
56
57
|
/**
|
|
57
58
|
* Processes an oracle function invoked by the Noir test associated to this session.
|
|
@@ -68,6 +69,7 @@ export declare class TXESession implements TXESessionStateHandler {
|
|
|
68
69
|
private exitPrivateState;
|
|
69
70
|
private exitPublicState;
|
|
70
71
|
private exitUtilityContext;
|
|
72
|
+
private utilityExecutorForContractSync;
|
|
71
73
|
}
|
|
72
74
|
export {};
|
|
73
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3Nlc3Npb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy90eGVfc2Vzc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDOUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sRUFBRSxLQUFLLE1BQU0sRUFBZ0IsTUFBTSx1QkFBdUIsQ0FBQztBQUNsRSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFNUMsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSwyQkFBMkIsQ0FBQztBQUNsRSxPQUFPLEVBQ0wsWUFBWSxFQUNaLFlBQVksRUFDWixjQUFjLEVBRWQsU0FBUyxFQUNULGlCQUFpQixFQUNqQixxQkFBcUIsRUFDckIsc0JBQXNCLEVBQ3RCLGtCQUFrQixFQUNuQixNQUFNLG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QixDQUFDLGVBQWUsR0FBRSxZQUE4QixpQkFxQ3RFO0lBRUQsT0FBTyxDQUFDLGlCQUFpQjtZQWlCWCxnQkFBZ0I7WUE2QmhCLGVBQWU7SUFTN0IsT0FBTyxDQUFDLGtCQUFrQjtJQU0xQixPQUFPLENBQUMsOEJBQThCO0NBNEN2QyJ9
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,EACZ,cAAc,EAEd,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAI7B,MAAM,sBAAsB,CAAC;AAW9B,OAAO,EAAE,YAAY,EAAE,MAAM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iBAAiB,CACrB,eAAe,GAAE,YAA8B,EAC/C,iBAAiB,CAAC,EAAE,WAAW,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CA+D/B;IAEK,gBAAgB,CAAC,eAAe,CAAC,EAAE,YAAY,iBAsBpD;IAEK,iBAAiB,CAAC,eAAe,GAAE,YAA8B,iBAqCtE;IAED,OAAO,CAAC,iBAAiB;YAiBX,gBAAgB;YA6BhB,eAAe;IAS7B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,8BAA8B;CA4CvC"}
|
package/dest/txe_session.js
CHANGED
|
@@ -3,15 +3,17 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { KeyStore } from '@aztec/key-store';
|
|
5
5
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
6
|
-
import { AddressStore, CapsuleStore, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
7
|
-
import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
8
|
-
import {
|
|
6
|
+
import { AddressStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
7
|
+
import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
8
|
+
import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
|
|
9
|
+
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
9
10
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
10
11
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
11
12
|
import { computeProtocolNullifier } from '@aztec/stdlib/hash';
|
|
12
13
|
import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
13
14
|
import { CallContext, TxContext } from '@aztec/stdlib/tx';
|
|
14
15
|
import { z } from 'zod';
|
|
16
|
+
import { DEFAULT_ADDRESS } from './constants.js';
|
|
15
17
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
16
18
|
import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
|
|
17
19
|
import { RPCTranslator } from './rpc_translator.js';
|
|
@@ -20,7 +22,6 @@ import { TXEAccountStore } from './util/txe_account_store.js';
|
|
|
20
22
|
import { TXEContractStore } from './util/txe_contract_store.js';
|
|
21
23
|
import { getSingleTxBlockRequestHash, insertTxEffectIntoWorldTrees, makeTXEBlock } from './utils/block_creation.js';
|
|
22
24
|
import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
23
|
-
export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
24
25
|
/**
|
|
25
26
|
* A `TXESession` corresponds to a Noir `#[test]` function, and handles all of its oracle calls, stores test-specific
|
|
26
27
|
* state, etc., independent of all other tests running in parallel.
|
|
@@ -38,12 +39,14 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
38
39
|
senderAddressBookStore;
|
|
39
40
|
capsuleStore;
|
|
40
41
|
privateEventStore;
|
|
42
|
+
jobCoordinator;
|
|
43
|
+
currentJobId;
|
|
41
44
|
chainId;
|
|
42
45
|
version;
|
|
43
46
|
nextBlockTimestamp;
|
|
44
47
|
state;
|
|
45
48
|
authwits;
|
|
46
|
-
constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, chainId, version, nextBlockTimestamp){
|
|
49
|
+
constructor(logger, stateMachine, oracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, currentJobId, chainId, version, nextBlockTimestamp){
|
|
47
50
|
this.logger = logger;
|
|
48
51
|
this.stateMachine = stateMachine;
|
|
49
52
|
this.oracleHandler = oracleHandler;
|
|
@@ -57,6 +60,8 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
57
60
|
this.senderAddressBookStore = senderAddressBookStore;
|
|
58
61
|
this.capsuleStore = capsuleStore;
|
|
59
62
|
this.privateEventStore = privateEventStore;
|
|
63
|
+
this.jobCoordinator = jobCoordinator;
|
|
64
|
+
this.currentJobId = currentJobId;
|
|
60
65
|
this.chainId = chainId;
|
|
61
66
|
this.version = version;
|
|
62
67
|
this.nextBlockTimestamp = nextBlockTimestamp;
|
|
@@ -70,13 +75,22 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
70
75
|
const addressStore = new AddressStore(store);
|
|
71
76
|
const privateEventStore = new PrivateEventStore(store);
|
|
72
77
|
const contractStore = new TXEContractStore(store);
|
|
73
|
-
const noteStore =
|
|
78
|
+
const noteStore = new NoteStore(store);
|
|
74
79
|
const senderTaggingStore = new SenderTaggingStore(store);
|
|
75
80
|
const recipientTaggingStore = new RecipientTaggingStore(store);
|
|
76
81
|
const senderAddressBookStore = new SenderAddressBookStore(store);
|
|
77
82
|
const capsuleStore = new CapsuleStore(store);
|
|
78
83
|
const keyStore = new KeyStore(store);
|
|
79
84
|
const accountStore = new TXEAccountStore(store);
|
|
85
|
+
// Create job coordinator and register staged stores
|
|
86
|
+
const jobCoordinator = new JobCoordinator(store);
|
|
87
|
+
jobCoordinator.registerStores([
|
|
88
|
+
capsuleStore,
|
|
89
|
+
senderTaggingStore,
|
|
90
|
+
recipientTaggingStore,
|
|
91
|
+
privateEventStore,
|
|
92
|
+
noteStore
|
|
93
|
+
]);
|
|
80
94
|
// Register protocol contracts.
|
|
81
95
|
for (const { contractClass, instance, artifact } of protocolContracts){
|
|
82
96
|
await contractStore.addContractArtifact(contractClass.id, artifact);
|
|
@@ -86,9 +100,10 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
86
100
|
const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
|
|
87
101
|
const version = new Fr(await stateMachine.node.getVersion());
|
|
88
102
|
const chainId = new Fr(await stateMachine.node.getChainId());
|
|
89
|
-
const
|
|
103
|
+
const initialJobId = jobCoordinator.beginJob();
|
|
104
|
+
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, initialJobId, nextBlockTimestamp, version, chainId, new Map());
|
|
90
105
|
await topLevelOracleHandler.txeAdvanceBlocksBy(1);
|
|
91
|
-
return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, version, chainId, nextBlockTimestamp);
|
|
106
|
+
return new TXESession(createLogger('txe:session'), stateMachine, topLevelOracleHandler, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, senderAddressBookStore, capsuleStore, privateEventStore, jobCoordinator, initialJobId, version, chainId, nextBlockTimestamp);
|
|
92
107
|
}
|
|
93
108
|
/**
|
|
94
109
|
* Processes an oracle function invoked by the Noir test associated to this session.
|
|
@@ -137,7 +152,10 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
137
152
|
this.state;
|
|
138
153
|
}
|
|
139
154
|
}
|
|
140
|
-
|
|
155
|
+
// Commit all staged stores from the job that was just completed, then begin a new job
|
|
156
|
+
await this.jobCoordinator.commitJob(this.currentJobId);
|
|
157
|
+
this.currentJobId = this.jobCoordinator.beginJob();
|
|
158
|
+
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.currentJobId, this.nextBlockTimestamp, this.version, this.chainId, this.authwits);
|
|
141
159
|
this.state = {
|
|
142
160
|
name: 'TOP_LEVEL'
|
|
143
161
|
};
|
|
@@ -145,12 +163,7 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
145
163
|
}
|
|
146
164
|
async enterPrivateState(contractAddress = DEFAULT_ADDRESS, anchorBlockNumber) {
|
|
147
165
|
this.exitTopLevelState();
|
|
148
|
-
|
|
149
|
-
// contexts, which means that known nullifiers are also not searched for, since it is during the tagging sync that
|
|
150
|
-
// we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
|
|
151
|
-
// be removed from the database.
|
|
152
|
-
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
153
|
-
await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore).syncNoteNullifiers(contractAddress);
|
|
166
|
+
await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.currentJobId).syncNoteNullifiers(contractAddress);
|
|
154
167
|
// Private execution has two associated block numbers: the anchor block (i.e. the historical block that is used to
|
|
155
168
|
// build the proof), and the *next* block, i.e. the one we'll create once the execution ends, and which will contain
|
|
156
169
|
// a single transaction with the effects of what was done in the test.
|
|
@@ -166,7 +179,8 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
166
179
|
const protocolNullifier = await computeProtocolNullifier(txRequestHash);
|
|
167
180
|
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
168
181
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
169
|
-
|
|
182
|
+
const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
|
|
183
|
+
this.oracleHandler = new PrivateExecutionOracle(Fr.ZERO, new TxContext(this.chainId, this.version, GasSettings.empty()), new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false), anchorBlock, utilityExecutor, [], [], 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, this.currentJobId);
|
|
170
184
|
// We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
|
|
171
185
|
// data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
|
|
172
186
|
// difference resides in that the simulator has all information needed in order to run the simulation, while ours
|
|
@@ -175,7 +189,6 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
175
189
|
this.state = {
|
|
176
190
|
name: 'PRIVATE',
|
|
177
191
|
nextBlockGlobalVariables,
|
|
178
|
-
protocolNullifier,
|
|
179
192
|
noteCache,
|
|
180
193
|
taggingIndexCache
|
|
181
194
|
};
|
|
@@ -206,9 +219,9 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
206
219
|
// we perform this. We therefore search for known nullifiers now, as otherwise notes that were nullified would not
|
|
207
220
|
// be removed from the database.
|
|
208
221
|
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
209
|
-
await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore).syncNoteNullifiers(contractAddress);
|
|
222
|
+
await new NoteService(this.noteStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.currentJobId).syncNoteNullifiers(contractAddress);
|
|
210
223
|
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);
|
|
224
|
+
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, this.currentJobId);
|
|
212
225
|
this.state = {
|
|
213
226
|
name: 'UTILITY'
|
|
214
227
|
};
|
|
@@ -238,7 +251,7 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
238
251
|
});
|
|
239
252
|
// We rely on the note cache to determine the effects of the transaction. This is incomplete as it doesn't private
|
|
240
253
|
// logs (other effects like enqueued public calls don't need to be considered since those are not allowed).
|
|
241
|
-
const txEffect = await makeTxEffect(this.state.noteCache, this.state.
|
|
254
|
+
const txEffect = await makeTxEffect(this.state.noteCache, this.state.nextBlockGlobalVariables.blockNumber);
|
|
242
255
|
// We build a block holding just this transaction
|
|
243
256
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
244
257
|
await insertTxEffectIntoWorldTrees(txEffect, forkedWorldTrees);
|
|
@@ -264,4 +277,26 @@ export const DEFAULT_ADDRESS = AztecAddress.fromNumber(42);
|
|
|
264
277
|
throw new Error(`Expected to be in state 'UTILITY', but got '${this.state.name}' instead`);
|
|
265
278
|
}
|
|
266
279
|
}
|
|
280
|
+
utilityExecutorForContractSync(anchorBlock) {
|
|
281
|
+
return async (call)=>{
|
|
282
|
+
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
283
|
+
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
284
|
+
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
const oracle = new UtilityExecutionOracle(call.to, [], [], anchorBlock, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.stateMachine.node, this.stateMachine.anchorBlockStore, this.recipientTaggingStore, this.senderAddressBookStore, this.capsuleStore, this.privateEventStore, this.currentJobId);
|
|
288
|
+
await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
|
|
289
|
+
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
290
|
+
throw new ExecutionError(err.message, {
|
|
291
|
+
contractAddress: call.to,
|
|
292
|
+
functionSelector: call.selector
|
|
293
|
+
}, extractCallStack(err, entryPointArtifact.debug), {
|
|
294
|
+
cause: err
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
} catch (err) {
|
|
298
|
+
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error contract data sync'));
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
267
302
|
}
|
package/dest/util/encoding.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
|
|
|
150
150
|
error_kind: "custom";
|
|
151
151
|
} & import("@aztec/stdlib/abi").AbiType) | undefined>;
|
|
152
152
|
}>, z.ZodObject<{
|
|
153
|
-
bytecode: import("
|
|
153
|
+
bytecode: import("@aztec/foundation/schemas").ZodFor<Buffer<ArrayBufferLike>>;
|
|
154
154
|
verificationKey: z.ZodOptional<z.ZodString>;
|
|
155
155
|
debugSymbols: z.ZodString;
|
|
156
156
|
debug: z.ZodOptional<z.ZodObject<{
|
|
@@ -656,27 +656,27 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
|
|
|
656
656
|
}>;
|
|
657
657
|
}>, z.ZodIntersection<z.ZodObject<{
|
|
658
658
|
version: z.ZodLiteral<1>;
|
|
659
|
-
salt: import("
|
|
660
|
-
deployer: import("
|
|
661
|
-
currentContractClassId: import("
|
|
662
|
-
originalContractClassId: import("
|
|
663
|
-
initializationHash: import("
|
|
659
|
+
salt: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
660
|
+
deployer: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
661
|
+
currentContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
662
|
+
originalContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
663
|
+
initializationHash: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
664
664
|
publicKeys: z.ZodEffects<z.ZodObject<{
|
|
665
|
-
masterNullifierPublicKey: z.ZodType<import("
|
|
666
|
-
masterIncomingViewingPublicKey: z.ZodType<import("
|
|
667
|
-
masterOutgoingViewingPublicKey: z.ZodType<import("
|
|
668
|
-
masterTaggingPublicKey: z.ZodType<import("
|
|
665
|
+
masterNullifierPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
|
|
666
|
+
masterIncomingViewingPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
|
|
667
|
+
masterOutgoingViewingPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
|
|
668
|
+
masterTaggingPublicKey: z.ZodType<import("@aztec/foundation/schemas").Point, any, string>;
|
|
669
669
|
}, "strip", z.ZodTypeAny, {
|
|
670
|
-
masterNullifierPublicKey: import("
|
|
671
|
-
masterIncomingViewingPublicKey: import("
|
|
672
|
-
masterOutgoingViewingPublicKey: import("
|
|
673
|
-
masterTaggingPublicKey: import("
|
|
670
|
+
masterNullifierPublicKey: import("@aztec/foundation/schemas").Point;
|
|
671
|
+
masterIncomingViewingPublicKey: import("@aztec/foundation/schemas").Point;
|
|
672
|
+
masterOutgoingViewingPublicKey: import("@aztec/foundation/schemas").Point;
|
|
673
|
+
masterTaggingPublicKey: import("@aztec/foundation/schemas").Point;
|
|
674
674
|
}, {
|
|
675
675
|
masterNullifierPublicKey: string;
|
|
676
676
|
masterIncomingViewingPublicKey: string;
|
|
677
677
|
masterOutgoingViewingPublicKey: string;
|
|
678
678
|
masterTaggingPublicKey: string;
|
|
679
|
-
}>, import("
|
|
679
|
+
}>, import("@aztec/stdlib/keys").PublicKeys, {
|
|
680
680
|
masterNullifierPublicKey: string;
|
|
681
681
|
masterIncomingViewingPublicKey: string;
|
|
682
682
|
masterOutgoingViewingPublicKey: string;
|
|
@@ -689,7 +689,7 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
|
|
|
689
689
|
currentContractClassId: Fr;
|
|
690
690
|
originalContractClassId: Fr;
|
|
691
691
|
initializationHash: Fr;
|
|
692
|
-
publicKeys: import("
|
|
692
|
+
publicKeys: import("@aztec/stdlib/keys").PublicKeys;
|
|
693
693
|
}, {
|
|
694
694
|
version: 1;
|
|
695
695
|
salt?: any;
|
|
@@ -704,7 +704,7 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<[z.ZodString,
|
|
|
704
704
|
masterTaggingPublicKey: string;
|
|
705
705
|
};
|
|
706
706
|
}>, z.ZodObject<{
|
|
707
|
-
address: import("
|
|
707
|
+
address: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
708
708
|
}, "strip", z.ZodTypeAny, {
|
|
709
709
|
address: AztecAddress;
|
|
710
710
|
}, {
|