From f3d815cfaca064798c6b68c31fab31c4ac079276 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Mon, 7 Oct 2024 14:38:21 +0200 Subject: [PATCH 1/3] remove obsolete dfxvm default --- .github/workflows/motoko-threshold-schnorr-example.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/motoko-threshold-schnorr-example.yaml b/.github/workflows/motoko-threshold-schnorr-example.yaml index 68e774f0d..2ef3f35c5 100644 --- a/.github/workflows/motoko-threshold-schnorr-example.yaml +++ b/.github/workflows/motoko-threshold-schnorr-example.yaml @@ -21,7 +21,6 @@ jobs: run: bash .github/workflows/provision-darwin.sh - name: Motoko Threshold Schnorr Darwin run: | - dfxvm default 0.22.0-beta.0 dfx start --background npm install @noble/curves pushd motoko/threshold-schnorr @@ -34,7 +33,6 @@ jobs: run: bash .github/workflows/provision-linux.sh - name: Motoko Threshold Schnorr Linux run: | - dfxvm default 0.22.0-beta.0 dfx start --background npm install @noble/curves pushd motoko/threshold-schnorr From 660e48806d2fbbc41a13c4397c5b9a08e88da32c Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Mon, 7 Oct 2024 15:16:36 +0200 Subject: [PATCH 2/3] re-enable tests --- rust/threshold-schnorr/Makefile | 7 ++++- .../src/schnorr_example_rust/src/wasm_only.rs | 4 +-- .../src/schnorr_example_rust/tests/tests.rs | 27 ++++++++++++------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/rust/threshold-schnorr/Makefile b/rust/threshold-schnorr/Makefile index 07fd3fbfb..c277d4a9e 100644 --- a/rust/threshold-schnorr/Makefile +++ b/rust/threshold-schnorr/Makefile @@ -1,6 +1,11 @@ .PHONY: all all: build +.PHONY: build +.SILENT: build +build: + dfx build --check + .PHONY: deploy .SILENT: deploy deploy: @@ -8,7 +13,7 @@ deploy: .PHONY: test .SILENT: test -test: +test: build cargo test .PHONY: clean diff --git a/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs b/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs index 1aa02d4db..55efa248e 100644 --- a/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs +++ b/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs @@ -42,7 +42,7 @@ async fn public_key(algorithm: SchnorrAlgorithm) -> Result Result = update( &pic, my_principal, example_canister_id, "sign", - encode_args((message_hex.clone(), algorithm)).unwrap(), + encode_args((message.clone(), algorithm)).unwrap(), ); let signature_hex = sig_reply.expect("failed to sign").signature_hex; @@ -63,7 +72,7 @@ fn test_impl(pic: &PocketIc, algorithm: SchnorrAlgorithm) { "verify", encode_args(( signature_hex.clone(), - message_hex.clone(), + message.clone(), public_key_hex.clone(), algorithm, )) @@ -81,7 +90,7 @@ fn test_impl(pic: &PocketIc, algorithm: SchnorrAlgorithm) { "verify", encode_args(( clone_and_reverse_chars(&signature_hex), - message_hex.clone(), + message.clone(), public_key_hex.clone(), algorithm, )) @@ -99,7 +108,7 @@ fn test_impl(pic: &PocketIc, algorithm: SchnorrAlgorithm) { "verify", encode_args(( signature_hex.clone(), - clone_and_reverse_chars(&message_hex), + clone_and_reverse_chars(&message), public_key_hex.clone(), algorithm, )) @@ -117,7 +126,7 @@ fn test_impl(pic: &PocketIc, algorithm: SchnorrAlgorithm) { "verify", encode_args(( signature_hex.clone(), - message_hex.clone(), + message.clone(), clone_and_reverse_chars(&public_key_hex), algorithm, )) @@ -138,7 +147,7 @@ fn test_impl(pic: &PocketIc, algorithm: SchnorrAlgorithm) { "verify", encode_args(( signature_hex.clone(), - message_hex.clone(), + message.clone(), public_key_hex.clone(), other_algorithm(algorithm), )) From adfc19c435a8d9219c79556aa3aa565ccada976d Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Mon, 7 Oct 2024 17:07:39 +0200 Subject: [PATCH 3/3] use number of cycles in sign_with_schnorr that is sufficient for 34 nodes on mainnet --- .../threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs b/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs index 55efa248e..f9fef1fe7 100644 --- a/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs +++ b/rust/threshold-schnorr/src/schnorr_example_rust/src/wasm_only.rs @@ -71,7 +71,7 @@ async fn sign(message: String, algorithm: SchnorrAlgorithm) -> Result