@aztec/txe 0.0.1-commit.d3ec352c → 0.0.1-commit.e6bd8901
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/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -2
- package/dest/oracle/interfaces.d.ts +6 -4
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +4 -4
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +7 -8
- package/dest/oracle/txe_oracle_top_level_context.d.ts +20 -11
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +100 -63
- package/dest/rpc_translator.d.ts +23 -11
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +91 -38
- package/dest/state_machine/archiver.d.ts +21 -57
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +61 -107
- 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 +16 -11
- package/dest/state_machine/global_variable_builder.d.ts +4 -3
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +13 -1
- package/dest/state_machine/index.d.ts +5 -5
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +32 -20
- 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/state_machine/synchronizer.js +2 -2
- package/dest/txe_session.d.ts +18 -10
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +91 -45
- package/dest/util/encoding.d.ts +618 -19
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/encoding.js +1 -1
- package/dest/util/txe_account_store.d.ts +10 -0
- package/dest/util/txe_account_store.d.ts.map +1 -0
- package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
- package/dest/util/txe_contract_store.d.ts +12 -0
- package/dest/util/txe_contract_store.d.ts.map +1 -0
- package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
- package/dest/util/txe_public_contract_data_source.d.ts +5 -5
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +11 -11
- package/dest/utils/block_creation.d.ts +19 -5
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +36 -4
- 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 +4 -7
- package/package.json +16 -16
- package/src/constants.ts +3 -0
- package/src/index.ts +15 -12
- package/src/oracle/interfaces.ts +5 -3
- package/src/oracle/txe_oracle_public_context.ts +7 -12
- package/src/oracle/txe_oracle_top_level_context.ts +149 -88
- package/src/rpc_translator.ts +113 -49
- package/src/state_machine/archiver.ts +57 -131
- package/src/state_machine/dummy_p2p_client.ts +21 -14
- package/src/state_machine/global_variable_builder.ts +19 -2
- package/src/state_machine/index.ts +41 -18
- package/src/state_machine/mock_epoch_cache.ts +10 -11
- package/src/state_machine/synchronizer.ts +3 -4
- package/src/txe_session.ts +187 -76
- package/src/util/encoding.ts +1 -1
- package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
- package/src/util/{txe_contract_data_provider.ts → txe_contract_store.ts} +3 -3
- package/src/util/txe_public_contract_data_source.ts +10 -10
- package/src/utils/block_creation.ts +46 -15
- package/src/utils/tx_effect_creation.ts +4 -12
- package/dest/util/txe_account_data_provider.d.ts +0 -10
- package/dest/util/txe_account_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.d.ts +0 -12
- package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
|
@@ -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,CAAC;AAE7G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG,MAAM,EAAE,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,CAAC,iBAAiB,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,2BAA2B,CAAC,EAAE,CAAC;AAExH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,EAAE,CAAC;CAClD,CAAC;AAEF,wBAAgB,UAAU,CAAC,GAAG,EAAE,iBAAiB,MAEhD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,iBAAiB,gBAEvD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,gBAAgB,QAE9C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,GAAG,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEjC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC"}
|
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';
|
|
@@ -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
1
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
-
import {
|
|
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,14 +1,14 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
-
import type {
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
+
import type { ContractStore } from '@aztec/pxe/server';
|
|
4
4
|
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
5
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
6
|
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
7
7
|
export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
8
8
|
#private;
|
|
9
9
|
private blockNumber;
|
|
10
|
-
private
|
|
11
|
-
constructor(blockNumber: BlockNumber,
|
|
10
|
+
private contractStore;
|
|
11
|
+
constructor(blockNumber: BlockNumber, contractStore: ContractStore);
|
|
12
12
|
getBlockNumber(): Promise<BlockNumber>;
|
|
13
13
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
14
14
|
getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
|
|
@@ -18,4 +18,4 @@ export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
18
18
|
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
19
19
|
registerContractFunctionSignatures(_signatures: []): Promise<void>;
|
|
20
20
|
}
|
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3B1YmxpY19jb250cmFjdF9kYXRhX3NvdXJjZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWwvdHhlX3B1YmxpY19jb250cmFjdF9kYXRhX3NvdXJjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDOUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQU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UFFLFlBQVksRUFBRSxRQUFRLEVBQUUsZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLE1BQU0sR0FBRyxTQUFTLENBQUMsQ0FFekc7SUFFRCxrQ0FBa0MsQ0FBQyxXQUFXLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFakU7Q0FDRiJ9
|
|
@@ -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,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,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,24 +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
|
-
|
|
6
|
+
contractStore;
|
|
7
7
|
#privateFunctionsRoot;
|
|
8
|
-
constructor(blockNumber,
|
|
8
|
+
constructor(blockNumber, contractStore){
|
|
9
9
|
this.blockNumber = blockNumber;
|
|
10
|
-
this.
|
|
10
|
+
this.contractStore = contractStore;
|
|
11
11
|
this.#privateFunctionsRoot = new Map();
|
|
12
12
|
}
|
|
13
13
|
getBlockNumber() {
|
|
14
14
|
return Promise.resolve(this.blockNumber);
|
|
15
15
|
}
|
|
16
16
|
async getContractClass(id) {
|
|
17
|
-
const contractClass = await this.
|
|
17
|
+
const contractClass = await this.contractStore.getContractClass(id);
|
|
18
18
|
if (!contractClass) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
const artifact = await this.
|
|
21
|
+
const artifact = await this.contractStore.getContractArtifact(id);
|
|
22
22
|
if (!artifact) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
@@ -41,11 +41,11 @@ export class TXEPublicContractDataSource {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
async getBytecodeCommitment(id) {
|
|
44
|
-
const contractClass = await this.
|
|
44
|
+
const contractClass = await this.contractStore.getContractClass(id);
|
|
45
45
|
return contractClass && computePublicBytecodeCommitment(contractClass.packedBytecode);
|
|
46
46
|
}
|
|
47
47
|
async getContract(address) {
|
|
48
|
-
const instance = await this.
|
|
48
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
49
49
|
return instance && {
|
|
50
50
|
...instance,
|
|
51
51
|
address
|
|
@@ -55,11 +55,11 @@ export class TXEPublicContractDataSource {
|
|
|
55
55
|
throw new Error('Method not implemented.');
|
|
56
56
|
}
|
|
57
57
|
async getContractArtifact(address) {
|
|
58
|
-
const instance = await this.
|
|
59
|
-
return instance && this.
|
|
58
|
+
const instance = await this.contractStore.getContractInstance(address);
|
|
59
|
+
return instance && this.contractStore.getContractArtifact(instance.currentContractClassId);
|
|
60
60
|
}
|
|
61
61
|
async getDebugFunctionName(address, selector) {
|
|
62
|
-
return await this.
|
|
62
|
+
return await this.contractStore.getDebugFunctionName(address, selector);
|
|
63
63
|
}
|
|
64
64
|
registerContractFunctionSignatures(_signatures) {
|
|
65
65
|
return Promise.resolve();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
3
|
-
import {
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
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,5 +10,19 @@ 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<
|
|
14
|
-
|
|
13
|
+
export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<BlockHeader>;
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcmVhdGlvbi50cyJdL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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
|
-
import { Fr } from '@aztec/foundation/
|
|
4
|
-
import {
|
|
5
|
-
import { makeContentCommitment } from '@aztec/stdlib/testing';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
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,5 +21,36 @@ 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
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates an L2Block with proper archive chaining.
|
|
35
|
+
* This function:
|
|
36
|
+
* 1. Gets the current archive state as lastArchive for the header
|
|
37
|
+
* 2. Creates the block header
|
|
38
|
+
* 3. Updates the archive tree with the header hash
|
|
39
|
+
* 4. Gets the new archive state for the block's archive
|
|
40
|
+
*
|
|
41
|
+
* @param worldTrees - The world trees to read/write from
|
|
42
|
+
* @param globalVariables - Global variables for the block
|
|
43
|
+
* @param txEffects - Transaction effects to include in the block
|
|
44
|
+
* @returns The created L2Block with proper archive chaining
|
|
45
|
+
*/ export async function makeTXEBlock(worldTrees, globalVariables, txEffects) {
|
|
46
|
+
const header = await makeTXEBlockHeader(worldTrees, globalVariables);
|
|
47
|
+
// Update the archive tree with this block's header hash
|
|
48
|
+
await worldTrees.updateArchive(header);
|
|
49
|
+
// Get the new archive state after updating
|
|
50
|
+
const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
51
|
+
const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
|
|
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);
|
|
24
56
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
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
|
-
import { Fr } from '@aztec/foundation/
|
|
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.e6bd8901",
|
|
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.e6bd8901",
|
|
65
|
+
"@aztec/archiver": "0.0.1-commit.e6bd8901",
|
|
66
|
+
"@aztec/aztec-node": "0.0.1-commit.e6bd8901",
|
|
67
|
+
"@aztec/aztec.js": "0.0.1-commit.e6bd8901",
|
|
68
|
+
"@aztec/bb-prover": "0.0.1-commit.e6bd8901",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.e6bd8901",
|
|
70
|
+
"@aztec/foundation": "0.0.1-commit.e6bd8901",
|
|
71
|
+
"@aztec/key-store": "0.0.1-commit.e6bd8901",
|
|
72
|
+
"@aztec/kv-store": "0.0.1-commit.e6bd8901",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.e6bd8901",
|
|
74
|
+
"@aztec/pxe": "0.0.1-commit.e6bd8901",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.e6bd8901",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.e6bd8901",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.e6bd8901",
|
|
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/constants.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -12,7 +12,8 @@ import type { Logger } from '@aztec/foundation/log';
|
|
|
12
12
|
import { type ProtocolContract, protocolContractNames } from '@aztec/protocol-contracts';
|
|
13
13
|
import { BundledProtocolContractsProvider } from '@aztec/protocol-contracts/providers/bundle';
|
|
14
14
|
import { computeArtifactHash } from '@aztec/stdlib/contract';
|
|
15
|
-
import type { ApiSchemaFor
|
|
15
|
+
import type { ApiSchemaFor } from '@aztec/stdlib/schemas';
|
|
16
|
+
import { zodFor } from '@aztec/stdlib/schemas';
|
|
16
17
|
|
|
17
18
|
import { createHash } from 'crypto';
|
|
18
19
|
import { createReadStream } from 'fs';
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
fromSingle,
|
|
33
34
|
toSingle,
|
|
34
35
|
} from './util/encoding.js';
|
|
35
|
-
import type { ContractArtifactWithHash } from './util/
|
|
36
|
+
import type { ContractArtifactWithHash } from './util/txe_contract_store.js';
|
|
36
37
|
|
|
37
38
|
const sessions = new Map<number, TXESession>();
|
|
38
39
|
|
|
@@ -53,16 +54,18 @@ type TXEForeignCallInput = {
|
|
|
53
54
|
inputs: ForeignCallArgs;
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
const TXEForeignCallInputSchema =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
+
);
|
|
66
69
|
|
|
67
70
|
class TXEDispatcher {
|
|
68
71
|
private protocolContracts!: ProtocolContract[];
|
package/src/oracle/interfaces.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { CompleteAddress } from '@aztec/aztec.js/addresses';
|
|
|
3
3
|
import type { ContractInstanceWithAddress } from '@aztec/aztec.js/contracts';
|
|
4
4
|
import { TxHash } from '@aztec/aztec.js/tx';
|
|
5
5
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
6
|
-
import type { Fr } from '@aztec/foundation/
|
|
7
|
-
import type { FunctionSelector } from '@aztec/stdlib/abi';
|
|
6
|
+
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
7
|
+
import type { EventSelector, FunctionSelector } from '@aztec/stdlib/abi';
|
|
8
8
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
9
9
|
import type { UInt64 } from '@aztec/stdlib/types';
|
|
10
10
|
|
|
@@ -35,7 +35,7 @@ export interface IAvmExecutionOracle {
|
|
|
35
35
|
avmOpcodeEmitNoteHash(noteHash: Fr): Promise<void>;
|
|
36
36
|
avmOpcodeNullifierExists(innerNullifier: Fr, targetAddress: AztecAddress): 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
|
/**
|
|
@@ -44,6 +44,7 @@ export interface IAvmExecutionOracle {
|
|
|
44
44
|
export interface ITxeExecutionOracle {
|
|
45
45
|
isTxe: true;
|
|
46
46
|
|
|
47
|
+
txeGetDefaultAddress(): AztecAddress;
|
|
47
48
|
txeGetNextBlockNumber(): Promise<BlockNumber>;
|
|
48
49
|
txeGetNextBlockTimestamp(): Promise<UInt64>;
|
|
49
50
|
txeAdvanceBlocksBy(blocks: number): Promise<void>;
|
|
@@ -62,6 +63,7 @@ export interface ITxeExecutionOracle {
|
|
|
62
63
|
noteHashes: Fr[];
|
|
63
64
|
nullifiers: Fr[];
|
|
64
65
|
}>;
|
|
66
|
+
txeGetPrivateEvents(selector: EventSelector, contractAddress: AztecAddress, scope: AztecAddress): Promise<Fr[][]>;
|
|
65
67
|
txePrivateCallNewFlow(
|
|
66
68
|
from: AztecAddress,
|
|
67
69
|
targetContractAddress: AztecAddress,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import { Fr } from '@aztec/foundation/
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
3
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { PublicDataWrite } from '@aztec/stdlib/avm';
|
|
5
5
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
6
|
-
import {
|
|
6
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
7
7
|
import { computePublicDataTreeLeafSlot, siloNoteHash, siloNullifier } from '@aztec/stdlib/hash';
|
|
8
|
-
import { makeAppendOnlyTreeSnapshot } from '@aztec/stdlib/testing';
|
|
9
8
|
import {
|
|
10
9
|
MerkleTreeId,
|
|
11
10
|
type MerkleTreeWriteOperations,
|
|
@@ -14,7 +13,7 @@ import {
|
|
|
14
13
|
} from '@aztec/stdlib/trees';
|
|
15
14
|
import { GlobalVariables, TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
16
15
|
|
|
17
|
-
import { insertTxEffectIntoWorldTrees,
|
|
16
|
+
import { insertTxEffectIntoWorldTrees, makeTXEBlock } from '../utils/block_creation.js';
|
|
18
17
|
import type { IAvmExecutionOracle } from './interfaces.js';
|
|
19
18
|
|
|
20
19
|
export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
@@ -102,8 +101,8 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
102
101
|
]);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
async avmOpcodeStorageRead(slot: Fr): Promise<Fr> {
|
|
106
|
-
const leafSlot = await computePublicDataTreeLeafSlot(
|
|
104
|
+
async avmOpcodeStorageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr> {
|
|
105
|
+
const leafSlot = await computePublicDataTreeLeafSlot(contractAddress, slot);
|
|
107
106
|
|
|
108
107
|
const lowLeafResult = await this.forkedWorldTrees.getPreviousValueIndex(
|
|
109
108
|
MerkleTreeId.PUBLIC_DATA_TREE,
|
|
@@ -120,7 +119,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
120
119
|
)) as PublicDataTreeLeafPreimage
|
|
121
120
|
).leaf.value;
|
|
122
121
|
|
|
123
|
-
this.logger.debug('AVM storage read', { slot, value });
|
|
122
|
+
this.logger.debug('AVM storage read', { slot, contractAddress, value });
|
|
124
123
|
|
|
125
124
|
return value;
|
|
126
125
|
}
|
|
@@ -133,11 +132,7 @@ export class TXEOraclePublicContext implements IAvmExecutionOracle {
|
|
|
133
132
|
const txEffect = this.makeTxEffect();
|
|
134
133
|
await insertTxEffectIntoWorldTrees(txEffect, this.forkedWorldTrees);
|
|
135
134
|
|
|
136
|
-
const block =
|
|
137
|
-
makeAppendOnlyTreeSnapshot(),
|
|
138
|
-
await makeTXEBlockHeader(this.forkedWorldTrees, this.globalVariables),
|
|
139
|
-
new Body([txEffect]),
|
|
140
|
-
);
|
|
135
|
+
const block = await makeTXEBlock(this.forkedWorldTrees, this.globalVariables, [txEffect]);
|
|
141
136
|
|
|
142
137
|
await this.forkedWorldTrees.close();
|
|
143
138
|
|