@aztec/txe 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108
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/bin/index.js +1 -1
- package/dest/constants.d.ts +3 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +8 -4
- package/dest/oracle/interfaces.d.ts +57 -0
- package/dest/oracle/interfaces.d.ts.map +1 -0
- package/dest/oracle/interfaces.js +3 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +12 -12
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +30 -34
- package/dest/oracle/txe_oracle_top_level_context.d.ts +65 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_top_level_context.js +463 -0
- package/dest/rpc_translator.d.ts +246 -0
- package/dest/rpc_translator.d.ts.map +1 -0
- package/dest/{txe_service/txe_service.js → rpc_translator.js} +201 -124
- package/dest/state_machine/archiver.d.ts +34 -13
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +111 -16
- package/dest/state_machine/dummy_p2p_client.d.ts +5 -2
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +9 -1
- package/dest/state_machine/global_variable_builder.d.ts +6 -17
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +16 -23
- 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 +17 -21
- 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 +42 -46
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +241 -93
- 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} +4 -4
- package/dest/util/txe_public_contract_data_source.d.ts +8 -6
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +14 -12
- package/dest/utils/block_creation.d.ts +28 -0
- package/dest/utils/block_creation.d.ts.map +1 -0
- package/dest/utils/block_creation.js +45 -0
- package/dest/utils/tx_effect_creation.d.ts +6 -0
- package/dest/utils/tx_effect_creation.d.ts.map +1 -0
- package/dest/utils/tx_effect_creation.js +16 -0
- package/package.json +18 -17
- package/src/bin/index.ts +1 -1
- package/src/constants.ts +3 -0
- package/src/index.ts +20 -20
- package/src/oracle/interfaces.ts +86 -0
- package/src/oracle/txe_oracle_public_context.ts +37 -75
- package/src/oracle/txe_oracle_top_level_context.ts +716 -0
- package/src/{txe_service/txe_service.ts → rpc_translator.ts} +261 -125
- package/src/state_machine/archiver.ts +147 -29
- package/src/state_machine/dummy_p2p_client.ts +13 -2
- package/src/state_machine/global_variable_builder.ts +25 -42
- package/src/state_machine/index.ts +24 -21
- package/src/state_machine/mock_epoch_cache.ts +12 -11
- package/src/state_machine/synchronizer.ts +8 -7
- package/src/txe_session.ts +416 -115
- 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} +5 -4
- package/src/util/txe_public_contract_data_source.ts +16 -13
- package/src/utils/block_creation.ts +94 -0
- package/src/utils/tx_effect_creation.ts +38 -0
- package/dest/oracle/txe_oracle.d.ts +0 -124
- package/dest/oracle/txe_oracle.d.ts.map +0 -1
- package/dest/oracle/txe_oracle.js +0 -770
- package/dest/oracle/txe_typed_oracle.d.ts +0 -42
- package/dest/oracle/txe_typed_oracle.d.ts.map +0 -1
- package/dest/oracle/txe_typed_oracle.js +0 -83
- package/dest/txe_constants.d.ts +0 -2
- package/dest/txe_constants.d.ts.map +0 -1
- package/dest/txe_constants.js +0 -7
- package/dest/txe_service/txe_service.d.ts +0 -231
- package/dest/txe_service/txe_service.d.ts.map +0 -1
- package/dest/util/txe_account_data_provider.d.ts +0 -10
- package/dest/util/txe_account_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.d.ts +0 -11
- package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
- package/src/oracle/txe_oracle.ts +0 -1287
- package/src/oracle/txe_typed_oracle.ts +0 -142
- package/src/txe_constants.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../src/util/encoding.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../src/util/encoding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,KAAK,2BAA2B,EAAqC,MAAM,wBAAwB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AC"}
|
package/dest/util/encoding.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { hexToBuffer } from '@aztec/foundation/string';
|
|
3
3
|
import { ContractArtifactSchema } from '@aztec/stdlib/abi';
|
|
4
4
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare class ExpectedFailureError extends Error {
|
|
2
2
|
constructor(message: string);
|
|
3
3
|
}
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXhwZWN0ZWRfZmFpbHVyZV9lcnJvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWwvZXhwZWN0ZWRfZmFpbHVyZV9lcnJvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQkFBYSxvQkFBcUIsU0FBUSxLQUFLO0lBQzdDLFlBQVksT0FBTyxFQUFFLE1BQU0sRUFFMUI7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expected_failure_error.d.ts","sourceRoot":"","sources":["../../src/util/expected_failure_error.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAqB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"expected_failure_error.d.ts","sourceRoot":"","sources":["../../src/util/expected_failure_error.ts"],"names":[],"mappings":"AAAA,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
2
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
+
import { CompleteAddress } from '@aztec/stdlib/contract';
|
|
4
|
+
export declare class TXEAccountStore {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(store: AztecAsyncKVStore);
|
|
7
|
+
getAccount(key: AztecAddress): Promise<CompleteAddress>;
|
|
8
|
+
setAccount(key: AztecAddress, value: CompleteAddress): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX2FjY291bnRfc3RvcmUuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3R4ZV9hY2NvdW50X3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFpQixNQUFNLGlCQUFpQixDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUV6RCxxQkFBYSxlQUFlOztJQUcxQixZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFFbkM7SUFFSyxVQUFVLENBQUMsR0FBRyxFQUFFLFlBQVksNEJBTWpDO0lBRUssVUFBVSxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLGVBQWUsaUJBRXpEO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txe_account_store.d.ts","sourceRoot":"","sources":["../../src/util/txe_account_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,qBAAa,eAAe;;IAG1B,YAAY,KAAK,EAAE,iBAAiB,EAEnC;IAEK,UAAU,CAAC,GAAG,EAAE,YAAY,4BAMjC;IAEK,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,iBAEzD;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
+
import { ContractStore } from '@aztec/pxe/server';
|
|
4
|
+
export type ContractArtifactWithHash = ContractArtifact & {
|
|
5
|
+
artifactHash: Fr;
|
|
6
|
+
};
|
|
7
|
+
export declare class TXEContractStore extends ContractStore {
|
|
8
|
+
#private;
|
|
9
|
+
addContractArtifact(id: Fr, artifact: ContractArtifact | ContractArtifactWithHash): Promise<void>;
|
|
10
|
+
getContractArtifact(contractClassId: Fr): Promise<ContractArtifact | ContractArtifactWithHash | undefined>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX2NvbnRyYWN0X3N0b3JlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbC90eGVfY29udHJhY3Rfc3RvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUM1RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDNUMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRWxELE1BQU0sTUFBTSx3QkFBd0IsR0FBRyxnQkFBZ0IsR0FBRztJQUFFLFlBQVksRUFBRSxFQUFFLENBQUE7Q0FBRSxDQUFDO0FBTy9FLHFCQUFhLGdCQUFpQixTQUFRLGFBQWE7O0lBRzNCLG1CQUFtQixDQUN2QyxFQUFFLEVBQUUsRUFBRSxFQUNOLFFBQVEsRUFBRSxnQkFBZ0IsR0FBRyx3QkFBd0IsR0FDcEQsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUtmO0lBRXFCLG1CQUFtQixDQUN2QyxlQUFlLEVBQUUsRUFBRSxHQUNsQixPQUFPLENBQUMsZ0JBQWdCLEdBQUcsd0JBQXdCLEdBQUcsU0FBUyxDQUFDLENBUWxFO0NBQ0YifQ==
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txe_contract_store.d.ts","sourceRoot":"","sources":["../../src/util/txe_contract_store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IAAE,YAAY,EAAE,EAAE,CAAA;CAAE,CAAC;AAO/E,qBAAa,gBAAiB,SAAQ,aAAa;;IAG3B,mBAAmB,CACvC,EAAE,EAAE,EAAE,EACN,QAAQ,EAAE,gBAAgB,GAAG,wBAAwB,GACpD,OAAO,CAAC,IAAI,CAAC,CAKf;IAEqB,mBAAmB,CACvC,eAAe,EAAE,EAAE,GAClB,OAAO,CAAC,gBAAgB,GAAG,wBAAwB,GAAG,SAAS,CAAC,CAQlE;CACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fr } from '@aztec/aztec.js';
|
|
2
|
-
import {
|
|
1
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import { ContractStore } from '@aztec/pxe/server';
|
|
3
3
|
/*
|
|
4
|
-
* A contract
|
|
4
|
+
* A contract store that stores contract artifacts with their hashes. Since
|
|
5
5
|
* TXE typically deploys the same contract again and again for multiple tests, caching
|
|
6
6
|
* the *very* expensive artifact hash computation improves testing speed significantly.
|
|
7
|
-
*/ export class
|
|
7
|
+
*/ export class TXEContractStore extends ContractStore {
|
|
8
8
|
#artifactHashes = new Map();
|
|
9
9
|
async addContractArtifact(id, artifact) {
|
|
10
10
|
if ('artifactHash' in artifact) {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { ContractStore } from '@aztec/pxe/server';
|
|
2
4
|
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
6
|
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
5
|
-
import type { TXE } from '../oracle/txe_oracle.js';
|
|
6
7
|
export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
7
8
|
#private;
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
private blockNumber;
|
|
10
|
+
private contractStore;
|
|
11
|
+
constructor(blockNumber: BlockNumber, contractStore: ContractStore);
|
|
12
|
+
getBlockNumber(): Promise<BlockNumber>;
|
|
11
13
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
12
14
|
getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
|
|
13
15
|
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
@@ -16,4 +18,4 @@ export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
16
18
|
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
17
19
|
registerContractFunctionSignatures(_signatures: []): Promise<void>;
|
|
18
20
|
}
|
|
19
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3B1YmxpY19jb250cmFjdF9kYXRhX3NvdXJjZS5kL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QUFPLENBQUMsMkJBQTJCLEdBQUcsU0FBUyxDQUFDLENBR3pGO0lBRUQsbUJBQW1CLElBQUksT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBRW5DO0lBRUssbUJBQW1CLENBQUMsT0FBTyxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsZ0JBQWdCLEdBQUcsU0FBUyxDQUFDLENBR3RGO0lBRUssb0JBQW9CLENBQUMsT0FBTyxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FFekc7SUFFRCxrQ0FBa0MsQ0FBQyxXQUFXLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFakU7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_public_contract_data_source.d.ts","sourceRoot":"","sources":["../../src/util/txe_public_contract_data_source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"txe_public_contract_data_source.d.ts","sourceRoot":"","sources":["../../src/util/txe_public_contract_data_source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAgB,MAAM,mBAAmB,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAIjC,MAAM,wBAAwB,CAAC;AAEhC,qBAAa,2BAA4B,YAAW,kBAAkB;;IAGlE,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,aAAa;IAFvB,YACU,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAClC;IAEJ,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAErC;IAEK,gBAAgB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAgCvE;IAEK,qBAAqB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC,CAG3D;IAEK,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAGzF;IAED,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAEnC;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAGtF;IAEK,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEzG;IAED,kCAAkC,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;CACF"}
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { FunctionType } from '@aztec/stdlib/abi';
|
|
3
3
|
import { computePrivateFunctionsRoot, computePublicBytecodeCommitment, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
|
|
4
4
|
export class TXEPublicContractDataSource {
|
|
5
|
-
|
|
5
|
+
blockNumber;
|
|
6
|
+
contractStore;
|
|
6
7
|
#privateFunctionsRoot;
|
|
7
|
-
constructor(
|
|
8
|
-
this.
|
|
8
|
+
constructor(blockNumber, contractStore){
|
|
9
|
+
this.blockNumber = blockNumber;
|
|
10
|
+
this.contractStore = contractStore;
|
|
9
11
|
this.#privateFunctionsRoot = new Map();
|
|
10
12
|
}
|
|
11
13
|
getBlockNumber() {
|
|
12
|
-
return this.
|
|
14
|
+
return Promise.resolve(this.blockNumber);
|
|
13
15
|
}
|
|
14
16
|
async getContractClass(id) {
|
|
15
|
-
const contractClass = await this.
|
|
17
|
+
const contractClass = await this.contractStore.getContractClass(id);
|
|
16
18
|
if (!contractClass) {
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
|
-
const artifact = await this.
|
|
21
|
+
const artifact = await this.contractStore.getContractArtifact(id);
|
|
20
22
|
if (!artifact) {
|
|
21
23
|
return;
|
|
22
24
|
}
|
|
@@ -39,11 +41,11 @@ export class TXEPublicContractDataSource {
|
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
async getBytecodeCommitment(id) {
|
|
42
|
-
const contractClass = await this.
|
|
44
|
+
const contractClass = await this.contractStore.getContractClass(id);
|
|
43
45
|
return contractClass && computePublicBytecodeCommitment(contractClass.packedBytecode);
|
|
44
46
|
}
|
|
45
47
|
async getContract(address) {
|
|
46
|
-
const instance = await this.
|
|
48
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
47
49
|
return instance && {
|
|
48
50
|
...instance,
|
|
49
51
|
address
|
|
@@ -53,11 +55,11 @@ export class TXEPublicContractDataSource {
|
|
|
53
55
|
throw new Error('Method not implemented.');
|
|
54
56
|
}
|
|
55
57
|
async getContractArtifact(address) {
|
|
56
|
-
const instance = await this.
|
|
57
|
-
return instance && this.
|
|
58
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
59
|
+
return instance && this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
58
60
|
}
|
|
59
61
|
async getDebugFunctionName(address, selector) {
|
|
60
|
-
return await this.
|
|
62
|
+
return await this.contractStore.getDebugFunctionName(address, selector);
|
|
61
63
|
}
|
|
62
64
|
registerContractFunctionSignatures(_signatures) {
|
|
63
65
|
return Promise.resolve();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import { L2Block, L2BlockHeader } from '@aztec/stdlib/block';
|
|
4
|
+
import { type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
5
|
+
import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
6
|
+
/**
|
|
7
|
+
* Returns a transaction request hash that is valid for transactions that are the only ones in a block.
|
|
8
|
+
* @param blockNumber The number for the block in which there is a single transaction.
|
|
9
|
+
* @returns The transaction request hash.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getSingleTxBlockRequestHash(blockNumber: BlockNumber): Fr;
|
|
12
|
+
export declare function insertTxEffectIntoWorldTrees(txEffect: TxEffect, worldTrees: MerkleTreeWriteOperations): Promise<void>;
|
|
13
|
+
export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<L2BlockHeader>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an L2Block with proper archive chaining.
|
|
16
|
+
* This function:
|
|
17
|
+
* 1. Gets the current archive state as lastArchive for the header
|
|
18
|
+
* 2. Creates the block header
|
|
19
|
+
* 3. Updates the archive tree with the header hash
|
|
20
|
+
* 4. Gets the new archive state for the block's archive
|
|
21
|
+
*
|
|
22
|
+
* @param worldTrees - The world trees to read/write from
|
|
23
|
+
* @param globalVariables - Global variables for the block
|
|
24
|
+
* @param txEffects - Transaction effects to include in the block
|
|
25
|
+
* @returns The created L2Block with proper archive chaining
|
|
26
|
+
*/
|
|
27
|
+
export declare function makeTXEBlock(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables, txEffects: TxEffect[]): Promise<L2Block>;
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcm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AC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAQ,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAwC,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE7D;;;;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,aAAa,CAAC,CAcxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAWlB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { padArrayEnd } from '@aztec/foundation/collection';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { Body, L2Block, L2BlockHeader } from '@aztec/stdlib/block';
|
|
5
|
+
import { makeContentCommitment } from '@aztec/stdlib/testing';
|
|
6
|
+
import { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
7
|
+
/**
|
|
8
|
+
* Returns a transaction request hash that is valid for transactions that are the only ones in a block.
|
|
9
|
+
* @param blockNumber The number for the block in which there is a single transaction.
|
|
10
|
+
* @returns The transaction request hash.
|
|
11
|
+
*/ export function getSingleTxBlockRequestHash(blockNumber) {
|
|
12
|
+
return new Fr(blockNumber + 9999); // Why does this need to be a high number? Why do small numbered nullifiers already exist?
|
|
13
|
+
}
|
|
14
|
+
export async function insertTxEffectIntoWorldTrees(txEffect, worldTrees) {
|
|
15
|
+
await worldTrees.appendLeaves(MerkleTreeId.NOTE_HASH_TREE, padArrayEnd(txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX));
|
|
16
|
+
await worldTrees.batchInsert(MerkleTreeId.NULLIFIER_TREE, padArrayEnd(txEffect.nullifiers, Fr.ZERO, MAX_NULLIFIERS_PER_TX).map((nullifier)=>nullifier.toBuffer()), NULLIFIER_SUBTREE_HEIGHT);
|
|
17
|
+
await worldTrees.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, padArrayEnd(txEffect.l2ToL1Msgs, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP));
|
|
18
|
+
// We do not need to add public data writes because we apply them as we go.
|
|
19
|
+
}
|
|
20
|
+
export async function makeTXEBlockHeader(worldTrees, globalVariables) {
|
|
21
|
+
const stateReference = await worldTrees.getStateReference();
|
|
22
|
+
const archiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
23
|
+
return new L2BlockHeader(new AppendOnlyTreeSnapshot(new Fr(archiveInfo.root), Number(archiveInfo.size)), makeContentCommitment(), stateReference, globalVariables, Fr.ZERO, Fr.ZERO, Fr.ZERO, Fr.ZERO);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates an L2Block with proper archive chaining.
|
|
27
|
+
* This function:
|
|
28
|
+
* 1. Gets the current archive state as lastArchive for the header
|
|
29
|
+
* 2. Creates the block header
|
|
30
|
+
* 3. Updates the archive tree with the header hash
|
|
31
|
+
* 4. Gets the new archive state for the block's archive
|
|
32
|
+
*
|
|
33
|
+
* @param worldTrees - The world trees to read/write from
|
|
34
|
+
* @param globalVariables - Global variables for the block
|
|
35
|
+
* @param txEffects - Transaction effects to include in the block
|
|
36
|
+
* @returns The created L2Block with proper archive chaining
|
|
37
|
+
*/ export async function makeTXEBlock(worldTrees, globalVariables, txEffects) {
|
|
38
|
+
const header = await makeTXEBlockHeader(worldTrees, globalVariables);
|
|
39
|
+
// Update the archive tree with this block's header hash
|
|
40
|
+
await worldTrees.updateArchive(header.toBlockHeader());
|
|
41
|
+
// Get the new archive state after updating
|
|
42
|
+
const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
43
|
+
const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
|
|
44
|
+
return new L2Block(newArchive, header, new Body(txEffects));
|
|
45
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
4
|
+
import { TxEffect } from '@aztec/stdlib/tx';
|
|
5
|
+
export declare function makeTxEffect(noteCache: ExecutionNoteCache, protocolNullifier: Fr, txBlockNumber: BlockNumber): Promise<TxEffect>;
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZWZmZWN0X2NyZWF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvdHhfZWZmZWN0X2NyZWF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM5RCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUUvRCxPQUFPLEVBQUUsUUFBUSxFQUFVLE1BQU0sa0JBQWtCLENBQUM7QUFFcEQsd0JBQXNCLFlBQVksQ0FDaEMsU0FBUyxFQUFFLGtCQUFrQixFQUM3QixpQkFBaUIsRUFBRSxFQUFFLEVBQ3JCLGFBQWEsRUFBRSxXQUFXLEdBQ3pCLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0EyQm5CIn0=
|
|
@@ -0,0 +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;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAChC,SAAS,EAAE,kBAAkB,EAC7B,iBAAiB,EAAE,EAAE,EACrB,aAAa,EAAE,WAAW,GACzB,OAAO,CAAC,QAAQ,CAAC,CA2BnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
+
import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@aztec/stdlib/hash';
|
|
3
|
+
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
4
|
+
export async function makeTxEffect(noteCache, protocolNullifier, txBlockNumber) {
|
|
5
|
+
const txEffect = TxEffect.empty();
|
|
6
|
+
const { usedProtocolNullifierForNonces } = noteCache.finish();
|
|
7
|
+
const nonceGenerator = usedProtocolNullifierForNonces ? protocolNullifier : noteCache.getAllNullifiers()[0];
|
|
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
|
+
// Nullifiers are already siloed
|
|
10
|
+
txEffect.nullifiers = noteCache.getAllNullifiers();
|
|
11
|
+
if (usedProtocolNullifierForNonces) {
|
|
12
|
+
txEffect.nullifiers.unshift(protocolNullifier);
|
|
13
|
+
}
|
|
14
|
+
txEffect.txHash = new TxHash(new Fr(txBlockNumber));
|
|
15
|
+
return txEffect;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260108",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"tsconfig": "./tsconfig.json"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "yarn clean && tsc
|
|
16
|
-
"build:dev": "tsc
|
|
15
|
+
"build": "yarn clean && ../scripts/tsc.sh",
|
|
16
|
+
"build:dev": "../scripts/tsc.sh --watch",
|
|
17
17
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
18
18
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
19
19
|
"dev": "LOG_LEVEL=\"debug; trace: simulator:state_manager; info: json-rpc:proxy\" node ./dest/bin/index.js",
|
|
@@ -61,26 +61,27 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/accounts": "4.0.0-nightly.
|
|
65
|
-
"@aztec/archiver": "4.0.0-nightly.
|
|
66
|
-
"@aztec/aztec-node": "4.0.0-nightly.
|
|
67
|
-
"@aztec/aztec.js": "4.0.0-nightly.
|
|
68
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
69
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
70
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
71
|
-
"@aztec/key-store": "4.0.0-nightly.
|
|
72
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
73
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
74
|
-
"@aztec/pxe": "4.0.0-nightly.
|
|
75
|
-
"@aztec/simulator": "4.0.0-nightly.
|
|
76
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
77
|
-
"@aztec/world-state": "4.0.0-nightly.
|
|
64
|
+
"@aztec/accounts": "4.0.0-nightly.20260108",
|
|
65
|
+
"@aztec/archiver": "4.0.0-nightly.20260108",
|
|
66
|
+
"@aztec/aztec-node": "4.0.0-nightly.20260108",
|
|
67
|
+
"@aztec/aztec.js": "4.0.0-nightly.20260108",
|
|
68
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260108",
|
|
69
|
+
"@aztec/constants": "4.0.0-nightly.20260108",
|
|
70
|
+
"@aztec/foundation": "4.0.0-nightly.20260108",
|
|
71
|
+
"@aztec/key-store": "4.0.0-nightly.20260108",
|
|
72
|
+
"@aztec/kv-store": "4.0.0-nightly.20260108",
|
|
73
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260108",
|
|
74
|
+
"@aztec/pxe": "4.0.0-nightly.20260108",
|
|
75
|
+
"@aztec/simulator": "4.0.0-nightly.20260108",
|
|
76
|
+
"@aztec/stdlib": "4.0.0-nightly.20260108",
|
|
77
|
+
"@aztec/world-state": "4.0.0-nightly.20260108",
|
|
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.20251126.1",
|
|
84
85
|
"jest": "^30.0.0",
|
|
85
86
|
"jest-mock-extended": "^4.0.0",
|
|
86
87
|
"ts-node": "^10.9.1",
|
package/src/bin/index.ts
CHANGED
package/src/constants.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { type NoirCompiledContract, loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
3
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
4
|
import {
|
|
3
|
-
AztecAddress,
|
|
4
5
|
type ContractInstanceWithAddress,
|
|
5
|
-
Fr,
|
|
6
|
-
type NoirCompiledContract,
|
|
7
|
-
PublicKeys,
|
|
8
|
-
deriveKeys,
|
|
9
6
|
getContractInstanceFromInstantiationParams,
|
|
10
|
-
|
|
11
|
-
} from '@aztec/aztec.js';
|
|
7
|
+
} from '@aztec/aztec.js/contracts';
|
|
8
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
9
|
+
import { PublicKeys, deriveKeys } from '@aztec/aztec.js/keys';
|
|
12
10
|
import { createSafeJsonRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
13
11
|
import type { Logger } from '@aztec/foundation/log';
|
|
14
12
|
import { type ProtocolContract, protocolContractNames } from '@aztec/protocol-contracts';
|
|
15
13
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
16
14
|
import { computeArtifactHash } from '@aztec/stdlib/contract';
|
|
17
|
-
import type { ApiSchemaFor
|
|
15
|
+
import type { ApiSchemaFor } from '@aztec/stdlib/schemas';
|
|
16
|
+
import { zodFor } from '@aztec/stdlib/schemas';
|
|
18
17
|
|
|
19
18
|
import { createHash } from 'crypto';
|
|
20
19
|
import { createReadStream } from 'fs';
|
|
@@ -34,7 +33,7 @@ import {
|
|
|
34
33
|
fromSingle,
|
|
35
34
|
toSingle,
|
|
36
35
|
} from './util/encoding.js';
|
|
37
|
-
import type { ContractArtifactWithHash } from './util/
|
|
36
|
+
import type { ContractArtifactWithHash } from './util/txe_contract_store.js';
|
|
38
37
|
|
|
39
38
|
const sessions = new Map<number, TXESession>();
|
|
40
39
|
|
|
@@ -55,17 +54,18 @@ type TXEForeignCallInput = {
|
|
|
55
54
|
inputs: ForeignCallArgs;
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})
|
|
57
|
+
const TXEForeignCallInputSchema = zodFor<TXEForeignCallInput>()(
|
|
58
|
+
z.object({
|
|
59
|
+
// eslint-disable-next-line camelcase
|
|
60
|
+
session_id: z.number().int().nonnegative(),
|
|
61
|
+
function: z.string() as z.ZodType<TXEOracleFunctionName>,
|
|
62
|
+
// eslint-disable-next-line camelcase
|
|
63
|
+
root_path: z.string(),
|
|
64
|
+
// eslint-disable-next-line camelcase
|
|
65
|
+
package_name: z.string(),
|
|
66
|
+
inputs: ForeignCallArgsSchema,
|
|
67
|
+
}),
|
|
68
|
+
);
|
|
69
69
|
|
|
70
70
|
class TXEDispatcher {
|
|
71
71
|
private protocolContracts!: ProtocolContract[];
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
+
import { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import type { ContractInstanceWithAddress } from '@aztec/aztec.js/contracts';
|
|
4
|
+
import { TxHash } from '@aztec/aztec.js/tx';
|
|
5
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
6
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
|
+
import type { EventSelector, FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
|
+
import type { UInt64 } from '@aztec/stdlib/types';
|
|
10
|
+
|
|
11
|
+
// These interfaces complement the ones defined in PXE, and combined with those contain the full list of oracles used by
|
|
12
|
+
// aztec-nr. In particular, these include the ones needed to run Brillig code associated to #[external("public")] functions that has
|
|
13
|
+
// not been transpiled (e.g. in the context of a Noir test) as well as the ones associated with managing the state of
|
|
14
|
+
// such a Noir test (deploying contracts, manipulating block time, making calls, etc) - the so called 'top level test
|
|
15
|
+
// context'.
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Oracle methods associated with the execution of an Aztec #[external("public")] function.
|
|
19
|
+
*
|
|
20
|
+
* Note that real contracts have their Brillig calls to these be transpiled into opcodes, the oracles are only executed
|
|
21
|
+
* as such when running the original Brillig code, e.g. when invoking functions that interact with a PublicContext
|
|
22
|
+
* directly in a Noir test.
|
|
23
|
+
*/
|
|
24
|
+
export interface IAvmExecutionOracle {
|
|
25
|
+
isAvm: true;
|
|
26
|
+
|
|
27
|
+
avmOpcodeAddress(): Promise<AztecAddress>;
|
|
28
|
+
avmOpcodeSender(): Promise<AztecAddress>;
|
|
29
|
+
avmOpcodeBlockNumber(): Promise<BlockNumber>;
|
|
30
|
+
avmOpcodeTimestamp(): Promise<bigint>;
|
|
31
|
+
avmOpcodeIsStaticCall(): Promise<boolean>;
|
|
32
|
+
avmOpcodeChainId(): Promise<Fr>;
|
|
33
|
+
avmOpcodeVersion(): Promise<Fr>;
|
|
34
|
+
avmOpcodeEmitNullifier(nullifier: Fr): Promise<void>;
|
|
35
|
+
avmOpcodeEmitNoteHash(noteHash: Fr): Promise<void>;
|
|
36
|
+
avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): Promise<boolean>;
|
|
37
|
+
avmOpcodeStorageWrite(slot: Fr, value: Fr): Promise<void>;
|
|
38
|
+
avmOpcodeStorageRead(slot: Fr): Promise<Fr>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Oracle methods associated with the execution of an Aztec Noir test.
|
|
43
|
+
*/
|
|
44
|
+
export interface ITxeExecutionOracle {
|
|
45
|
+
isTxe: true;
|
|
46
|
+
|
|
47
|
+
txeGetDefaultAddress(): AztecAddress;
|
|
48
|
+
txeGetNextBlockNumber(): Promise<BlockNumber>;
|
|
49
|
+
txeGetNextBlockTimestamp(): Promise<UInt64>;
|
|
50
|
+
txeAdvanceBlocksBy(blocks: number): Promise<void>;
|
|
51
|
+
txeAdvanceTimestampBy(duration: UInt64): void;
|
|
52
|
+
txeDeploy(artifact: ContractArtifact, instance: ContractInstanceWithAddress, foreignSecret: Fr): Promise<void>;
|
|
53
|
+
txeCreateAccount(secret: Fr): Promise<CompleteAddress>;
|
|
54
|
+
txeAddAccount(
|
|
55
|
+
artifact: ContractArtifact,
|
|
56
|
+
instance: ContractInstanceWithAddress,
|
|
57
|
+
secret: Fr,
|
|
58
|
+
): Promise<CompleteAddress>;
|
|
59
|
+
txeAddAuthWitness(address: AztecAddress, messageHash: Fr): Promise<void>;
|
|
60
|
+
txeGetLastBlockTimestamp(): Promise<bigint>;
|
|
61
|
+
txeGetLastTxEffects(): Promise<{
|
|
62
|
+
txHash: TxHash;
|
|
63
|
+
noteHashes: Fr[];
|
|
64
|
+
nullifiers: Fr[];
|
|
65
|
+
}>;
|
|
66
|
+
txeGetPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress): Promise<Fr[][]>;
|
|
67
|
+
txePrivateCallNewFlow(
|
|
68
|
+
from: AztecAddress,
|
|
69
|
+
targetContractAddress: AztecAddress,
|
|
70
|
+
functionSelector: FunctionSelector,
|
|
71
|
+
args: Fr[],
|
|
72
|
+
argsHash: Fr,
|
|
73
|
+
isStaticCall: boolean,
|
|
74
|
+
): Promise<Fr[]>;
|
|
75
|
+
txeSimulateUtilityFunction(
|
|
76
|
+
targetContractAddress: AztecAddress,
|
|
77
|
+
functionSelector: FunctionSelector,
|
|
78
|
+
args: Fr[],
|
|
79
|
+
): Promise<Fr[]>;
|
|
80
|
+
txePublicCallNewFlow(
|
|
81
|
+
from: AztecAddress,
|
|
82
|
+
targetContractAddress: AztecAddress,
|
|
83
|
+
calldata: Fr[],
|
|
84
|
+
isStaticCall: boolean,
|
|
85
|
+
): Promise<Fr[]>;
|
|
86
|
+
}
|