diff --git a/Cargo.lock b/Cargo.lock index 77ca8f011c..7fe7f60a46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2652,7 +2652,7 @@ dependencies = [ [[package]] name = "ic-agent" version = "0.39.3" -source = "git+https://github.com/dfinity/agent-rs?rev=a96022bd185e97f52c5cde1c82c7592abddcff86#a96022bd185e97f52c5cde1c82c7592abddcff86" +source = "git+https://github.com/dfinity/agent-rs?rev=9ebf6314ce2fcb36772c7d81d6d414b4628d6101#9ebf6314ce2fcb36772c7d81d6d414b4628d6101" dependencies = [ "arc-swap", "async-channel", @@ -2671,7 +2671,7 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "ic-certification 3.0.2", - "ic-transport-types 0.39.3 (git+https://github.com/dfinity/agent-rs?rev=a96022bd185e97f52c5cde1c82c7592abddcff86)", + "ic-transport-types 0.39.3 (git+https://github.com/dfinity/agent-rs?rev=9ebf6314ce2fcb36772c7d81d6d414b4628d6101)", "ic-verify-bls-signature", "k256 0.13.4", "leb128", @@ -3111,7 +3111,7 @@ dependencies = [ [[package]] name = "ic-identity-hsm" version = "0.39.3" -source = "git+https://github.com/dfinity/agent-rs?rev=a96022bd185e97f52c5cde1c82c7592abddcff86#a96022bd185e97f52c5cde1c82c7592abddcff86" +source = "git+https://github.com/dfinity/agent-rs?rev=9ebf6314ce2fcb36772c7d81d6d414b4628d6101#9ebf6314ce2fcb36772c7d81d6d414b4628d6101" dependencies = [ "hex", "ic-agent", @@ -3229,7 +3229,7 @@ dependencies = [ [[package]] name = "ic-transport-types" version = "0.39.3" -source = "git+https://github.com/dfinity/agent-rs?rev=a96022bd185e97f52c5cde1c82c7592abddcff86#a96022bd185e97f52c5cde1c82c7592abddcff86" +source = "git+https://github.com/dfinity/agent-rs?rev=9ebf6314ce2fcb36772c7d81d6d414b4628d6101#9ebf6314ce2fcb36772c7d81d6d414b4628d6101" dependencies = [ "candid", "hex", @@ -3299,7 +3299,7 @@ dependencies = [ [[package]] name = "ic-utils" version = "0.39.3" -source = "git+https://github.com/dfinity/agent-rs?rev=a96022bd185e97f52c5cde1c82c7592abddcff86#a96022bd185e97f52c5cde1c82c7592abddcff86" +source = "git+https://github.com/dfinity/agent-rs?rev=9ebf6314ce2fcb36772c7d81d6d414b4628d6101#9ebf6314ce2fcb36772c7d81d6d414b4628d6101" dependencies = [ "async-trait", "candid", diff --git a/Cargo.toml b/Cargo.toml index 2a3ebbd8de..97044c6b8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,11 +22,11 @@ license = "Apache-2.0" candid = "0.10.11" candid_parser = "0.1.4" dfx-core = { path = "src/dfx-core", version = "0.1.0" } -ic-agent = { version = "0.39", git = "https://github.com/dfinity/agent-rs", rev = "a96022bd185e97f52c5cde1c82c7592abddcff86" } +ic-agent = { version = "0.39", git = "https://github.com/dfinity/agent-rs", rev = "9ebf6314ce2fcb36772c7d81d6d414b4628d6101" } ic-asset = { path = "src/canisters/frontend/ic-asset", version = "0.21.0" } ic-cdk = "0.13.1" -ic-identity-hsm = { version = "0.39", git = "https://github.com/dfinity/agent-rs", rev = "a96022bd185e97f52c5cde1c82c7592abddcff86" } -ic-utils = { version = "0.39", git = "https://github.com/dfinity/agent-rs", rev = "a96022bd185e97f52c5cde1c82c7592abddcff86" } +ic-identity-hsm = { version = "0.39", git = "https://github.com/dfinity/agent-rs", rev = "9ebf6314ce2fcb36772c7d81d6d414b4628d6101" } +ic-utils = { version = "0.39", git = "https://github.com/dfinity/agent-rs", rev = "9ebf6314ce2fcb36772c7d81d6d414b4628d6101" } aes-gcm = "0.10.3" anyhow = "1.0.56" diff --git a/e2e/assets/playground_backend/mops.toml b/e2e/assets/playground_backend/mops.toml index 8114f36b67..eb5a2ffebe 100644 --- a/e2e/assets/playground_backend/mops.toml +++ b/e2e/assets/playground_backend/mops.toml @@ -5,3 +5,4 @@ splay = "0.1.0" [[canister]] candid = "service/wasm-utils/wasm-utils.did" output = "service/pool/Wasm-utils.mo" + diff --git a/e2e/assets/playground_backend/service/pool/IC.mo b/e2e/assets/playground_backend/service/pool/IC.mo index fa6fedad08..231bdb4bc8 100644 --- a/e2e/assets/playground_backend/service/pool/IC.mo +++ b/e2e/assets/playground_backend/service/pool/IC.mo @@ -23,8 +23,8 @@ module { #reinstall; #upgrade : ?{ wasm_memory_persistence : ?{ - #Keep; - #Replace; + #keep; + #replace; }; }; #install; @@ -85,6 +85,22 @@ module { message_hash : Blob; }; public type sign_with_ecdsa_result = { signature : Blob }; + public type schnorr_algorithm = { + #bip340secp256k1; + #ed25519; + }; + public type schnorr_aux = { + #bip341: { + merkle_root_hash: Blob + } + }; + public type sign_with_schnorr_args = { + message : Blob; + derivation_path : [Blob]; + key_id : { algorithm : schnorr_algorithm; name : Text }; + aux: ?schnorr_aux; + }; + public type sign_with_schnorr_result = { signature : Blob }; public type user_id = Principal; public type wasm_module = Blob; public type Self = actor { @@ -116,6 +132,7 @@ module { } -> async (); raw_rand : shared () -> async Blob; sign_with_ecdsa : shared sign_with_ecdsa_args -> async sign_with_ecdsa_result; + sign_with_schnorr : shared sign_with_schnorr_args -> async sign_with_schnorr_result; start_canister : shared { canister_id : canister_id } -> async (); stop_canister : shared { canister_id : canister_id } -> async (); uninstall_code : shared { canister_id : canister_id } -> async (); diff --git a/e2e/assets/playground_backend/service/pool/Main.mo b/e2e/assets/playground_backend/service/pool/Main.mo index 2d297f4287..f99532cc44 100644 --- a/e2e/assets/playground_backend/service/pool/Main.mo +++ b/e2e/assets/playground_backend/service/pool/Main.mo @@ -361,7 +361,6 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this { mode = args.mode; canister_id = args.canister_id; }; - Debug.print("install mode: " # debug_show(args.mode)); await IC.install_code newArgs; stats := Logs.updateStats(stats, #install); @@ -710,6 +709,12 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this { await* pool.addCycles(caller, #refund); res }; + public shared ({ caller }) func sign_with_schnorr(arg: ICType.sign_with_schnorr_args) : async ICType.sign_with_schnorr_result { + await* pool.addCycles(caller, #method "sign_with_schnorr"); + let res = await IC.sign_with_schnorr(arg); + await* pool.addCycles(caller, #refund); + res + }; public shared ({ caller }) func _ttp_request(request : ICType.http_request_args) : async ICType.http_request_result { await* pool.addCycles(caller, #method "http_request"); let new_request = switch (request.transform) { @@ -832,6 +837,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this { #_ttp_request : Any; #__transform : Any; #sign_with_ecdsa: Any; + #sign_with_schnorr: Any; #eth_call: Any; #eth_feeHistory: Any; #eth_getBlockByNumber: Any; @@ -856,6 +862,7 @@ shared (creator) actor class Self(opt_params : ?Types.InitParams) = this { case (#_ttp_request _) false; case (#__transform _) false; case (#sign_with_ecdsa _) false; + case (#sign_with_schnorr _) false; case (#eth_call _) false; case (#eth_feeHistory _) false; case (#eth_getBlockByNumber _) false; diff --git a/e2e/assets/playground_backend/wasm-utils.did b/e2e/assets/playground_backend/wasm-utils.did index 76c7913b92..004ede4e73 100644 --- a/e2e/assets/playground_backend/wasm-utils.did +++ b/e2e/assets/playground_backend/wasm-utils.did @@ -1,7 +1,8 @@ type Config = record { - profiling : bool; + profiling : opt record { start_page: opt nat32; page_limit: opt nat32 }; remove_cycles_add : bool; limit_stable_memory_page : opt nat32; + limit_heap_memory_page : opt nat32; backend_canister_id : opt principal; }; diff --git a/e2e/assets/playground_backend/wasm-utils.wasm b/e2e/assets/playground_backend/wasm-utils.wasm old mode 100644 new mode 100755 index c56d4f8abb..7fce4f7ec5 Binary files a/e2e/assets/playground_backend/wasm-utils.wasm and b/e2e/assets/playground_backend/wasm-utils.wasm differ diff --git a/src/dfx/src/lib/operations/canister/install_canister.rs b/src/dfx/src/lib/operations/canister/install_canister.rs index d7e6c1c094..54a8be8bff 100644 --- a/src/dfx/src/lib/operations/canister/install_canister.rs +++ b/src/dfx/src/lib/operations/canister/install_canister.rs @@ -95,6 +95,7 @@ pub async fn install_canister( installed_module_hash.is_some(), wasm_memory_persistence_embedded, ); + // .canonicalize(); // let mode = mode.unwrap_or_else(|| { // if installed_module_hash.is_some() { diff --git a/src/dfx/src/lib/operations/canister/motoko_playground.rs b/src/dfx/src/lib/operations/canister/motoko_playground.rs index 71a84bf84f..e4f4243f6a 100644 --- a/src/dfx/src/lib/operations/canister/motoko_playground.rs +++ b/src/dfx/src/lib/operations/canister/motoko_playground.rs @@ -83,6 +83,9 @@ impl TryFrom for PlaygroundInstallMode { .. }) | None, + // ) => Ok(Self::Upgrade(Some(PlaygroundCanisterUpgradeOptions { + // wasm_memory_persistence: Some(WasmMemoryPersistence::Replace), + // }))), ) => Ok(Self::Upgrade(None)), InstallMode::Upgrade(Some(CanisterUpgradeOptions { wasm_memory_persistence: Some(WasmMemoryPersistence::Keep), @@ -241,7 +244,9 @@ pub async fn playground_install_code( } fn convert_mode(mode: InstallMode, wasm_module: &[u8]) -> DfxResult { - let converted_mode: PlaygroundInstallMode = mode.try_into()?; + let converted_mode: PlaygroundInstallMode = mode + // .canonicalize() + .try_into()?; // Motoko EOP requires `wasm_memory_persistence: Keep` for canister upgrades. // Usually, this option is auto-set if the installed wasm has the private metadata `enhanced-orthogonal-persistence` set. // However, in the playground setting, the playground is the controller. So we can't read that metadata section and will set `wasm_memory_persistence: Replace` as a fallback.