@aztec/txe 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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/AuthRegistry-QVGDDH5X.js +3 -0
- package/dest/AuthRegistry-QVGDDH5X.js.map +7 -0
- package/dest/ContractClassRegistry-PVNCKGG7.js +3 -0
- package/dest/ContractClassRegistry-PVNCKGG7.js.map +7 -0
- package/dest/ContractInstanceRegistry-WLOZKTR6.js +3 -0
- package/dest/ContractInstanceRegistry-WLOZKTR6.js.map +7 -0
- package/dest/FeeJuice-MAQJU53K.js +3 -0
- package/dest/FeeJuice-MAQJU53K.js.map +7 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js +3 -0
- package/dest/HandshakeRegistry-GY5CPEPS.js.map +7 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js +3 -0
- package/dest/MultiCallEntrypoint-QG5H33ZZ.js.map +7 -0
- package/dest/SchnorrAccount-ADD65DYA.js +3 -0
- package/dest/SchnorrAccount-ADD65DYA.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-TWGKRUSY.js +3 -0
- package/dest/SchnorrInitializerlessAccount-TWGKRUSY.js.map +7 -0
- package/dest/bin/check_txe_oracle_version.js +9 -19
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_test_server.d.ts +3 -0
- package/dest/bin/oracle_test_server.d.ts.map +1 -0
- package/dest/bin/oracle_test_server.js +41 -0
- package/dest/chunk-32UHX7YY.js +3 -0
- package/dest/{chunk-DF6RMOC6.js → chunk-RVEPNDEP.js} +2 -2
- package/dest/{chunk-DF6RMOC6.js.map → chunk-RVEPNDEP.js.map} +3 -3
- package/dest/chunk-XWIMXLKD.js +258 -0
- package/dest/chunk-XWIMXLKD.js.map +7 -0
- package/dest/constants.d.ts +3 -1
- package/dest/constants.d.ts.map +1 -1
- package/dest/constants.js +5 -2
- package/dest/dispatcher_pool.d.ts +2 -2
- package/dest/dispatcher_pool.d.ts.map +1 -1
- package/dest/dispatcher_pool.js +5 -3
- package/dest/index.d.ts +6 -143
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +12 -169
- package/dest/metafile.json +10267 -9581
- package/dest/oracle/interfaces.d.ts +38 -11
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
- package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
- package/dest/oracle/tagging_secret_strategy.js +12 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts +16 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -0
- package/dest/oracle/test-resolver/default_fixtures.js +200 -0
- package/dest/oracle/test-resolver/index.d.ts +9 -0
- package/dest/oracle/test-resolver/index.d.ts.map +1 -0
- package/dest/oracle/test-resolver/index.js +32 -0
- package/dest/oracle/test-resolver/resolver.d.ts +48 -0
- package/dest/oracle/test-resolver/resolver.d.ts.map +1 -0
- package/dest/oracle/test-resolver/resolver.js +181 -0
- package/dest/oracle/txe_oracle_public_context.d.ts +25 -6
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +34 -1
- package/dest/oracle/txe_oracle_registry.d.ts +172 -0
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -0
- package/dest/oracle/txe_oracle_registry.js +767 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +39 -14
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +489 -289
- package/dest/{txe_oracle_version.d.ts → oracle/txe_oracle_version.d.ts} +5 -5
- package/dest/oracle/txe_oracle_version.d.ts.map +1 -0
- package/dest/{txe_oracle_version.js → oracle/txe_oracle_version.js} +4 -4
- package/dest/rpc_translator.d.ts +116 -284
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +809 -860
- package/dest/server.bundle.js +1 -1
- package/dest/state_machine/archiver.d.ts +3 -2
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +9 -3
- 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 -0
- package/dest/state_machine/global_variable_builder.d.ts +3 -4
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +0 -3
- package/dest/state_machine/index.d.ts +8 -6
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +41 -19
- package/dest/state_machine/mock_epoch_cache.d.ts +2 -3
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +3 -6
- package/dest/state_machine/synchronizer.d.ts +10 -2
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +18 -5
- package/dest/txe_session.d.ts +43 -28
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +183 -47
- package/dest/utils/block_creation.d.ts +2 -2
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +2 -2
- package/dest/utils/encoding.d.ts +8 -5
- package/dest/utils/encoding.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.d.ts +1 -1
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +0 -1
- package/dest/utils/txe_artifact_resolver.d.ts +37 -0
- package/dest/utils/txe_artifact_resolver.d.ts.map +1 -0
- package/dest/utils/txe_artifact_resolver.js +161 -0
- package/dest/utils/txe_public_contract_data_source.d.ts +1 -1
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/utils/txe_public_contract_data_source.js +7 -4
- package/dest/worker.bundle.js +1 -1
- package/package.json +18 -17
- package/src/bin/check_txe_oracle_version.ts +11 -17
- package/src/bin/oracle_test_server.ts +51 -0
- package/src/constants.ts +6 -2
- package/src/dispatcher_pool.ts +4 -3
- package/src/index.ts +21 -198
- package/src/oracle/interfaces.ts +35 -9
- package/src/oracle/tagging_secret_strategy.ts +25 -0
- package/src/oracle/test-resolver/default_fixtures.ts +271 -0
- package/src/oracle/test-resolver/index.ts +44 -0
- package/src/oracle/test-resolver/resolver.ts +245 -0
- package/src/oracle/txe_oracle_public_context.ts +36 -4
- package/src/oracle/txe_oracle_registry.ts +556 -0
- package/src/oracle/txe_oracle_top_level_context.ts +249 -66
- package/src/{txe_oracle_version.ts → oracle/txe_oracle_version.ts} +4 -4
- package/src/rpc_translator.ts +850 -1065
- package/src/state_machine/archiver.ts +9 -3
- package/src/state_machine/dummy_p2p_client.ts +13 -0
- package/src/state_machine/global_variable_builder.ts +2 -16
- package/src/state_machine/index.ts +50 -34
- package/src/state_machine/mock_epoch_cache.ts +4 -8
- package/src/state_machine/synchronizer.ts +26 -5
- package/src/txe_session.ts +325 -56
- package/src/utils/block_creation.ts +2 -1
- package/src/utils/tx_effect_creation.ts +0 -2
- package/src/utils/txe_artifact_resolver.ts +217 -0
- package/src/utils/txe_public_contract_data_source.ts +6 -4
- package/dest/ContractClassRegistry-KKNT527R.js +0 -3
- package/dest/ContractClassRegistry-KKNT527R.js.map +0 -7
- package/dest/ContractInstanceRegistry-GSKBNL3Q.js +0 -3
- package/dest/ContractInstanceRegistry-GSKBNL3Q.js.map +0 -7
- package/dest/FeeJuice-GUJ5O6GB.js +0 -3
- package/dest/FeeJuice-GUJ5O6GB.js.map +0 -7
- package/dest/MultiCallEntrypoint-ZQPCKVKL.js +0 -3
- package/dest/MultiCallEntrypoint-ZQPCKVKL.js.map +0 -7
- package/dest/SchnorrAccount-QIXE5DXA.js +0 -3
- package/dest/SchnorrAccount-QIXE5DXA.js.map +0 -7
- package/dest/chunk-BJVAAXNA.js +0 -3
- package/dest/chunk-PPJTNNUG.js +0 -265
- package/dest/chunk-PPJTNNUG.js.map +0 -7
- package/dest/txe_oracle_version.d.ts.map +0 -1
- /package/dest/{chunk-BJVAAXNA.js.map → chunk-32UHX7YY.js.map} +0 -0
package/dest/constants.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
2
2
|
export declare const DEFAULT_ADDRESS: AztecAddress;
|
|
3
|
+
export declare const MAX_PRIVATE_EVENT_LEN = 10;
|
|
4
|
+
export declare const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
|
|
3
5
|
export declare const MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY = 64;
|
|
4
6
|
export declare const MAX_OFFCHAIN_EFFECT_LEN: number;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUUzRCxlQUFPLE1BQU0sZUFBZSxjQUFvQyxDQUFDO0FBR2pFLGVBQU8sTUFBTSxxQkFBcUIsS0FBSyxDQUFDO0FBQ3hDLGVBQU8sTUFBTSxnQ0FBZ0MsSUFBSSxDQUFDO0FBR2xELGVBQU8sTUFBTSxrQ0FBa0MsS0FBSyxDQUFDO0FBRXJELGVBQU8sTUFBTSx1QkFBdUIsUUFBaUMsQ0FBQyJ9
|
package/dest/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAO,MAAM,eAAe,cAAoC,CAAC;AAGjE,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAGlD,eAAO,MAAM,kCAAkC,KAAK,CAAC;AAErD,eAAO,MAAM,uBAAuB,QAAiC,CAAC"}
|
package/dest/constants.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
2
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
3
|
-
export const DEFAULT_ADDRESS = AztecAddress.
|
|
3
|
+
export const DEFAULT_ADDRESS = AztecAddress.fromNumberUnsafe(42);
|
|
4
|
+
// This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_MSG_PLAINTEXT_RESERVED_FIELDS_LEN
|
|
5
|
+
export const MAX_PRIVATE_EVENT_LEN = 10;
|
|
6
|
+
export const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
|
|
4
7
|
// Arbitrarily set at 64 because we need a bound. Nothing inherent about it.
|
|
5
8
|
export const MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY = 64;
|
|
6
|
-
// Must match MAX_OFFCHAIN_EFFECT_LEN in noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr.
|
|
9
|
+
// Must match MAX_OFFCHAIN_EFFECT_LEN in noir-projects/labs/aztec-nr/aztec/src/test/helpers/txe_oracles.nr.
|
|
7
10
|
export const MAX_OFFCHAIN_EFFECT_LEN = 2 + PRIVATE_LOG_CIPHERTEXT_LEN;
|
|
@@ -3,7 +3,7 @@ import type { TXEForeignCallInput } from './index.js';
|
|
|
3
3
|
import type { ForeignCallResult } from './utils/encoding.js';
|
|
4
4
|
/**
|
|
5
5
|
* Opens a fresh LMDB in a tmp dir and writes the protocol contracts in
|
|
6
|
-
* {@link TXE_REQUIRED_PROTOCOL_CONTRACTS} plus the standard AuthRegistry and the SchnorrAccount artifact,
|
|
6
|
+
* {@link TXE_REQUIRED_PROTOCOL_CONTRACTS} plus the standard AuthRegistry, HandshakeRegistry, and the SchnorrAccount artifact,
|
|
7
7
|
* returning the directory path and the SchnorrAccount class id (hex). The store handle is intentionally kept
|
|
8
8
|
* alive: closing it would trigger the ephemeral-store cleanup hook and remove the tmp
|
|
9
9
|
* directory, so any worker that has not yet cloned would find it missing.
|
|
@@ -64,4 +64,4 @@ export declare class TXEDispatcherPool {
|
|
|
64
64
|
private handleResult;
|
|
65
65
|
private handleWorkerError;
|
|
66
66
|
}
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlzcGF0Y2hlcl9wb29sLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZGlzcGF0Y2hlcl9wb29sLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBY3BELE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sWUFBWSxDQUFDO0FBQ3RELE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFLN0Q7Ozs7OztHQU1HO0FBQ0gsd0JBQXNCLHdCQUF3QixJQUFJLE9BQU8sQ0FBQztJQUFFLE9BQU8sRUFBRSxNQUFNLENBQUM7SUFBQyxjQUFjLEVBQUUsTUFBTSxDQUFBO0NBQUUsQ0FBQyxDQW1Cckc7QUEwREQsTUFBTSxXQUFXLHdCQUF3QjtJQUN2QywrQkFBK0I7SUFDL0IsT0FBTyxDQUFDLEVBQUUsTUFBTSxDQUFDO0NBQ2xCO0FBRUQ7Ozs7Ozs7Ozs7O0dBV0c7QUFDSCxxQkFBYSxpQkFBaUI7SUFZMUIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNO0lBWHpCLE9BQU8sQ0FBQyxRQUFRLENBQUMsT0FBTyxDQUFvQjtJQUM1QyxPQUFPLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBNkI7SUFDN0QsT0FBTyxDQUFDLFFBQVEsQ0FBQyxPQUFPLENBQXFDO0lBQzdELE9BQU8sQ0FBQyxhQUFhLENBQUs7SUFDMUIsT0FBTyxDQUFDLFFBQVEsQ0FBQyxVQUFVLENBQVM7SUFDcEMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxZQUFZLENBQWdCO0lBQzdDLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQyxDQUFTO0lBQ3hDLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FBUztJQUNoQyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQU07SUFFekIsWUFDbUIsTUFBTSxFQUFFLE1BQU0sRUFDL0IsSUFBSSxHQUFFLHdCQUE2QixFQUtwQztJQUVELGtHQUFrRztJQUMzRixLQUFLLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUU1QjtZQUVhLElBQUk7SUFhbEI7Ozs7T0FJRztJQUNILE9BQU8sQ0FBQyxXQUFXO0lBeUJuQiw2RkFBNkY7SUFDN0YsY0FBYyxDQUFDLFNBQVMsRUFBRSxNQUFNLEdBQUcsSUFBSSxDQVl0QztJQUdLLG9CQUFvQixDQUFDLFFBQVEsRUFBRSxtQkFBbUIsR0FBRyxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FtQnBGO0lBRUQsd0ZBQXdGO0lBQ2xGLFFBQVEsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLENBTzlCO0lBRUQ7Ozs7T0FJRztJQUNILE9BQU8sQ0FBQyxpQkFBaUI7SUFnQnpCLE9BQU8sQ0FBQyxhQUFhO0lBbUJyQixPQUFPLENBQUMsWUFBWTtJQWtCcEIsT0FBTyxDQUFDLGlCQUFpQjtDQW9CMUIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher_pool.d.ts","sourceRoot":"","sources":["../src/dispatcher_pool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"dispatcher_pool.d.ts","sourceRoot":"","sources":["../src/dispatcher_pool.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAcpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAK7D;;;;;;GAMG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC,CAmBrG;AA0DD,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAiB;IAY1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAXzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;IAC7C,OAAO,CAAC,sBAAsB,CAAC,CAAS;IACxC,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,UAAU,CAAC,CAAM;IAEzB,YACmB,MAAM,EAAE,MAAM,EAC/B,IAAI,GAAE,wBAA6B,EAKpC;IAED,kGAAkG;IAC3F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5B;YAEa,IAAI;IAalB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAyBnB,6FAA6F;IAC7F,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAYtC;IAGK,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAmBpF;IAED,wFAAwF;IAClF,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAO9B;IAED;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,iBAAiB;CAoB1B"}
|
package/dest/dispatcher_pool.js
CHANGED
|
@@ -3,7 +3,8 @@ import { BackendType, Barretenberg, BarretenbergSync } from '@aztec/bb.js';
|
|
|
3
3
|
import { openEphemeralStore } from '@aztec/kv-store/lmdb-v2';
|
|
4
4
|
import { LazyProtocolContractsProvider } from '@aztec/protocol-contracts/providers/lazy';
|
|
5
5
|
import { ContractStore } from '@aztec/pxe/client/lazy';
|
|
6
|
-
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
|
|
6
|
+
import { getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry/lazy';
|
|
7
|
+
import { getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry/lazy';
|
|
7
8
|
import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
|
|
8
9
|
import { existsSync } from 'node:fs';
|
|
9
10
|
import { cpus } from 'node:os';
|
|
@@ -20,7 +21,7 @@ void BarretenbergSync.initSingleton({
|
|
|
20
21
|
});
|
|
21
22
|
/**
|
|
22
23
|
* Opens a fresh LMDB in a tmp dir and writes the protocol contracts in
|
|
23
|
-
* {@link TXE_REQUIRED_PROTOCOL_CONTRACTS} plus the standard AuthRegistry and the SchnorrAccount artifact,
|
|
24
|
+
* {@link TXE_REQUIRED_PROTOCOL_CONTRACTS} plus the standard AuthRegistry, HandshakeRegistry, and the SchnorrAccount artifact,
|
|
24
25
|
* returning the directory path and the SchnorrAccount class id (hex). The store handle is intentionally kept
|
|
25
26
|
* alive: closing it would trigger the ephemeral-store cleanup hook and remove the tmp
|
|
26
27
|
* directory, so any worker that has not yet cloned would find it missing.
|
|
@@ -32,7 +33,8 @@ void BarretenbergSync.initSingleton({
|
|
|
32
33
|
const [protocolContracts, standardContracts, schnorrArtifact] = await Promise.all([
|
|
33
34
|
Promise.all(TXE_REQUIRED_PROTOCOL_CONTRACTS.map((name)=>provider.getProtocolContractArtifact(name))),
|
|
34
35
|
Promise.all([
|
|
35
|
-
getStandardAuthRegistry()
|
|
36
|
+
getStandardAuthRegistry(),
|
|
37
|
+
getStandardHandshakeRegistry()
|
|
36
38
|
]),
|
|
37
39
|
getSchnorrAccountContractArtifact()
|
|
38
40
|
]);
|
package/dest/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
3
|
-
import { PublicKeys } from '@aztec/aztec.js/keys';
|
|
4
1
|
import type { Logger } from '@aztec/foundation/log';
|
|
5
2
|
import type { ProtocolContractName } from '@aztec/protocol-contracts';
|
|
6
3
|
import type { ApiSchemaFor } from '@aztec/stdlib/schemas';
|
|
@@ -16,140 +13,7 @@ export type TXEForeignCallInput = {
|
|
|
16
13
|
package_name: string;
|
|
17
14
|
inputs: ForeignCallArgs;
|
|
18
15
|
};
|
|
19
|
-
export declare const TXEForeignCallInputSchema: z.
|
|
20
|
-
session_id: z.ZodNumber;
|
|
21
|
-
function: z.ZodType<TXEOracleFunctionName, unknown, z.core.$ZodTypeInternals<TXEOracleFunctionName, unknown>>;
|
|
22
|
-
root_path: z.ZodString;
|
|
23
|
-
package_name: z.ZodString;
|
|
24
|
-
inputs: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
25
|
-
name: z.ZodString;
|
|
26
|
-
aztecVersion: z.ZodDefault<z.ZodString>;
|
|
27
|
-
functions: z.ZodArray<z.ZodIntersection<z.ZodObject<{
|
|
28
|
-
name: z.ZodString;
|
|
29
|
-
functionType: z.ZodEnum<typeof import("@aztec/aztec.js/abi").FunctionType>;
|
|
30
|
-
isOnlySelf: z.ZodBoolean;
|
|
31
|
-
isStatic: z.ZodBoolean;
|
|
32
|
-
isInitializer: z.ZodBoolean;
|
|
33
|
-
parameters: z.ZodArray<z.ZodObject<{
|
|
34
|
-
name: z.ZodString;
|
|
35
|
-
type: z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>;
|
|
36
|
-
visibility: z.ZodEnum<{
|
|
37
|
-
databus: "databus";
|
|
38
|
-
private: "private";
|
|
39
|
-
public: "public";
|
|
40
|
-
}>;
|
|
41
|
-
}, z.core.$strip>>;
|
|
42
|
-
returnTypes: z.ZodArray<z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>;
|
|
43
|
-
errorTypes: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
44
|
-
error_kind: z.ZodLiteral<"string">;
|
|
45
|
-
string: z.ZodString;
|
|
46
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
-
error_kind: z.ZodLiteral<"fmtstring">;
|
|
48
|
-
length: z.ZodNumber;
|
|
49
|
-
item_types: z.ZodArray<z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>;
|
|
50
|
-
}, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
|
|
51
|
-
error_kind: z.ZodLiteral<"custom">;
|
|
52
|
-
}, z.core.$strip>, z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>]>>>;
|
|
53
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
-
bytecode: import("@aztec/stdlib/schemas").ZodFor<Buffer<ArrayBufferLike>>;
|
|
55
|
-
verificationKey: z.ZodOptional<z.ZodString>;
|
|
56
|
-
debugSymbols: z.ZodString;
|
|
57
|
-
debug: z.ZodOptional<z.ZodObject<{
|
|
58
|
-
debugSymbols: z.ZodObject<{
|
|
59
|
-
location_tree: z.ZodObject<{
|
|
60
|
-
locations: z.ZodArray<z.ZodObject<{
|
|
61
|
-
parent: z.ZodNullable<z.ZodNumber>;
|
|
62
|
-
value: z.ZodObject<{
|
|
63
|
-
span: z.ZodObject<{
|
|
64
|
-
start: z.ZodNumber;
|
|
65
|
-
end: z.ZodNumber;
|
|
66
|
-
}, z.core.$strip>;
|
|
67
|
-
file: z.ZodNumber;
|
|
68
|
-
}, z.core.$strip>;
|
|
69
|
-
}, z.core.$strip>>;
|
|
70
|
-
}, z.core.$strip>;
|
|
71
|
-
acir_locations: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
72
|
-
brillig_locations: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
73
|
-
}, z.core.$strip>;
|
|
74
|
-
files: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
75
|
-
source: z.ZodString;
|
|
76
|
-
path: z.ZodString;
|
|
77
|
-
function_locations: z.ZodArray<z.ZodObject<{
|
|
78
|
-
start: z.ZodNumber;
|
|
79
|
-
name: z.ZodString;
|
|
80
|
-
}, z.core.$strip>>;
|
|
81
|
-
}, z.core.$strip>>;
|
|
82
|
-
}, z.core.$strip>>;
|
|
83
|
-
}, z.core.$strip>>>;
|
|
84
|
-
nonDispatchPublicFunctions: z.ZodArray<z.ZodObject<{
|
|
85
|
-
name: z.ZodString;
|
|
86
|
-
functionType: z.ZodEnum<typeof import("@aztec/aztec.js/abi").FunctionType>;
|
|
87
|
-
isOnlySelf: z.ZodBoolean;
|
|
88
|
-
isStatic: z.ZodBoolean;
|
|
89
|
-
isInitializer: z.ZodBoolean;
|
|
90
|
-
parameters: z.ZodArray<z.ZodObject<{
|
|
91
|
-
name: z.ZodString;
|
|
92
|
-
type: z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>;
|
|
93
|
-
visibility: z.ZodEnum<{
|
|
94
|
-
databus: "databus";
|
|
95
|
-
private: "private";
|
|
96
|
-
public: "public";
|
|
97
|
-
}>;
|
|
98
|
-
}, z.core.$strip>>;
|
|
99
|
-
returnTypes: z.ZodArray<z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>;
|
|
100
|
-
errorTypes: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
101
|
-
error_kind: z.ZodLiteral<"string">;
|
|
102
|
-
string: z.ZodString;
|
|
103
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
-
error_kind: z.ZodLiteral<"fmtstring">;
|
|
105
|
-
length: z.ZodNumber;
|
|
106
|
-
item_types: z.ZodArray<z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>;
|
|
107
|
-
}, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
|
|
108
|
-
error_kind: z.ZodLiteral<"custom">;
|
|
109
|
-
}, z.core.$strip>, z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>]>>>;
|
|
110
|
-
}, z.core.$strip>>;
|
|
111
|
-
outputs: z.ZodObject<{
|
|
112
|
-
structs: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodType<import("@aztec/aztec.js/abi").AbiType, unknown, z.core.$ZodTypeInternals<import("@aztec/aztec.js/abi").AbiType, unknown>>>>, z.ZodTransform<Record<string, import("@aztec/aztec.js/abi").AbiType[]>, Record<string, import("@aztec/aztec.js/abi").AbiType[]>>>;
|
|
113
|
-
globals: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodType<import("@aztec/stdlib/abi").AbiValue, unknown, z.core.$ZodTypeInternals<import("@aztec/stdlib/abi").AbiValue, unknown>>>>;
|
|
114
|
-
}, z.core.$strip>;
|
|
115
|
-
storageLayout: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
116
|
-
slot: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
|
|
117
|
-
}, z.core.$strip>>;
|
|
118
|
-
fileMap: z.ZodRecord<z.ZodCoercedNumber<unknown>, z.ZodObject<{
|
|
119
|
-
source: z.ZodString;
|
|
120
|
-
path: z.ZodString;
|
|
121
|
-
function_locations: z.ZodArray<z.ZodObject<{
|
|
122
|
-
start: z.ZodNumber;
|
|
123
|
-
name: z.ZodString;
|
|
124
|
-
}, z.core.$strip>>;
|
|
125
|
-
}, z.core.$strip>>;
|
|
126
|
-
}, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
|
|
127
|
-
version: z.ZodLiteral<2>;
|
|
128
|
-
salt: import("@aztec/stdlib/schemas").ZodFor<Fr>;
|
|
129
|
-
deployer: import("@aztec/stdlib/schemas").ZodFor<AztecAddress>;
|
|
130
|
-
currentContractClassId: import("@aztec/stdlib/schemas").ZodFor<Fr>;
|
|
131
|
-
originalContractClassId: import("@aztec/stdlib/schemas").ZodFor<Fr>;
|
|
132
|
-
initializationHash: import("@aztec/stdlib/schemas").ZodFor<Fr>;
|
|
133
|
-
immutablesHash: import("@aztec/stdlib/schemas").ZodFor<Fr>;
|
|
134
|
-
publicKeys: z.ZodPipe<z.ZodObject<{
|
|
135
|
-
npkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
|
|
136
|
-
ivpkM: z.ZodType<import("@aztec/aztec.js/fields").Point, string, z.core.$ZodTypeInternals<import("@aztec/aztec.js/fields").Point, string>>;
|
|
137
|
-
ovpkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
|
|
138
|
-
tpkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
|
|
139
|
-
mspkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
|
|
140
|
-
fbpkMHash: z.ZodType<Fr, string, z.core.$ZodTypeInternals<Fr, string>>;
|
|
141
|
-
}, z.core.$strip>, z.ZodTransform<PublicKeys, {
|
|
142
|
-
npkMHash: Fr;
|
|
143
|
-
ivpkM: import("@aztec/aztec.js/fields").Point;
|
|
144
|
-
ovpkMHash: Fr;
|
|
145
|
-
tpkMHash: Fr;
|
|
146
|
-
mspkMHash: Fr;
|
|
147
|
-
fbpkMHash: Fr;
|
|
148
|
-
}>>;
|
|
149
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
150
|
-
address: import("@aztec/stdlib/schemas").ZodFor<AztecAddress>;
|
|
151
|
-
}, z.core.$strip>>]>>;
|
|
152
|
-
}, z.core.$strip>;
|
|
16
|
+
export declare const TXEForeignCallInputSchema: z.ZodType<TXEForeignCallInput>;
|
|
153
17
|
export interface TXEDispatcherOptions {
|
|
154
18
|
/**
|
|
155
19
|
* Path to an LMDB directory holding the required protocol contracts (see
|
|
@@ -159,21 +23,20 @@ export interface TXEDispatcherOptions {
|
|
|
159
23
|
*/
|
|
160
24
|
contractStoreSourceDir: string;
|
|
161
25
|
/**
|
|
162
|
-
* Class id (hex) of the SchnorrAccount artifact pre-registered in the shared LMDB.
|
|
163
|
-
*
|
|
164
|
-
* recomputing it via `getSchnorrAccountContractArtifact()` + `computeArtifactHash()`.
|
|
26
|
+
* Class id (hex) of the SchnorrAccount artifact pre-registered in the shared LMDB. The
|
|
27
|
+
* {@link TXEArtifactResolver} looks the artifact up from the cloned store via this class id
|
|
28
|
+
* instead of recomputing it via `getSchnorrAccountContractArtifact()` + `computeArtifactHash()`.
|
|
165
29
|
*/
|
|
166
30
|
schnorrClassId: string;
|
|
167
31
|
}
|
|
168
32
|
export declare class TXEDispatcher {
|
|
169
|
-
#private;
|
|
170
33
|
private logger;
|
|
171
34
|
private contractStore;
|
|
35
|
+
private artifactResolver;
|
|
172
36
|
private readonly contractStoreSourceDir;
|
|
173
37
|
private readonly schnorrClassId;
|
|
174
38
|
constructor(logger: Logger, opts: TXEDispatcherOptions);
|
|
175
39
|
private warmUp;
|
|
176
|
-
private fastHashFile;
|
|
177
40
|
resolve_foreign_call(callData: TXEForeignCallInput): Promise<ForeignCallResult>;
|
|
178
41
|
/**
|
|
179
42
|
* Releases a session and its resources (per-session LMDB + `NativeWorldStateService`).
|
|
@@ -186,4 +49,4 @@ export declare class TXEDispatcher {
|
|
|
186
49
|
/** Diagnostic-only: number of sessions currently held by this worker. */
|
|
187
50
|
export declare function activeSessionCount(): number;
|
|
188
51
|
export declare const TXEDispatcherApiSchema: ApiSchemaFor<TXEDispatcher>;
|
|
189
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
52
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUVwRCxPQUFPLEtBQUssRUFBRSxvQkFBb0IsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRXRFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSTFELE9BQU8sRUFBRSxDQUFDLEVBQUUsTUFBTSxLQUFLLENBQUM7QUFJeEIsT0FBTyw0QkFBNEIsQ0FBQztBQUNwQyxPQUFPLEVBQUUsS0FBSyxxQkFBcUIsRUFBYyxNQUFNLGtCQUFrQixDQUFDO0FBQzFFLE9BQU8sRUFDTCxLQUFLLGVBQWUsRUFFcEIsS0FBSyxpQkFBaUIsRUFFdkIsTUFBTSxxQkFBcUIsQ0FBQztBQUc3QixlQUFPLE1BQU0sK0JBQStCLEVBQUUsb0JBQW9CLEVBSWpFLENBQUM7QUFJRixNQUFNLE1BQU0sbUJBQW1CLEdBQUc7SUFDaEMsVUFBVSxFQUFFLE1BQU0sQ0FBQztJQUNuQixRQUFRLEVBQUUscUJBQXFCLENBQUM7SUFDaEMsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixZQUFZLEVBQUUsTUFBTSxDQUFDO0lBQ3JCLE1BQU0sRUFBRSxlQUFlLENBQUM7Q0FDekIsQ0FBQztBQUVGLGVBQU8sTUFBTSx5QkFBeUIsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLG1CQUFtQixDQWNwRSxDQUFDO0FBRUYsTUFBTSxXQUFXLG9CQUFvQjtJQUNuQzs7Ozs7T0FLRztJQUNILHNCQUFzQixFQUFFLE1BQU0sQ0FBQztJQUMvQjs7OztPQUlHO0lBQ0gsY0FBYyxFQUFFLE1BQU0sQ0FBQztDQUN4QjtBQUVELHFCQUFhLGFBQWE7SUFPdEIsT0FBTyxDQUFDLE1BQU07SUFOaEIsT0FBTyxDQUFDLGFBQWEsQ0FBaUI7SUFDdEMsT0FBTyxDQUFDLGdCQUFnQixDQUF1QjtJQUMvQyxPQUFPLENBQUMsUUFBUSxDQUFDLHNCQUFzQixDQUFTO0lBQ2hELE9BQU8sQ0FBQyxRQUFRLENBQUMsY0FBYyxDQUFLO0lBRXBDLFlBQ1UsTUFBTSxFQUFFLE1BQU0sRUFDdEIsSUFBSSxFQUFFLG9CQUFvQixFQUkzQjtZQU9hLE1BQU07SUFpQmQsb0JBQW9CLENBQUMsUUFBUSxFQUFFLG1CQUFtQixHQUFHLE9BQU8sQ0FBQyxpQkFBaUIsQ0FBQyxDQWlCcEY7SUFFRDs7Ozs7T0FLRztJQUNHLGNBQWMsQ0FBQyxTQUFTLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FPckQ7Q0FDRjtBQUVELHlFQUF5RTtBQUN6RSx3QkFBZ0Isa0JBQWtCLElBQUksTUFBTSxDQUUzQztBQUVELGVBQU8sTUFBTSxzQkFBc0IsRUFBRSxZQUFZLENBQUMsYUFBYSxDQUs5RCxDQUFDIn0=
|
package/dest/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAI1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,qBAAqB,EAAc,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,iBAAiB,EAEvB,MAAM,qBAAqB,CAAC;AAG7B,eAAO,MAAM,+BAA+B,EAAE,oBAAoB,EAIjE,CAAC;AAIF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAcpE,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,aAAa;IAOtB,OAAO,CAAC,MAAM;IANhB,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAS;IAChD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAK;IAEpC,YACU,MAAM,EAAE,MAAM,EACtB,IAAI,EAAE,oBAAoB,EAI3B;YAOa,MAAM;IAiBd,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiBpF;IAED;;;;;OAKG;IACG,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOrD;CACF;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAAC,aAAa,CAK9D,CAAC"}
|
package/dest/index.js
CHANGED
|
@@ -1,60 +1,21 @@
|
|
|
1
|
-
import { loadContractArtifact } from '@aztec/aztec.js/abi';
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
-
import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
|
|
4
1
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
5
|
-
import { PublicKeys, deriveKeys } from '@aztec/aztec.js/keys';
|
|
6
2
|
import { cloneEphemeralStoreFrom } from '@aztec/kv-store/lmdb-v2';
|
|
7
3
|
import { ContractStore } from '@aztec/pxe/client/lazy';
|
|
8
|
-
import { computeArtifactHash } from '@aztec/stdlib/contract';
|
|
9
4
|
import { zodFor } from '@aztec/stdlib/schemas';
|
|
10
|
-
import {
|
|
11
|
-
import { createReadStream } from 'fs';
|
|
12
|
-
import { readFile, readdir } from 'fs/promises';
|
|
13
|
-
import { join, parse } from 'path';
|
|
5
|
+
import { join } from 'path';
|
|
14
6
|
import { z } from 'zod';
|
|
15
7
|
// Side-effect import: registers the msgpackr Fr extension for the bundled `Fr` class. Must
|
|
16
8
|
// be loaded before any `sendMessage` call. See msgpackr_fr_extension.ts for the why.
|
|
17
9
|
import './msgpackr_fr_extension.js';
|
|
18
10
|
import { TXESession } from './txe_session.js';
|
|
19
|
-
import { ForeignCallArgsSchema, ForeignCallResultSchema
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
import { ForeignCallArgsSchema, ForeignCallResultSchema } from './utils/encoding.js';
|
|
12
|
+
import { TXEArtifactResolver } from './utils/txe_artifact_resolver.js';
|
|
13
|
+
export const TXE_REQUIRED_PROTOCOL_CONTRACTS = [
|
|
14
|
+
'ContractClassRegistry',
|
|
15
|
+
'ContractInstanceRegistry',
|
|
16
|
+
'FeeJuice'
|
|
17
|
+
];
|
|
23
18
|
const sessions = new Map();
|
|
24
|
-
/**
|
|
25
|
-
* Cache + in-flight map pair. Lookup hits the cache, then awaits an in-flight `compute()` if one
|
|
26
|
-
* exists, otherwise starts one and stores it. Guarantees `compute()` runs at most once per `key`
|
|
27
|
-
* across concurrent callers, which matters because `computeArtifactHash` is expensive.
|
|
28
|
-
*/ class AsyncCache {
|
|
29
|
-
cache = new Map();
|
|
30
|
-
inFlight = new Map();
|
|
31
|
-
getOrCompute(key, compute) {
|
|
32
|
-
const cached = this.cache.get(key);
|
|
33
|
-
if (cached !== undefined) {
|
|
34
|
-
return Promise.resolve(cached);
|
|
35
|
-
}
|
|
36
|
-
let pending = this.inFlight.get(key);
|
|
37
|
-
if (!pending) {
|
|
38
|
-
pending = (async ()=>{
|
|
39
|
-
try {
|
|
40
|
-
const value = await compute();
|
|
41
|
-
this.cache.set(key, value);
|
|
42
|
-
return value;
|
|
43
|
-
} finally{
|
|
44
|
-
this.inFlight.delete(key);
|
|
45
|
-
}
|
|
46
|
-
})();
|
|
47
|
-
this.inFlight.set(key, pending);
|
|
48
|
-
}
|
|
49
|
-
return pending;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Full deploys (artifact + computed instance), keyed by the full deploy context (contract +
|
|
53
|
-
// constructor args + publicKeys + salt + deployer). Hits on repeated identical deploys.
|
|
54
|
-
const TXEDeploymentsCache = new AsyncCache();
|
|
55
|
-
// Loaded + hashed contract artifact, keyed by compiled-bytecode hash. Hits across deploys of the
|
|
56
|
-
// same contract when constructor args / salt / deployer differ.
|
|
57
|
-
const TXEArtifactsCache = new AsyncCache();
|
|
58
19
|
export const TXEForeignCallInputSchema = zodFor()(z.object({
|
|
59
20
|
// Nargo generates session_id as a u64, which may exceed Number.MAX_SAFE_INTEGER.
|
|
60
21
|
// Zod 4's `.int()` enforces the safe-integer bound, so we drop it here and only require
|
|
@@ -71,6 +32,7 @@ export const TXEForeignCallInputSchema = zodFor()(z.object({
|
|
|
71
32
|
export class TXEDispatcher {
|
|
72
33
|
logger;
|
|
73
34
|
contractStore;
|
|
35
|
+
artifactResolver;
|
|
74
36
|
contractStoreSourceDir;
|
|
75
37
|
schnorrClassId;
|
|
76
38
|
constructor(logger, opts){
|
|
@@ -89,138 +51,19 @@ export class TXEDispatcher {
|
|
|
89
51
|
const t0 = Date.now();
|
|
90
52
|
const kvStore = await cloneEphemeralStoreFrom(join(this.contractStoreSourceDir, 'data.mdb'), 'txe-contracts', undefined, 2);
|
|
91
53
|
this.contractStore = new ContractStore(kvStore);
|
|
54
|
+
this.artifactResolver = new TXEArtifactResolver(this.contractStore, this.schnorrClassId);
|
|
92
55
|
this.logger.debug('Cloned shared protocol-contracts store', {
|
|
93
56
|
totalMs: Date.now() - t0
|
|
94
57
|
});
|
|
95
58
|
}
|
|
96
|
-
fastHashFile(path) {
|
|
97
|
-
return new Promise((resolve)=>{
|
|
98
|
-
const fd = createReadStream(path);
|
|
99
|
-
const hash = createHash('sha1');
|
|
100
|
-
hash.setEncoding('hex');
|
|
101
|
-
fd.on('end', function() {
|
|
102
|
-
hash.end();
|
|
103
|
-
resolve(hash.read());
|
|
104
|
-
});
|
|
105
|
-
fd.pipe(hash);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
async #processDeployInputs({ inputs, root_path: rootPath, package_name: packageName }) {
|
|
109
|
-
const [contractPath, initializer] = inputs.slice(0, 2).map((input)=>fromArray(input).map((char)=>String.fromCharCode(char.toNumber())).join(''));
|
|
110
|
-
const decodedArgs = fromArray(inputs[3]);
|
|
111
|
-
const secret = fromSingle(inputs[4]);
|
|
112
|
-
const salt = fromSingle(inputs[5]);
|
|
113
|
-
const deployer = addressFromSingle(inputs[6]);
|
|
114
|
-
const publicKeys = secret.equals(Fr.ZERO) ? PublicKeys.default() : (await deriveKeys(secret)).publicKeys;
|
|
115
|
-
const publicKeysHash = await publicKeys.hash();
|
|
116
|
-
let artifactPath = '';
|
|
117
|
-
const { dir: contractDirectory, base: contractFilename } = parse(contractPath);
|
|
118
|
-
if (contractDirectory) {
|
|
119
|
-
if (contractDirectory.includes('@')) {
|
|
120
|
-
// We're deploying a contract that belongs in a workspace
|
|
121
|
-
// env.deploy("../path/to/workspace/root@packageName/contractName")
|
|
122
|
-
const [workspace, pkg] = contractDirectory.split('@');
|
|
123
|
-
const targetPath = join(rootPath, workspace, '/target');
|
|
124
|
-
this.logger.debug(`Looking for compiled artifact in workspace ${targetPath}`);
|
|
125
|
-
artifactPath = join(targetPath, `${pkg}-${contractFilename}.json`);
|
|
126
|
-
} else {
|
|
127
|
-
// We're deploying a standalone external contract
|
|
128
|
-
// env.deploy("../path/to/contract/root/contractName")
|
|
129
|
-
const targetPath = join(rootPath, contractDirectory, '/target');
|
|
130
|
-
this.logger.debug(`Looking for compiled artifact in ${targetPath}`);
|
|
131
|
-
[artifactPath] = (await readdir(targetPath)).filter((file)=>file.endsWith(`-${contractFilename}.json`));
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
// We're deploying a local contract
|
|
135
|
-
// env.deploy("contractName")
|
|
136
|
-
artifactPath = join(rootPath, './target', `${packageName}-${contractFilename}.json`);
|
|
137
|
-
}
|
|
138
|
-
const fileHash = await this.fastHashFile(artifactPath);
|
|
139
|
-
const cacheKey = `${contractDirectory ?? ''}-${contractFilename}-${initializer}-${decodedArgs.map((arg)=>arg.toString()).join('-')}-${publicKeysHash}-${salt}-${deployer}-${fileHash}`;
|
|
140
|
-
const { artifact, instance } = await TXEDeploymentsCache.getOrCompute(cacheKey, async ()=>{
|
|
141
|
-
this.logger.debug(`Loading compiled artifact ${artifactPath}`);
|
|
142
|
-
// Inner cache: artifact load + hash depends only on the compiled bytecode (`fileHash`), so
|
|
143
|
-
// subsequent deploys of the same contract — regardless of constructor args / deployer /
|
|
144
|
-
// salt — reuse the same `ContractArtifactWithHash`.
|
|
145
|
-
const computedArtifact = await TXEArtifactsCache.getOrCompute(fileHash, async ()=>{
|
|
146
|
-
const artifactJSON = JSON.parse(await readFile(artifactPath, 'utf-8'));
|
|
147
|
-
const artifactWithoutHash = loadContractArtifact(artifactJSON);
|
|
148
|
-
return {
|
|
149
|
-
...artifactWithoutHash,
|
|
150
|
-
artifactHash: await computeArtifactHash(artifactWithoutHash)
|
|
151
|
-
};
|
|
152
|
-
});
|
|
153
|
-
this.logger.debug(`Deploy ${computedArtifact.name} with initializer ${initializer}(${decodedArgs}) and public keys hash ${publicKeysHash.toString()}`);
|
|
154
|
-
const computedInstance = await getContractInstanceFromInstantiationParams(computedArtifact, {
|
|
155
|
-
constructorArgs: decodedArgs,
|
|
156
|
-
skipArgsDecoding: true,
|
|
157
|
-
salt,
|
|
158
|
-
publicKeys,
|
|
159
|
-
constructorArtifact: initializer ? initializer : undefined,
|
|
160
|
-
deployer
|
|
161
|
-
});
|
|
162
|
-
return {
|
|
163
|
-
artifact: computedArtifact,
|
|
164
|
-
instance: computedInstance
|
|
165
|
-
};
|
|
166
|
-
});
|
|
167
|
-
inputs.splice(0, 1, artifact, instance, toSingle(secret));
|
|
168
|
-
}
|
|
169
|
-
async #processAddAccountInputs({ inputs }) {
|
|
170
|
-
const secret = fromSingle(inputs[0]);
|
|
171
|
-
const cacheKey = `SchnorrAccountContract-${secret}`;
|
|
172
|
-
const { artifact, instance } = await TXEDeploymentsCache.getOrCompute(cacheKey, async ()=>{
|
|
173
|
-
const [artifactFromStore, classWithPreimage] = await Promise.all([
|
|
174
|
-
this.contractStore.getContractArtifact(this.schnorrClassId),
|
|
175
|
-
this.contractStore.getContractClassWithPreimage(this.schnorrClassId)
|
|
176
|
-
]);
|
|
177
|
-
if (!artifactFromStore || !classWithPreimage) {
|
|
178
|
-
throw new Error(`SchnorrAccount not found in shared contract store at class id ${this.schnorrClassId.toString()}`);
|
|
179
|
-
}
|
|
180
|
-
const computedArtifact = {
|
|
181
|
-
...artifactFromStore,
|
|
182
|
-
artifactHash: classWithPreimage.artifactHash
|
|
183
|
-
};
|
|
184
|
-
const keys = await deriveKeys(secret);
|
|
185
|
-
const args = [
|
|
186
|
-
keys.publicKeys.ivpkM.x,
|
|
187
|
-
keys.publicKeys.ivpkM.y
|
|
188
|
-
];
|
|
189
|
-
const computedInstance = await getContractInstanceFromInstantiationParams(computedArtifact, {
|
|
190
|
-
constructorArgs: args,
|
|
191
|
-
skipArgsDecoding: true,
|
|
192
|
-
salt: Fr.ONE,
|
|
193
|
-
publicKeys: keys.publicKeys,
|
|
194
|
-
constructorArtifact: 'constructor',
|
|
195
|
-
deployer: AztecAddress.ZERO
|
|
196
|
-
});
|
|
197
|
-
return {
|
|
198
|
-
artifact: computedArtifact,
|
|
199
|
-
instance: computedInstance
|
|
200
|
-
};
|
|
201
|
-
});
|
|
202
|
-
inputs.splice(0, 0, artifact, instance);
|
|
203
|
-
}
|
|
204
59
|
// eslint-disable-next-line camelcase
|
|
205
60
|
async resolve_foreign_call(callData) {
|
|
206
|
-
const { session_id: sessionId, function: functionName, inputs } = callData;
|
|
61
|
+
const { session_id: sessionId, function: functionName, inputs, root_path: rootPath, package_name: packageName } = callData;
|
|
207
62
|
this.logger.debug(`Calling ${functionName} on session ${sessionId}`);
|
|
208
63
|
if (!sessions.has(sessionId)) {
|
|
209
64
|
this.logger.debug(`Creating new session ${sessionId}`);
|
|
210
65
|
await this.warmUp();
|
|
211
|
-
sessions.set(sessionId, await TXESession.init(this.contractStore));
|
|
212
|
-
}
|
|
213
|
-
switch(functionName){
|
|
214
|
-
case 'aztec_txe_deploy':
|
|
215
|
-
{
|
|
216
|
-
await this.#processDeployInputs(callData);
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
case 'aztec_txe_addAccount':
|
|
220
|
-
{
|
|
221
|
-
await this.#processAddAccountInputs(callData);
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
66
|
+
sessions.set(sessionId, await TXESession.init(this.contractStore, this.artifactResolver, rootPath, packageName));
|
|
224
67
|
}
|
|
225
68
|
return await sessions.get(sessionId).processFunction(functionName, inputs);
|
|
226
69
|
}
|