@aztec/txe 0.0.0-test.1 → 0.0.1-commit.5daedc8
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 +3 -2
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +78 -49
- package/dest/oracle/interfaces.d.ts +54 -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 +34 -0
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_public_context.js +124 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +56 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_top_level_context.js +432 -0
- package/dest/rpc_translator.d.ts +240 -0
- package/dest/rpc_translator.d.ts.map +1 -0
- package/dest/rpc_translator.js +624 -0
- package/dest/state_machine/archiver.d.ts +62 -0
- package/dest/state_machine/archiver.d.ts.map +1 -0
- package/dest/state_machine/archiver.js +118 -0
- package/dest/state_machine/dummy_p2p_client.d.ts +54 -0
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -0
- package/dest/state_machine/dummy_p2p_client.js +136 -0
- package/dest/state_machine/global_variable_builder.d.ts +10 -0
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -0
- package/dest/state_machine/global_variable_builder.js +10 -0
- package/dest/state_machine/index.d.ts +16 -0
- package/dest/state_machine/index.d.ts.map +1 -0
- package/dest/state_machine/index.js +51 -0
- package/dest/state_machine/mock_epoch_cache.d.ts +26 -0
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -0
- package/dest/state_machine/mock_epoch_cache.js +51 -0
- package/dest/state_machine/synchronizer.d.ts +32 -0
- package/dest/state_machine/synchronizer.d.ts.map +1 -0
- package/dest/state_machine/synchronizer.js +58 -0
- package/dest/txe_session.d.ts +67 -0
- package/dest/txe_session.d.ts.map +1 -0
- package/dest/txe_session.js +255 -0
- package/dest/util/encoding.d.ts +39 -21
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/encoding.js +65 -10
- 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_data_provider.d.ts +1 -1
- package/dest/util/txe_account_data_provider.d.ts.map +1 -1
- package/dest/util/txe_contract_data_provider.d.ts +12 -0
- package/dest/util/txe_contract_data_provider.d.ts.map +1 -0
- package/dest/util/txe_contract_data_provider.js +22 -0
- package/dest/util/txe_public_contract_data_source.d.ts +9 -9
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +36 -57
- package/dest/utils/block_creation.d.ts +13 -0
- package/dest/utils/block_creation.d.ts.map +1 -0
- package/dest/utils/block_creation.js +24 -0
- package/dest/utils/tx_effect_creation.d.ts +5 -0
- package/dest/utils/tx_effect_creation.d.ts.map +1 -0
- package/dest/utils/tx_effect_creation.js +16 -0
- package/package.json +30 -24
- package/src/bin/index.ts +3 -2
- package/src/index.ts +92 -64
- package/src/oracle/interfaces.ts +83 -0
- package/src/oracle/txe_oracle_public_context.ts +165 -0
- package/src/oracle/txe_oracle_top_level_context.ts +667 -0
- package/src/rpc_translator.ts +1013 -0
- package/src/state_machine/archiver.ts +152 -0
- package/src/state_machine/dummy_p2p_client.ts +202 -0
- package/src/state_machine/global_variable_builder.ts +21 -0
- package/src/state_machine/index.ts +77 -0
- package/src/state_machine/mock_epoch_cache.ts +68 -0
- package/src/state_machine/synchronizer.ts +87 -0
- package/src/txe_session.ts +434 -0
- package/src/util/encoding.ts +84 -10
- package/src/util/txe_contract_data_provider.ts +36 -0
- package/src/util/txe_public_contract_data_source.ts +40 -56
- package/src/utils/block_creation.ts +63 -0
- package/src/utils/tx_effect_creation.ts +37 -0
- package/dest/node/txe_node.d.ts +0 -358
- package/dest/node/txe_node.d.ts.map +0 -1
- package/dest/node/txe_node.js +0 -504
- package/dest/oracle/txe_oracle.d.ts +0 -152
- package/dest/oracle/txe_oracle.d.ts.map +0 -1
- package/dest/oracle/txe_oracle.js +0 -833
- package/dest/txe_service/txe_service.d.ts +0 -212
- package/dest/txe_service/txe_service.d.ts.map +0 -1
- package/dest/txe_service/txe_service.js +0 -572
- package/dest/util/txe_world_state_db.d.ts +0 -14
- package/dest/util/txe_world_state_db.d.ts.map +0 -1
- package/dest/util/txe_world_state_db.js +0 -27
- package/src/node/txe_node.ts +0 -725
- package/src/oracle/txe_oracle.ts +0 -1241
- package/src/txe_service/txe_service.ts +0 -749
- package/src/util/txe_world_state_db.ts +0 -38
|
@@ -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"}
|
|
@@ -7,4 +7,4 @@ export declare class TXEAccountDataProvider {
|
|
|
7
7
|
getAccount(key: AztecAddress): Promise<CompleteAddress>;
|
|
8
8
|
setAccount(key: AztecAddress, value: CompleteAddress): Promise<void>;
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX2FjY291bnRfZGF0YV9wcm92aWRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWwvdHhlX2FjY291bnRfZGF0YV9wcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxpQkFBaUIsRUFBaUIsTUFBTSxpQkFBaUIsQ0FBQztBQUN4RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFekQscUJBQWEsc0JBQXNCOztJQUdqQyxZQUFZLEtBQUssRUFBRSxpQkFBaUIsRUFFbkM7SUFFSyxVQUFVLENBQUMsR0FBRyxFQUFFLFlBQVksNEJBTWpDO0lBRUssVUFBVSxDQUFDLEdBQUcsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLGVBQWUsaUJBRXpEO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_account_data_provider.d.ts","sourceRoot":"","sources":["../../src/util/txe_account_data_provider.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,sBAAsB;;
|
|
1
|
+
{"version":3,"file":"txe_account_data_provider.d.ts","sourceRoot":"","sources":["../../src/util/txe_account_data_provider.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,sBAAsB;;IAGjC,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 { ContractDataProvider } from '@aztec/pxe/server';
|
|
4
|
+
export type ContractArtifactWithHash = ContractArtifact & {
|
|
5
|
+
artifactHash: Fr;
|
|
6
|
+
};
|
|
7
|
+
export declare class TXEContractDataProvider extends ContractDataProvider {
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX2NvbnRyYWN0X2RhdGFfcHJvdmlkZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3R4ZV9jb250cmFjdF9kYXRhX3Byb3ZpZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDNUQsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQzVDLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRXpELE1BQU0sTUFBTSx3QkFBd0IsR0FBRyxnQkFBZ0IsR0FBRztJQUFFLFlBQVksRUFBRSxFQUFFLENBQUE7Q0FBRSxDQUFDO0FBTy9FLHFCQUFhLHVCQUF3QixTQUFRLG9CQUFvQjs7SUFHekMsbUJBQW1CLENBQ3ZDLEVBQUUsRUFBRSxFQUFFLEVBQ04sUUFBUSxFQUFFLGdCQUFnQixHQUFHLHdCQUF3QixHQUNwRCxPQUFPLENBQUMsSUFBSSxDQUFDLENBS2Y7SUFFcUIsbUJBQW1CLENBQ3ZDLGVBQWUsRUFBRSxFQUFFLEdBQ2xCLE9BQU8sQ0FBQyxnQkFBZ0IsR0FBRyx3QkFBd0IsR0FBRyxTQUFTLENBQUMsQ0FRbEU7Q0FDRiJ9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"txe_contract_data_provider.d.ts","sourceRoot":"","sources":["../../src/util/txe_contract_data_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IAAE,YAAY,EAAE,EAAE,CAAA;CAAE,CAAC;AAO/E,qBAAa,uBAAwB,SAAQ,oBAAoB;;IAGzC,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import { ContractDataProvider } from '@aztec/pxe/server';
|
|
3
|
+
/*
|
|
4
|
+
* A contract data provider that stores contract artifacts with their hashes. Since
|
|
5
|
+
* TXE typically deploys the same contract again and again for multiple tests, caching
|
|
6
|
+
* the *very* expensive artifact hash computation improves testing speed significantly.
|
|
7
|
+
*/ export class TXEContractDataProvider extends ContractDataProvider {
|
|
8
|
+
#artifactHashes = new Map();
|
|
9
|
+
async addContractArtifact(id, artifact) {
|
|
10
|
+
if ('artifactHash' in artifact) {
|
|
11
|
+
this.#artifactHashes.set(id.toString(), artifact.artifactHash.toBuffer());
|
|
12
|
+
}
|
|
13
|
+
await super.addContractArtifact(id, artifact);
|
|
14
|
+
}
|
|
15
|
+
async getContractArtifact(contractClassId) {
|
|
16
|
+
const artifact = await super.getContractArtifact(contractClassId);
|
|
17
|
+
if (artifact && this.#artifactHashes.has(contractClassId.toString())) {
|
|
18
|
+
artifact.artifactHash = Fr.fromBuffer(this.#artifactHashes.get(contractClassId.toString()));
|
|
19
|
+
}
|
|
20
|
+
return artifact;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { ContractDataProvider } from '@aztec/pxe/server';
|
|
2
3
|
import { type ContractArtifact, FunctionSelector } from '@aztec/stdlib/abi';
|
|
3
4
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
|
-
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress
|
|
5
|
-
import type { TXE } from '../oracle/txe_oracle.js';
|
|
5
|
+
import { type ContractClassPublic, type ContractDataSource, type ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
6
6
|
export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
#private;
|
|
8
|
+
private blockNumber;
|
|
9
|
+
private contractDataProvider;
|
|
10
|
+
constructor(blockNumber: number, contractDataProvider: ContractDataProvider);
|
|
10
11
|
getBlockNumber(): Promise<number>;
|
|
11
12
|
getContractClass(id: Fr): Promise<ContractClassPublic | undefined>;
|
|
12
13
|
getBytecodeCommitment(id: Fr): Promise<Fr | undefined>;
|
|
13
14
|
getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined>;
|
|
14
15
|
getContractClassIds(): Promise<Fr[]>;
|
|
15
16
|
getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined>;
|
|
16
|
-
|
|
17
|
-
registerContractFunctionSignatures(
|
|
18
|
-
addContractClass(_contractClass: ContractClassPublic): Promise<void>;
|
|
17
|
+
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
18
|
+
registerContractFunctionSignatures(_signatures: []): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3B1YmxpY19jb250cmFjdF9kYXRhX3NvdXJjZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWwvdHhlX3B1YmxpY19jb250cmFjdF9kYXRhX3NvdXJjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDOUMsT0FBTyxLQUFLLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUM5RCxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFBZ0IsTUFBTSxtQkFBbUIsQ0FBQztBQUMxRixPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUNoRSxPQUFPLEVBQ0wsS0FBSyxtQkFBbUIsRUFDeEIsS0FBSyxrQkFBa0IsRUFDdkIsS0FBSywyQkFBMkIsRUFJakMsTUFBTSx3QkFBd0IsQ0FBQztBQUVoQyxxQkFBYSwyQkFBNEIsWUFBVyxrQkFBa0I7O0lBR2xFLE9BQU8sQ0FBQyxXQUFXO0lBQ25CLE9BQU8sQ0FBQyxvQkFBb0I7SUFGOUIsWUFDVSxXQUFXLEVBQUUsTUFBTSxFQUNuQixvQkFBb0IsRUFBRSxvQkFBb0IsRUFDaEQ7SUFFSixjQUFjLElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUVoQztJQUVLLGdCQUFnQixDQUFDLEVBQUUsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixHQUFHLFNBQVMsQ0FBQyxDQWdDdkU7SUFFSyxxQkFBcUIsQ0FBQyxFQUFFLEVBQUUsRUFBRSxHQUFHLE9BQU8sQ0FBQyxFQUFFLEdBQUcsU0FBUyxDQUFDLENBRzNEO0lBRUssV0FBVyxDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLDJCQUEyQixHQUFHLFNBQVMsQ0FBQyxDQUd6RjtJQUVELG1CQUFtQixJQUFJLE9BQU8sQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUVuQztJQUVLLG1CQUFtQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLGdCQUFnQixHQUFHLFNBQVMsQ0FBQyxDQUd0RjtJQUVLLG9CQUFvQixDQUFDLE9BQU8sRUFBRSxZQUFZLEVBQUUsUUFBUSxFQUFFLGdCQUFnQixHQUFHLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRXpHO0lBRUQsa0NBQWtDLENBQUMsV0FBVyxFQUFFLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBRWpFO0NBQ0YifQ==
|
|
@@ -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":"
|
|
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,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,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,oBAAoB;IAF9B,YACU,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,oBAAoB,EAChD;IAEJ,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAEhC;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,56 +1,52 @@
|
|
|
1
|
-
import { PUBLIC_DISPATCH_SELECTOR } from '@aztec/constants';
|
|
2
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { computePublicBytecodeCommitment } from '@aztec/stdlib/contract';
|
|
2
|
+
import { FunctionType } from '@aztec/stdlib/abi';
|
|
3
|
+
import { computePrivateFunctionsRoot, computePublicBytecodeCommitment, getContractClassPrivateFunctionFromArtifact } from '@aztec/stdlib/contract';
|
|
6
4
|
export class TXEPublicContractDataSource {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
bytecode,
|
|
18
|
-
selector
|
|
19
|
-
};
|
|
5
|
+
blockNumber;
|
|
6
|
+
contractDataProvider;
|
|
7
|
+
#privateFunctionsRoot;
|
|
8
|
+
constructor(blockNumber, contractDataProvider){
|
|
9
|
+
this.blockNumber = blockNumber;
|
|
10
|
+
this.contractDataProvider = contractDataProvider;
|
|
11
|
+
this.#privateFunctionsRoot = new Map();
|
|
20
12
|
}
|
|
21
13
|
getBlockNumber() {
|
|
22
|
-
return this.
|
|
14
|
+
return Promise.resolve(this.blockNumber);
|
|
23
15
|
}
|
|
24
16
|
async getContractClass(id) {
|
|
25
|
-
const contractClass = await this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
const contractClass = await this.contractDataProvider.getContractClass(id);
|
|
18
|
+
if (!contractClass) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const artifact = await this.contractDataProvider.getContractArtifact(id);
|
|
22
|
+
if (!artifact) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let privateFunctionsRoot;
|
|
26
|
+
if (!this.#privateFunctionsRoot.has(id.toString())) {
|
|
27
|
+
const privateFunctions = await Promise.all(artifact.functions.filter((fn)=>fn.functionType === FunctionType.PRIVATE).map((fn)=>getContractClassPrivateFunctionFromArtifact(fn)));
|
|
28
|
+
privateFunctionsRoot = await computePrivateFunctionsRoot(privateFunctions);
|
|
29
|
+
this.#privateFunctionsRoot.set(id.toString(), privateFunctionsRoot.toBuffer());
|
|
30
|
+
} else {
|
|
31
|
+
privateFunctionsRoot = Fr.fromBuffer(this.#privateFunctionsRoot.get(id.toString()));
|
|
35
32
|
}
|
|
36
33
|
return {
|
|
37
34
|
id,
|
|
38
35
|
artifactHash: contractClass.artifactHash,
|
|
39
36
|
packedBytecode: contractClass.packedBytecode,
|
|
40
|
-
|
|
41
|
-
privateFunctionsRoot: new Fr(privateFunctionsRoot.root),
|
|
37
|
+
privateFunctionsRoot,
|
|
42
38
|
version: contractClass.version,
|
|
43
39
|
privateFunctions: [],
|
|
44
|
-
|
|
40
|
+
utilityFunctions: []
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
async getBytecodeCommitment(id) {
|
|
48
|
-
const contractClass = await this.
|
|
49
|
-
return computePublicBytecodeCommitment(contractClass.packedBytecode);
|
|
44
|
+
const contractClass = await this.contractDataProvider.getContractClass(id);
|
|
45
|
+
return contractClass && computePublicBytecodeCommitment(contractClass.packedBytecode);
|
|
50
46
|
}
|
|
51
47
|
async getContract(address) {
|
|
52
|
-
const instance = await this.
|
|
53
|
-
return {
|
|
48
|
+
const instance = await this.contractDataProvider.getContractInstance(address);
|
|
49
|
+
return instance && {
|
|
54
50
|
...instance,
|
|
55
51
|
address
|
|
56
52
|
};
|
|
@@ -59,30 +55,13 @@ export class TXEPublicContractDataSource {
|
|
|
59
55
|
throw new Error('Method not implemented.');
|
|
60
56
|
}
|
|
61
57
|
async getContractArtifact(address) {
|
|
62
|
-
const instance = await this.
|
|
63
|
-
return this.
|
|
64
|
-
}
|
|
65
|
-
async getContractFunctionName(address, selector) {
|
|
66
|
-
const artifact = await this.getContractArtifact(address);
|
|
67
|
-
if (!artifact) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
const functionSelectorsAndNames = await Promise.all(artifact.functions.map(async (f)=>({
|
|
71
|
-
name: f.name,
|
|
72
|
-
selector: await FunctionSelector.fromNameAndParameters({
|
|
73
|
-
name: f.name,
|
|
74
|
-
parameters: f.parameters
|
|
75
|
-
})
|
|
76
|
-
})));
|
|
77
|
-
const func = functionSelectorsAndNames.find((f)=>f.selector.equals(selector));
|
|
78
|
-
return Promise.resolve(func?.name);
|
|
58
|
+
const instance = await this.contractDataProvider.getContractInstance(address);
|
|
59
|
+
return instance && this.contractDataProvider.getContractArtifact(instance.currentContractClassId);
|
|
79
60
|
}
|
|
80
|
-
|
|
81
|
-
return
|
|
61
|
+
async getDebugFunctionName(address, selector) {
|
|
62
|
+
return await this.contractDataProvider.getDebugFunctionName(address, selector);
|
|
82
63
|
}
|
|
83
|
-
|
|
84
|
-
addContractClass(_contractClass) {
|
|
85
|
-
// We don't really need to do anything for the txe here
|
|
64
|
+
registerContractFunctionSignatures(_signatures) {
|
|
86
65
|
return Promise.resolve();
|
|
87
66
|
}
|
|
88
67
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import { L2BlockHeader } from '@aztec/stdlib/block';
|
|
3
|
+
import { type MerkleTreeWriteOperations } from '@aztec/stdlib/trees';
|
|
4
|
+
import { GlobalVariables, TxEffect } from '@aztec/stdlib/tx';
|
|
5
|
+
/**
|
|
6
|
+
* Returns a transaction request hash that is valid for transactions that are the only ones in a block.
|
|
7
|
+
* @param blockNumber The number for the block in which there is a single transaction.
|
|
8
|
+
* @returns The transaction request hash.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSingleTxBlockRequestHash(blockNumber: number): Fr;
|
|
11
|
+
export declare function insertTxEffectIntoWorldTrees(txEffect: TxEffect, worldTrees: MerkleTreeWriteOperations): Promise<void>;
|
|
12
|
+
export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables): Promise<L2BlockHeader>;
|
|
13
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcmVhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFPQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRXBELE9BQU8sRUFBd0MsS0FBSyx5QkFBeUIsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQzNHLE9BQU8sRUFBRSxlQUFlLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFN0Q7Ozs7R0FJRztBQUNILHdCQUFnQiwyQkFBMkIsQ0FBQyxXQUFXLEVBQUUsTUFBTSxHQUFHLEVBQUUsQ0FFbkU7QUFFRCx3QkFBc0IsNEJBQTRCLENBQ2hELFFBQVEsRUFBRSxRQUFRLEVBQ2xCLFVBQVUsRUFBRSx5QkFBeUIsR0FDcEMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQWtCZjtBQUVELHdCQUFzQixrQkFBa0IsQ0FDdEMsVUFBVSxFQUFFLHlCQUF5QixFQUNyQyxlQUFlLEVBQUUsZUFBZSxHQUMvQixPQUFPLENBQUMsYUFBYSxDQUFDLENBY3hCIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,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,MAAM,GAAG,EAAE,CAEnE;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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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/fields';
|
|
4
|
+
import { 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
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
2
|
+
import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
3
|
+
import { TxEffect } from '@aztec/stdlib/tx';
|
|
4
|
+
export declare function makeTxEffect(noteCache: ExecutionNoteCache, protocolNullifier: Fr, txBlockNumber: number): Promise<TxEffect>;
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZWZmZWN0X2NyZWF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvdHhfZWZmZWN0X2NyZWF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUM5QyxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRS9ELE9BQU8sRUFBRSxRQUFRLEVBQVUsTUFBTSxrQkFBa0IsQ0FBQztBQUVwRCx3QkFBc0IsWUFBWSxDQUNoQyxTQUFTLEVBQUUsa0JBQWtCLEVBQzdCLGlCQUFpQixFQUFFLEVBQUUsRUFDckIsYUFBYSxFQUFFLE1BQU0sR0FDcEIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQTJCbkIifQ==
|
|
@@ -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,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,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,MAAM,GACpB,OAAO,CAAC,QAAQ,CAAC,CA2BnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
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": "0.0.
|
|
3
|
+
"version": "0.0.1-commit.5daedc8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -12,13 +12,11 @@
|
|
|
12
12
|
"tsconfig": "./tsconfig.json"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "yarn clean &&
|
|
16
|
-
"build:dev": "
|
|
15
|
+
"build": "yarn clean && tsgo -b",
|
|
16
|
+
"build:dev": "tsgo -b --watch",
|
|
17
17
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
18
|
-
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
19
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
20
18
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
|
|
21
|
-
"dev": "LOG_LEVEL
|
|
19
|
+
"dev": "LOG_LEVEL=\"debug; trace: simulator:state_manager; info: json-rpc:proxy\" node ./dest/bin/index.js",
|
|
22
20
|
"start": "node --no-warnings ./dest/bin/index.js"
|
|
23
21
|
},
|
|
24
22
|
"inherits": [
|
|
@@ -56,30 +54,38 @@
|
|
|
56
54
|
"testTimeout": 120000,
|
|
57
55
|
"setupFiles": [
|
|
58
56
|
"../../foundation/src/jest/setup.mjs"
|
|
57
|
+
],
|
|
58
|
+
"testEnvironment": "../../foundation/src/jest/env.mjs",
|
|
59
|
+
"setupFilesAfterEnv": [
|
|
60
|
+
"../../foundation/src/jest/setupAfterEnv.mjs"
|
|
59
61
|
]
|
|
60
62
|
},
|
|
61
63
|
"dependencies": {
|
|
62
|
-
"@aztec/accounts": "0.0.
|
|
63
|
-
"@aztec/
|
|
64
|
-
"@aztec/
|
|
65
|
-
"@aztec/
|
|
66
|
-
"@aztec/
|
|
67
|
-
"@aztec/
|
|
68
|
-
"@aztec/
|
|
69
|
-
"@aztec/
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/
|
|
72
|
-
"@aztec/
|
|
64
|
+
"@aztec/accounts": "0.0.1-commit.5daedc8",
|
|
65
|
+
"@aztec/archiver": "0.0.1-commit.5daedc8",
|
|
66
|
+
"@aztec/aztec-node": "0.0.1-commit.5daedc8",
|
|
67
|
+
"@aztec/aztec.js": "0.0.1-commit.5daedc8",
|
|
68
|
+
"@aztec/bb-prover": "0.0.1-commit.5daedc8",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.5daedc8",
|
|
70
|
+
"@aztec/foundation": "0.0.1-commit.5daedc8",
|
|
71
|
+
"@aztec/key-store": "0.0.1-commit.5daedc8",
|
|
72
|
+
"@aztec/kv-store": "0.0.1-commit.5daedc8",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.5daedc8",
|
|
74
|
+
"@aztec/pxe": "0.0.1-commit.5daedc8",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.5daedc8",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.5daedc8",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.5daedc8",
|
|
73
78
|
"zod": "^3.23.8"
|
|
74
79
|
},
|
|
75
80
|
"devDependencies": {
|
|
76
|
-
"@jest/globals": "^
|
|
77
|
-
"@types/jest": "^
|
|
78
|
-
"@types/node": "^
|
|
79
|
-
"
|
|
80
|
-
"jest
|
|
81
|
+
"@jest/globals": "^30.0.0",
|
|
82
|
+
"@types/jest": "^30.0.0",
|
|
83
|
+
"@types/node": "^22.15.17",
|
|
84
|
+
"@typescript/native-preview": "7.0.0-dev.20251126.1",
|
|
85
|
+
"jest": "^30.0.0",
|
|
86
|
+
"jest-mock-extended": "^4.0.0",
|
|
81
87
|
"ts-node": "^10.9.1",
|
|
82
|
-
"typescript": "^5.
|
|
88
|
+
"typescript": "^5.3.3"
|
|
83
89
|
},
|
|
84
90
|
"files": [
|
|
85
91
|
"dest",
|
|
@@ -88,6 +94,6 @@
|
|
|
88
94
|
],
|
|
89
95
|
"types": "./dest/index.d.ts",
|
|
90
96
|
"engines": {
|
|
91
|
-
"node": ">=
|
|
97
|
+
"node": ">=20.10"
|
|
92
98
|
}
|
|
93
99
|
}
|
package/src/bin/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --no-warnings
|
|
2
|
-
import { createLogger } from '@aztec/aztec.js';
|
|
2
|
+
import { createLogger } from '@aztec/aztec.js/log';
|
|
3
3
|
import { startHttpRpcServer } from '@aztec/foundation/json-rpc/server';
|
|
4
4
|
|
|
5
5
|
import { createTXERpcServer } from '../index.js';
|
|
@@ -20,11 +20,12 @@ async function main() {
|
|
|
20
20
|
process.exit(0);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const logger = createLogger('txe:
|
|
23
|
+
const logger = createLogger('txe:rpc');
|
|
24
24
|
logger.info(`Setting up TXE...`);
|
|
25
25
|
|
|
26
26
|
const txeServer = createTXERpcServer(logger);
|
|
27
27
|
const { port } = await startHttpRpcServer(txeServer, {
|
|
28
|
+
host: '127.0.0.1',
|
|
28
29
|
port: TXE_PORT,
|
|
29
30
|
timeoutMs: 1e3 * 60 * 5,
|
|
30
31
|
});
|