@aztec/txe 0.0.1-commit.6230efd → 0.0.1-commit.6b90f3f5
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/oracle/interfaces.d.ts +3 -3
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +3 -3
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +6 -6
- package/dest/oracle/txe_oracle_top_level_context.d.ts +3 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +29 -21
- package/dest/rpc_translator.d.ts +16 -10
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +52 -39
- 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 +57 -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 +22 -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 +5 -3
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +30 -14
- 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/oracle/interfaces.ts +2 -2
- package/src/oracle/txe_oracle_public_context.ts +6 -8
- package/src/oracle/txe_oracle_top_level_context.ts +49 -21
- package/src/rpc_translator.ts +56 -49
- package/src/state_machine/archiver.ts +52 -220
- 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 +26 -4
- package/src/state_machine/mock_epoch_cache.ts +10 -11
- package/src/state_machine/synchronizer.ts +2 -2
- package/src/txe_session.ts +37 -20
- package/src/utils/block_creation.ts +17 -16
- package/src/utils/tx_effect_creation.ts +3 -11
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
|
}, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { L2Block
|
|
3
|
+
import { L2Block } from '@aztec/stdlib/block';
|
|
4
4
|
import { type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
5
|
-
import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
5
|
+
import { BlockHeader, GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
6
6
|
/**
|
|
7
7
|
* Returns a transaction request hash that is valid for transactions that are the only ones in a block.
|
|
8
8
|
* @param blockNumber The number for the block in which there is a single transaction.
|
|
@@ -10,7 +10,7 @@ import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function getSingleTxBlockRequestHash(blockNumber: BlockNumber): Fr;
|
|
12
12
|
export declare function insertTxEffectIntoWorldTrees(txEffect: TxEffect, worldTrees: MerkleTreeWriteOperations): Promise<void>;
|
|
13
|
-
export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<
|
|
13
|
+
export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<BlockHeader>;
|
|
14
14
|
/**
|
|
15
15
|
* Creates an L2Block with proper archive chaining.
|
|
16
16
|
* This function:
|
|
@@ -25,4 +25,4 @@ export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations
|
|
|
25
25
|
* @returns The created L2Block with proper archive chaining
|
|
26
26
|
*/
|
|
27
27
|
export declare function makeTXEBlock(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables, txEffects: TxEffect[]): Promise<L2Block>;
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcmVhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxPQUFPLEVBQUUsV0FBVyxFQUEyQyxNQUFNLGlDQUFpQyxDQUFDO0FBRXZHLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQVEsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDcEQsT0FBTyxFQUF3QyxLQUFLLHlCQUF5QixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDM0csT0FBTyxFQUFFLFdBQVcsRUFBRSxlQUFlLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFMUU7Ozs7R0FJRztBQUNILHdCQUFnQiwyQkFBMkIsQ0FBQyxXQUFXLEVBQUUsV0FBVyxHQUFHLEVBQUUsQ0FFeEU7QUFFRCx3QkFBc0IsNEJBQTRCLENBQ2hELFFBQVEsRUFBRSxRQUFRLEVBQ2xCLFVBQVUsRUFBRSx5QkFBeUIsR0FDcEMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQWtCZjtBQUVELHdCQUFzQixrQkFBa0IsQ0FDdEMsVUFBVSxFQUFFLHlCQUF5QixFQUNyQyxlQUFlLEVBQUUsZUFBZSxHQUMvQixPQUFPLENBQUMsV0FBVyxDQUFDLENBWXRCO0FBRUQ7Ozs7Ozs7Ozs7OztHQVlHO0FBQ0gsd0JBQXNCLFlBQVksQ0FDaEMsVUFBVSxFQUFFLHlCQUF5QixFQUNyQyxlQUFlLEVBQUUsZUFBZSxFQUNoQyxTQUFTLEVBQUUsUUFBUSxFQUFFLEdBQ3BCLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FlbEIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAA2C,MAAM,iCAAiC,CAAC;AAEvG,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAQ,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAwC,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,CAExE;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAelB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, NULLIFIER_SUBTREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/constants';
|
|
2
|
+
import { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import { Body, L2Block
|
|
5
|
-
import { makeContentCommitment } from '@aztec/stdlib/testing';
|
|
5
|
+
import { Body, L2Block } from '@aztec/stdlib/block';
|
|
6
6
|
import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
7
|
+
import { BlockHeader } from '@aztec/stdlib/tx';
|
|
7
8
|
/**
|
|
8
9
|
* Returns a transaction request hash that is valid for transactions that are the only ones in a block.
|
|
9
10
|
* @param blockNumber The number for the block in which there is a single transaction.
|
|
@@ -20,7 +21,14 @@ export async function insertTxEffectIntoWorldTrees(txEffect, worldTrees) {
|
|
|
20
21
|
export async function makeTXEBlockHeader(worldTrees, globalVariables) {
|
|
21
22
|
const stateReference = await worldTrees.getStateReference();
|
|
22
23
|
const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
23
|
-
return
|
|
24
|
+
return BlockHeader.from({
|
|
25
|
+
lastArchive: new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)),
|
|
26
|
+
spongeBlobHash: Fr.ZERO,
|
|
27
|
+
state: stateReference,
|
|
28
|
+
globalVariables,
|
|
29
|
+
totalFees: Fr.ZERO,
|
|
30
|
+
totalManaUsed: Fr.ZERO
|
|
31
|
+
});
|
|
24
32
|
}
|
|
25
33
|
/**
|
|
26
34
|
* Creates an L2Block with proper archive chaining.
|
|
@@ -37,9 +45,12 @@ export async function makeTXEBlockHeader(worldTrees, globalVariables) {
|
|
|
37
45
|
*/ export async function makeTXEBlock(worldTrees, globalVariables, txEffects) {
|
|
38
46
|
const header = await makeTXEBlockHeader(worldTrees, globalVariables);
|
|
39
47
|
// Update the archive tree with this block's header hash
|
|
40
|
-
await worldTrees.updateArchive(header
|
|
48
|
+
await worldTrees.updateArchive(header);
|
|
41
49
|
// Get the new archive state after updating
|
|
42
50
|
const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
43
51
|
const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
|
|
44
|
-
|
|
52
|
+
// L2Block requires checkpointNumber and indexWithinCheckpoint
|
|
53
|
+
const checkpointNumber = CheckpointNumber.fromBlockNumber(globalVariables.blockNumber);
|
|
54
|
+
const indexWithinCheckpoint = IndexWithinCheckpoint(0);
|
|
55
|
+
return new L2Block(newArchive, header, new Body(txEffects), checkpointNumber, indexWithinCheckpoint);
|
|
45
56
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
2
|
import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
4
3
|
import { TxEffect } from '@aztec/stdlib/tx';
|
|
5
|
-
export declare function makeTxEffect(noteCache: ExecutionNoteCache,
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
4
|
+
export declare function makeTxEffect(noteCache: ExecutionNoteCache, txBlockNumber: BlockNumber): Promise<TxEffect>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZWZmZWN0X2NyZWF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvdHhfZWZmZWN0X2NyZWF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5RCxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRS9ELE9BQU8sRUFBRSxRQUFRLEVBQVUsTUFBTSxrQkFBa0IsQ0FBQztBQUVwRCx3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxrQkFBa0IsRUFBRSxhQUFhLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0F1Qi9HIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAAC,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuB/G"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/stdlib/hash';
|
|
3
3
|
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
4
|
-
export async function makeTxEffect(noteCache,
|
|
4
|
+
export async function makeTxEffect(noteCache, txBlockNumber) {
|
|
5
5
|
const txEffect = TxEffect.empty();
|
|
6
|
-
|
|
7
|
-
const nonceGenerator =
|
|
6
|
+
noteCache.finish();
|
|
7
|
+
const nonceGenerator = noteCache.getNonceGenerator();
|
|
8
8
|
txEffect.noteHashes = await Promise.all(noteCache.getAllNotes().map(async (pendingNote, i)=>computeUniqueNoteHash(await computeNoteHashNonce(nonceGenerator, i), await siloNoteHash(pendingNote.note.contractAddress, pendingNote.noteHashForConsumption))));
|
|
9
9
|
// Nullifiers are already siloed
|
|
10
10
|
txEffect.nullifiers = noteCache.getAllNullifiers();
|
|
11
|
-
if (usedProtocolNullifierForNonces) {
|
|
12
|
-
txEffect.nullifiers.unshift(protocolNullifier);
|
|
13
|
-
}
|
|
14
11
|
txEffect.txHash = new TxHash(new Fr(txBlockNumber));
|
|
15
12
|
return txEffect;
|
|
16
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.6b90f3f5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -61,27 +61,27 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
65
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
66
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
67
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
68
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
69
|
-
"@aztec/constants": "0.0.1-commit.
|
|
70
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
71
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
72
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
73
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
74
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
75
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
76
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
64
|
+
"@aztec/accounts": "0.0.1-commit.6b90f3f5",
|
|
65
|
+
"@aztec/archiver": "0.0.1-commit.6b90f3f5",
|
|
66
|
+
"@aztec/aztec-node": "0.0.1-commit.6b90f3f5",
|
|
67
|
+
"@aztec/aztec.js": "0.0.1-commit.6b90f3f5",
|
|
68
|
+
"@aztec/bb-prover": "0.0.1-commit.6b90f3f5",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.6b90f3f5",
|
|
70
|
+
"@aztec/foundation": "0.0.1-commit.6b90f3f5",
|
|
71
|
+
"@aztec/key-store": "0.0.1-commit.6b90f3f5",
|
|
72
|
+
"@aztec/kv-store": "0.0.1-commit.6b90f3f5",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.6b90f3f5",
|
|
74
|
+
"@aztec/pxe": "0.0.1-commit.6b90f3f5",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.6b90f3f5",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.6b90f3f5",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.6b90f3f5",
|
|
78
78
|
"zod": "^3.23.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@jest/globals": "^30.0.0",
|
|
82
82
|
"@types/jest": "^30.0.0",
|
|
83
83
|
"@types/node": "^22.15.17",
|
|
84
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
84
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
85
85
|
"jest": "^30.0.0",
|
|
86
86
|
"jest-mock-extended": "^4.0.0",
|
|
87
87
|
"ts-node": "^10.9.1",
|
package/src/oracle/interfaces.ts
CHANGED
|
@@ -33,9 +33,9 @@ export interface IAvmExecutionOracle {
|
|
|
33
33
|
avmOpcodeVersion(): Promise<Fr>;
|
|
34
34
|
avmOpcodeEmitNullifier(nullifier: Fr): Promise<void>;
|
|
35
35
|
avmOpcodeEmitNoteHash(noteHash: Fr): Promise<void>;
|
|
36
|
-
avmOpcodeNullifierExists(
|
|
36
|
+
avmOpcodeNullifierExists(siloedNullifier: Fr): Promise<boolean>;
|
|
37
37
|
avmOpcodeStorageWrite(slot: Fr, value: Fr): Promise<void>;
|
|
38
|
-
avmOpcodeStorageRead(slot: Fr): Promise<Fr>;
|
|
38
|
+
avmOpcodeStorageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -78,13 +78,11 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
78
78
|
this.transientUniqueNoteHashes.push(siloedNoteHash);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async avmOpcodeNullifierExists(
|
|
82
|
-
const nullifier = await siloNullifier(targetAddress, innerNullifier!);
|
|
83
|
-
|
|
81
|
+
async avmOpcodeNullifierExists(siloedNullifier: Fr): Promise<boolean> {
|
|
84
82
|
const treeIndex = (
|
|
85
|
-
await this.forkedWorldTrees.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [
|
|
83
|
+
await this.forkedWorldTrees.findLeafIndices(MerkleTreeId.NULLIFIER_TREE, [siloedNullifier.toBuffer()])
|
|
86
84
|
)[0];
|
|
87
|
-
const transientIndex = this.transientSiloedNullifiers.find(n => n.equals(
|
|
85
|
+
const transientIndex = this.transientSiloedNullifiers.find(n => n.equals(siloedNullifier));
|
|
88
86
|
|
|
89
87
|
return treeIndex !== undefined || transientIndex !== undefined;
|
|
90
88
|
}
|
|
@@ -101,8 +99,8 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
101
99
|
]);
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
async avmOpcodeStorageRead(slot: Fr): Promise<Fr> {
|
|
105
|
-
const leafSlot = await computePublicDataTreeLeafSlot(
|
|
102
|
+
async avmOpcodeStorageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr> {
|
|
103
|
+
const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, slot);
|
|
106
104
|
|
|
107
105
|
const lowLeafResult = await this.forkedWorldTrees.getPreviousValueIndex(
|
|
108
106
|
MerkleTreeId.PUBLIC_DATA_TREE,
|
|
@@ -119,7 +117,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
119
117
|
)) as PublicDataTreeLeafPreimage
|
|
120
118
|
).leaf.value;
|
|
121
119
|
|
|
122
|
-
this.logger.debug('AVM storage read', { slot, value });
|
|
120
|
+
this.logger.debug('AVM storage read', { slot, contractAddress, value });
|
|
123
121
|
|
|
124
122
|
return value;
|
|
125
123
|
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
SenderAddressBookStore,
|
|
23
23
|
SenderTaggingStore,
|
|
24
24
|
enrichPublicSimulationError,
|
|
25
|
+
syncState,
|
|
25
26
|
} from '@aztec/pxe/server';
|
|
26
27
|
import {
|
|
27
28
|
ExecutionNoteCache,
|
|
@@ -106,6 +107,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
106
107
|
private senderAddressBookStore: SenderAddressBookStore,
|
|
107
108
|
private capsuleStore: CapsuleStore,
|
|
108
109
|
private privateEventStore: PrivateEventStore,
|
|
110
|
+
private jobId: string,
|
|
109
111
|
private nextBlockTimestamp: bigint,
|
|
110
112
|
private version: Fr,
|
|
111
113
|
private chainId: Fr,
|
|
@@ -156,7 +158,8 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
async txeGetLastTxEffects() {
|
|
159
|
-
const
|
|
161
|
+
const latestBlockNumber = await this.stateMachine.archiver.getBlockNumber();
|
|
162
|
+
const block = await this.stateMachine.archiver.getBlock(latestBlockNumber);
|
|
160
163
|
|
|
161
164
|
if (block!.body.txEffects.length != 1) {
|
|
162
165
|
// Note that calls like env.mine() will result in blocks with no transactions, hitting this
|
|
@@ -299,7 +302,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
299
302
|
await this.executeUtilityCall(call);
|
|
300
303
|
};
|
|
301
304
|
|
|
302
|
-
await this.contractStore
|
|
305
|
+
await syncState(targetContractAddress, this.contractStore, functionSelector, utilityExecutor);
|
|
303
306
|
|
|
304
307
|
const blockNumber = await this.txeGetNextBlockNumber();
|
|
305
308
|
|
|
@@ -315,6 +318,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
315
318
|
|
|
316
319
|
const protocolNullifier = await computeProtocolNullifier(getSingleTxBlockRequestHash(blockNumber));
|
|
317
320
|
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
321
|
+
// In production, the account contract sets the min revertible counter before calling the app function.
|
|
322
|
+
// Since TXE bypasses the account contract, we simulate this by setting minRevertibleSideEffectCounter to 1,
|
|
323
|
+
// marking all side effects as revertible.
|
|
324
|
+
const minRevertibleSideEffectCounter = 1;
|
|
325
|
+
await noteCache.setMinRevertibleSideEffectCounter(minRevertibleSideEffectCounter);
|
|
318
326
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
319
327
|
|
|
320
328
|
const simulator = new WASMSimulator();
|
|
@@ -338,14 +346,14 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
338
346
|
this.keyStore,
|
|
339
347
|
this.addressStore,
|
|
340
348
|
this.stateMachine.node,
|
|
341
|
-
this.stateMachine.anchorBlockStore,
|
|
342
349
|
this.senderTaggingStore,
|
|
343
350
|
this.recipientTaggingStore,
|
|
344
351
|
this.senderAddressBookStore,
|
|
345
352
|
this.capsuleStore,
|
|
346
353
|
this.privateEventStore,
|
|
347
|
-
|
|
348
|
-
|
|
354
|
+
this.jobId,
|
|
355
|
+
0, // totalPublicArgsCount
|
|
356
|
+
minRevertibleSideEffectCounter, // (start) sideEffectCounter
|
|
349
357
|
undefined, // log
|
|
350
358
|
undefined, // scopes
|
|
351
359
|
/**
|
|
@@ -381,19 +389,21 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
381
389
|
}),
|
|
382
390
|
);
|
|
383
391
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
result = new PrivateExecutionResult(executionResult, Fr.ZERO, publicFunctionsCalldata);
|
|
392
|
+
noteCache.finish();
|
|
393
|
+
const nonceGenerator = noteCache.getNonceGenerator();
|
|
394
|
+
result = new PrivateExecutionResult(executionResult, nonceGenerator, publicFunctionsCalldata);
|
|
388
395
|
} catch (err) {
|
|
389
396
|
throw createSimulationError(err instanceof Error ? err : new Error('Unknown error during private execution'));
|
|
390
397
|
}
|
|
391
398
|
|
|
392
|
-
// According to the protocol rules,
|
|
393
|
-
//
|
|
394
|
-
//
|
|
395
|
-
const
|
|
396
|
-
|
|
399
|
+
// According to the protocol rules, there must be at least one nullifier in the tx. The first nullifier is used as
|
|
400
|
+
// the nonce generator for the note hashes.
|
|
401
|
+
// We pass the non-zero minRevertibleSideEffectCounter to make sure the side effects are split correctly.
|
|
402
|
+
const { publicInputs } = await generateSimulatedProvingResult(
|
|
403
|
+
result,
|
|
404
|
+
this.contractStore,
|
|
405
|
+
minRevertibleSideEffectCounter,
|
|
406
|
+
);
|
|
397
407
|
|
|
398
408
|
const globals = makeGlobalVariables();
|
|
399
409
|
globals.blockNumber = blockNumber;
|
|
@@ -404,7 +414,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
404
414
|
|
|
405
415
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
406
416
|
|
|
407
|
-
const
|
|
417
|
+
const bindings = this.logger.getBindings();
|
|
418
|
+
const contractsDB = new PublicContractsDB(
|
|
419
|
+
new TXEPublicContractDataSource(blockNumber, this.contractStore),
|
|
420
|
+
bindings,
|
|
421
|
+
);
|
|
408
422
|
const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
|
|
409
423
|
const config = PublicSimulatorConfig.from({
|
|
410
424
|
skipFeeEnforcement: true,
|
|
@@ -417,8 +431,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
417
431
|
globals,
|
|
418
432
|
guardedMerkleTrees,
|
|
419
433
|
contractsDB,
|
|
420
|
-
new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config),
|
|
434
|
+
new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config, bindings),
|
|
421
435
|
new TestDateProvider(),
|
|
436
|
+
undefined,
|
|
437
|
+
createLogger('simulator:public-processor', bindings),
|
|
422
438
|
);
|
|
423
439
|
|
|
424
440
|
const tx = await Tx.create({
|
|
@@ -515,7 +531,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
515
531
|
|
|
516
532
|
const forkedWorldTrees = await this.stateMachine.synchronizer.nativeWorldStateService.fork();
|
|
517
533
|
|
|
518
|
-
const
|
|
534
|
+
const bindings2 = this.logger.getBindings();
|
|
535
|
+
const contractsDB = new PublicContractsDB(
|
|
536
|
+
new TXEPublicContractDataSource(blockNumber, this.contractStore),
|
|
537
|
+
bindings2,
|
|
538
|
+
);
|
|
519
539
|
const guardedMerkleTrees = new GuardedMerkleTreeOperations(forkedWorldTrees);
|
|
520
540
|
const config = PublicSimulatorConfig.from({
|
|
521
541
|
skipFeeEnforcement: true,
|
|
@@ -524,8 +544,16 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
524
544
|
collectStatistics: false,
|
|
525
545
|
collectCallMetadata: true,
|
|
526
546
|
});
|
|
527
|
-
const simulator = new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config);
|
|
528
|
-
const processor = new PublicProcessor(
|
|
547
|
+
const simulator = new CppPublicTxSimulator(guardedMerkleTrees, contractsDB, globals, config, bindings2);
|
|
548
|
+
const processor = new PublicProcessor(
|
|
549
|
+
globals,
|
|
550
|
+
guardedMerkleTrees,
|
|
551
|
+
contractsDB,
|
|
552
|
+
simulator,
|
|
553
|
+
new TestDateProvider(),
|
|
554
|
+
undefined,
|
|
555
|
+
createLogger('simulator:public-processor', bindings2),
|
|
556
|
+
);
|
|
529
557
|
|
|
530
558
|
// We're simulating a scenario in which private execution immediately enqueues a public call and halts. The private
|
|
531
559
|
// kernel init would in this case inject a nullifier with the transaction request hash as a non-revertible
|
|
@@ -635,7 +663,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
635
663
|
}
|
|
636
664
|
|
|
637
665
|
// Sync notes before executing utility function to discover notes from previous transactions
|
|
638
|
-
await this.contractStore
|
|
666
|
+
await syncState(targetContractAddress, this.contractStore, functionSelector, async call => {
|
|
639
667
|
await this.executeUtilityCall(call);
|
|
640
668
|
});
|
|
641
669
|
|
|
@@ -676,11 +704,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
676
704
|
this.keyStore,
|
|
677
705
|
this.addressStore,
|
|
678
706
|
this.stateMachine.node,
|
|
679
|
-
this.stateMachine.anchorBlockStore,
|
|
680
707
|
this.recipientTaggingStore,
|
|
681
708
|
this.senderAddressBookStore,
|
|
682
709
|
this.capsuleStore,
|
|
683
710
|
this.privateEventStore,
|
|
711
|
+
this.jobId,
|
|
684
712
|
);
|
|
685
713
|
const acirExecutionResult = await new WASMSimulator()
|
|
686
714
|
.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
|