From 0b43fc518b2f9aab0e1d54ed8be7b9b27bfeaacd Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 10:49:51 -0700 Subject: [PATCH 01/15] test: run e2e tests vs replica rather than ic-ref --- .github/workflows/ic-ref.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ic-ref.yml b/.github/workflows/ic-ref.yml index 5e0d8556..ffdaa035 100644 --- a/.github/workflows/ic-ref.yml +++ b/.github/workflows/ic-ref.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - ic-ref-to-replica pull_request: jobs: @@ -28,6 +29,11 @@ jobs: with: path: main + - name: Install dfx + uses: dfinity/setup-dfx@main + with: + dfx-version: "0.15.0" + - name: Cargo cache uses: actions/cache@v2 with: @@ -48,13 +54,8 @@ jobs: wget https://github.com/dfinity/cycles-wallet/releases/download/${{ matrix.wallet-tag }}/wallet.wasm mv wallet.wasm $HOME/wallet.wasm - - name: Download ic-ref and universal-canister + - name: Download universal-canister run: | - wget https://download.dfinity.systems/ic-ref/ic-ref-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz - tar -xvf ic-ref-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz ic-ref - mkdir -p $HOME/bin - mv ic-ref $HOME/bin/ic-ref - wget https://download.dfinity.systems/ic-ref/ic-ref-test-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz tar -xvf ic-ref-test-0.0.1-${{ matrix.ic-hs-ref }}-x86_64-linux.tar.gz test-data/universal-canister.wasm mv test-data/universal-canister.wasm $HOME/canister.wasm @@ -62,14 +63,14 @@ jobs: - name: Run Integration Tests run: | set -ex - $HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port & + dfx start --background sleep 1 - export IC_REF_PORT=$(cat $HOME/ic_ref_port) + export IC_REF_PORT=$(dfx info replica-port) export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm export IC_WALLET_CANISTER_PATH=$HOME/wallet.wasm cd main cargo test --all-features -- --ignored - killall ic-ref + dfx stop env: RUST_BACKTRACE: 1 @@ -89,14 +90,14 @@ jobs: # create key: pkcs11-tool -k --module $HSM_PKCS11_LIBRARY_PATH --login --slot-index $HSM_SLOT_INDEX -d $HSM_KEY_ID --key-type EC:prime256v1 --pin $HSM_PIN - $HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port & + dfx start --background sleep 1 - export IC_REF_PORT=$(cat $HOME/ic_ref_port) + export IC_REF_PORT=$(dfx info replica-port) export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm export IC_WALLET_CANISTER_PATH=$HOME/wallet.wasm cd main/ref-tests cargo test --all-features -- --ignored --nocapture --test-threads=1 - killall ic-ref + dfx stop env: RUST_BACKTRACE: 1 HSM_PKCS11_LIBRARY_PATH: /usr/lib/softhsm/libsofthsm2.so @@ -108,12 +109,12 @@ jobs: - name: Run Doc Tests run: | set -ex - $HOME/bin/ic-ref --pick-port --write-port-to $HOME/ic_ref_port & + dfx start --background sleep 1 - export IC_REF_PORT=$(cat $HOME/ic_ref_port) + export IC_REF_PORT=$(dfx info replica-port) cd main cargo test --all-features --doc -- --ignored - killall ic-ref + dfx stop env: RUST_BACKTRACE: 1 From 1302db28a819abcb07b11f513fb04b068496c5df Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 11:14:31 -0700 Subject: [PATCH 02/15] expected error message --- ref-tests/tests/ic-ref.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index d8da9380..7c443dce 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -929,7 +929,7 @@ mod extras { reject_code: RejectCode::DestinationInvalid, reject_message, .. - })) if reject_message == "The specified_id of the created canister is already in use.")); + })) if reject_message == "Canister iimsn-6yaaa-aaaaa-afiaa-cai is already installed")); Ok(()) }) From 78ae13edf26766eb760746b24bc5139be2da30e6 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 11:20:04 -0700 Subject: [PATCH 03/15] expected errors --- ref-tests/tests/ic-ref.rs | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 7c443dce..96bc2e80 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -538,33 +538,45 @@ mod management_canister { .start_canister(&canister_id) .call_and_wait() .await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == *"Wrong sender")); + assert!(matches!(result, + Err(AgentError::ReplicaError(RejectResponse { + reject_code: RejectCode::CanisterError, + reject_message, + .. + })) if reject_message == format!("Only controllers of canister {} can call ic00 method start_canister", canister_id))); // Stop as a wrong controller should fail. let result = other_ic00.stop_canister(&canister_id).call_and_wait().await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == *"Wrong sender")); + assert!(matches!(result, + Err(AgentError::ReplicaError(RejectResponse { + reject_code: RejectCode::CanisterError, + reject_message, + .. + })) if reject_message == format!("Only controllers of canister {} can call ic00 method stop_canister", canister_id))); // Get canister status as a wrong controller should fail. let result = other_ic00 .canister_status(&canister_id) .call_and_wait() .await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == *"Wrong sender")); + assert!(matches!(result, + Err(AgentError::ReplicaError(RejectResponse { + reject_code: RejectCode::CanisterError, + reject_message, + .. + })) if reject_message == format!("Only controllers of canister {} can call ic00 method canister_status", canister_id))); // Delete as a wrong controller should fail. let result = other_ic00 .delete_canister(&canister_id) .call_and_wait() .await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == *"Wrong sender")); + assert!(matches!(result, + Err(AgentError::ReplicaError(RejectResponse { + reject_code: RejectCode::CanisterError, + reject_message, + .. + })) if reject_message == format!("Only controllers of canister {} can call ic00 method delete_canister", canister_id))); Ok(()) }) From 63483928cfdd168b7360c298783ed940970b069a Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 11:30:40 -0700 Subject: [PATCH 04/15] error-messages --- ref-tests/tests/ic-ref.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 96bc2e80..77a17b28 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -65,7 +65,12 @@ mod management_canister { mod create_canister { use super::with_agent; - use ic_agent::{export::Principal, AgentError}; + use ic_agent::{ + agent::{RejectCode, RejectResponse}, + export::Principal, + AgentError, + }; + use ic_utils::interfaces::ManagementCanister; use ref_tests::get_effective_canister_id; use std::str::FromStr; @@ -103,13 +108,13 @@ mod management_canister { .call_and_wait() .await; - let payload_content = - "canister does not exist: 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q" - .to_string(); - assert!(matches!(result, - Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") == payload_content)); + Err(AgentError::ReplicaError(RejectResponse { + reject_code: RejectCode::DestinationInvalid, + reject_message, + .. + })) if reject_message == "Canister 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q not found")); + Ok(()) }) } From f83c7ddb372360a16f4562dfd724579b927b18e6 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 11:57:08 -0700 Subject: [PATCH 05/15] errors --- ref-tests/tests/ic-ref.rs | 87 +++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 77a17b28..51397909 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -112,8 +112,9 @@ mod management_canister { Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::DestinationInvalid, reject_message, - .. - })) if reject_message == "Canister 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q not found")); + error_code: Some(ref error_code) + })) if reject_message == "Canister 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q not found" && + error_code == "IC0301")); Ok(()) }) @@ -416,8 +417,8 @@ mod management_canister { matches!(result, Err(AgentError::ReplicaError(RejectResponse{ reject_code: RejectCode::CanisterError, reject_message, - .. - })) if reject_message == "canister is not running") + error_code: None, + })) if reject_message == format!("Canister {} is stopped", canister_id)) ); // Can't call query on a stopped canister @@ -426,8 +427,9 @@ mod management_canister { matches!(result, Err(AgentError::ReplicaError(RejectResponse{ reject_code: RejectCode::CanisterError, reject_message, - .. - })) if reject_message == "canister is stopped") + error_code: Some(ref error_code), + })) if reject_message == format!("IC0508: Canister {} is stopped and therefore does not have a CallContextManager", canister_id) && + error_code == "IC0508") ); // Upgrade should succeed @@ -449,8 +451,8 @@ mod management_canister { matches!(result, Err(AgentError::ReplicaError(RejectResponse{ reject_code: RejectCode::DestinationInvalid, reject_message, - .. - })) if reject_message == "method does not exist: update") + error_code: None, + })) if reject_message == format!("Canister {} has no update method 'update'", canister_id)) ); // Can call query @@ -459,8 +461,9 @@ mod management_canister { matches!(result, Err(AgentError::ReplicaError(RejectResponse{ reject_code: RejectCode::DestinationInvalid, reject_message, - .. - })) if reject_message == "query method does not exist") + error_code: Some(ref error_code), + })) if reject_message == format!("IC0302: Canister {} has no query method 'query'", canister_id) && + error_code == "IC0302") ); // Another start is a noop @@ -478,9 +481,14 @@ mod management_canister { // Cannot call update let result = agent.update(&canister_id, "update").call_and_wait().await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == format!("canister no longer exists: {}", canister_id.to_text()))); + assert!( + matches!(result, Err(AgentError::ReplicaError(RejectResponse{ + reject_code: RejectCode::DestinationInvalid, + reject_message, + error_code: Some(ref error_code), + })) if reject_message == format!("Canister {} not found", canister_id) && + error_code == "IC0301") + ); // Cannot call query let result = agent.query(&canister_id, "query").with_arg([]).call().await; @@ -488,17 +496,21 @@ mod management_canister { matches!(result, Err(AgentError::ReplicaError(RejectResponse{ reject_code: RejectCode::DestinationInvalid, reject_message, - .. - })) if reject_message - == format!("canister no longer exists: {}", canister_id.to_text())) + error_code: Some(ref error_code) + })) if reject_message == format!("IC0301: Canister {} not found", canister_id) && + error_code == "IC0301") ); // Cannot query canister status let result = ic00.canister_status(&canister_id).call_and_wait().await; assert!(match result { - Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == format!("canister no longer exists: {}", canister_id.to_text()) => + Err(AgentError::ReplicaError(RejectResponse{ + reject_code: RejectCode::DestinationInvalid, + reject_message, + error_code: Some(ref error_code) + })) + if reject_message == format!("Canister {} not found", canister_id) && + error_code == "IC0301" => true, Ok((_status_call_result,)) => false, _ => false, @@ -506,9 +518,14 @@ mod management_canister { // Delete a deleted canister should fail. let result = ic00.delete_canister(&canister_id).call_and_wait().await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == format!("canister no longer exists: {}", canister_id.to_text()))); + assert!( + matches!(result, Err(AgentError::ReplicaError(RejectResponse{ + reject_code: RejectCode::DestinationInvalid, + reject_message, + error_code: Some(ref error_code) + })) if reject_message == format!("Canister {} not found", canister_id) && + error_code == "IC0301") + ); Ok(()) }) } @@ -547,17 +564,21 @@ mod management_canister { Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::CanisterError, reject_message, - .. - })) if reject_message == format!("Only controllers of canister {} can call ic00 method start_canister", canister_id))); + error_code: Some(ref error_code) + })) if reject_message == format!("Only controllers of canister {} can call ic00 method start_canister", canister_id) && + error_code == "IC0512")); // Stop as a wrong controller should fail. let result = other_ic00.stop_canister(&canister_id).call_and_wait().await; - assert!(matches!(result, + assert!( + matches!(result, Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::CanisterError, reject_message, - .. - })) if reject_message == format!("Only controllers of canister {} can call ic00 method stop_canister", canister_id))); + error_code: Some(ref error_code) + })) if reject_message == format!("Only controllers of canister {} can call ic00 method stop_canister", canister_id) && + error_code == "IC0512") + ); // Get canister status as a wrong controller should fail. let result = other_ic00 @@ -568,8 +589,9 @@ mod management_canister { Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::CanisterError, reject_message, - .. - })) if reject_message == format!("Only controllers of canister {} can call ic00 method canister_status", canister_id))); + error_code: Some(ref error_code) + })) if reject_message == format!("Only controllers of canister {} can call ic00 method canister_status", canister_id) && + error_code == "IC0512")); // Delete as a wrong controller should fail. let result = other_ic00 @@ -580,8 +602,9 @@ mod management_canister { Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::CanisterError, reject_message, - .. - })) if reject_message == format!("Only controllers of canister {} can call ic00 method delete_canister", canister_id))); + error_code: Some(ref error_code) + })) if reject_message == format!("Only controllers of canister {} can call ic00 method delete_canister", canister_id) && + error_code == "IC0512")); Ok(()) }) @@ -945,7 +968,7 @@ mod extras { Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::DestinationInvalid, reject_message, - .. + error_code: None, })) if reject_message == "Canister iimsn-6yaaa-aaaaa-afiaa-cai is already installed")); Ok(()) From 2503599c76a15b76dbc638cf8ace5aeee83ea574 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 12:21:02 -0700 Subject: [PATCH 06/15] error results --- ref-tests/tests/ic-ref.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 51397909..34cb92ee 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -170,7 +170,7 @@ mod management_canister { .with_mode(InstallMode::Reinstall) .call_and_wait() .await; - assert!(matches!(result, Err(AgentError::HttpError(..)))); + assert!(matches!(result, Err(AgentError::ReplicaError(..)))); // Upgrade should succeed. ic00.install_code(&canister_id, &canister_wasm) @@ -184,7 +184,7 @@ mod management_canister { .with_mode(InstallMode::Upgrade) .call_and_wait() .await; - assert!(matches!(result, Err(AgentError::HttpError(..)))); + assert!(matches!(result, Err(AgentError::ReplicaError(..)))); // Change controller. ic00.update_settings(&canister_id) @@ -198,9 +198,14 @@ mod management_canister { .with_controller(other_agent_principal) .call_and_wait() .await; - assert!(matches!(result, Err(AgentError::HttpError(payload)) - if String::from_utf8(payload.content.clone()).expect("Expected utf8") - == *"Wrong sender")); + assert!( + matches!(result, Err(AgentError::ReplicaError(RejectResponse{ + reject_code: RejectCode::CanisterError, + reject_message, + error_code: Some(ref error_code), + })) if reject_message == format!("Only controllers of canister {} can call ic00 method update_settings", canister_id) && + error_code == "IC0512") + ); // Reinstall as new controller other_ic00 @@ -467,10 +472,9 @@ mod management_canister { ); // Another start is a noop - ic00.start_canister(&canister_id).call_and_wait().await?; + let result = ic00.start_canister(&canister_id).call_and_wait().await; // Delete a running canister should fail. - let result = ic00.delete_canister(&canister_id).call_and_wait().await; assert!(matches!(result, Err(AgentError::ReplicaError { .. }))); // Stop should succeed. From a1bdeea8e6fd9dcbd1b14b35c8e0e9df84843ec3 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 12:52:04 -0700 Subject: [PATCH 07/15] . --- ref-tests/tests/ic-ref.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 34cb92ee..98203abb 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -472,10 +472,7 @@ mod management_canister { ); // Another start is a noop - let result = ic00.start_canister(&canister_id).call_and_wait().await; - - // Delete a running canister should fail. - assert!(matches!(result, Err(AgentError::ReplicaError { .. }))); + ic00.start_canister(&canister_id).call_and_wait().await?; // Stop should succeed. ic00.stop_canister(&canister_id).call_and_wait().await?; From 577f0e6e8575ca5bbc2feae07a56433722ae8fa9 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 12:59:16 -0700 Subject: [PATCH 08/15] creation fee --- ref-tests/tests/ic-ref.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 98203abb..ddf5eb0e 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -637,8 +637,9 @@ mod management_canister { let args = Argument::from_candid((create_args,)); + let creation_fee = 8000000000; let (create_result,): (CreateResult,) = wallet - .call(Principal::management_canister(), "create_canister", args, 0) + .call(Principal::management_canister(), "create_canister", args, creation_fee) .call_and_wait() .await?; let canister_id = create_result.canister_id; From ffb4d52a6f8f8b008689d4386e955741e8f5ce8a Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 13:26:46 -0700 Subject: [PATCH 09/15] replica burns some cycles --- ref-tests/tests/ic-ref.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index ddf5eb0e..986757b7 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -62,6 +62,7 @@ mod management_canister { }; use sha2::{Digest, Sha256}; use std::collections::HashSet; + use std::convert::TryInto; mod create_canister { use super::with_agent; @@ -656,7 +657,7 @@ mod management_canister { .call_and_wait() .await?; - assert_eq!(result.cycles, 0_u64); + assert!(result.cycles > 0_u64 && result.cycles < creation_fee); let ic00 = ManagementCanister::create(&agent); // cycle balance is default_canister_balance when creating with @@ -668,7 +669,10 @@ mod management_canister { .call_and_wait() .await?; let result = ic00.canister_status(&canister_id_1).call_and_wait().await?; - assert_eq!(result.0.cycles, default_canister_balance); + // assume some cycles are already burned + let cycles: i128 = result.0.cycles.0.try_into().unwrap(); + let burned = default_canister_balance as i128 - cycles; + assert!(burned > 0 && burned < 100_000_000); // cycle balance should be amount specified to // provisional_create_canister_with_cycles call @@ -680,7 +684,9 @@ mod management_canister { .call_and_wait() .await?; let result = ic00.canister_status(&canister_id_2).call_and_wait().await?; - assert_eq!(result.0.cycles, amount); + let cycles: i128 = result.0.cycles.0.try_into().unwrap(); + let burned = amount as i128 - cycles; + assert!(burned > 0 && burned < 100_000_000); Ok(()) }) From 6014368906ca6fa5690b7cb4589420569f8ebaaf Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 13:45:41 -0700 Subject: [PATCH 10/15] more cycles --- ref-tests/tests/integration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ref-tests/tests/integration.rs b/ref-tests/tests/integration.rs index 7b4ac15e..fdf595dd 100644 --- a/ref-tests/tests/integration.rs +++ b/ref-tests/tests/integration.rs @@ -148,7 +148,7 @@ fn wallet_canister_create_and_install() { let wallet = WalletCanister::create(&agent, wallet_id).await?; let create_result = wallet - .wallet_create_canister(1_000_000, None, None, None, None) + .wallet_create_canister(10_000_000_000, None, None, None, None) .await?; #[derive(CandidType)] From a3cb096aaa120cef4987a99c603bdc6f5350c85a Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 14:11:35 -0700 Subject: [PATCH 11/15] wow --- ref-tests/tests/integration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ref-tests/tests/integration.rs b/ref-tests/tests/integration.rs index fdf595dd..b8c84198 100644 --- a/ref-tests/tests/integration.rs +++ b/ref-tests/tests/integration.rs @@ -104,7 +104,7 @@ fn canister_reject_call() { result, Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::DestinationInvalid, - reject_message: "method does not exist: wallet_send".to_string(), + reject_message: format!("Canister {} has no update method 'wallet_send'", alice.canister_id()), error_code: None })) ); From bbcbe223e3959889c2893a5104f1e043f6a22a49 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 14:22:59 -0700 Subject: [PATCH 12/15] . --- ref-tests/tests/integration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ref-tests/tests/integration.rs b/ref-tests/tests/integration.rs index b8c84198..166827e1 100644 --- a/ref-tests/tests/integration.rs +++ b/ref-tests/tests/integration.rs @@ -148,7 +148,7 @@ fn wallet_canister_create_and_install() { let wallet = WalletCanister::create(&agent, wallet_id).await?; let create_result = wallet - .wallet_create_canister(10_000_000_000, None, None, None, None) + .wallet_create_canister(100_000_000_000, None, None, None, None) .await?; #[derive(CandidType)] From 06a145bf03198e90270de9e8a422bdd63eb332fe Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 14:37:46 -0700 Subject: [PATCH 13/15] start clean --- .github/workflows/ic-ref.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ic-ref.yml b/.github/workflows/ic-ref.yml index ffdaa035..18ac5ab7 100644 --- a/.github/workflows/ic-ref.yml +++ b/.github/workflows/ic-ref.yml @@ -63,7 +63,7 @@ jobs: - name: Run Integration Tests run: | set -ex - dfx start --background + dfx start --background --clean sleep 1 export IC_REF_PORT=$(dfx info replica-port) export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm @@ -90,7 +90,7 @@ jobs: # create key: pkcs11-tool -k --module $HSM_PKCS11_LIBRARY_PATH --login --slot-index $HSM_SLOT_INDEX -d $HSM_KEY_ID --key-type EC:prime256v1 --pin $HSM_PIN - dfx start --background + dfx start --background --clean sleep 1 export IC_REF_PORT=$(dfx info replica-port) export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm @@ -109,7 +109,7 @@ jobs: - name: Run Doc Tests run: | set -ex - dfx start --background + dfx start --background --clean sleep 1 export IC_REF_PORT=$(dfx info replica-port) cd main From b89bd3b425f093674bb99dec9822fb3fc538a3dd Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 14:51:43 -0700 Subject: [PATCH 14/15] . --- .github/workflows/ic-ref.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ic-ref.yml b/.github/workflows/ic-ref.yml index 18ac5ab7..2afb36ea 100644 --- a/.github/workflows/ic-ref.yml +++ b/.github/workflows/ic-ref.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - ic-ref-to-replica pull_request: jobs: From 7237607f5c230b306af7fce057c082fff9251972 Mon Sep 17 00:00:00 2001 From: Eric Swanson Date: Wed, 27 Sep 2023 14:56:07 -0700 Subject: [PATCH 15/15] format --- ref-tests/tests/ic-ref.rs | 7 ++++++- ref-tests/tests/integration.rs | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ref-tests/tests/ic-ref.rs b/ref-tests/tests/ic-ref.rs index 986757b7..963c63c8 100644 --- a/ref-tests/tests/ic-ref.rs +++ b/ref-tests/tests/ic-ref.rs @@ -640,7 +640,12 @@ mod management_canister { let creation_fee = 8000000000; let (create_result,): (CreateResult,) = wallet - .call(Principal::management_canister(), "create_canister", args, creation_fee) + .call( + Principal::management_canister(), + "create_canister", + args, + creation_fee, + ) .call_and_wait() .await?; let canister_id = create_result.canister_id; diff --git a/ref-tests/tests/integration.rs b/ref-tests/tests/integration.rs index 166827e1..1bf9b015 100644 --- a/ref-tests/tests/integration.rs +++ b/ref-tests/tests/integration.rs @@ -104,7 +104,10 @@ fn canister_reject_call() { result, Err(AgentError::ReplicaError(RejectResponse { reject_code: RejectCode::DestinationInvalid, - reject_message: format!("Canister {} has no update method 'wallet_send'", alice.canister_id()), + reject_message: format!( + "Canister {} has no update method 'wallet_send'", + alice.canister_id() + ), error_code: None })) );