From 18fdb88272418bb04c22551f72b279f8bb243d81 Mon Sep 17 00:00:00 2001 From: max-dfinity <100170574+max-dfinity@users.noreply.github.com> Date: Wed, 23 Oct 2024 06:23:21 -0700 Subject: [PATCH 01/21] refactor(nns): Remove dfn_candid from test_utils, simplify method (#2196) This removes simplifies the usage of a method to no longer require witnesses (but instead always just use candid encoders/decoders), as there are no instances of using it in any other way. Moves us closer to removing dependency on dfn_candid. --- .../tests/test_change_canister_controllers.rs | 8 +--- .../impl/tests/test_open_calls_tracking.rs | 4 +- .../src/canister_playground.rs | 2 - .../src/cycles_minting_canister.rs | 3 +- .../src/governance_upgrade.rs | 3 -- rs/nns/integration_tests/src/lifeline.rs | 2 - .../src/node_provider_remuneration.rs | 2 - rs/nns/integration_tests/src/reset_root.rs | 2 - rs/nns/sns-wasm/tests/common/mod.rs | 2 - rs/nns/sns-wasm/tests/deploy_new_sns.rs | 3 -- rs/nns/sns-wasm/tests/upgrade_sns_instance.rs | 6 --- rs/nns/test_utils/src/sns_wasm.rs | 3 -- rs/nns/test_utils/src/state_test_helpers.rs | 42 ++++++------------- rs/sns/integration_tests/src/root.rs | 4 +- 14 files changed, 17 insertions(+), 69 deletions(-) diff --git a/rs/nns/handlers/root/impl/tests/test_change_canister_controllers.rs b/rs/nns/handlers/root/impl/tests/test_change_canister_controllers.rs index ea1cb1fcb40..c62b8344ae6 100644 --- a/rs/nns/handlers/root/impl/tests/test_change_canister_controllers.rs +++ b/rs/nns/handlers/root/impl/tests/test_change_canister_controllers.rs @@ -1,4 +1,3 @@ -use dfn_candid::candid_one; use ic_base_types::{CanisterId, PrincipalId}; use ic_nervous_system_clients::{ canister_id_record::CanisterIdRecord, @@ -99,7 +98,6 @@ fn test_change_canister_controllers_integrates_with_management_canister() { &machine, ROOT_CANISTER_ID, "canister_status", - candid_one, CanisterIdRecord::from(universal), PrincipalId::new_anonymous(), ) @@ -111,11 +109,11 @@ fn test_change_canister_controllers_integrates_with_management_canister() { // calls to change_canister_controllers from unauthorized callers should fail let unauthorized_caller = CanisterId::from_u64(1000).get(); - let err = update_with_sender( + + let err = update_with_sender::<_, ChangeCanisterControllersResponse>( &machine, ROOT_CANISTER_ID, "change_canister_controllers", - candid_one::, ChangeCanisterControllersRequest { target_canister_id: universal.get(), new_controllers: vec![ROOT_CANISTER_ID.get(), test_canister_id.get()], @@ -130,7 +128,6 @@ fn test_change_canister_controllers_integrates_with_management_canister() { &machine, ROOT_CANISTER_ID, "change_canister_controllers", - candid_one, ChangeCanisterControllersRequest { target_canister_id: universal.get(), new_controllers: vec![ROOT_CANISTER_ID.get(), test_canister_id.get()], @@ -151,7 +148,6 @@ fn test_change_canister_controllers_integrates_with_management_canister() { &machine, ROOT_CANISTER_ID, "canister_status", - candid_one, CanisterIdRecord::from(universal), PrincipalId::new_anonymous(), ) diff --git a/rs/nns/handlers/root/impl/tests/test_open_calls_tracking.rs b/rs/nns/handlers/root/impl/tests/test_open_calls_tracking.rs index c691c70fec6..dd30d314f4f 100644 --- a/rs/nns/handlers/root/impl/tests/test_open_calls_tracking.rs +++ b/rs/nns/handlers/root/impl/tests/test_open_calls_tracking.rs @@ -1,5 +1,4 @@ use candid::{Decode, Encode}; -use dfn_candid::candid_one; use ic_base_types::PrincipalId; use ic_canisters_http_types::{HttpRequest, HttpResponse}; use ic_nervous_system_clients::{ @@ -28,11 +27,10 @@ fn test_canister_status_call_tracking() { let universal = set_up_universal_canister(&machine, None); // Canister status call should fail as NNS Root is not a controller. - assert!(update_with_sender( + assert!(update_with_sender::<_, CanisterStatusResult>( &machine, ROOT_CANISTER_ID, "canister_status", - candid_one::, CanisterIdRecord::from(universal), PrincipalId::new_anonymous(), ) diff --git a/rs/nns/integration_tests/src/canister_playground.rs b/rs/nns/integration_tests/src/canister_playground.rs index 868ba6f5f32..2304f2dcfb8 100644 --- a/rs/nns/integration_tests/src/canister_playground.rs +++ b/rs/nns/integration_tests/src/canister_playground.rs @@ -1,5 +1,4 @@ use canister_test::Project; -use dfn_candid::candid_one; use ic_base_types::PrincipalId; use ic_nns_test_utils::state_test_helpers::{ create_canister, state_machine_builder_for_nns_tests, update_with_sender, @@ -20,7 +19,6 @@ fn test_canister_playground() { &state_machine, playground_id, "test", - candid_one, (), PrincipalId::new_anonymous(), ) diff --git a/rs/nns/integration_tests/src/cycles_minting_canister.rs b/rs/nns/integration_tests/src/cycles_minting_canister.rs index 38fd7f4dc43..f9014a9f24e 100644 --- a/rs/nns/integration_tests/src/cycles_minting_canister.rs +++ b/rs/nns/integration_tests/src/cycles_minting_canister.rs @@ -303,8 +303,7 @@ fn canister_status( machine, CanisterId::ic_00(), "canister_status", - candid_one, - &CanisterIdRecord::from(target), + CanisterIdRecord::from(target), sender, ) } diff --git a/rs/nns/integration_tests/src/governance_upgrade.rs b/rs/nns/integration_tests/src/governance_upgrade.rs index 9e42ebf9f73..51f27993ad0 100644 --- a/rs/nns/integration_tests/src/governance_upgrade.rs +++ b/rs/nns/integration_tests/src/governance_upgrade.rs @@ -136,7 +136,6 @@ fn test_root_restarts_canister_during_upgrade_canister_with_stop_canister_timeou &state_machine, ROOT_CANISTER_ID, "change_nns_canister", - candid_one, proposal, GOVERNANCE_CANISTER_ID.get(), ) @@ -153,7 +152,6 @@ fn test_root_restarts_canister_during_upgrade_canister_with_stop_canister_timeou &state_machine, ROOT_CANISTER_ID, "canister_status", - candid_one, CanisterIdRecord::from(GOVERNANCE_CANISTER_ID), PrincipalId::new_anonymous(), ) @@ -170,7 +168,6 @@ fn test_root_restarts_canister_during_upgrade_canister_with_stop_canister_timeou &state_machine, ROOT_CANISTER_ID, "canister_status", - candid_one, CanisterIdRecord::from(GOVERNANCE_CANISTER_ID), PrincipalId::new_anonymous(), ) diff --git a/rs/nns/integration_tests/src/lifeline.rs b/rs/nns/integration_tests/src/lifeline.rs index 762f00f6206..4441816176e 100644 --- a/rs/nns/integration_tests/src/lifeline.rs +++ b/rs/nns/integration_tests/src/lifeline.rs @@ -1,5 +1,4 @@ use canister_test::Project; -use dfn_candid::candid_one; use ic_base_types::CanisterId; use ic_management_canister_types::{CanisterInstallMode, CanisterStatusType}; use ic_nervous_system_clients::canister_id_record::CanisterIdRecord; @@ -253,7 +252,6 @@ fn test_lifeline_canister_restarts_root_on_stop_canister_timeout() { &state_machine, CanisterId::ic_00(), "uninstall_code", - candid_one, CanisterIdRecord::from(ROOT_CANISTER_ID), LIFELINE_CANISTER_ID.get(), ) diff --git a/rs/nns/integration_tests/src/node_provider_remuneration.rs b/rs/nns/integration_tests/src/node_provider_remuneration.rs index 346efcd6d83..375293f5ed5 100644 --- a/rs/nns/integration_tests/src/node_provider_remuneration.rs +++ b/rs/nns/integration_tests/src/node_provider_remuneration.rs @@ -1,6 +1,5 @@ use candid::{Decode, Encode}; use cycles_minting_canister::IcpXdrConversionRateCertifiedResponse; -use dfn_candid::candid_one; use ic_canister_client_sender::Sender; use ic_nervous_system_common::{ONE_DAY_SECONDS, ONE_MONTH_SECONDS}; use ic_nervous_system_common_test_keys::{ @@ -764,7 +763,6 @@ fn set_icp_xdr_conversion_rate( state_machine, CYCLES_MINTING_CANISTER_ID, "set_icp_xdr_conversion_rate", - candid_one, payload, GOVERNANCE_CANISTER_ID.get(), ) diff --git a/rs/nns/integration_tests/src/reset_root.rs b/rs/nns/integration_tests/src/reset_root.rs index 174279e4c8d..863d62256da 100644 --- a/rs/nns/integration_tests/src/reset_root.rs +++ b/rs/nns/integration_tests/src/reset_root.rs @@ -1,4 +1,3 @@ -use dfn_candid::candid_one; use ic_crypto_sha2::Sha256; use ic_nervous_system_common_test_keys::{TEST_NEURON_1_ID, TEST_NEURON_1_OWNER_PRINCIPAL}; use ic_nns_common::pb::v1::NeuronId; @@ -106,7 +105,6 @@ fn test_other_controllers_cannot_reset_root() { &state_machine, LIFELINE_CANISTER_ID, "hard_reset_root_to_version", - candid_one, payload, *TEST_NEURON_1_OWNER_PRINCIPAL, ); diff --git a/rs/nns/sns-wasm/tests/common/mod.rs b/rs/nns/sns-wasm/tests/common/mod.rs index 9af1f7c589b..c5fde6a6434 100644 --- a/rs/nns/sns-wasm/tests/common/mod.rs +++ b/rs/nns/sns-wasm/tests/common/mod.rs @@ -1,6 +1,5 @@ use candid::Encode; use canister_test::Project; -use dfn_candid::candid_one; use ic_base_types::{CanisterId, PrincipalId}; use ic_nervous_system_common::ONE_TRILLION; use ic_nns_constants::SNS_WASM_CANISTER_ID; @@ -52,7 +51,6 @@ pub fn get_deployed_sns_by_proposal_id( machine, SNS_WASM_CANISTER_ID, "get_deployed_sns_by_proposal_id", - candid_one, GetDeployedSnsByProposalIdRequest { proposal_id }, PrincipalId::new_anonymous(), ) diff --git a/rs/nns/sns-wasm/tests/deploy_new_sns.rs b/rs/nns/sns-wasm/tests/deploy_new_sns.rs index 0a0ad6590e5..88d7dc61190 100644 --- a/rs/nns/sns-wasm/tests/deploy_new_sns.rs +++ b/rs/nns/sns-wasm/tests/deploy_new_sns.rs @@ -3,7 +3,6 @@ use crate::common::{ EXPECTED_SNS_CREATION_FEE, }; use canister_test::Wasm; -use dfn_candid::candid_one; use ic_base_types::{CanisterId, PrincipalId}; use ic_nervous_system_clients::canister_status::CanisterStatusType::Running; use ic_nervous_system_common::ONE_TRILLION; @@ -63,7 +62,6 @@ fn test_canisters_are_created_and_installed() { &state_machine, CanisterId::unchecked_from_principal(root_canister_id), "get_sns_canisters_summary", - candid_one, GetSnsCanistersSummaryRequest { update_canister_list: None, }, @@ -386,7 +384,6 @@ fn test_deploy_sns_and_transfer_dapps() { &machine, CanisterId::unchecked_from_principal(root_canister_principal), "get_sns_canisters_summary", - candid_one, GetSnsCanistersSummaryRequest { update_canister_list: None, }, diff --git a/rs/nns/sns-wasm/tests/upgrade_sns_instance.rs b/rs/nns/sns-wasm/tests/upgrade_sns_instance.rs index 248ee81fc5c..e5ac35a62c5 100644 --- a/rs/nns/sns-wasm/tests/upgrade_sns_instance.rs +++ b/rs/nns/sns-wasm/tests/upgrade_sns_instance.rs @@ -1,7 +1,6 @@ use crate::common::EXPECTED_SNS_CREATION_FEE; use candid::{Decode, Encode, Nat}; use canister_test::Project; -use dfn_candid::candid_one; use ic_base_types::{CanisterId, PrincipalId}; use ic_icrc1_ledger::LedgerArgument; use ic_management_canister_types::{CanisterIdRecord, CanisterInstallMode}; @@ -187,7 +186,6 @@ fn test_governance_restarts_root_if_root_cannot_stop_during_upgrade() { &machine, CanisterId::ic_00(), "canister_status", - candid_one, CanisterIdRecord::from(root), governance.get(), ) @@ -645,7 +643,6 @@ fn upgrade_archive_sns_canister_via_sns_wasms() { &machine, ledger, "icrc1_transfer", - candid_one, TransferArg { from_subaccount: None, to: Account { @@ -907,7 +904,6 @@ fn test_out_of_sync_version_still_allows_upgrade_to_succeed() { &machine, ledger, "icrc1_transfer", - candid_one, TransferArg { from_subaccount: None, to: Account { @@ -1226,7 +1222,6 @@ fn insert_upgrade_path_entries_only_callable_by_governance_when_access_controls_ &machine, SNS_WASM_CANISTER_ID, "insert_upgrade_path_entries", - candid_one, InsertUpgradePathEntriesRequest { upgrade_path: vec![], sns_governance_canister_id: None, @@ -1261,7 +1256,6 @@ fn insert_upgrade_path_entries_callable_by_anyone_when_access_controls_disabled( &machine, SNS_WASM_CANISTER_ID, "insert_upgrade_path_entries", - candid_one, InsertUpgradePathEntriesRequest { upgrade_path: vec![], sns_governance_canister_id: None, diff --git a/rs/nns/test_utils/src/sns_wasm.rs b/rs/nns/test_utils/src/sns_wasm.rs index aa22ad8e196..c561551e1b6 100644 --- a/rs/nns/test_utils/src/sns_wasm.rs +++ b/rs/nns/test_utils/src/sns_wasm.rs @@ -4,7 +4,6 @@ use crate::{ }; use candid::{Decode, Encode}; use canister_test::Project; -use dfn_candid::candid_one; use ic_base_types::CanisterId; use ic_nervous_system_common_test_keys::{TEST_NEURON_1_ID, TEST_NEURON_1_OWNER_PRINCIPAL}; use ic_nervous_system_common_test_utils::wasm_helpers; @@ -186,7 +185,6 @@ fn make_proposal_with_test_neuron_1(env: &StateMachine, proposal: Proposal) -> P env, GOVERNANCE_CANISTER_ID, "manage_neuron", - candid_one, ManageNeuron { id: None, command: Some(Command::MakeProposal(Box::new(proposal))), @@ -285,7 +283,6 @@ pub fn deploy_new_sns( env, sns_wasm_canister_id, "deploy_new_sns", - candid_one, DeployNewSnsRequest { sns_init_payload: Some(sns_init_payload), }, diff --git a/rs/nns/test_utils/src/state_test_helpers.rs b/rs/nns/test_utils/src/state_test_helpers.rs index 979a5a5076a..a66e975601f 100644 --- a/rs/nns/test_utils/src/state_test_helpers.rs +++ b/rs/nns/test_utils/src/state_test_helpers.rs @@ -8,7 +8,6 @@ use canister_test::Wasm; use cycles_minting_canister::{ IcpXdrConversionRateCertifiedResponse, SetAuthorizedSubnetworkListArgs, }; -use dfn_candid::candid_one; use dfn_http::types::{HttpRequest, HttpResponse}; use dfn_protobuf::ToProto; use ic_base_types::{CanisterId, PrincipalId, SubnetId}; @@ -76,7 +75,6 @@ use icrc_ledger_types::icrc1::{ transfer::{TransferArg, TransferError}, }; use num_traits::ToPrimitive; -use on_wire::{FromWire, IntoWire, NewType}; use prost::Message; use serde::Serialize; use std::{convert::TryInto, env, time::Duration}; @@ -211,33 +209,30 @@ pub fn update( } } -pub fn update_with_sender( +pub fn update_with_sender( machine: &StateMachine, canister_target: CanisterId, method_name: &str, - _: Witness, - payload: Payload::Inner, + payload: Payload, sender: PrincipalId, -) -> Result +) -> Result where - Payload: IntoWire + NewType, - Witness: FnOnce(ReturnType, Payload::Inner) -> (ReturnType::Inner, Payload), - ReturnType: FromWire + NewType, + Payload: CandidType, + ReturnType: CandidType + for<'de> serde::Deserialize<'de>, { // move time forward machine.advance_time(Duration::from_secs(2)); - let payload = Payload::from_inner(payload); let result = machine .execute_ingress_as( sender, canister_target, method_name, - payload.into_bytes().unwrap(), + Encode!(&payload).unwrap(), ) .map_err(|e| e.to_string())?; match result { - WasmResult::Reply(v) => FromWire::from_bytes(v).map(|x: ReturnType| x.into_inner()), + WasmResult::Reply(v) => Decode!(&v, ReturnType).map_err(|e| e.to_string()), WasmResult::Reject(s) => Err(format!("Canister rejected with message: {}", s)), } } @@ -341,7 +336,6 @@ pub fn set_controllers( machine, CanisterId::ic_00(), "update_settings", - candid_one, UpdateSettingsArgs { canister_id: target.into(), settings: CanisterSettingsArgsBuilder::new() @@ -364,8 +358,7 @@ pub fn get_controllers( machine, CanisterId::ic_00(), "canister_status", - candid_one, - &CanisterIdRecord::from(target), + CanisterIdRecord::from(target), sender, ) .unwrap(); @@ -383,8 +376,7 @@ pub fn get_canister_status( machine, canister_target, "canister_status", - candid_one, - &CanisterIdRecord::from(target), + CanisterIdRecord::from(target), sender, ) } @@ -403,8 +395,7 @@ pub fn get_canister_status_from_root( machine, ROOT_CANISTER_ID, "canister_status", - candid_one, - &CanisterIdRecord::from(target), + CanisterIdRecord::from(target), PrincipalId::new_anonymous(), ) .unwrap() @@ -1727,14 +1718,8 @@ pub fn icrc1_transfer( sender: PrincipalId, args: TransferArg, ) -> Result { - let result: Result, String> = update_with_sender( - machine, - ledger_id, - "icrc1_transfer", - candid_one, - args, - sender, - ); + let result: Result, String> = + update_with_sender(machine, ledger_id, "icrc1_transfer", args, sender); let result = result.unwrap(); match result { @@ -1783,7 +1768,6 @@ pub fn sns_claim_staked_neuron( machine, governance_canister_id, "manage_neuron", - candid_one, sns_pb::ManageNeuron { subaccount: to_subaccount.to_vec(), command: Some(sns_pb::manage_neuron::Command::ClaimOrRefresh( @@ -1860,7 +1844,6 @@ pub fn sns_increase_dissolve_delay( machine, governance_canister_id, "manage_neuron", - candid_one, payload, sender, ) @@ -1895,7 +1878,6 @@ pub fn sns_make_proposal( machine, sns_governance_canister_id, "manage_neuron", - candid_one, sns_pb::ManageNeuron { subaccount: sub_account.to_vec(), command: Some(sns_pb::manage_neuron::Command::MakeProposal(proposal)), diff --git a/rs/sns/integration_tests/src/root.rs b/rs/sns/integration_tests/src/root.rs index bae3718ad91..508a862aece 100644 --- a/rs/sns/integration_tests/src/root.rs +++ b/rs/sns/integration_tests/src/root.rs @@ -1,6 +1,6 @@ use candid::{Decode, Encode}; use canister_test::Project; -use dfn_candid::{candid, candid_one}; +use dfn_candid::candid; use ic_base_types::{CanisterId, PrincipalId}; use ic_ledger_core::Tokens; use ic_management_canister_types::CanisterInstallMode; @@ -285,7 +285,6 @@ fn test_root_restarts_governance_on_stop_canister_timeout() { &state_machine, CanisterId::ic_00(), "uninstall_code", - candid_one, CanisterIdRecord::from(scenario.governance_canister_id), scenario.root_canister_id.get(), ) @@ -323,7 +322,6 @@ fn test_root_restarts_governance_on_stop_canister_timeout() { &state_machine, scenario.root_canister_id, "change_canister", - candid_one, proposal, scenario.governance_canister_id.get(), ) From 8c2e0c98e26163b5a0bd59a3e351d9a06ca6a61c Mon Sep 17 00:00:00 2001 From: Daniel Sharifi <40335219+DSharifi@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:37:18 +0200 Subject: [PATCH 02/21] feat(https-outcalls): re-enable H/2 support for outcalls (#2200) This reverts commit 4e666d720a90d3b9f08d7f72d771bcb5f0c43afd. We initially reverted the http2 outcalls as `canister_http_correctness_test` was failing on the hourly system test. The problem was due to a bug in the test server, and was fixed in https://github.com/dfinity/ic/pull/2190. We can therefor re-enable the http/2 functionality for HTTPS outcalls. --- Cargo.lock | 622 ++++++++++-------- rs/https_outcalls/adapter/BUILD.bazel | 5 + rs/https_outcalls/adapter/Cargo.toml | 5 + rs/https_outcalls/adapter/src/rpc_server.rs | 4 +- .../adapter/tests/server_test.rs | 132 +++- 5 files changed, 477 insertions(+), 291 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c3f5fe919e..ec1a6d886e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,7 +66,7 @@ dependencies = [ "brotli 6.0.0", "bytes", "bytestring", - "derive_more", + "derive_more 0.99.18", "encoding_rs", "flate2", "futures-core", @@ -96,7 +96,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -183,7 +183,7 @@ dependencies = [ "bytestring", "cfg-if 1.0.0", "cookie", - "derive_more", + "derive_more 0.99.18", "encoding_rs", "futures-core", "futures-util", @@ -214,7 +214,7 @@ dependencies = [ "actix-router", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -404,9 +404,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" [[package]] name = "arbitrary" @@ -472,7 +472,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -514,7 +514,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "synstructure", ] @@ -526,7 +526,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -575,9 +575,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.13" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e614738943d3f68c628ae3dbce7c3daffb196665f82f8c8ea6b65de73c79429" +checksum = "0cb8f1d480b0ea3783ab015936d2a55c87e219676f0c0b7dec61494043f21857" dependencies = [ "brotli 7.0.0", "flate2", @@ -651,7 +651,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -694,7 +694,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -711,7 +711,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -757,7 +757,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1041,9 +1041,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags 2.6.0", "cexpr", @@ -1056,7 +1056,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1326,7 +1326,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "syn_derive", ] @@ -1364,9 +1364,9 @@ dependencies = [ [[package]] name = "bs58" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ "sha2 0.10.8", "tinyvec", @@ -1417,7 +1417,7 @@ name = "build-info-common" version = "0.0.27" source = "git+https://github.com/dfinity-lab/build-info?rev=701a696844fba5c87df162fbbc1ccef96f27c9d7#701a696844fba5c87df162fbbc1ccef96f27c9d7" dependencies = [ - "derive_more", + "derive_more 0.99.18", "semver", "serde", ] @@ -1494,9 +1494,9 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" [[package]] name = "byteorder" @@ -1506,9 +1506,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" dependencies = [ "serde", ] @@ -1624,7 +1624,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bytes", - "clap 4.5.19", + "clap 4.5.20", "futures-util", "http 1.1.0", "http-body 1.0.1", @@ -1694,7 +1694,7 @@ dependencies = [ "lazy_static", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1802,9 +1802,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.28" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "jobserver", "libc", @@ -1854,7 +1854,7 @@ dependencies = [ "candid", "certificate_orchestrator_interface", "chacha20poly1305", - "clap 4.5.19", + "clap 4.5.20", "cloudflare 0.12.0 (git+https://github.com/dfinity/cloudflare-rs.git?rev=a6538a036926bd756986c9c0a5de356daef48881)", "flate2", "futures", @@ -2058,9 +2058,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive 4.5.18", @@ -2068,9 +2068,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.19" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -2100,7 +2100,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2266,7 +2266,7 @@ name = "config" version = "1.0.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "ic-types", "mac_address", "once_cell", @@ -2562,18 +2562,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e376bd92bddd03dcfc443b14382611cae5d10012aa0b1628bbf18bb73f12f7" +checksum = "7b765ed4349e66bedd9b88c7691da42e24c7f62067a6be17ddffa949367b6e17" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ecbe07f25a8100e5077933516200e97808f1d7196b5a073edb85fa08fde32e" +checksum = "9eaa2aece6237198afd32bff57699e08d4dccb8d3902c214fc1e6ba907247ca4" dependencies = [ "serde", "serde_derive", @@ -2581,9 +2581,9 @@ dependencies = [ [[package]] name = "cranelift-codegen" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc60913f32c1de18538c28bef74b8c87cf16de7841a1b0956fcf01b23237853a" +checksum = "351824439e59d42f0e4fa5aac1d13deded155120043565769e55cd4ad3ca8ed9" dependencies = [ "bumpalo", "cranelift-bforest", @@ -2604,33 +2604,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae009e7822f47aa55e7dcef846ccf3aa4eb102ca6b4bcb8a44b36f3f49aa85c" +checksum = "5a0ce0273d7a493ef8f31f606849a4e931c19187a4923f5f87fc1f2b13109981" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c78f01a852536c68e34444450f845ed6e0782a1f047f85397fe460b8fbce8f1" +checksum = "0f72016ac35579051913f4f07f6b36c509ed69412d852fd44c8e1d7b7fa6d92a" [[package]] name = "cranelift-control" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a061b22e00a9e36b31f2660dfb05a9617b7775bd54b79754d3bb75a990dac06" +checksum = "db28951d21512c4fd0554ef179bfb11e4eb6815062957a9173824eee5de0c46c" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95e2b261a3e74ae42f4e606906d5ffa44ee2684e8b1ae23bdf75d21908dc9233" +checksum = "14ebe592a2f81af9237cf9be29dd3854ecb72108cfffa59e85ef12389bf939e3" dependencies = [ "cranelift-bitset", "serde", @@ -2639,9 +2639,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe14abba0e6bab42aca0f9ce757f96880f9187e88bc6cb975ed6acd8a42f7770" +checksum = "4437db9d60c7053ac91ded0802740c2ccf123ee6d6898dd906c34f8c530cd119" dependencies = [ "cranelift-codegen", "log", @@ -2651,15 +2651,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "311d91ae72b37d4262b51217baf8c9e01f1afd5148931468da1fdb7e9d011347" +checksum = "230cb33572b9926e210f2ca28145f2bc87f389e1456560932168e2591feb65c1" [[package]] name = "cranelift-native" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a3f84c75e578189ff7a716c24ad83740b553bf583f2510b323bfe4c1a74bb93" +checksum = "364524ac7aef7070b1141478724abebeec297d4ea1e87ad8b8986465e91146d9" dependencies = [ "cranelift-codegen", "libc", @@ -2668,9 +2668,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.112.1" +version = "0.112.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56b7b2476c47b2091eee5a20bc54a80fbb29ca5313ae2bd0dea52621abcfca1" +checksum = "0572cbd9d136a62c0f39837b6bce3b0978b96b8586794042bec0c214668fd6f5" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -2700,7 +2700,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.5.19", + "clap 4.5.20", "criterion-plot", "futures", "is-terminal", @@ -2867,7 +2867,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -2927,7 +2927,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3064,7 +3064,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3097,14 +3097,14 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "dary_heap" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7762d17f1241643615821a8455a0b2c3e803784b058693d990b11f2dce25a0ca" +checksum = "04d2cd9c18b9f454ed67da600630b021a8a80bf33f8c95896ab33aaf1c26b728" [[package]] name = "dashmap" @@ -3190,7 +3190,7 @@ checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3211,7 +3211,7 @@ checksum = "d150dea618e920167e5973d70ae6ece4385b7164e0d799fe7c122dd0a5d912ad" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3222,7 +3222,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3235,7 +3235,27 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.79", + "syn 2.0.82", +] + +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.82", ] [[package]] @@ -3243,7 +3263,7 @@ name = "deterministic_ips" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "ic-crypto-sha2", "thiserror", ] @@ -3253,7 +3273,7 @@ name = "dflate" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "libc", "tar", ] @@ -3368,7 +3388,7 @@ name = "diroid" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "walkdir", ] @@ -3442,7 +3462,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3681,7 +3701,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3694,7 +3714,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4261,7 +4281,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4451,7 +4471,7 @@ name = "guestos_tool" version = "1.0.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "config", "indoc", "itertools 0.12.1", @@ -4787,7 +4807,7 @@ name = "hostos_tool" version = "1.0.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "config", "mac_address", "network", @@ -4897,7 +4917,7 @@ name = "httpbin-rs" version = "0.9.0" dependencies = [ "axum", - "clap 4.5.19", + "clap 4.5.20", "hyper 1.5.0", "hyper-util", "rustls 0.23.15", @@ -4941,9 +4961,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.30" +version = "0.14.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" +checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" dependencies = [ "bytes", "futures-channel", @@ -5012,7 +5032,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -5157,7 +5177,7 @@ dependencies = [ "base64 0.13.1", "candid", "chrono", - "clap 4.5.19", + "clap 4.5.20", "cycles-minting-canister", "futures", "hex", @@ -5330,7 +5350,7 @@ version = "0.9.0" dependencies = [ "bincode", "byteorder", - "clap 4.5.19", + "clap 4.5.20", "criterion", "ic-config", "ic-crypto-test-utils-canister-threshold-sigs", @@ -5393,7 +5413,7 @@ version = "0.9.0" dependencies = [ "anyhow", "chrono", - "clap 4.5.19", + "clap 4.5.20", "ic-config", "ic-crypto-utils-threshold-sig-der", "ic-logger", @@ -5538,7 +5558,7 @@ dependencies = [ "axum-extra", "bytes", "candid", - "clap 4.5.19", + "clap 4.5.20", "criterion", "dashmap 6.1.0", "ethnum", @@ -5705,7 +5725,7 @@ dependencies = [ "bitcoin 0.28.2", "bitcoincore-rpc", "bitcoind", - "clap 4.5.19", + "clap 4.5.20", "criterion", "futures", "hashlink", @@ -6235,7 +6255,7 @@ dependencies = [ "quote", "serde", "serde_tokenstream 0.2.2", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6249,7 +6269,7 @@ dependencies = [ "quote", "serde", "serde_tokenstream 0.2.2", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -6711,7 +6731,7 @@ dependencies = [ "assert_matches", "async-trait", "bincode", - "clap 4.5.19", + "clap 4.5.20", "criterion", "hex", "ic-adapter-metrics-server", @@ -7973,7 +7993,7 @@ dependencies = [ name = "ic-drun" version = "0.9.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "futures", "hex", "ic-canister-sandbox-backend-lib", @@ -8066,7 +8086,7 @@ dependencies = [ "wasmprinter", "wasmtime", "wasmtime-environ", - "wast", + "wast 212.0.0", "wat", ] @@ -8192,7 +8212,7 @@ dependencies = [ "anyhow", "assert_cmd", "assert_matches", - "clap 4.5.19", + "clap 4.5.20", "ic-crypto-test-utils-reproducible-rng", "ic-sys", "maplit", @@ -8401,7 +8421,8 @@ version = "0.1.0" dependencies = [ "async-stream", "byte-unit", - "clap 4.5.19", + "bytes", + "clap 4.5.20", "futures", "http 1.1.0", "http-body-util", @@ -8418,12 +8439,16 @@ dependencies = [ "once_cell", "prometheus", "rand 0.8.5", + "rstest", + "rustls 0.23.15", + "rustls-pemfile 2.2.0", "serde", "serde_json", "slog", "tempfile", "thiserror", "tokio", + "tokio-rustls 0.26.0", "tonic", "tower 0.4.13", "uuid", @@ -8543,7 +8568,7 @@ version = "0.1.0" dependencies = [ "anyhow", "candid", - "clap 4.5.19", + "clap 4.5.20", "hex", "ic-agent", "ic-base-types", @@ -8589,7 +8614,7 @@ dependencies = [ "axum", "candid", "ciborium", - "clap 4.5.19", + "clap 4.5.20", "futures", "hex", "ic-agent", @@ -8650,7 +8675,7 @@ version = "0.1.0" dependencies = [ "anyhow", "candid", - "clap 4.5.19", + "clap 4.5.20", "hex", "ic-agent", "ic-crypto-ed25519", @@ -9384,7 +9409,7 @@ dependencies = [ "assert_matches", "candid", "candid_parser", - "clap 4.5.19", + "clap 4.5.20", "futures", "hex", "maplit", @@ -10254,7 +10279,7 @@ version = "0.9.0" dependencies = [ "candid", "canister-test", - "clap 4.5.19", + "clap 4.5.20", "ic-base-types", "ic-canister-client", "ic-interfaces-registry", @@ -10278,7 +10303,7 @@ dependencies = [ name = "ic-nns-inspector" version = "0.1.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "csv", "hex", "ic-base-types", @@ -10557,7 +10582,7 @@ dependencies = [ "anyhow", "assert_matches", "base64 0.13.1", - "clap 4.5.19", + "clap 4.5.20", "fs_extra", "ic-config", "ic-crypto-node-key-generation", @@ -10689,7 +10714,7 @@ name = "ic-recovery" version = "0.1.0" dependencies = [ "base64 0.13.1", - "clap 4.5.19", + "clap 4.5.20", "futures", "hex", "ic-artifact-pool", @@ -10739,7 +10764,7 @@ version = "0.9.0" dependencies = [ "anyhow", "base64 0.13.1", - "clap 4.5.19", + "clap 4.5.20", "ic-base-types", "ic-crypto-sha2", "ic-crypto-utils-threshold-sig-der", @@ -10954,7 +10979,7 @@ dependencies = [ name = "ic-registry-replicator" version = "0.1.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "ic-config", "ic-crypto-utils-threshold-sig-der", "ic-http-endpoints-metrics", @@ -11039,7 +11064,7 @@ name = "ic-replay" version = "0.9.0" dependencies = [ "candid", - "clap 4.5.19", + "clap 4.5.20", "hex", "ic-artifact-pool", "ic-canister-client", @@ -11092,7 +11117,7 @@ version = "0.9.0" dependencies = [ "assert_cmd", "canister-test", - "clap 4.5.19", + "clap 4.5.20", "criterion", "hex", "ic-artifact-pool", @@ -11350,7 +11375,7 @@ dependencies = [ "async-trait", "base64 0.13.1", "candid", - "clap 4.5.19", + "clap 4.5.20", "dfn_candid", "dfn_protobuf", "futures", @@ -11553,7 +11578,7 @@ dependencies = [ "anyhow", "base64 0.13.1", "candid", - "clap 4.5.19", + "clap 4.5.20", "futures", "hex", "ic-agent", @@ -11594,7 +11619,7 @@ dependencies = [ "build-info-build", "candid", "candid_parser", - "clap 4.5.19", + "clap 4.5.20", "comparable", "futures", "hex", @@ -12056,7 +12081,7 @@ name = "ic-starter" version = "0.9.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "ic-config", "ic-logger", "ic-management-canister-types", @@ -12108,7 +12133,7 @@ version = "0.9.0" dependencies = [ "candid", "ciborium", - "clap 4.5.19", + "clap 4.5.20", "hex", "ic-artifact-pool", "ic-base-types", @@ -12280,7 +12305,7 @@ dependencies = [ name = "ic-state-tool" version = "0.9.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "hex", "ic-config", "ic-logger", @@ -12304,7 +12329,7 @@ dependencies = [ name = "ic-subnet-splitting" version = "0.1.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "hex", "ic-agent", "ic-base-types", @@ -12400,7 +12425,7 @@ dependencies = [ "candid", "canister-test", "chrono", - "clap 4.5.19", + "clap 4.5.20", "crossbeam-channel", "cycles-minting-canister", "deterministic_ips", @@ -13209,7 +13234,7 @@ checksum = "19fabaeecfe37f24b433c62489242fc54503d98d4cc8d0f9ef7544dfdfc0ddcb" dependencies = [ "anyhow", "candid", - "clap 4.5.19", + "clap 4.5.20", "libflate", "rustc-demangle", "serde", @@ -13249,7 +13274,7 @@ dependencies = [ "byte-unit", "candid", "chrono", - "clap 4.5.19", + "clap 4.5.20", "console 0.11.3", "futures", "hex", @@ -13612,7 +13637,7 @@ dependencies = [ name = "icp-config" version = "0.1.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "eyre", "ic-config", "ic-replicated-state", @@ -13891,7 +13916,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -13974,9 +13999,9 @@ dependencies = [ [[package]] name = "impl-more" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" +checksum = "aae21c3177a27788957044151cc2800043d127acaa460a47ebb9b84dfa2c6aa0" [[package]] name = "impl-rlp" @@ -14061,7 +14086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "232929e1d75fe899576a3d5c7416ad0d88dbfbb3c3d6aa00873a7408a50ddb88" dependencies = [ "ahash 0.8.11", - "clap 4.5.19", + "clap 4.5.20", "crossbeam-channel", "crossbeam-utils", "dashmap 6.1.0", @@ -14082,7 +14107,7 @@ name = "inject-files" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "partition_tools", "tempfile", "tokio", @@ -14256,9 +14281,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -14438,25 +14463,24 @@ dependencies = [ [[package]] name = "lalrpop" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" +checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" dependencies = [ "ascii-canvas", "bit-set", - "diff", "ena", - "is-terminal", - "itertools 0.10.5", + "itertools 0.11.0", "lalrpop-util", "petgraph", "pico-args", "regex", - "regex-syntax 0.7.5", + "regex-syntax 0.8.5", "string_cache", "term 0.7.0", "tiny-keccak", "unicode-xid", + "walkdir", ] [[package]] @@ -14478,7 +14502,7 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" name = "launch-single-vm" version = "0.1.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "ic-prep", "ic-registry-subnet-type", "ic-system-test-driver", @@ -14653,9 +14677,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libflate" @@ -14725,7 +14749,7 @@ version = "0.16.0+8.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" dependencies = [ - "bindgen 0.69.4", + "bindgen 0.69.5", "bzip2-sys", "cc", "glob", @@ -14920,7 +14944,7 @@ dependencies = [ "proc-macro2", "quote", "regex-syntax 0.6.29", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -15307,7 +15331,7 @@ dependencies = [ "cfg-if 1.0.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -15319,7 +15343,7 @@ dependencies = [ "cfg-if 1.0.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -15499,7 +15523,7 @@ name = "nft_exporter" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "serde", "serde_json", ] @@ -15810,7 +15834,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -15917,9 +15941,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -16101,7 +16125,7 @@ dependencies = [ "async-trait", "backoff", "candid", - "clap 4.5.19", + "clap 4.5.20", "exec", "get_if_addrs", "hex", @@ -16413,9 +16437,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", "thiserror", @@ -16424,9 +16448,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" dependencies = [ "pest", "pest_generator", @@ -16434,22 +16458,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "pest_meta" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" dependencies = [ "once_cell", "pest", @@ -16458,9 +16482,9 @@ dependencies = [ [[package]] name = "pest_vm" -version = "2.7.13" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf162e3b69ed27d7a19716f2174f184c5207e42826e7f2d9075687cc8ac705e" +checksum = "5385573c124b12495734797b8b427832b6a4182ac313c50dd09fe360795840e2" dependencies = [ "pest", "pest_meta", @@ -16546,7 +16570,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -16590,7 +16614,7 @@ checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -16740,7 +16764,7 @@ dependencies = [ "bitcoincore-rpc", "bytes", "candid", - "clap 4.5.19", + "clap 4.5.20", "ctrlc", "flate2", "form_urlencoded", @@ -16991,12 +17015,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.22" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +checksum = "910d41a655dac3b764f1ade94821093d3610248694320cd072303a8eedcf221d" dependencies = [ "proc-macro2", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -17074,9 +17098,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -17175,7 +17199,7 @@ checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -17215,7 +17239,7 @@ dependencies = [ "prost 0.12.6", "prost-types 0.12.6", "regex", - "syn 2.0.79", + "syn 2.0.82", "tempfile", ] @@ -17236,7 +17260,7 @@ dependencies = [ "prost 0.13.3", "prost-types 0.13.3", "regex", - "syn 2.0.79", + "syn 2.0.82", "tempfile", ] @@ -17250,7 +17274,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -17263,7 +17287,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -17919,7 +17943,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.30", + "hyper 0.14.31", "hyper-rustls 0.24.2", "ipnet", "js-sys", @@ -18220,7 +18244,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.79", + "syn 2.0.82", "unicode-ident", ] @@ -18496,9 +18520,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "rusty-fork" @@ -18529,21 +18553,21 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.11.3" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" +checksum = "22760a375f81a31817aeaf6f5081e9ccb7ffd7f2da1809a6e3fc82b6656f10d5" dependencies = [ "cfg-if 1.0.0", - "derive_more", + "derive_more 1.0.0", "parity-scale-codec", "scale-info-derive", ] [[package]] name = "scale-info-derive" -version = "2.11.3" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" +checksum = "abc61ebe25a5c410c0e245028fc9934bf8fa4817199ef5a24a68092edfd34614" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -18582,7 +18606,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -18767,7 +18791,7 @@ checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06" dependencies = [ "bitflags 2.6.0", "cssparser", - "derive_more", + "derive_more 0.99.18", "fxhash", "log", "new_debug_unreachable", @@ -18789,9 +18813,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" dependencies = [ "serde_derive", ] @@ -18849,13 +18873,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.213" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -18866,14 +18890,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "itoa", "memchr", @@ -18922,7 +18946,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -18945,7 +18969,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19007,7 +19031,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19037,7 +19061,7 @@ name = "setupos-disable-checks" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "indoc", "partition_tools", "tempfile", @@ -19049,7 +19073,7 @@ name = "setupos-inject-configuration" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "config", "partition_tools", "serde", @@ -19065,7 +19089,7 @@ name = "setupos_tool" version = "1.0.0" dependencies = [ "anyhow", - "clap 4.5.19", + "clap 4.5.20", "config", "mac_address", "network", @@ -19549,7 +19573,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive 0.2.0", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19561,7 +19585,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta-derive 0.3.0", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19572,7 +19596,7 @@ checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19583,7 +19607,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19605,7 +19629,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19666,9 +19690,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -19684,7 +19708,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19732,7 +19756,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19763,7 +19787,7 @@ dependencies = [ "anyhow", "async-trait", "axum", - "clap 4.5.19", + "clap 4.5.20", "http 1.1.0", "ic-async-utils", "itertools 0.12.1", @@ -19805,9 +19829,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.39" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec96d2ffad078296368d46ff1cb309be1c23c513b4ab0e22a45de0185275ac96" +checksum = "4ff6c40d3aedb5e06b57c6f669ad17ab063dd1e63d977c6a88e7f4dfa4f04020" dependencies = [ "filetime", "libc", @@ -19943,7 +19967,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta 0.2.0", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -19955,7 +19979,7 @@ dependencies = [ "proc-macro2", "quote", "structmeta 0.3.0", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -20189,22 +20213,22 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.64" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -20380,14 +20404,14 @@ checksum = "8d9ef545650e79f30233c0003bcc2504d7efac6dad25fca40744de773fe2049c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "tokio" -version = "1.40.0" +version = "1.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" dependencies = [ "backtrace", "bytes", @@ -20419,7 +20443,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -20605,7 +20629,7 @@ dependencies = [ "prost-build 0.13.3", "prost-types 0.13.3", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -20710,9 +20734,9 @@ dependencies = [ [[package]] name = "tower_governor" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "313fa625fea5790ed56360a30ea980e41229cf482b4835801a67ef1922bf63b9" +checksum = "aea939ea6cfa7c4880f3e7422616624f97a567c16df67b53b11f0d03917a8e46" dependencies = [ "axum", "forwarded-header-value", @@ -20720,7 +20744,7 @@ dependencies = [ "http 1.1.0", "pin-project", "thiserror", - "tower 0.4.13", + "tower 0.5.1", "tracing", ] @@ -20756,7 +20780,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -20963,9 +20987,9 @@ dependencies = [ [[package]] name = "turmoil" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4d81bafd9a29aea436db2b3d5bec441ed3b777ac627059dd3ea65bea638126a" +checksum = "9b20f35a8264406dd5afac69a541665e860e52fec3dcec4091a0e2a3ce7f2b75" dependencies = [ "bytes", "futures", @@ -21030,12 +21054,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" @@ -21181,9 +21202,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", "serde", @@ -21221,7 +21242,7 @@ dependencies = [ name = "vsock_guest" version = "1.0.0" dependencies = [ - "clap 4.5.19", + "clap 4.5.20", "vsock_lib", ] @@ -21266,9 +21287,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -21322,7 +21343,7 @@ dependencies = [ "futures-util", "headers 0.3.9", "http 0.2.12", - "hyper 0.14.30", + "hyper 0.14.31", "log", "mime", "mime_guess", @@ -21350,9 +21371,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if 1.0.0", "once_cell", @@ -21361,24 +21382,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -21388,9 +21409,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -21398,22 +21419,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-encoder" @@ -21434,6 +21455,16 @@ dependencies = [ "wasmparser 0.217.0", ] +[[package]] +name = "wasm-encoder" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" +dependencies = [ + "leb128", + "wasmparser 0.219.1", +] + [[package]] name = "wasm-streams" version = "0.4.1" @@ -21475,6 +21506,16 @@ dependencies = [ "serde", ] +[[package]] +name = "wasmparser" +version = "0.219.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" +dependencies = [ + "bitflags 2.6.0", + "indexmap 2.6.0", +] + [[package]] name = "wasmprinter" version = "0.217.0" @@ -21488,9 +21529,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03601559991d459a228236a49135364eac85ac00dc07b65fb95ae61a957793af" +checksum = "ef01f9cb9636ed42a7ec5a09d785c0643590199dc7372dc22c7e2ba7a31a97d4" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -21529,23 +21570,23 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e453b3bde07312874c0c6703e2de9281daab46646172c1b71fa59a97226f858e" +checksum = "ba5b20797419d6baf2296db2354f864e8bb3447cacca9d151ce7700ae08b4460" dependencies = [ "cfg-if 1.0.0", ] [[package]] name = "wasmtime-component-macro" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a6faeabbdbfd27e24e8d5204207ba9c247a13cf84181ea721b5f209f281fe01" +checksum = "26593c4b18c76ca3c3fbdd813d6692256537b639b851d8a6fe827e3d6966fc01" dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -21553,15 +21594,15 @@ dependencies = [ [[package]] name = "wasmtime-component-util" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1b24db4aa3dc7c0d3181d1833b4fe9ec0cd3f08780b746415c84c0a9ec9011" +checksum = "a2ed562fbb0cbed20a56c369c8de146c1de06a48c19e26ed9aa45f073514ee60" [[package]] name = "wasmtime-cranelift" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c737bef9ea94aab874e29ac6a8688b89ceb43c7b51f047079c43387972c07ee3" +checksum = "f389b789cbcb53a8499131182135dea21d7d97ad77e7fb66830f69479ef0e68c" dependencies = [ "anyhow", "cfg-if 1.0.0", @@ -21584,9 +21625,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "817bfa9ea878ec37aa24f85fd6912844e8d87d321662824cf920d561b698cdfd" +checksum = "84b72debe8899f19bedf66f7071310f06ef62de943a1369ba9b373613e77dd3d" dependencies = [ "anyhow", "cranelift-bitset", @@ -21607,9 +21648,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48011232c0da424f89c3752a378d0b7f512fae321ea414a43e1e7a302a6a1f7e" +checksum = "1d930bc1325bc0448be6a11754156d770f56f6c3a61f440e9567f36cd2ea3065" dependencies = [ "anyhow", "cfg-if 1.0.0", @@ -21619,15 +21660,15 @@ dependencies = [ [[package]] name = "wasmtime-slab" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9858a22e656ae8574631221b474b8bebf63f1367fcac3f179873833eabc2ced" +checksum = "055a181b8d03998511294faea14798df436503f14d7fd20edcf7370ec583e80a" [[package]] name = "wasmtime-types" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d14b8a9206fe94485a03edb1654cd530dbd2a859a85a43502cb4e99653a568c" +checksum = "c8340d976673ac3fdacac781f2afdc4933920c1adc738c3409e825dab3955399" dependencies = [ "anyhow", "cranelift-entity", @@ -21639,20 +21680,20 @@ dependencies = [ [[package]] name = "wasmtime-versioned-export-macros" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9bb1f01efb8b542eadfda511e8ea1cc54309451aba97b69969e5b1a59cb7ded" +checksum = "a4b0c1f76891f778db9602ee3fbb4eb7e9a3f511847d1fb1b69eddbcea28303c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "wasmtime-wit-bindgen" -version = "25.0.1" +version = "25.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1596caa67b31ac675fd3da61685c4260f8b10832021db42c85d227b7ba8133" +checksum = "b2fca2cbb5bb390f65d4434c19bf8d9873dfc60f10802918ebcd6f819a38d703" dependencies = [ "anyhow", "heck 0.4.1", @@ -21673,20 +21714,33 @@ dependencies = [ "wasm-encoder 0.212.0", ] +[[package]] +name = "wast" +version = "219.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f79a9d9df79986a68689a6b40bcc8d5d40d807487b235bebc2ac69a242b54a1" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.219.1", +] + [[package]] name = "wat" -version = "1.212.0" +version = "1.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74ca7f93f11a5d6eed8499f2a8daaad6e225cab0151bc25a091fff3b987532f" +checksum = "8bc3cf014fb336883a411cd662f987abf6a1d2a27f2f0008616a0070bbf6bd0d" dependencies = [ - "wast", + "wast 219.0.1", ] [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -22085,11 +22139,13 @@ dependencies = [ [[package]] name = "xattr" -version = "0.2.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] [[package]] @@ -22179,7 +22235,7 @@ checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "synstructure", ] @@ -22201,7 +22257,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -22221,7 +22277,7 @@ checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "synstructure", ] @@ -22242,7 +22298,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -22264,7 +22320,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] diff --git a/rs/https_outcalls/adapter/BUILD.bazel b/rs/https_outcalls/adapter/BUILD.bazel index 89e484705c1..c89e2625020 100644 --- a/rs/https_outcalls/adapter/BUILD.bazel +++ b/rs/https_outcalls/adapter/BUILD.bazel @@ -33,9 +33,14 @@ MACRO_DEPENDENCIES = [] DEV_DEPENDENCIES = [ # Keep sorted. "@crate_index//:async-stream", + "@crate_index//:bytes", "@crate_index//:once_cell", "@crate_index//:rand", + "@crate_index//:rstest", + "@crate_index//:rustls", + "@crate_index//:rustls-pemfile", "@crate_index//:tempfile", + "@crate_index//:tokio-rustls", "@crate_index//:uuid", "@crate_index//:warp", ] diff --git a/rs/https_outcalls/adapter/Cargo.toml b/rs/https_outcalls/adapter/Cargo.toml index 578ef82680d..4de76bd7dce 100644 --- a/rs/https_outcalls/adapter/Cargo.toml +++ b/rs/https_outcalls/adapter/Cargo.toml @@ -31,9 +31,14 @@ tower = { workspace = true } [dev-dependencies] async-stream = { workspace = true } +bytes = { workspace = true } once_cell = "1.13.1" rand = { workspace = true } +rustls = { workspace = true } +rustls-pemfile = "2.1.2" +rstest = { workspace = true } tempfile = { workspace = true } +tokio-rustls = { workspace = true } uuid = { workspace = true } warp = { version = "0.3.7", features = ["tls"] } diff --git a/rs/https_outcalls/adapter/src/rpc_server.rs b/rs/https_outcalls/adapter/src/rpc_server.rs index 0d8f04e7563..6366324210d 100644 --- a/rs/https_outcalls/adapter/src/rpc_server.rs +++ b/rs/https_outcalls/adapter/src/rpc_server.rs @@ -70,7 +70,7 @@ impl CanisterHttp { .with_native_roots() .expect("Failed to set native roots") .https_only() - .enable_http1() + .enable_all_versions() .wrap_connector(proxy_connector); // Https client setup. @@ -82,7 +82,7 @@ impl CanisterHttp { #[cfg(feature = "http")] let builder = builder.https_or_http(); - let builder = builder.enable_http1(); + let builder = builder.enable_all_versions(); let direct_https_connector = builder.wrap_connector(http_connector); let socks_client = diff --git a/rs/https_outcalls/adapter/tests/server_test.rs b/rs/https_outcalls/adapter/tests/server_test.rs index 904fdacf073..9dc09504791 100644 --- a/rs/https_outcalls/adapter/tests/server_test.rs +++ b/rs/https_outcalls/adapter/tests/server_test.rs @@ -2,6 +2,10 @@ // a self signed certificate. // We use `hyper-rustls` which uses Rustls, which supports the SSL_CERT_FILE variable. mod test { + use bytes::Bytes; + use http_body_util::Full; + use hyper::Request; + use hyper_util::rt::{TokioExecutor, TokioIo}; use ic_https_outcalls_adapter::{Config, IncomingSource}; use ic_https_outcalls_service::{ https_outcalls_service_client::HttpsOutcallsServiceClient, HttpMethod, HttpsOutcallRequest, @@ -9,11 +13,12 @@ mod test { use ic_logger::replica_logger::no_op_logger; use ic_metrics::MetricsRegistry; use once_cell::sync::OnceCell; - use std::convert::TryFrom; - use std::env; - use std::io::Write; + use rstest::rstest; + use rustls::ServerConfig; + use std::{convert::TryFrom, env, io::Write, path::Path, sync::Arc}; use tempfile::TempDir; - use tokio::net::UnixStream; + use tokio::net::{TcpSocket, UnixStream}; + use tokio_rustls::TlsAcceptor; use tonic::transport::{Channel, Endpoint, Uri}; use tower::service_fn; use uuid::Uuid; @@ -117,11 +122,19 @@ MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgob29X4H4m2XOkSZE .boxed() } + fn cert_path(cert_dir: &TempDir) -> impl AsRef { + cert_dir.path().join("cert.crt") + } + + fn key_path(cert_dir: &TempDir) -> impl AsRef { + cert_dir.path().join("key.pem") + } + fn start_server(cert_dir: &TempDir) -> String { let (addr, fut) = warp::serve(warp_server()) .tls() - .cert_path(cert_dir.path().join("cert.crt")) - .key_path(cert_dir.path().join("key.pem")) + .cert_path(cert_path(cert_dir)) + .key_path(key_path(cert_dir)) .bind_ephemeral(([127, 0, 0, 1], 0)); tokio::spawn(fut); @@ -444,6 +457,113 @@ MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgob29X4H4m2XOkSZE let _ = response.unwrap_err(); } + #[rstest] + #[case(hyper::Version::HTTP_2, vec![b"h3".to_vec(), b"h2".to_vec(), b"http/1.1".to_vec()])] + #[case(hyper::Version::HTTP_2, vec![b"h2".to_vec(), b"http/1.1".to_vec()])] + #[case(hyper::Version::HTTP_2, vec![b"h2".to_vec()])] + #[case(hyper::Version::HTTP_11, vec![b"http/1.1".to_vec()])] + /// Tests that the outcalls adapter enables HTTP/2 and HTTP/1.1. The test spawns a server that + /// responds with OK if the HTTP protocol corresponds to the negotiated ALPN protocol. + fn test_http_protocols_are_supported_and_alpn_header_is_set( + #[case] expected_negotiated_http_protocol: hyper::Version, + #[case] server_advertised_alpn_protocols: Vec>, + ) { + tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap() + .block_on(async { + let socket = TcpSocket::new_v4().unwrap(); + socket.set_reuseport(false).unwrap(); + socket.set_reuseaddr(false).unwrap(); + socket.bind("127.0.0.1:0".parse().unwrap()).unwrap(); + let listener = socket.listen(1024).unwrap(); + + let addr = listener.local_addr().unwrap(); + + let server_config = { + let cert_dir = CERT_INIT.get_or_init(generate_certs); + let cert_path = cert_path(cert_dir); + let key_path = key_path(cert_dir); + + let cert_file = tokio::fs::read(cert_path).await.unwrap(); + let certs = rustls_pemfile::certs(&mut cert_file.as_ref()) + .collect::, _>>() + .unwrap(); + + let key_file = tokio::fs::read(key_path).await.unwrap(); + let key = rustls_pemfile::private_key(&mut key_file.as_ref()) + .unwrap() + .unwrap(); + + let mut server_config = ServerConfig::builder() + .with_no_client_auth() + .with_single_cert(certs, key) + .unwrap(); + + server_config.alpn_protocols = server_advertised_alpn_protocols; + + server_config + }; + + // Spawn a server that responds with OK if the HTTP protocol corresponds to the negotiated + // ALPN protocol. + tokio::spawn(async move { + let service = hyper::service::service_fn( + |req: Request| async move { + let status = if req.version() == expected_negotiated_http_protocol { + hyper::StatusCode::OK + } else { + hyper::StatusCode::BAD_REQUEST + }; + + Ok::<_, String>( + http::response::Response::builder() + .status(status) + .body(Full::::from("")) + .unwrap(), + ) + }, + ); + + let (tcp_stream, _socket) = listener.accept().await.unwrap(); + + let tls_stream = TlsAcceptor::from(Arc::new(server_config)) + .accept(tcp_stream) + .await + .unwrap(); + + let stream = TokioIo::new(tls_stream); + + hyper_util::server::conn::auto::Builder::new(TokioExecutor::new()) + .http2() + .serve_connection_with_upgrades(stream, service) + .await + }); + + let path = "/tmp/canister-http-test-".to_string() + &Uuid::new_v4().to_string(); + let server_config = Config { + incoming_source: IncomingSource::Path(path.into()), + ..Default::default() + }; + let mut client = spawn_grpc_server(server_config); + + let request = tonic::Request::new(HttpsOutcallRequest { + url: format!("https://localhost:{}", addr.port()), + headers: Vec::new(), + method: HttpMethod::Get as i32, + body: "hello".to_string().as_bytes().to_vec(), + max_response_size_bytes: 512, + socks_proxy_allowed: false, + }); + + let response = client.https_outcall(request).await; + + let http_response = response.unwrap().into_inner(); + assert_eq!(http_response.status, StatusCode::OK.as_u16() as u32); + }); + } + // Spawn grpc server and return canister http client fn spawn_grpc_server(config: Config) -> HttpsOutcallsServiceClient { ic_https_outcalls_adapter::start_server( From 54f0fae1c7ab79a805661caaf8195e8977bfbcc7 Mon Sep 17 00:00:00 2001 From: Rostislav Rumenov Date: Wed, 23 Oct 2024 15:58:06 +0200 Subject: [PATCH 03/21] chore: disallow async locks (RwLock) (#2144) --- clippy.toml | 3 ++- rs/boundary_node/ic_boundary/src/core.rs | 1 + rs/boundary_node/ic_boundary/src/metrics.rs | 2 ++ rs/monitoring/metrics/src/adapter_metrics_registry.rs | 1 + rs/orchestrator/src/dashboard.rs | 1 + rs/orchestrator/src/firewall.rs | 1 + rs/orchestrator/src/ipv4_network.rs | 1 + rs/orchestrator/src/orchestrator.rs | 1 + rs/orchestrator/src/ssh_access_manager.rs | 1 + rs/pocket_ic_server/src/main.rs | 1 + rs/pocket_ic_server/src/state_api/routes.rs | 1 + rs/registry/local_registry/src/lib.rs | 1 + .../src/ledger_blocks_sync.rs | 1 + rs/rosetta-api/icp/tests/test_utils/mod.rs | 1 + 14 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clippy.toml b/clippy.toml index cdd3864c007..b81de6269a4 100644 --- a/clippy.toml +++ b/clippy.toml @@ -12,5 +12,6 @@ disallowed-methods = [ { path = "crossbeam_channel::unbounded", reason = "Using an unbounded channel most likely will read to unbounded memory growth. Please use a bounded channel instead. If you are intentionally using unbounded channel, use `#[allow(clippy::disallowed_methods)]` to locally disable this check." }, ] disallowed-types = [ - { path = "tokio::sync::Mutex", reason = "You should only use an asynchronous lock if you need to .await something while the lock is locked. Usually, this is not necessary, and you should avoid using an asynchronous lock when you can. Asynchronous locks are a lot slower than blocking locks. Please read how to share state effectively across async tasks https://tokio.rs/tokio/tutorial/shared-state. If you are intentionally using an async mutex, use `#[allow(clippy::disallowed_types)]` to locally disable this check." }, + { path = "tokio::sync::Mutex", reason = "You should only use an asynchronous lock if you need to .await something while the lock is locked. Usually, this is not necessary, and you should avoid using an asynchronous lock when you can. Asynchronous locks are a lot slower than blocking locks. Please read how to share state effectively across async tasks https://tokio.rs/tokio/tutorial/shared-state. If you are intentionally using an async Mutex, use `#[allow(clippy::disallowed_types)]` to locally disable this check." }, + { path = "tokio::sync::RwLock", reason = "You should only use an asynchronous lock if you need to .await something while the lock is locked. Usually, this is not necessary, and you should avoid using an asynchronous lock when you can. Asynchronous locks are a lot slower than blocking locks. Please read how to share state effectively across async tasks https://tokio.rs/tokio/tutorial/shared-state. If you are intentionally using an async RwLock, use `#[allow(clippy::disallowed_types)]` to locally disable this check." }, ] diff --git a/rs/boundary_node/ic_boundary/src/core.rs b/rs/boundary_node/ic_boundary/src/core.rs index c811ec3b6ef..0b94aa0edd7 100644 --- a/rs/boundary_node/ic_boundary/src/core.rs +++ b/rs/boundary_node/ic_boundary/src/core.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use std::{ error::Error as StdError, net::{Ipv6Addr, SocketAddr}, diff --git a/rs/boundary_node/ic_boundary/src/metrics.rs b/rs/boundary_node/ic_boundary/src/metrics.rs index b563e7433b5..8a499aef57d 100644 --- a/rs/boundary_node/ic_boundary/src/metrics.rs +++ b/rs/boundary_node/ic_boundary/src/metrics.rs @@ -1,3 +1,5 @@ +#![allow(clippy::disallowed_types)] + use std::{sync::Arc, time::Instant}; use anyhow::Error; diff --git a/rs/monitoring/metrics/src/adapter_metrics_registry.rs b/rs/monitoring/metrics/src/adapter_metrics_registry.rs index 59978640875..435b1f74e05 100644 --- a/rs/monitoring/metrics/src/adapter_metrics_registry.rs +++ b/rs/monitoring/metrics/src/adapter_metrics_registry.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use crate::buckets::{add_bucket, decimal_buckets}; use futures::future::join_all; use futures::future::FutureExt; diff --git a/rs/orchestrator/src/dashboard.rs b/rs/orchestrator/src/dashboard.rs index 69cc7f842b3..1a7a543b800 100644 --- a/rs/orchestrator/src/dashboard.rs +++ b/rs/orchestrator/src/dashboard.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use crate::{ catch_up_package_provider::CatchUpPackageProvider, process_manager::ProcessManager, registry_helper::RegistryHelper, ssh_access_manager::SshAccessParameters, diff --git a/rs/orchestrator/src/firewall.rs b/rs/orchestrator/src/firewall.rs index b902a5f1be5..f5a0f6317ad 100644 --- a/rs/orchestrator/src/firewall.rs +++ b/rs/orchestrator/src/firewall.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use crate::{ catch_up_package_provider::CatchUpPackageProvider, error::{OrchestratorError, OrchestratorResult}, diff --git a/rs/orchestrator/src/ipv4_network.rs b/rs/orchestrator/src/ipv4_network.rs index 3335f328165..3383625b1e0 100644 --- a/rs/orchestrator/src/ipv4_network.rs +++ b/rs/orchestrator/src/ipv4_network.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use crate::{ error::{OrchestratorError, OrchestratorResult}, metrics::OrchestratorMetrics, diff --git a/rs/orchestrator/src/orchestrator.rs b/rs/orchestrator/src/orchestrator.rs index 7c1450499d2..f19769e2284 100644 --- a/rs/orchestrator/src/orchestrator.rs +++ b/rs/orchestrator/src/orchestrator.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use crate::{ args::OrchestratorArgs, boundary_node::BoundaryNodeManager, diff --git a/rs/orchestrator/src/ssh_access_manager.rs b/rs/orchestrator/src/ssh_access_manager.rs index 6fb1d15dd04..94ab0d00bcc 100644 --- a/rs/orchestrator/src/ssh_access_manager.rs +++ b/rs/orchestrator/src/ssh_access_manager.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use crate::{ error::{OrchestratorError, OrchestratorResult}, metrics::OrchestratorMetrics, diff --git a/rs/pocket_ic_server/src/main.rs b/rs/pocket_ic_server/src/main.rs index f380bee86cb..3a7928186a4 100644 --- a/rs/pocket_ic_server/src/main.rs +++ b/rs/pocket_ic_server/src/main.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use aide::{ axum::{ routing::{get, post}, diff --git a/rs/pocket_ic_server/src/state_api/routes.rs b/rs/pocket_ic_server/src/state_api/routes.rs index b4f22563939..a66f2e62be5 100644 --- a/rs/pocket_ic_server/src/state_api/routes.rs +++ b/rs/pocket_ic_server/src/state_api/routes.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] /// This module contains the route handlers for the PocketIc server. /// /// A handler may receive a representation of a PocketIc Operation in the request diff --git a/rs/registry/local_registry/src/lib.rs b/rs/registry/local_registry/src/lib.rs index c82c9c1257b..1d0f6683fb2 100644 --- a/rs/registry/local_registry/src/lib.rs +++ b/rs/registry/local_registry/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] //! Access a local store through the standard `RegistryClient` trait. Hides the //! complexities of syncing the local store with the NNS registry behind a //! simple function call. Control over when the synchronization happens is left diff --git a/rs/rosetta-api/icp/ledger_canister_blocks_synchronizer/src/ledger_blocks_sync.rs b/rs/rosetta-api/icp/ledger_canister_blocks_synchronizer/src/ledger_blocks_sync.rs index 8999cded864..8445ae8caa5 100644 --- a/rs/rosetta-api/icp/ledger_canister_blocks_synchronizer/src/ledger_blocks_sync.rs +++ b/rs/rosetta-api/icp/ledger_canister_blocks_synchronizer/src/ledger_blocks_sync.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use std::ops::Range; use std::sync::atomic::{AtomicBool, Ordering::Relaxed}; use std::sync::Arc; diff --git a/rs/rosetta-api/icp/tests/test_utils/mod.rs b/rs/rosetta-api/icp/tests/test_utils/mod.rs index dcff24181b4..e3882eb699e 100644 --- a/rs/rosetta-api/icp/tests/test_utils/mod.rs +++ b/rs/rosetta-api/icp/tests/test_utils/mod.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_types)] use async_trait::async_trait; use ic_ledger_canister_blocks_synchronizer::blocks::{Blocks, HashedBlock, RosettaBlocksMode}; use ic_ledger_canister_core::ledger::LedgerTransaction; From 7d8e6852e0dbe5aa58a764631ee6aec9aee23fc7 Mon Sep 17 00:00:00 2001 From: Arshavir Ter-Gabrielyan Date: Wed, 23 Oct 2024 18:24:24 +0200 Subject: [PATCH 04/21] feat(sns): Refactor API types related to managing timers (#2204) This PR moves some timer-related API types into the `ic_nervous_system` crate, as three different SNS canisters would benefit from using the same types to reset their timers and read timer-related metadata. As the first step, only Swap is adjusted to refer to the common types in this PR. To make the timer-related APIs uniform, we add `Swap.get_timers`, despite this information also being available via `Swap.get_state`. | [Next PR](https://github.com/dfinity/ic/pull/2211) > --- .../pb/v1/nervous_system.proto | 19 +++++ .../proto/src/gen/ic_nervous_system.pb.v1.rs | 73 +++++++++++++++++++ .../src/golden_state_swap_upgrade_twice.rs | 3 +- rs/sns/integration_tests/src/timers.rs | 37 +++++----- rs/sns/swap/canister/canister.rs | 13 +++- rs/sns/swap/canister/swap.did | 5 ++ .../swap/proto/ic_sns_swap/pb/v1/swap.proto | 11 +-- rs/sns/swap/src/gen/ic_sns_swap.pb.v1.rs | 42 +---------- 8 files changed, 131 insertions(+), 72 deletions(-) diff --git a/rs/nervous_system/proto/proto/ic_nervous_system/pb/v1/nervous_system.proto b/rs/nervous_system/proto/proto/ic_nervous_system/pb/v1/nervous_system.proto index 9496d966baf..149c334a29d 100644 --- a/rs/nervous_system/proto/proto/ic_nervous_system/pb/v1/nervous_system.proto +++ b/rs/nervous_system/proto/proto/ic_nervous_system/pb/v1/nervous_system.proto @@ -55,3 +55,22 @@ message Decimal { // E.g. "3.14". optional string human_readable = 1; } + +// API types related to managing canister timers. + +message ResetTimersRequest {} +message ResetTimersResponse {} + +message Timers { + // Indicates whether this canister (still) requires (timer-based) periodic tasks. + // + // May be ignored by canisters that never cancel their periodic tasks. + optional bool requires_periodic_tasks = 1; + optional uint64 last_reset_timestamp_seconds = 2; + optional uint64 last_spawned_timestamp_seconds = 3; +} + +message GetTimersRequest {} +message GetTimersResponse { + optional Timers timers = 1; +} diff --git a/rs/nervous_system/proto/src/gen/ic_nervous_system.pb.v1.rs b/rs/nervous_system/proto/src/gen/ic_nervous_system.pb.v1.rs index 5f977c272ae..6901ac064f5 100644 --- a/rs/nervous_system/proto/src/gen/ic_nervous_system.pb.v1.rs +++ b/rs/nervous_system/proto/src/gen/ic_nervous_system.pb.v1.rs @@ -150,3 +150,76 @@ pub struct Decimal { #[prost(string, optional, tag = "1")] pub human_readable: ::core::option::Option<::prost::alloc::string::String>, } +#[derive( + Eq, + candid::CandidType, + candid::Deserialize, + comparable::Comparable, + serde::Serialize, + Clone, + Copy, + PartialEq, + ::prost::Message, +)] +pub struct ResetTimersRequest {} +#[derive( + Eq, + candid::CandidType, + candid::Deserialize, + comparable::Comparable, + serde::Serialize, + Clone, + Copy, + PartialEq, + ::prost::Message, +)] +pub struct ResetTimersResponse {} +#[derive( + Eq, + candid::CandidType, + candid::Deserialize, + comparable::Comparable, + serde::Serialize, + Clone, + Copy, + PartialEq, + ::prost::Message, +)] +pub struct Timers { + /// Indicates whether this canister (still) requires (timer-based) periodic tasks. + /// + /// May be ignored by canisters that never cancel their periodic tasks. + #[prost(bool, optional, tag = "1")] + pub requires_periodic_tasks: ::core::option::Option, + #[prost(uint64, optional, tag = "2")] + pub last_reset_timestamp_seconds: ::core::option::Option, + #[prost(uint64, optional, tag = "3")] + pub last_spawned_timestamp_seconds: ::core::option::Option, +} +#[derive( + Eq, + candid::CandidType, + candid::Deserialize, + comparable::Comparable, + serde::Serialize, + Clone, + Copy, + PartialEq, + ::prost::Message, +)] +pub struct GetTimersRequest {} +#[derive( + Eq, + candid::CandidType, + candid::Deserialize, + comparable::Comparable, + serde::Serialize, + Clone, + Copy, + PartialEq, + ::prost::Message, +)] +pub struct GetTimersResponse { + #[prost(message, optional, tag = "1")] + pub timers: ::core::option::Option, +} diff --git a/rs/sns/integration_tests/src/golden_state_swap_upgrade_twice.rs b/rs/sns/integration_tests/src/golden_state_swap_upgrade_twice.rs index 30c73e10e3b..5f08465073e 100644 --- a/rs/sns/integration_tests/src/golden_state_swap_upgrade_twice.rs +++ b/rs/sns/integration_tests/src/golden_state_swap_upgrade_twice.rs @@ -1,9 +1,10 @@ use assert_matches::assert_matches; use candid::{Decode, Encode}; +use ic_nervous_system_proto::pb::v1::Timers; use ic_nns_test_utils::sns_wasm::{ build_swap_sns_wasm, create_modified_sns_wasm, ensure_sns_wasm_gzipped, }; -use ic_sns_swap::pb::v1::{DerivedState, GetStateRequest, GetStateResponse, Swap, Timers}; +use ic_sns_swap::pb::v1::{DerivedState, GetStateRequest, GetStateResponse, Swap}; use ic_sns_wasm::pb::v1::SnsWasm; use ic_state_machine_tests::StateMachine; use ic_types::{CanisterId, PrincipalId}; diff --git a/rs/sns/integration_tests/src/timers.rs b/rs/sns/integration_tests/src/timers.rs index 06c7c660379..5e30138e867 100644 --- a/rs/sns/integration_tests/src/timers.rs +++ b/rs/sns/integration_tests/src/timers.rs @@ -1,9 +1,10 @@ use assert_matches::assert_matches; use candid::{Decode, Encode, Principal}; +use ic_nervous_system_proto::pb::v1::{ResetTimersRequest, ResetTimersResponse, Timers}; use ic_nns_test_utils::sns_wasm::build_governance_sns_wasm; use ic_sns_governance::{init::GovernanceCanisterInitPayloadBuilder, pb::v1 as governance_pb}; use ic_sns_swap::pb::v1::{ - self as swap_pb, GetStateRequest, Init, Lifecycle, NeuronBasketConstructionParameters, + GetStateRequest, GetStateResponse, Init, Lifecycle, NeuronBasketConstructionParameters, }; use ic_sns_test_utils::state_test_helpers::state_machine_builder_for_sns_tests; use ic_types::PrincipalId; @@ -74,7 +75,7 @@ fn test_swap_periodic_tasks_disabled_eventually() { let response = state_machine .execute_ingress(canister_id, "get_state", payload) .expect("Unable to call get_state on the Swap canister"); - let response = Decode!(&response.bytes(), swap_pb::GetStateResponse).unwrap(); + let response = Decode!(&response.bytes(), GetStateResponse).unwrap(); let swap_state = response.swap.unwrap(); ( swap_state.timers, @@ -91,7 +92,7 @@ fn test_swap_periodic_tasks_disabled_eventually() { assert_matches!( get_relevant_state_components(), ( - Some(swap_pb::Timers { + Some(Timers { requires_periodic_tasks: Some(true), last_reset_timestamp_seconds: Some(_), last_spawned_timestamp_seconds: Some(_), @@ -117,7 +118,7 @@ fn test_swap_periodic_tasks_disabled_eventually() { assert_matches!( get_relevant_state_components(), ( - Some(swap_pb::Timers { + Some(Timers { requires_periodic_tasks: Some(false), last_reset_timestamp_seconds: Some(_), last_spawned_timestamp_seconds: Some(_), @@ -145,12 +146,12 @@ fn test_swap_reset_timers() { let response = state_machine .execute_ingress(canister_id, "get_state", payload) .expect("Unable to call get_state on the Swap canister"); - let response = Decode!(&response.bytes(), swap_pb::GetStateResponse).unwrap(); + let response = Decode!(&response.bytes(), GetStateResponse).unwrap(); response.swap.unwrap().timers }; let last_spawned_timestamp_seconds = { - let last_reset_timestamp_seconds = assert_matches!(get_timers(), Some(swap_pb::Timers { + let last_reset_timestamp_seconds = assert_matches!(get_timers(), Some(Timers { requires_periodic_tasks: Some(true), last_reset_timestamp_seconds: Some(last_reset_timestamp_seconds), last_spawned_timestamp_seconds: None, @@ -161,7 +162,7 @@ fn test_swap_reset_timers() { state_machine.advance_time(Duration::from_secs(1000)); state_machine.tick(); - let last_spawned_timestamp_seconds = assert_matches!(get_timers(), Some(swap_pb::Timers { + let last_spawned_timestamp_seconds = assert_matches!(get_timers(), Some(Timers { requires_periodic_tasks: Some(true), last_reset_timestamp_seconds: Some(last_reset_timestamp_seconds_1), last_spawned_timestamp_seconds: Some(last_spawned_timestamp_seconds), @@ -179,18 +180,18 @@ fn test_swap_reset_timers() { // Reset the timers. { - let payload = Encode!(&swap_pb::ResetTimersRequest {}).unwrap(); + let payload = Encode!(&ResetTimersRequest {}).unwrap(); let response = state_machine .execute_ingress(canister_id, "reset_timers", payload) .expect("Unable to call reset_timers on the Swap canister"); - Decode!(&response.bytes(), swap_pb::ResetTimersResponse).unwrap(); + Decode!(&response.bytes(), ResetTimersResponse).unwrap(); } // Inspect the sate after resetting the timers. { let last_spawned_before_reset_timestamp_seconds = last_spawned_timestamp_seconds; - let last_reset_timestamp_seconds = assert_matches!(get_timers(), Some(swap_pb::Timers { + let last_reset_timestamp_seconds = assert_matches!(get_timers(), Some(Timers { requires_periodic_tasks: Some(true), last_reset_timestamp_seconds: Some(last_reset_timestamp_seconds), last_spawned_timestamp_seconds: None, @@ -206,7 +207,7 @@ fn test_swap_reset_timers() { state_machine.advance_time(Duration::from_secs(100)); state_machine.tick(); - let last_spawned_timestamp_seconds = assert_matches!(get_timers(), Some(swap_pb::Timers { + let last_spawned_timestamp_seconds = assert_matches!(get_timers(), Some(Timers { requires_periodic_tasks: Some(true), last_reset_timestamp_seconds: Some(last_reset_timestamp_seconds_1), last_spawned_timestamp_seconds: Some(last_spawned_timestamp_seconds), @@ -272,11 +273,11 @@ fn test_governance_reset_timers() { // Reset the timers. { - let payload = Encode!(&swap_pb::ResetTimersRequest {}).unwrap(); + let payload = Encode!(&ResetTimersRequest {}).unwrap(); let response = state_machine .execute_ingress(canister_id, "reset_timers", payload) .expect("Unable to call reset_timers on the Governance canister"); - Decode!(&response.bytes(), swap_pb::ResetTimersResponse).unwrap(); + Decode!(&response.bytes(), ResetTimersResponse).unwrap(); } // Inspect the sate after resetting the timers. @@ -325,11 +326,11 @@ fn test_swap_reset_timers_cannot_be_spammed() { .unwrap(); // Helpers. - let try_reset_timers = || -> Result { - let payload = Encode!(&swap_pb::ResetTimersRequest {}).unwrap(); + let try_reset_timers = || -> Result { + let payload = Encode!(&ResetTimersRequest {}).unwrap(); let response = state_machine.execute_ingress(canister_id, "reset_timers", payload); match response { - Ok(response) => Ok(Decode!(&response.bytes(), swap_pb::ResetTimersResponse).unwrap()), + Ok(response) => Ok(Decode!(&response.bytes(), ResetTimersResponse).unwrap()), Err(err) => Err(err.to_string()), } }; @@ -343,11 +344,11 @@ fn test_swap_reset_timers_cannot_be_spammed() { let response = state_machine .execute_ingress(canister_id, "get_state", payload) .expect("Unable to call get_state on the Swap canister"); - let response = Decode!(&response.bytes(), swap_pb::GetStateResponse).unwrap(); + let response = Decode!(&response.bytes(), GetStateResponse).unwrap(); response.swap.unwrap().timers }; - let last_reset_timestamp_seconds = assert_matches!(timers, Some(swap_pb::Timers { + let last_reset_timestamp_seconds = assert_matches!(timers, Some(Timers { last_reset_timestamp_seconds: Some(last_reset_timestamp_seconds), .. }) => last_reset_timestamp_seconds); diff --git a/rs/sns/swap/canister/canister.rs b/rs/sns/swap/canister/canister.rs index 1b7f859b71a..24e3f7db239 100644 --- a/rs/sns/swap/canister/canister.rs +++ b/rs/sns/swap/canister/canister.rs @@ -10,6 +10,9 @@ use ic_nervous_system_clients::{ management_canister_client::{ManagementCanisterClient, ManagementCanisterClientImpl}, }; use ic_nervous_system_common::{serve_logs, serve_logs_v2, serve_metrics}; +use ic_nervous_system_proto::pb::v1::{ + GetTimersRequest, GetTimersResponse, ResetTimersRequest, ResetTimersResponse, Timers, +}; use ic_nervous_system_runtime::CdkRuntime; use ic_sns_swap::{ logs::{ERROR, INFO}, @@ -25,8 +28,7 @@ use ic_sns_swap::{ ListCommunityFundParticipantsResponse, ListDirectParticipantsRequest, ListDirectParticipantsResponse, ListSnsNeuronRecipesRequest, ListSnsNeuronRecipesResponse, NewSaleTicketRequest, NewSaleTicketResponse, NotifyPaymentFailureRequest, - NotifyPaymentFailureResponse, RefreshBuyerTokensRequest, RefreshBuyerTokensResponse, - ResetTimersRequest, ResetTimersResponse, Swap, Timers, + NotifyPaymentFailureResponse, RefreshBuyerTokensRequest, RefreshBuyerTokensResponse, Swap, }, }; use ic_stable_structures::{writer::Writer, Memory}; @@ -305,6 +307,13 @@ async fn run_periodic_tasks() { } } +#[query] +fn get_timers(arg: GetTimersRequest) -> GetTimersResponse { + let GetTimersRequest {} = arg; + let timers = swap().timers; + GetTimersResponse { timers } +} + fn init_timers() { let last_reset_timestamp_seconds = Some(now_seconds()); let requires_periodic_tasks = swap().requires_periodic_tasks(); diff --git a/rs/sns/swap/canister/swap.did b/rs/sns/swap/canister/swap.did index 3d7f517b25b..295231a8624 100644 --- a/rs/sns/swap/canister/swap.did +++ b/rs/sns/swap/canister/swap.did @@ -421,6 +421,10 @@ type Timers = record { last_spawned_timestamp_seconds : opt nat64; }; +type GetTimersResponse = record { + timers : opt Timers; +}; + type SweepResult = record { failure : nat32; skipped : nat32; @@ -474,4 +478,5 @@ service : (Init) -> { RefreshBuyerTokensResponse, ); reset_timers : (record {}) -> (record {}); + get_timers : (record {}) -> (GetTimersResponse) query; } diff --git a/rs/sns/swap/proto/ic_sns_swap/pb/v1/swap.proto b/rs/sns/swap/proto/ic_sns_swap/pb/v1/swap.proto index b84172aafd8..698bd2eb2ed 100644 --- a/rs/sns/swap/proto/ic_sns_swap/pb/v1/swap.proto +++ b/rs/sns/swap/proto/ic_sns_swap/pb/v1/swap.proto @@ -277,13 +277,7 @@ message Swap { optional uint64 neurons_fund_participation_icp_e8s = 20; // Information about the timers that perform periodic tasks of this Swap canister. - optional Timers timers = 22; -} - -message Timers { - optional bool requires_periodic_tasks = 1; - optional uint64 last_reset_timestamp_seconds = 2; - optional uint64 last_spawned_timestamp_seconds = 3; + optional ic_nervous_system.pb.v1.Timers timers = 22; } // The initialisation data of the canister. Always specified on @@ -794,9 +788,6 @@ message GetStateResponse { DerivedState derived = 2; } -message ResetTimersRequest {} -message ResetTimersResponse {} - message GetBuyerStateRequest { // The principal_id of the user who's buyer state is being queried for. ic_base_types.pb.v1.PrincipalId principal_id = 1; diff --git a/rs/sns/swap/src/gen/ic_sns_swap.pb.v1.rs b/rs/sns/swap/src/gen/ic_sns_swap.pb.v1.rs index df8a788b75f..9823caed852 100644 --- a/rs/sns/swap/src/gen/ic_sns_swap.pb.v1.rs +++ b/rs/sns/swap/src/gen/ic_sns_swap.pb.v1.rs @@ -238,25 +238,7 @@ pub struct Swap { pub neurons_fund_participation_icp_e8s: ::core::option::Option, /// Information about the timers that perform periodic tasks of this Swap canister. #[prost(message, optional, tag = "22")] - pub timers: ::core::option::Option, -} -#[derive( - candid::CandidType, - candid::Deserialize, - serde::Serialize, - comparable::Comparable, - Clone, - Copy, - PartialEq, - ::prost::Message, -)] -pub struct Timers { - #[prost(bool, optional, tag = "1")] - pub requires_periodic_tasks: ::core::option::Option, - #[prost(uint64, optional, tag = "2")] - pub last_reset_timestamp_seconds: ::core::option::Option, - #[prost(uint64, optional, tag = "3")] - pub last_spawned_timestamp_seconds: ::core::option::Option, + pub timers: ::core::option::Option<::ic_nervous_system_proto::pb::v1::Timers>, } /// The initialisation data of the canister. Always specified on /// canister creation, and cannot be modified afterwards. @@ -998,28 +980,6 @@ pub struct GetStateResponse { #[prost(message, optional, tag = "2")] pub derived: ::core::option::Option, } -#[derive( - candid::CandidType, - candid::Deserialize, - serde::Serialize, - comparable::Comparable, - Clone, - Copy, - PartialEq, - ::prost::Message, -)] -pub struct ResetTimersRequest {} -#[derive( - candid::CandidType, - candid::Deserialize, - serde::Serialize, - comparable::Comparable, - Clone, - Copy, - PartialEq, - ::prost::Message, -)] -pub struct ResetTimersResponse {} #[derive( candid::CandidType, candid::Deserialize, From e70f04d9f24349b457234af011bf67060f0051bb Mon Sep 17 00:00:00 2001 From: Adrian Alic <39585474+dist1ll@users.noreply.github.com> Date: Wed, 23 Oct 2024 18:36:45 +0200 Subject: [PATCH 05/21] fix(recovery): [CON-1405] Print example of expected ssh key format during recovery (#2187) To avoid confusion during recovery, we now print the expected key format. ![image](https://github.com/user-attachments/assets/5c7f4425-fb8f-4e5d-b34d-0a4be3a4d5fc) --- rs/recovery/src/app_subnet_recovery.rs | 5 ++++- rs/recovery/src/file_sync_helper.rs | 4 +--- rs/recovery/subnet_splitting/src/subnet_splitting.rs | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/rs/recovery/src/app_subnet_recovery.rs b/rs/recovery/src/app_subnet_recovery.rs index 2462ea9eede..e8f60c41668 100644 --- a/rs/recovery/src/app_subnet_recovery.rs +++ b/rs/recovery/src/app_subnet_recovery.rs @@ -210,7 +210,10 @@ impl RecoveryIterator for AppSubnetRecovery { if self.params.pub_key.is_none() { self.params.pub_key = read_optional( &self.logger, - "Enter public key to add readonly SSH access to subnet: ", + "Enter public key to add readonly SSH access to subnet. Ensure the right format.\n\ + Format: ssh-ed25519 \n\ + Example: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPwS/0S6xH0g/xLDV0Tz7VeMZE9AKPeSbLmCsq9bY3F1 foo@dfinity.org\n\ + Enter your key: ", ); } } diff --git a/rs/recovery/src/file_sync_helper.rs b/rs/recovery/src/file_sync_helper.rs index f7f7aba1979..c3c9e94b043 100644 --- a/rs/recovery/src/file_sync_helper.rs +++ b/rs/recovery/src/file_sync_helper.rs @@ -85,9 +85,7 @@ pub fn rsync_with_retries( require_confirmation, key_file, ) { - Err(e) => { - warn!(logger, "Rsync failed: {:?}, retrying...", e); - } + Err(e) => warn!(logger, "Rsync failed: {:?}, retrying...", e), success => return success, } thread::sleep(time::Duration::from_secs(10)); diff --git a/rs/recovery/subnet_splitting/src/subnet_splitting.rs b/rs/recovery/subnet_splitting/src/subnet_splitting.rs index f20defd9a7f..b7fa704fe7c 100644 --- a/rs/recovery/subnet_splitting/src/subnet_splitting.rs +++ b/rs/recovery/subnet_splitting/src/subnet_splitting.rs @@ -433,7 +433,10 @@ impl RecoveryIterator for SubnetSplitting { if self.params.pub_key.is_none() { self.params.pub_key = read_optional( &self.logger, - "Enter public key to add readonly SSH access to subnet: ", + "Enter public key to add readonly SSH access to subnet. Ensure the right format.\n\ + Format: ssh-ed25519 \n\ + Example: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPwS/0S6xH0g/xLDV0Tz7VeMZE9AKPeSbLmCsq9bY3F1 foo@dfinity.org\n\ + Enter your key: ", ) } } From 161b12ce8f5b2e020dfb73ef9dda53ddd312663e Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 23 Oct 2024 14:08:07 -0400 Subject: [PATCH 06/21] feat(crypto): CRP-2579 Add support for derivation to ecdsa_secp256r1 crate (#1730) In order to remove the dependency on the internal threshold ECDSA protocol implementation from ic-crypto-utils-canister-threshold-sig we have to have derivation available in the 3 signature utility crates. --------- Co-authored-by: IDX GitHub Automation --- Cargo.lock | 3 + rs/crypto/ecdsa_secp256r1/BUILD.bazel | 3 + rs/crypto/ecdsa_secp256r1/Cargo.toml | 3 + rs/crypto/ecdsa_secp256r1/src/lib.rs | 201 ++++++++++++++++++++++- rs/crypto/ecdsa_secp256r1/tests/tests.rs | 134 ++++++++++++++- 5 files changed, 342 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec1a6d886e9..b641da059e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6825,6 +6825,8 @@ name = "ic-crypto-ecdsa-secp256r1" version = "0.9.0" dependencies = [ "hex", + "hex-literal", + "hmac", "ic-crypto-sha2", "ic-crypto-test-utils-reproducible-rng", "lazy_static", @@ -6833,6 +6835,7 @@ dependencies = [ "pem 1.1.1", "rand 0.8.5", "rand_chacha 0.3.1", + "sha2 0.10.8", "simple_asn1", "wycheproof", "zeroize", diff --git a/rs/crypto/ecdsa_secp256r1/BUILD.bazel b/rs/crypto/ecdsa_secp256r1/BUILD.bazel index 2dd54e9b91a..d8abaad623b 100644 --- a/rs/crypto/ecdsa_secp256r1/BUILD.bazel +++ b/rs/crypto/ecdsa_secp256r1/BUILD.bazel @@ -4,12 +4,14 @@ package(default_visibility = ["//visibility:public"]) DEPENDENCIES = [ # Keep sorted. + "@crate_index//:hmac", "@crate_index//:lazy_static", "@crate_index//:num-bigint", "@crate_index//:p256", "@crate_index//:pem", "@crate_index//:rand", "@crate_index//:rand_chacha", + "@crate_index//:sha2", "@crate_index//:simple_asn1", "@crate_index//:zeroize", ] @@ -21,6 +23,7 @@ DEV_DEPENDENCIES = [ "//rs/crypto/sha2", "//rs/crypto/test_utils/reproducible_rng", "@crate_index//:hex", + "@crate_index//:hex-literal", "@crate_index//:wycheproof", ] diff --git a/rs/crypto/ecdsa_secp256r1/Cargo.toml b/rs/crypto/ecdsa_secp256r1/Cargo.toml index b7d69b03ebe..c220363b150 100644 --- a/rs/crypto/ecdsa_secp256r1/Cargo.toml +++ b/rs/crypto/ecdsa_secp256r1/Cargo.toml @@ -9,17 +9,20 @@ documentation.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +hmac = "0.12" lazy_static = { workspace = true } num-bigint = { workspace = true } p256 = { workspace = true } pem = "1.1.0" rand = { workspace = true } rand_chacha = { workspace = true } +sha2 = { workspace = true } simple_asn1 = { workspace = true } zeroize = { workspace = true } [dev-dependencies] hex = { workspace = true } +hex-literal = "0.4" ic-crypto-sha2 = { path = "../sha2" } ic-crypto-test-utils-reproducible-rng = { path = "../test_utils/reproducible_rng" } wycheproof = { version = "0.6", default-features = false, features = ["ecdsa"] } diff --git a/rs/crypto/ecdsa_secp256r1/src/lib.rs b/rs/crypto/ecdsa_secp256r1/src/lib.rs index ef97a572556..5b8c5bc266c 100644 --- a/rs/crypto/ecdsa_secp256r1/src/lib.rs +++ b/rs/crypto/ecdsa_secp256r1/src/lib.rs @@ -10,7 +10,7 @@ use p256::{ generic_array::{typenum::Unsigned, GenericArray}, Curve, }, - NistP256, + AffinePoint, NistP256, Scalar, }; use rand::{CryptoRng, RngCore}; use zeroize::ZeroizeOnDrop; @@ -35,6 +35,138 @@ lazy_static::lazy_static! { static ref SECP256R1_OID: simple_asn1::OID = simple_asn1::oid!(1, 2, 840, 10045, 3, 1, 7); } +/// A component of a derivation path +#[derive(Clone, Debug)] +pub struct DerivationIndex(pub Vec); + +/// Derivation Path +/// +/// A derivation path is simply a sequence of DerivationIndex +#[derive(Clone, Debug)] +pub struct DerivationPath { + path: Vec, +} + +impl DerivationPath { + /// Create a BIP32-style derivation path + /// + /// See SLIP-10 + /// for details of derivation paths + pub fn new_bip32(bip32: &[u32]) -> Self { + let mut path = Vec::with_capacity(bip32.len()); + for n in bip32 { + path.push(DerivationIndex(n.to_be_bytes().to_vec())); + } + Self::new(path) + } + + /// Create a free-form derivation path + pub fn new(path: Vec) -> Self { + Self { path } + } + + /// Create a path from a canister ID and a user provided path + pub fn from_canister_id_and_path(canister_id: &[u8], path: &[Vec]) -> Self { + let mut vpath = Vec::with_capacity(1 + path.len()); + vpath.push(DerivationIndex(canister_id.to_vec())); + + for n in path { + vpath.push(DerivationIndex(n.to_vec())); + } + Self::new(vpath) + } + + /// Return the length of this path + pub fn len(&self) -> usize { + self.path.len() + } + + /// Return if this path is empty + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + + /// Return the components of the derivation path + pub fn path(&self) -> &[DerivationIndex] { + &self.path + } + + fn ckd(idx: &[u8], input: &[u8], chain_code: &[u8; 32]) -> ([u8; 32], Scalar) { + use hmac::{Hmac, Mac}; + use p256::elliptic_curve::ops::Reduce; + use sha2::Sha512; + + let mut hmac = Hmac::::new_from_slice(chain_code) + .expect("HMAC-SHA-512 should accept 256 bit key"); + + hmac.update(input); + hmac.update(idx); + + let hmac_output: [u8; 64] = hmac.finalize().into_bytes().into(); + + let fb = p256::FieldBytes::from_slice(&hmac_output[..32]); + let next_offset = >::reduce_bytes(fb); + let next_chain_key: [u8; 32] = hmac_output[32..].to_vec().try_into().expect("Correct size"); + + // If iL >= order, try again with the "next" index as described in SLIP-10 + if next_offset.to_bytes().to_vec() != hmac_output[..32] { + let mut next_input = [0u8; 33]; + next_input[0] = 0x01; + next_input[1..].copy_from_slice(&next_chain_key); + Self::ckd(idx, &next_input, chain_code) + } else { + (next_chain_key, next_offset) + } + } + + fn ckd_pub( + idx: &[u8], + pt: AffinePoint, + chain_code: &[u8; 32], + ) -> ([u8; 32], Scalar, AffinePoint) { + use p256::elliptic_curve::{group::GroupEncoding, ops::MulByGenerator}; + use p256::ProjectivePoint; + + let mut ckd_input = pt.to_bytes(); + + let pt: ProjectivePoint = pt.into(); + + loop { + let (next_chain_code, next_offset) = Self::ckd(idx, &ckd_input, chain_code); + + let next_pt = (pt + ProjectivePoint::mul_by_generator(&next_offset)).to_affine(); + + // If the new key is not infinity, we're done: return the new key + if !bool::from(next_pt.is_identity()) { + return (next_chain_code, next_offset, next_pt); + } + + // Otherwise set up the next input as defined by SLIP-0010 + ckd_input[0] = 0x01; + ckd_input[1..].copy_from_slice(&next_chain_code); + } + } + + fn derive_offset( + &self, + pt: AffinePoint, + chain_code: &[u8; 32], + ) -> (AffinePoint, Scalar, [u8; 32]) { + let mut offset = Scalar::ZERO; + let mut pt = pt; + let mut chain_code = *chain_code; + + for idx in self.path() { + let (next_chain_code, next_offset, next_pt) = Self::ckd_pub(&idx.0, pt, &chain_code); + chain_code = next_chain_code; + pt = next_pt; + offset = offset.add(&next_offset); + } + + (pt, offset, chain_code) + } +} + const PEM_HEADER_PKCS8: &str = "PRIVATE KEY"; const PEM_HEADER_RFC5915: &str = "EC PRIVATE KEY"; @@ -305,6 +437,45 @@ impl PrivateKey { let key = self.key.verifying_key(); PublicKey { key: *key } } + + /// Derive a private key from this private key using a derivation path + /// + /// As long as each index of the derivation path is a 4-byte input with the highest + /// bit cleared, this derivation scheme matches SLIP-10 + /// + pub fn derive_subkey(&self, derivation_path: &DerivationPath) -> (Self, [u8; 32]) { + let chain_code = [0u8; 32]; + self.derive_subkey_with_chain_code(derivation_path, &chain_code) + } + + /// Derive a private key from this private key using a derivation path + /// and chain code + /// + /// As long as each index of the derivation path is a 4-byte input with the highest + /// bit cleared, this derivation scheme matches SLIP-10 + /// + pub fn derive_subkey_with_chain_code( + &self, + derivation_path: &DerivationPath, + chain_code: &[u8; 32], + ) -> (Self, [u8; 32]) { + use p256::NonZeroScalar; + + let public_key: AffinePoint = *self.key.verifying_key().as_affine(); + let (_pt, offset, derived_chain_code) = + derivation_path.derive_offset(public_key, chain_code); + + let derived_scalar = self.key.as_nonzero_scalar().as_ref().add(&offset); + + let nz_ds = + NonZeroScalar::new(derived_scalar).expect("Derivation always produces non-zero sum"); + + let derived_key = Self { + key: p256::ecdsa::SigningKey::from(nz_ds), + }; + + (derived_key, derived_chain_code) + } } /// An ECDSA public key @@ -399,4 +570,32 @@ impl PublicKey { self.key.verify_prehash(digest, &signature).is_ok() } + + /// Derive a public key from this public key using a derivation path + /// + pub fn derive_subkey(&self, derivation_path: &DerivationPath) -> (Self, [u8; 32]) { + let chain_code = [0u8; 32]; + self.derive_subkey_with_chain_code(derivation_path, &chain_code) + } + + /// Derive a public key from this public key using a derivation path + /// and chain code + /// + /// This derivation matches SLIP-10 + pub fn derive_subkey_with_chain_code( + &self, + derivation_path: &DerivationPath, + chain_code: &[u8; 32], + ) -> (Self, [u8; 32]) { + let public_key: AffinePoint = *self.key.as_affine(); + let (pt, _offset, chain_code) = derivation_path.derive_offset(public_key, chain_code); + + let derived_key = Self { + key: p256::ecdsa::VerifyingKey::from( + p256::PublicKey::from_affine(pt).expect("Derived point is valid"), + ), + }; + + (derived_key, chain_code) + } } diff --git a/rs/crypto/ecdsa_secp256r1/tests/tests.rs b/rs/crypto/ecdsa_secp256r1/tests/tests.rs index 9a93463dc7b..01279952b9e 100644 --- a/rs/crypto/ecdsa_secp256r1/tests/tests.rs +++ b/rs/crypto/ecdsa_secp256r1/tests/tests.rs @@ -1,4 +1,5 @@ -use ic_crypto_ecdsa_secp256r1::{KeyDecodingError, PrivateKey, PublicKey}; +use hex_literal::hex; +use ic_crypto_ecdsa_secp256r1::*; use ic_crypto_test_utils_reproducible_rng::reproducible_rng; #[test] @@ -271,3 +272,134 @@ NRLvCGaIxJfchxpjcCysTG12MfKOf6/Phw== SAMPLE_SECP256R1_5915_PEM ); } + +#[test] +fn private_derivation_is_compatible_with_public_derivation() { + use rand::Rng; + + let rng = &mut reproducible_rng(); + + fn random_path(rng: &mut R) -> DerivationPath { + let l = 1 + rng.gen::() % 9; + let path = (0..l).map(|_| rng.gen::()).collect::>(); + DerivationPath::new_bip32(&path) + } + + for _ in 0..100 { + let master_sk = PrivateKey::generate_using_rng(rng); + let master_pk = master_sk.public_key(); + + let path = random_path(rng); + + let chain_code = rng.gen::<[u8; 32]>(); + + let (derived_pk, cc_pk) = master_pk.derive_subkey_with_chain_code(&path, &chain_code); + + let (derived_sk, cc_sk) = master_sk.derive_subkey_with_chain_code(&path, &chain_code); + + assert_eq!( + hex::encode(derived_pk.serialize_sec1(true)), + hex::encode(derived_sk.public_key().serialize_sec1(true)) + ); + + assert_eq!(hex::encode(cc_pk), hex::encode(cc_sk)); + + let msg = rng.gen::<[u8; 32]>(); + let derived_sig = derived_sk.sign_message(&msg); + + assert!(derived_pk.verify_signature(&msg, &derived_sig)); + } +} + +#[test] +fn should_match_slip10_derivation_test_data() { + // Test data from https://github.com/satoshilabs/slips/blob/master/slip-0010.md#test-vector-1-for-nist256p1 + let chain_code = hex!("98c7514f562e64e74170cc3cf304ee1ce54d6b6da4f880f313e8204c2a185318"); + + let private_key = PrivateKey::deserialize_sec1(&hex!( + "694596e8a54f252c960eb771a3c41e7e32496d03b954aeb90f61635b8e092aa7" + )) + .expect("Test has valid key"); + + let public_key = PublicKey::deserialize_sec1(&hex!( + "0359cf160040778a4b14c5f4d7b76e327ccc8c4a6086dd9451b7482b5a4972dda0" + )) + .expect("Test has valid key"); + + assert_eq!( + hex::encode(public_key.serialize_sec1(true)), + hex::encode(private_key.public_key().serialize_sec1(true)) + ); + + let path = DerivationPath::new_bip32(&[2, 1000000000]); + + let (derived_secret_key, sk_chain_code) = + private_key.derive_subkey_with_chain_code(&path, &chain_code); + + let (derived_public_key, pk_chain_code) = + public_key.derive_subkey_with_chain_code(&path, &chain_code); + assert_eq!( + hex::encode(sk_chain_code), + "b9b7b82d326bb9cb5b5b121066feea4eb93d5241103c9e7a18aad40f1dde8059", + ); + assert_eq!( + hex::encode(pk_chain_code), + "b9b7b82d326bb9cb5b5b121066feea4eb93d5241103c9e7a18aad40f1dde8059", + ); + + assert_eq!( + hex::encode(derived_public_key.serialize_sec1(true)), + "02216cd26d31147f72427a453c443ed2cde8a1e53c9cc44e5ddf739725413fe3f4", + ); + + assert_eq!( + hex::encode(derived_secret_key.serialize_sec1()), + "21c4f269ef0a5fd1badf47eeacebeeaa3de22eb8e5b0adcd0f27dd99d34d0119", + ); + + assert_eq!( + hex::encode(derived_public_key.serialize_sec1(true)), + hex::encode(derived_secret_key.public_key().serialize_sec1(true)), + "Derived keys match" + ); +} + +#[test] +fn private_derivation_also_works_for_derived_keys() { + let rng = &mut reproducible_rng(); + use rand::Rng; + + for _ in 0..100 { + let master_sk = PrivateKey::generate_using_rng(rng); + + let chain_code = rng.gen::<[u8; 32]>(); + let path_len = 2 + rng.gen::() % 32; + let path = (0..path_len) + .map(|_| rng.gen::()) + .collect::>(); + + // First derive directly from a normal key + let (derived_sk, cc_sk) = + master_sk.derive_subkey_with_chain_code(&DerivationPath::new_bip32(&path), &chain_code); + + // Now derive with the path split in half + + let split = rng.gen::() % (path_len - 1); + let path1 = DerivationPath::new_bip32(&path[..split]); + let path2 = DerivationPath::new_bip32(&path[split..]); + + // Derive the intermediate secret key and chain code + let (isk, icc) = master_sk.derive_subkey_with_chain_code(&path1, &chain_code); + + // From the intermediate key, use the second part of the path to derive the final key + + let (fsk, fcc) = isk.derive_subkey_with_chain_code(&path2, &icc); + + assert_eq!(hex::encode(fcc), hex::encode(cc_sk)); + + assert_eq!( + hex::encode(fsk.serialize_sec1()), + hex::encode(derived_sk.serialize_sec1()) + ); + } +} From 40e3cc9e64af33125cb8776d1c74dd0fc8547f87 Mon Sep 17 00:00:00 2001 From: gregorydemay <112856886+gregorydemay@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:19:56 +0200 Subject: [PATCH 07/21] feat(cketh/ckerc20): Deposit events with subaccounts (#2151) Parse deposit events originating from the smart contract introduced in #2143, which additionally contain an optional ledger subaccount. The events from that smart contract are not yet scraped, which will be done in a follow-up PR. --- rs/ethereum/cketh/minter/cketh_minter.did | 4 + .../cketh/minter/src/dashboard/tests.rs | 3 + rs/ethereum/cketh/minter/src/deposit.rs | 10 ++ rs/ethereum/cketh/minter/src/endpoints.rs | 2 + rs/ethereum/cketh/minter/src/eth_logs/mod.rs | 135 ++++++++++++++++-- .../cketh/minter/src/eth_logs/tests.rs | 16 +++ rs/ethereum/cketh/minter/src/main.rs | 4 + rs/ethereum/cketh/minter/src/memo/tests.rs | 1 + .../cketh/minter/src/state/audit/tests.rs | 6 +- rs/ethereum/cketh/minter/src/state/tests.rs | 16 ++- rs/ethereum/cketh/minter/src/tests.rs | 88 +++++++++++- rs/ethereum/cketh/minter/tests/ckerc20.rs | 2 + rs/ethereum/cketh/test_utils/src/ckerc20.rs | 2 + rs/ethereum/cketh/test_utils/src/flow.rs | 1 + 14 files changed, 275 insertions(+), 15 deletions(-) diff --git a/rs/ethereum/cketh/minter/cketh_minter.did b/rs/ethereum/cketh/minter/cketh_minter.did index bb91b77d316..c4764a641e4 100644 --- a/rs/ethereum/cketh/minter/cketh_minter.did +++ b/rs/ethereum/cketh/minter/cketh_minter.did @@ -5,6 +5,8 @@ type EthereumNetwork = variant { Sepolia; }; +type Subaccount = blob; + type CanisterStatusResponse = record { query_stats : QueryStats; status : CanisterStatusType; @@ -431,6 +433,7 @@ type Event = record { from_address : text; value : nat; "principal" : principal; + subaccount : opt Subaccount; }; InvalidDeposit : record { event_source : EventSource; @@ -502,6 +505,7 @@ type Event = record { value : nat; "principal" : principal; erc20_contract_address : text; + subaccount : opt Subaccount; }; AcceptedErc20WithdrawalRequest : record { max_transaction_fee : nat; diff --git a/rs/ethereum/cketh/minter/src/dashboard/tests.rs b/rs/ethereum/cketh/minter/src/dashboard/tests.rs index b09f251e0dc..5cf3e826122 100644 --- a/rs/ethereum/cketh/minter/src/dashboard/tests.rs +++ b/rs/ethereum/cketh/minter/src/dashboard/tests.rs @@ -966,6 +966,7 @@ fn initial_state_with_usdc_support() -> State { state } +// TODO XC-222: add subaccounts to dashboard fn received_eth_event() -> ReceivedEthEvent { ReceivedEthEvent { transaction_hash: "0xf1ac37d920fa57d9caeebc7136fea591191250309ffca95ae0e8a7739de89cc2" @@ -980,6 +981,7 @@ fn received_eth_event() -> ReceivedEthEvent { principal: "k2t6j-2nvnp-4zjm3-25dtz-6xhaa-c7boj-5gayf-oj3xs-i43lp-teztq-6ae" .parse() .unwrap(), + subaccount: None, } } @@ -1000,6 +1002,7 @@ fn received_erc20_event() -> ReceivedErc20Event { erc20_contract_address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" .parse() .unwrap(), + subaccount: None, } } diff --git a/rs/ethereum/cketh/minter/src/deposit.rs b/rs/ethereum/cketh/minter/src/deposit.rs index b883cf8786b..3dbb99a2cdd 100644 --- a/rs/ethereum/cketh/minter/src/deposit.rs +++ b/rs/ethereum/cketh/minter/src/deposit.rs @@ -15,12 +15,22 @@ use scopeguard::ScopeGuard; use std::cmp::{min, Ordering}; use std::time::Duration; +// Keccak256("ReceivedEth(address,uint256,bytes32)") pub(crate) const RECEIVED_ETH_EVENT_TOPIC: [u8; 32] = hex!("257e057bb61920d8d0ed2cb7b720ac7f9c513cd1110bc9fa543079154f45f435"); +// Keccak256("ReceivedEth(address,uint256,bytes32,bytes32)") +pub(crate) const RECEIVED_ETH_EVENT_WITH_SUBACCOUNT_TOPIC: [u8; 32] = + hex!("5cf3eb7dcd092fdae9eb9a8bee8249f871222400db54ff78e64b809d723a02bf"); + +// Keccak256("ReceivedErc20(address,address,uint256,bytes32)") pub(crate) const RECEIVED_ERC20_EVENT_TOPIC: [u8; 32] = hex!("4d69d0bd4287b7f66c548f90154dc81bc98f65a1b362775df5ae171a2ccd262b"); +// Keccak256("ReceivedErc20(address,address,uint256,bytes32,bytes32)") +pub(crate) const RECEIVED_ERC20_EVENT_WITH_SUBACCOUNT_TOPIC: [u8; 32] = + hex!("aef895090c2f5d6e81a70bef80dce496a0558487845aada57822159d5efae5cf"); + async fn mint() { use icrc_ledger_client_cdk::{CdkRuntime, ICRC1Client}; use icrc_ledger_types::icrc1::transfer::TransferArg; diff --git a/rs/ethereum/cketh/minter/src/endpoints.rs b/rs/ethereum/cketh/minter/src/endpoints.rs index 254b88b2749..ea5747ecd85 100644 --- a/rs/ethereum/cketh/minter/src/endpoints.rs +++ b/rs/ethereum/cketh/minter/src/endpoints.rs @@ -367,6 +367,7 @@ pub mod events { from_address: String, value: Nat, principal: Principal, + subaccount: Option<[u8; 32]>, }, AcceptedErc20Deposit { transaction_hash: String, @@ -376,6 +377,7 @@ pub mod events { value: Nat, principal: Principal, erc20_contract_address: String, + subaccount: Option<[u8; 32]>, }, InvalidDeposit { event_source: EventSource, diff --git a/rs/ethereum/cketh/minter/src/eth_logs/mod.rs b/rs/ethereum/cketh/minter/src/eth_logs/mod.rs index a5395b9de0e..f81945d82d5 100644 --- a/rs/ethereum/cketh/minter/src/eth_logs/mod.rs +++ b/rs/ethereum/cketh/minter/src/eth_logs/mod.rs @@ -1,7 +1,8 @@ #[cfg(test)] mod tests; -use crate::eth_rpc::{FixedSizeData, Hash, LogEntry}; +use crate::checked_amount::CheckedAmountOf; +use crate::eth_rpc::{Data, FixedSizeData, Hash, LogEntry}; use crate::eth_rpc_client::{EthRpcClient, MultiCallError}; use crate::logs::{DEBUG, INFO}; use crate::numeric::{BlockNumber, Erc20Value, LogIndex, Wei}; @@ -27,6 +28,8 @@ pub struct ReceivedEthEvent { pub value: Wei, #[cbor(n(5), with = "crate::cbor::principal")] pub principal: Principal, + #[n(6)] + pub subaccount: Option, } #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Decode, Encode)] @@ -45,6 +48,8 @@ pub struct ReceivedErc20Event { pub principal: Principal, #[n(6)] pub erc20_contract_address: Address, + #[n(7)] + pub subaccount: Option, } #[derive(Clone, Eq, PartialEq, Debug)] @@ -307,20 +312,15 @@ impl TryFrom for ReceivedEvent { }) }; - // We have only one non-indexed data field for both ETH and ERC20 events. - let value_bytes: [u8; 32] = entry.data.0.clone().try_into().map_err(|data| { - ReceivedEventError::InvalidEventSource { + if entry.topics.is_empty() { + return Err(ReceivedEventError::InvalidEventSource { source: event_source, - error: EventSourceError::InvalidEvent(format!( - "Invalid data length; expected 32-byte value, got {}", - hex::encode(data) - )), - } - })?; + error: EventSourceError::InvalidEvent("Expected at least one topic".to_string()), + }); + } - // We either have 3 indexed topics for ETH events: (hash, from_address, principal), - // or 4 indexed topics for ERC20 events: (hash, erc20_contract_address, from_address, principal) match entry.topics[0] { + // ReceivedEth (index_topic_1 address from, uint256 value, index_topic_2 bytes32 principal) FixedSizeData(crate::deposit::RECEIVED_ETH_EVENT_TOPIC) => { if entry.topics.len() != 3 { return Err(ReceivedEventError::InvalidEventSource { @@ -333,6 +333,7 @@ impl TryFrom for ReceivedEvent { }; let from_address = parse_address(&entry.topics[1])?; let principal = parse_principal(&entry.topics[2])?; + let [value_bytes] = parse_data_into_32_byte_words(entry.data, event_source)?; Ok(ReceivedEthEvent { transaction_hash, block_number, @@ -340,9 +341,39 @@ impl TryFrom for ReceivedEvent { from_address, value: Wei::from_be_bytes(value_bytes), principal, + subaccount: None, } .into()) } + // ReceivedEth (index_topic_1 address from, uint256 value, index_topic_2 bytes32 principal, bytes32 subaccount) + FixedSizeData(crate::deposit::RECEIVED_ETH_EVENT_WITH_SUBACCOUNT_TOPIC) => { + if entry.topics.len() != 3 { + return Err(ReceivedEventError::InvalidEventSource { + source: event_source, + error: EventSourceError::InvalidEvent(format!( + "Expected 3 topics for ReceivedEth event, got {}", + entry.topics.len() + )), + }); + }; + let from_address = parse_address(&entry.topics[1])?; + let principal = parse_principal(&entry.topics[2])?; + let [value_bytes, subaccount_bytes] = + parse_data_into_32_byte_words(entry.data, event_source)?; + let value = Wei::from_be_bytes(value_bytes); + let subaccount = LedgerSubaccount::from_bytes(subaccount_bytes); + Ok(ReceivedEthEvent { + transaction_hash, + block_number, + log_index, + from_address, + value, + principal, + subaccount, + } + .into()) + } + // ReceivedErc20 (index_topic_1 address erc20_contract_address, index_topic_2 address owner, uint256 amount, index_topic_3 bytes32 principal) FixedSizeData(crate::deposit::RECEIVED_ERC20_EVENT_TOPIC) => { if entry.topics.len() != 4 { return Err(ReceivedEventError::InvalidEventSource { @@ -356,6 +387,7 @@ impl TryFrom for ReceivedEvent { let erc20_contract_address = parse_address(&entry.topics[1])?; let from_address = parse_address(&entry.topics[2])?; let principal = parse_principal(&entry.topics[3])?; + let [value_bytes] = parse_data_into_32_byte_words(entry.data, event_source)?; Ok(ReceivedErc20Event { transaction_hash, block_number, @@ -364,6 +396,37 @@ impl TryFrom for ReceivedEvent { value: Erc20Value::from_be_bytes(value_bytes), principal, erc20_contract_address, + subaccount: None, + } + .into()) + } + // ReceivedErc20 (index_topic_1 address erc20ContractAddress, index_topic_2 address owner, uint256 amount, index_topic_3 bytes32 principal, bytes32 subaccount) + FixedSizeData(crate::deposit::RECEIVED_ERC20_EVENT_WITH_SUBACCOUNT_TOPIC) => { + if entry.topics.len() != 4 { + return Err(ReceivedEventError::InvalidEventSource { + source: event_source, + error: EventSourceError::InvalidEvent(format!( + "Expected 4 topics for ReceivedERC20 event, got {}", + entry.topics.len() + )), + }); + }; + let erc20_contract_address = parse_address(&entry.topics[1])?; + let from_address = parse_address(&entry.topics[2])?; + let principal = parse_principal(&entry.topics[3])?; + let [value_bytes, subaccount_bytes] = + parse_data_into_32_byte_words(entry.data, event_source)?; + let value = Erc20Value::from_be_bytes(value_bytes); + let subaccount = LedgerSubaccount::from_bytes(subaccount_bytes); + Ok(ReceivedErc20Event { + transaction_hash, + block_number, + log_index, + from_address, + value, + principal, + erc20_contract_address, + subaccount, } .into()) } @@ -378,6 +441,30 @@ impl TryFrom for ReceivedEvent { } } +fn parse_data_into_32_byte_words( + data: Data, + event_source: EventSource, +) -> Result<[[u8; 32]; N], ReceivedEventError> { + let data = data.0; + if data.len() != 32 * N { + return Err(ReceivedEventError::InvalidEventSource { + source: event_source, + error: EventSourceError::InvalidEvent(format!( + "Expected {} bytes, got {}", + 32 * N, + data.len() + )), + }); + } + let mut result = Vec::with_capacity(N); + for chunk in data.chunks_exact(32) { + let mut word = [0; 32]; + word.copy_from_slice(chunk); + result.push(word); + } + Ok(result.try_into().unwrap()) +} + /// Decode a candid::Principal from a slice of at most 32 bytes /// encoded as follows /// - the first byte is the number of bytes in the principal @@ -424,3 +511,27 @@ fn parse_principal_from_slice(slice: &[u8]) -> Result { } Principal::try_from_slice(principal_bytes).map_err(|err| err.to_string()) } + +enum InternalLedgerSubaccountTag {} +type InternalLedgerSubaccount = CheckedAmountOf; + +/// Ledger subaccount. +/// +/// Internally represented as a u256 to optimize cbor encoding for low values, +/// which can be represented as a u32 or a u64. +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Decode, Encode)] +pub struct LedgerSubaccount(#[n(0)] InternalLedgerSubaccount); + +impl LedgerSubaccount { + pub fn from_bytes(bytes: [u8; 32]) -> Option { + const DEFAULT_SUBACCOUNT: [u8; 32] = [0; 32]; + if bytes == DEFAULT_SUBACCOUNT { + return None; + } + Some(Self(InternalLedgerSubaccount::from_be_bytes(bytes))) + } + + pub fn to_bytes(self) -> [u8; 32] { + self.0.to_be_bytes() + } +} diff --git a/rs/ethereum/cketh/minter/src/eth_logs/tests.rs b/rs/ethereum/cketh/minter/src/eth_logs/tests.rs index 09bea201cbe..6892bf084da 100644 --- a/rs/ethereum/cketh/minter/src/eth_logs/tests.rs +++ b/rs/ethereum/cketh/minter/src/eth_logs/tests.rs @@ -117,3 +117,19 @@ mod parse_principal_from_slice { principal_bytes } } + +mod subaccount { + use crate::eth_logs::LedgerSubaccount; + use proptest::{array::uniform32, prelude::any, prop_assert_eq, prop_assume, proptest}; + + proptest! { + #[test] + fn should_preserve_bytes_representation(bytes in uniform32(any::())) { + prop_assume!(bytes != [0_u8; 32]); + let subaccount = LedgerSubaccount::from_bytes(bytes).unwrap(); + let actual_bytes = subaccount.to_bytes(); + + prop_assert_eq!(bytes, actual_bytes); + } + } +} diff --git a/rs/ethereum/cketh/minter/src/main.rs b/rs/ethereum/cketh/minter/src/main.rs index 53c1bfa10d9..49525f5600a 100644 --- a/rs/ethereum/cketh/minter/src/main.rs +++ b/rs/ethereum/cketh/minter/src/main.rs @@ -628,6 +628,7 @@ fn get_events(arg: GetEventsArg) -> GetEventsResult { from_address, value, principal, + subaccount, }) => EP::AcceptedDeposit { transaction_hash: transaction_hash.to_string(), block_number: block_number.into(), @@ -635,6 +636,7 @@ fn get_events(arg: GetEventsArg) -> GetEventsResult { from_address: from_address.to_string(), value: value.into(), principal, + subaccount: subaccount.map(|s| s.to_bytes()), }, EventType::AcceptedErc20Deposit(ReceivedErc20Event { transaction_hash, @@ -644,6 +646,7 @@ fn get_events(arg: GetEventsArg) -> GetEventsResult { value, principal, erc20_contract_address, + subaccount, }) => EP::AcceptedErc20Deposit { transaction_hash: transaction_hash.to_string(), block_number: block_number.into(), @@ -652,6 +655,7 @@ fn get_events(arg: GetEventsArg) -> GetEventsResult { value: value.into(), principal, erc20_contract_address: erc20_contract_address.to_string(), + subaccount: subaccount.map(|s| s.to_bytes()), }, EventType::InvalidDeposit { event_source, diff --git a/rs/ethereum/cketh/minter/src/memo/tests.rs b/rs/ethereum/cketh/minter/src/memo/tests.rs index 243611b72bd..cd1140ec933 100644 --- a/rs/ethereum/cketh/minter/src/memo/tests.rs +++ b/rs/ethereum/cketh/minter/src/memo/tests.rs @@ -65,6 +65,7 @@ fn encode_mint_convert_memo_is_stable() { from_address, value: Wei::from(10_000_000_000_000_000_u128), principal: Principal::from_str("2chl6-4hpzw-vqaaa-aaaaa-c").unwrap(), + subaccount: None, }; let memo: Memo = (&ReceivedEvent::from(event)).into(); diff --git a/rs/ethereum/cketh/minter/src/state/audit/tests.rs b/rs/ethereum/cketh/minter/src/state/audit/tests.rs index 37c7d5fcba7..d401cce5e98 100644 --- a/rs/ethereum/cketh/minter/src/state/audit/tests.rs +++ b/rs/ethereum/cketh/minter/src/state/audit/tests.rs @@ -1,7 +1,7 @@ use crate::checked_amount::CheckedAmountOf; use crate::endpoints::events::{Event as CandidEvent, EventPayload, UnsignedTransaction}; use crate::erc20::CkErc20Token; -use crate::eth_logs::{ReceivedErc20Event, ReceivedEthEvent}; +use crate::eth_logs::{LedgerSubaccount, ReceivedErc20Event, ReceivedEthEvent}; use crate::eth_rpc_client::responses::TransactionReceipt; use crate::lifecycle::EthereumNetwork; use crate::numeric::Wei; @@ -249,6 +249,7 @@ impl GetEventsFile { from_address, value, principal, + subaccount, } => ET::AcceptedDeposit(ReceivedEthEvent { transaction_hash: transaction_hash.parse().unwrap(), block_number: block_number.try_into().unwrap(), @@ -256,6 +257,7 @@ impl GetEventsFile { from_address: from_address.parse().unwrap(), value: value.try_into().unwrap(), principal, + subaccount: subaccount.and_then(LedgerSubaccount::from_bytes), }), EventPayload::AcceptedErc20Deposit { transaction_hash, @@ -265,6 +267,7 @@ impl GetEventsFile { value, principal, erc20_contract_address, + subaccount, } => ET::AcceptedErc20Deposit(ReceivedErc20Event { transaction_hash: transaction_hash.parse().unwrap(), block_number: block_number.try_into().unwrap(), @@ -273,6 +276,7 @@ impl GetEventsFile { value: value.try_into().unwrap(), principal, erc20_contract_address: erc20_contract_address.parse().unwrap(), + subaccount: subaccount.and_then(LedgerSubaccount::from_bytes), }), EventPayload::InvalidDeposit { event_source, diff --git a/rs/ethereum/cketh/minter/src/state/tests.rs b/rs/ethereum/cketh/minter/src/state/tests.rs index d48e8abc22c..04de1683942 100644 --- a/rs/ethereum/cketh/minter/src/state/tests.rs +++ b/rs/ethereum/cketh/minter/src/state/tests.rs @@ -1,5 +1,7 @@ use crate::endpoints::CandidBlockTag; -use crate::eth_logs::{EventSource, ReceivedErc20Event, ReceivedEthEvent, ReceivedEvent}; +use crate::eth_logs::{ + EventSource, LedgerSubaccount, ReceivedErc20Event, ReceivedEthEvent, ReceivedEvent, +}; use crate::eth_rpc::BlockTag; use crate::eth_rpc_client::responses::{TransactionReceipt, TransactionStatus}; use crate::lifecycle::init::InitArg; @@ -266,6 +268,7 @@ fn received_eth_event() -> ReceivedEthEvent { principal: "k2t6j-2nvnp-4zjm3-25dtz-6xhaa-c7boj-5gayf-oj3xs-i43lp-teztq-6ae" .parse() .unwrap(), + subaccount: None, } } @@ -287,6 +290,7 @@ fn received_erc20_event() -> ReceivedErc20Event { erc20_contract_address: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238" .parse() .unwrap(), + subaccount: None, } } @@ -531,6 +535,10 @@ fn arb_principal() -> impl Strategy { pvec(any::(), 0..=29).prop_map(|bytes| Principal::from_slice(&bytes)) } +fn arb_ledger_subaccount() -> impl Strategy> { + uniform32(any::()).prop_map(LedgerSubaccount::from_bytes) +} + fn arb_u256() -> impl Strategy { uniform32(any::()).prop_map(u256::from_be_bytes) } @@ -626,6 +634,7 @@ prop_compose! { from_address in arb_address(), value in arb_checked_amount_of(), principal in arb_principal(), + subaccount in arb_ledger_subaccount(), ) -> ReceivedEthEvent { ReceivedEthEvent { transaction_hash, @@ -634,6 +643,7 @@ prop_compose! { from_address, value, principal, + subaccount } } } @@ -647,6 +657,7 @@ prop_compose! { value in arb_checked_amount_of(), principal in arb_principal(), erc20_contract_address in arb_address(), + subaccount in arb_ledger_subaccount(), ) -> ReceivedErc20Event { ReceivedErc20Event { transaction_hash, @@ -656,6 +667,7 @@ prop_compose! { value, principal, erc20_contract_address, + subaccount } } } @@ -1013,6 +1025,7 @@ fn state_equivalence() { from_address: "0x9d68bd6F351bE62ed6dBEaE99d830BECD356Ed25".parse().unwrap(), value: Wei::new(500_000_000_000_000_000), principal: "lsywz-sl5vm-m6tct-7fhwt-6gdrw-4uzsg-ibknl-44d6d-a2oyt-c2cxu-7ae".parse().unwrap(), + subaccount: None, }.into() }, minted_events: btreemap! { @@ -1024,6 +1037,7 @@ fn state_equivalence() { from_address: "0x9d68bd6F351bE62ed6dBEaE99d830BECD356Ed25".parse().unwrap(), value: Wei::new(10_000_000_000_000_000), principal: "2chl6-4hpzw-vqaaa-aaaaa-c".parse().unwrap(), + subaccount: None, }.into(), mint_block_index: LedgerMintIndex::new(1), erc20_contract_address: None, diff --git a/rs/ethereum/cketh/minter/src/tests.rs b/rs/ethereum/cketh/minter/src/tests.rs index a464738b425..519dac43f72 100644 --- a/rs/ethereum/cketh/minter/src/tests.rs +++ b/rs/ethereum/cketh/minter/src/tests.rs @@ -48,7 +48,7 @@ fn deserialize_json_reply() { } mod eth_get_logs { - use crate::eth_logs::{ReceivedErc20Event, ReceivedEthEvent, ReceivedEvent}; + use crate::eth_logs::{LedgerSubaccount, ReceivedErc20Event, ReceivedEthEvent, ReceivedEvent}; use crate::eth_rpc::LogEntry; use crate::numeric::{BlockNumber, Erc20Value, LogIndex, Wei}; use candid::Principal; @@ -136,6 +136,47 @@ mod eth_get_logs { .unwrap(), value: Wei::from(10_000_000_000_000_000_u128), principal: Principal::from_str("2chl6-4hpzw-vqaaa-aaaaa-c").unwrap(), + subaccount: None, + } + .into(); + + assert_eq!(parsed_event, expected_event); + } + + #[test] + fn should_parse_received_eth_event_with_subaccount() { + let event = r#"{ + "address": "0x11d7c426eedc044b21066d2be9480d4b99e7cc1a", + "topics": [ + "0x5cf3eb7dcd092fdae9eb9a8bee8249f871222400db54ff78e64b809d723a02bf", + "0x000000000000000000000000dd2851cdd40ae6536831558dd46db62fac7a844d", + "0x1d9facb184cbe453de4841b6b9d9cc95bfc065344e485789b550544529020000" + ], + "data": "0x00000000000000000000000000000000000000000000000000038d7ea4c68000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "blockNumber": "0x698ab3", + "transactionHash": "0x037305b461a7c69bf65d4e143262fc038b39d5e46da79de1539e3a90e91b9b37", + "transactionIndex": "0x12", + "blockHash": "0x92d629a73b6e94c799e940868e4961e2674b0ffd28796102add19a89402e03dd", + "logIndex": "0x14", + "removed": false + }"#; + let parsed_event = + ReceivedEvent::try_from(serde_json::from_str::(event).unwrap()).unwrap(); + let expected_event = ReceivedEthEvent { + transaction_hash: "0x037305b461a7c69bf65d4e143262fc038b39d5e46da79de1539e3a90e91b9b37" + .parse() + .unwrap(), + block_number: BlockNumber::new(6916787), + log_index: LogIndex::from(20_u8), + from_address: "0xdd2851cdd40ae6536831558dd46db62fac7a844d" + .parse() + .unwrap(), + value: Wei::from(1_000_000_000_000_000_u128), + principal: Principal::from_str( + "hkroy-sm7vs-yyjs7-ekppe-qqnwx-hm4zf-n7ybs-titsi-k6e3k-ucuiu-uqe", + ) + .unwrap(), + subaccount: LedgerSubaccount::from_bytes([0xff; 32]), } .into(); @@ -179,6 +220,51 @@ mod eth_get_logs { erc20_contract_address: "0x7439e9bb6d8a84dd3a23fe621a30f95403f87fb9" .parse() .unwrap(), + subaccount: None, + } + .into(); + + assert_eq!(parsed_event, expected_event); + } + + #[test] + fn should_parse_received_erc20_event_with_subaccount() { + let event = r#"{ + "address": "0x11d7c426eedc044b21066d2be9480d4b99e7cc1a", + "topics": [ + "0xaef895090c2f5d6e81a70bef80dce496a0558487845aada57822159d5efae5cf", + "0x0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c7238", + "0x000000000000000000000000dd2851cdd40ae6536831558dd46db62fac7a844d", + "0x1d9facb184cbe453de4841b6b9d9cc95bfc065344e485789b550544529020000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000001869fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "blockNumber": "0x698adb", + "transactionHash": "0xf353e17cbcfea236a8b03d2d800205074e1f5014a3ce0f6dedcf128addb6bea4", + "transactionIndex": "0x15", + "blockHash": "0xeee67434b62fe62182ee51cdaf2693f112994fd3aa4d043c7e4a16fe775c37e3", + "logIndex": "0x45", + "removed": false + }"#; + let parsed_event = + ReceivedEvent::try_from(serde_json::from_str::(event).unwrap()).unwrap(); + let expected_event = ReceivedErc20Event { + transaction_hash: "0xf353e17cbcfea236a8b03d2d800205074e1f5014a3ce0f6dedcf128addb6bea4" + .parse() + .unwrap(), + block_number: BlockNumber::new(6916827), + log_index: LogIndex::from(69_u8), + from_address: "0xdd2851Cdd40aE6536831558DD46db62fAc7A844d" + .parse() + .unwrap(), + value: Erc20Value::from(99_999_u128), + principal: Principal::from_str( + "hkroy-sm7vs-yyjs7-ekppe-qqnwx-hm4zf-n7ybs-titsi-k6e3k-ucuiu-uqe", + ) + .unwrap(), + erc20_contract_address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238" + .parse() + .unwrap(), + subaccount: LedgerSubaccount::from_bytes([0xff; 32]), } .into(); diff --git a/rs/ethereum/cketh/minter/tests/ckerc20.rs b/rs/ethereum/cketh/minter/tests/ckerc20.rs index ae2264b7c00..a5eb6a9e3f7 100644 --- a/rs/ethereum/cketh/minter/tests/ckerc20.rs +++ b/rs/ethereum/cketh/minter/tests/ckerc20.rs @@ -1355,6 +1355,7 @@ fn should_deposit_cketh_and_ckerc20_when_ledger_temporary_offline() { from_address: format_ethereum_address_to_eip_55(DEFAULT_DEPOSIT_FROM_ADDRESS), value: CKETH_MINIMUM_WITHDRAWAL_AMOUNT.into(), principal: caller, + subaccount: None, }, EventPayload::AcceptedErc20Deposit { transaction_hash: DEFAULT_ERC20_DEPOSIT_TRANSACTION_HASH.to_string(), @@ -1364,6 +1365,7 @@ fn should_deposit_cketh_and_ckerc20_when_ledger_temporary_offline() { value: ONE_USDC.into(), principal: caller, erc20_contract_address: ckusdc.erc20_contract_address.clone(), + subaccount: None, }, ]) .check_events() diff --git a/rs/ethereum/cketh/test_utils/src/ckerc20.rs b/rs/ethereum/cketh/test_utils/src/ckerc20.rs index 8a2343860be..698fdf97e9c 100644 --- a/rs/ethereum/cketh/test_utils/src/ckerc20.rs +++ b/rs/ethereum/cketh/test_utils/src/ckerc20.rs @@ -484,6 +484,7 @@ impl CkErc20DepositFlow { ), value: amount.into(), principal: self.params.recipient, + subaccount: None, }, EventPayload::MintedCkEth { event_source: EventSource { @@ -505,6 +506,7 @@ impl CkErc20DepositFlow { value: self.params.ckerc20_amount.into(), principal: self.params.recipient, erc20_contract_address: self.params.token.erc20_contract_address.clone(), + subaccount: None, }, EventPayload::MintedCkErc20 { event_source: EventSource { diff --git a/rs/ethereum/cketh/test_utils/src/flow.rs b/rs/ethereum/cketh/test_utils/src/flow.rs index 55471c8f8c4..8a912124721 100644 --- a/rs/ethereum/cketh/test_utils/src/flow.rs +++ b/rs/ethereum/cketh/test_utils/src/flow.rs @@ -116,6 +116,7 @@ impl DepositFlow { from_address: self.params.from_address.to_string(), value: Nat::from(self.params.amount), principal: self.params.recipient, + subaccount: None, }, ); assert_contains_unique_event( From 3753b43881cb16e6b16afd2827d05edd2fc5aa72 Mon Sep 17 00:00:00 2001 From: nabdullindfinity <135595192+nabdullindfinity@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:27:58 +0200 Subject: [PATCH 08/21] fix(setupos): update default ipv6 prefix and gw for setupos testnets (#1805) For manual testnet deployments from setupos, use the current zh2 test machine prefixes as defaults to make it easier. --- ic-os/setupos/config/config.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ic-os/setupos/config/config.ini b/ic-os/setupos/config/config.ini index 956206374fa..138cd7491e4 100644 --- a/ic-os/setupos/config/config.ini +++ b/ic-os/setupos/config/config.ini @@ -9,10 +9,10 @@ # Update the following IPv6 settings as per your network configuration. # # Define the network part of your IPv6 address: -ipv6_prefix=2a00:fb01:400:200 +ipv6_prefix=2a00:fb01:400:44 # # Define the gateway address for your IPv6 network. Ensure it's within your network range: -ipv6_gateway=2a00:fb01:400:200::1 +ipv6_gateway=2a00:fb01:400:44::1 # ------------------------------ @@ -41,4 +41,4 @@ ipv6_gateway=2a00:fb01:400:200::1 # Verbose flag # ---------------------------------- # Verbose flag is used to log GuestOS console logs to the Host terminal. Only uncomment if directed to by the Troubleshooting Node Deployment Errors wiki page -# verbose=true \ No newline at end of file +# verbose=true From 9d5a584428df3d4b69004cdc6cfb4408a957fb34 Mon Sep 17 00:00:00 2001 From: Eero Kelly Date: Wed, 23 Oct 2024 12:01:28 -0700 Subject: [PATCH 09/21] fix: [NODE-1510] Clean cache in repro script (#2219) This will avoid https://dfinity.atlassian.net/browse/NODE-1510 when reproducing builds, until we have a better solution to avoid caching this commit time. --- ci/container/build-ic.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/container/build-ic.sh b/ci/container/build-ic.sh index a87aaf6e364..6e2e385c325 100755 --- a/ci/container/build-ic.sh +++ b/ci/container/build-ic.sh @@ -115,6 +115,14 @@ rm -rf "$DISK_DIR_FULL" echo_green "Building selected IC artifacts" BAZEL_CMD="bazel build --config=local --ic_version='$VERSION' --ic_version_rc_only='$IC_VERSION_RC_ONLY' \ --release_build=$RELEASE" + +BAZEL_CLEAN_CMD=$( + cat <<-END + # clear bazel cache + bazel clean +END +) + BUILD_BINARIES_CMD=$( cat <<-END # build binaries @@ -149,7 +157,7 @@ BUILD_IMAGES_CMD=$( bazel cquery --config=local --output=files //ic-os/setupos/envs/prod | xargs -I {} cp {} "${DISK_DIR}/setupos" END ) -BUILD_CMD="" +BUILD_CMD="${BAZEL_CLEAN_CMD}" if "$BUILD_BIN"; then BUILD_CMD="${BUILD_CMD}${BUILD_BINARIES_CMD}"; fi if "$BUILD_CAN"; then BUILD_CMD="${BUILD_CMD}${BUILD_CANISTERS_CMD}"; fi From 3e20279a451d5234436aa052f8ea86840a54d9e9 Mon Sep 17 00:00:00 2001 From: Andrew Battat <113942931+andrewbattat@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:20:29 -0500 Subject: [PATCH 10/21] fix: bare_metal_deployment timeout (#2220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deploy.py incorrectly determines the number of times to call iterate_func. The for loop assumes iterate_func will take 5 seconds, but the connectivity check actually fails faster than 5 seconds, causing the whole loop to typically run for just ~15 minutes. Summary of changes: * Change the success-check loop to run for the desired wait time * I also *lowered* the DEFAULT_SETUPOS_WAIT_TIME_MINS to 20 minutes. * SetupOS is pretty reliably installing in less than 15 minutes. I only hit this issue by chance, which is why we didn’t see it until now. So I figured we could lower the labeled wait time from 25 to 20 minutes * Remove unused parse_from_rows function --- ic-os/dev-tools/bare_metal_deployment/deploy.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ic-os/dev-tools/bare_metal_deployment/deploy.py b/ic-os/dev-tools/bare_metal_deployment/deploy.py index dbbbb5a2a78..7b34c737a20 100755 --- a/ic-os/dev-tools/bare_metal_deployment/deploy.py +++ b/ic-os/dev-tools/bare_metal_deployment/deploy.py @@ -25,8 +25,7 @@ # IDRAC versions after 6 use different REST API endpoints. NEWER_IDRAC_VERSION_THRESHOLD = 6000000 -# May vary depending on network or other conditions! -DEFAULT_SETUPOS_WAIT_TIME_MINS = 25 +DEFAULT_SETUPOS_WAIT_TIME_MINS = 20 BMC_INFO_ENV_VAR = "BMC_INFO_CSV_FILENAME" @@ -212,10 +211,6 @@ def parse_from_row(row: List[str], network_image_url: str) -> BMCInfo: assert False, f"Invalid csv row found. Must be 3 or 4 items: {row}" -def parse_from_rows(rows: List[List[str]], network_image_url: str) -> List["BMCInfo"]: - return [parse_from_row(row, network_image_url) for row in rows] - - def parse_from_csv_file(csv_filename: str, network_image_url: str) -> List["BMCInfo"]: with open(csv_filename, "r") as csv_file: rows = [line.strip().split(",") for line in csv_file] @@ -391,11 +386,13 @@ def check_connectivity_func() -> bool: iterate_func = check_connectivity_func if bmc_info.guestos_ipv6_address else wait_func log.info(f"Machine booting. Checking on SetupOS completion periodically. Timeout (mins): {wait_time_mins}") - for i in tqdm.tqdm(range(int(60 * (wait_time_mins / timeout_secs))), disable=DISABLE_PROGRESS_BAR): + start_time = time.time() + end_time = start_time + wait_time_mins * 60 + while time.time() < end_time: if iterate_func(): log.info("*** Deployment SUCCESS!") return OperationResult(bmc_info, success=True) - + time.sleep(timeout_secs) raise Exception("Could not successfully verify connectivity to node.") except DeploymentError as e: From 666ddbe8ad21d525f7bafcc01216c7b300824cbd Mon Sep 17 00:00:00 2001 From: Paul Liu Date: Thu, 24 Oct 2024 12:26:00 +0800 Subject: [PATCH 11/21] chore(test): move and inline ckbtc system tests (#2155) - Move ckbtc system tests from financial_integration subdir to ckbtc subdir. - Inline ckbtc system tests. - Inline btc_get_balance_test system test. - Remove ic-tests-ckbtc from ic-tests as a dependency. --- .github/CODEOWNERS | 2 +- Cargo.lock | 18 ++- rs/tests/Cargo.toml | 27 ---- rs/tests/README_NEW.md | 2 +- rs/tests/ckbtc/BUILD.bazel | 130 +++++++++++++++ rs/tests/ckbtc/Cargo.toml | 37 +++++ .../ckbtc_minter_basics_test.rs} | 137 +++++++++++++--- .../ckbtc_minter_batching.rs} | 35 +++-- .../ckbtc_minter_deposit_and_withdrawal.rs} | 40 +++-- .../test_kyt.rs => ckbtc/ckbtc_minter_kyt.rs} | 48 +++--- .../ckbtc_minter_retrieve_btc.rs} | 48 +++--- .../ckbtc_minter_update_balance.rs} | 49 +++--- rs/tests/ckbtc/src/lib.rs | 4 +- .../{src/ckbtc/minter => ckbtc/src}/utils.rs | 2 +- rs/tests/common.bzl | 1 - rs/tests/execution/BUILD.bazel | 37 ++++- rs/tests/execution/Cargo.toml | 6 + .../btc_get_balance_test.rs} | 62 +++++--- rs/tests/financial_integrations/BUILD.bazel | 26 +-- .../btc_get_balance_test.rs | 16 -- .../financial_integrations/ckbtc/BUILD.bazel | 148 ------------------ .../ckbtc/ckbtc_minter_basics_test.rs | 18 --- .../ckbtc/ckbtc_minter_batching.rs | 15 -- .../ckbtc/ckbtc_minter_heartbeat.rs | 15 -- .../ckbtc/ckbtc_minter_kyt.rs | 15 -- .../ckbtc/ckbtc_minter_retrieve_btc.rs | 17 -- .../ckbtc/ckbtc_minter_update_balance.rs | 17 -- rs/tests/src/btc_integration/mod.rs | 1 - rs/tests/src/ckbtc/lib.rs | 1 - rs/tests/src/ckbtc/minter/mod.rs | 7 - rs/tests/src/ckbtc/minter/test_addresses.rs | 100 ------------ .../src/ckbtc/minter/test_get_btc_address.rs | 60 ------- rs/tests/src/ckbtc/mod.rs | 6 - rs/tests/src/lib.rs | 2 - .../src/rosetta_tests/governance_client.rs | 3 +- 35 files changed, 524 insertions(+), 628 deletions(-) rename rs/tests/{src/ckbtc/agent.rs => ckbtc/ckbtc_minter_basics_test.rs} (53%) rename rs/tests/{src/ckbtc/minter/test_batching.rs => ckbtc/ckbtc_minter_batching.rs} (93%) rename rs/tests/{src/ckbtc/minter/test_heartbeat.rs => ckbtc/ckbtc_minter_deposit_and_withdrawal.rs} (91%) rename rs/tests/{src/ckbtc/minter/test_kyt.rs => ckbtc/ckbtc_minter_kyt.rs} (93%) rename rs/tests/{src/ckbtc/minter/test_retrieve_btc.rs => ckbtc/ckbtc_minter_retrieve_btc.rs} (89%) rename rs/tests/{src/ckbtc/minter/test_update_balance.rs => ckbtc/ckbtc_minter_update_balance.rs} (92%) rename rs/tests/{src/ckbtc/minter => ckbtc/src}/utils.rs (99%) rename rs/tests/{src/btc_integration/btc.rs => execution/btc_get_balance_test.rs} (93%) delete mode 100644 rs/tests/financial_integrations/btc_get_balance_test.rs delete mode 100644 rs/tests/financial_integrations/ckbtc/BUILD.bazel delete mode 100644 rs/tests/financial_integrations/ckbtc/ckbtc_minter_basics_test.rs delete mode 100644 rs/tests/financial_integrations/ckbtc/ckbtc_minter_batching.rs delete mode 100644 rs/tests/financial_integrations/ckbtc/ckbtc_minter_heartbeat.rs delete mode 100644 rs/tests/financial_integrations/ckbtc/ckbtc_minter_kyt.rs delete mode 100644 rs/tests/financial_integrations/ckbtc/ckbtc_minter_retrieve_btc.rs delete mode 100644 rs/tests/financial_integrations/ckbtc/ckbtc_minter_update_balance.rs delete mode 100644 rs/tests/src/btc_integration/mod.rs delete mode 100644 rs/tests/src/ckbtc/lib.rs delete mode 100644 rs/tests/src/ckbtc/minter/mod.rs delete mode 100644 rs/tests/src/ckbtc/minter/test_addresses.rs delete mode 100644 rs/tests/src/ckbtc/minter/test_get_btc_address.rs delete mode 100644 rs/tests/src/ckbtc/mod.rs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1e028a621ee..3e7d4dca9c9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -234,6 +234,7 @@ go_deps.bzl @dfinity/idx /rs/tests/dashboards/IC/bitcoin.json @dfinity/execution @dfinity/idx /rs/tests/driver/src/driver/simulate_network.rs @dfinity/networking /rs/tests/boundary_nodes/ @dfinity/boundary-node @dfinity/idx +/rs/tests/ckbtc/ @dfinity/cross-chain-team @dfinity/idx /rs/tests/consensus/ @dfinity/consensus @dfinity/idx /rs/tests/crypto/ @dfinity/crypto-team @dfinity/idx /rs/tests/dre/ @dfinity/dre @dfinity/idx @@ -250,7 +251,6 @@ go_deps.bzl @dfinity/idx /rs/tests/src/canister_http/ @dfinity/networking @dfinity/idx /rs/tests/src/canister_sig_verification_cache_test/ @dfinity/crypto-team @dfinity/idx /rs/tests/src/certificate_orchestrator.rs @dfinity/boundary-node @dfinity/idx -/rs/tests/src/ckbtc/ @dfinity/cross-chain-team @dfinity/idx /rs/tests/src/consensus/ @dfinity/consensus @dfinity/idx /rs/tests/src/cross_chain/ @dfinity/cross-chain-team @dfinity/idx /rs/tests/src/crypto/ @dfinity/crypto-team @dfinity/idx diff --git a/Cargo.lock b/Cargo.lock index b641da059e4..60754447f46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3985,6 +3985,7 @@ version = "0.9.0" dependencies = [ "anyhow", "assert_matches", + "bitcoincore-rpc", "candid", "futures", "ic-agent", @@ -3998,6 +3999,7 @@ dependencies = [ "ic-registry-routing-table", "ic-registry-subnet-type", "ic-system-test-driver", + "ic-tests-ckbtc", "ic-types", "ic-types-test-utils", "ic-universal-canister", @@ -12865,6 +12867,9 @@ dependencies = [ name = "ic-tests-ckbtc" version = "0.9.0" dependencies = [ + "anyhow", + "assert_matches", + "bitcoincore-rpc", "candid", "canister-test", "dfn_candid", @@ -12872,6 +12877,7 @@ dependencies = [ "ic-base-types", "ic-btc-interface", "ic-canister-client", + "ic-ckbtc-agent", "ic-ckbtc-kyt", "ic-ckbtc-minter", "ic-config", @@ -12887,10 +12893,19 @@ dependencies = [ "ic-system-test-driver", "ic-types", "ic-types-test-utils", + "ic-universal-canister", "ic_consensus_threshold_sig_system_test_utils", "icp-ledger", + "icrc-ledger-agent", + "icrc-ledger-types", + "k256", + "rand 0.8.5", + "rand_chacha 0.3.1", "registry-canister", + "serde", + "serde_bytes", "slog", + "tokio", ] [[package]] @@ -20044,7 +20059,6 @@ dependencies = [ "backon", "base64 0.13.1", "bincode", - "bitcoincore-rpc", "candid", "canister-test", "chrono", @@ -20068,7 +20082,6 @@ dependencies = [ "ic-cdk 0.16.0", "ic-certification 0.9.0", "ic-ckbtc-agent", - "ic-ckbtc-kyt", "ic-ckbtc-minter", "ic-config", "ic-crypto-sha2", @@ -20131,7 +20144,6 @@ dependencies = [ "ic-test-utilities", "ic-test-utilities-time", "ic-test-utilities-types", - "ic-tests-ckbtc", "ic-types", "ic-types-test-utils", "ic-universal-canister", diff --git a/rs/tests/Cargo.toml b/rs/tests/Cargo.toml index 64d0ee29919..523a0202c74 100644 --- a/rs/tests/Cargo.toml +++ b/rs/tests/Cargo.toml @@ -16,7 +16,6 @@ axum = { workspace = true } backon = "0.4.1" base64 = { workspace = true } bincode = { workspace = true } -bitcoincore-rpc = "0.15.0" candid = { workspace = true } canister-test = { path = "../rust_canisters/canister_test" } chrono = { workspace = true } @@ -39,7 +38,6 @@ ic-canister-client-sender = { path = "../canister_client/sender" } ic-cdk = { workspace = true } ic-certification = { path = "../certification" } ic-ckbtc-agent = { path = "../bitcoin/ckbtc/agent" } -ic-ckbtc-kyt = { path = "../bitcoin/ckbtc/kyt" } ic-ckbtc-minter = { path = "../bitcoin/ckbtc/minter" } ic-config = { path = "../config" } ic-limits = { path = "../limits" } @@ -102,7 +100,6 @@ ic-test-identity = { path = "../test_utilities/identity" } ic-test-utilities = { path = "../test_utilities" } ic-test-utilities-time = { path = "../test_utilities/time" } ic-test-utilities-types = { path = "../test_utilities/types" } -ic-tests-ckbtc = { path = "ckbtc" } ic-types = { path = "../types/types" } ic-types-test-utils = { path = "../types/types_test_utils" } ic-universal-canister = { path = "../universal_canister/lib" } @@ -182,10 +179,6 @@ path = "testing_verification/colocate_test.rs" name = "ic-ii-delegation-test" path = "testing_verification/ii_delegation_test.rs" -[[bin]] -name = "ic-systest-btc-get-balance" -path = "financial_integrations/btc_get_balance_test.rs" - [[bin]] name = "ic-systest-rosetta" path = "financial_integrations/rosetta/rosetta_test.rs" @@ -234,26 +227,6 @@ path = "financial_integrations/rosetta/rosetta_neuron_spawn_test.rs" name = "ic-systest-rosetta-neuron-staking-test" path = "financial_integrations/rosetta/rosetta_neuron_staking_test.rs" -[[bin]] -name = "ic-systest-ckbtc-minter-basics-test" -path = "financial_integrations/ckbtc/ckbtc_minter_basics_test.rs" - -[[bin]] -name = "ic-systest-ckbtc-batching" -path = "financial_integrations/ckbtc/ckbtc_minter_batching.rs" - -[[bin]] -name = "ic-systest-ckbtc-heartbeat" -path = "financial_integrations/ckbtc/ckbtc_minter_heartbeat.rs" - -[[bin]] -name = "ic-systest-ckbtc-retrieve-btc" -path = "financial_integrations/ckbtc/ckbtc_minter_retrieve_btc.rs" - -[[bin]] -name = "ic-systest-ckbtc-update-balance" -path = "financial_integrations/ckbtc/ckbtc_minter_update_balance.rs" - [[bin]] name = "ic-systest-icrc1-agent-test" path = "financial_integrations/icrc1_agent_test.rs" diff --git a/rs/tests/README_NEW.md b/rs/tests/README_NEW.md index 543879d9e7d..25f6f09309f 100644 --- a/rs/tests/README_NEW.md +++ b/rs/tests/README_NEW.md @@ -59,7 +59,7 @@ devenv-container$ ict test almost_basic_test There was an error while executing CLI: 'No test target `almost_basic_test` was found: Did you mean any of: //rs/tests/testing_verification:basic_health_test -//rs/tests/financial_integrations/ckbtc:ckbtc_minter_basics_test +//rs/tests/ckbtc:ckbtc_minter_basics_test ... ``` ## Running a cargo-based (legacy) flavour of a system test diff --git a/rs/tests/ckbtc/BUILD.bazel b/rs/tests/ckbtc/BUILD.bazel index a2e802ee36f..425d5716943 100644 --- a/rs/tests/ckbtc/BUILD.bazel +++ b/rs/tests/ckbtc/BUILD.bazel @@ -1,9 +1,14 @@ load("@rules_rust//rust:defs.bzl", "rust_library") +load("//rs/tests:common.bzl", "GUESTOS_RUNTIME_DEPS", "UNIVERSAL_VM_RUNTIME_DEPS") +load("//rs/tests:system_tests.bzl", "system_test_nns") package(default_visibility = ["//rs/tests:__subpackages__"]) DEPENDENCIES = [ # Keep sorted. + "//packages/icrc-ledger-agent:icrc_ledger_agent", + "//packages/icrc-ledger-types:icrc_ledger_types", + "//rs/bitcoin/ckbtc/agent", "//rs/bitcoin/ckbtc/kyt", "//rs/bitcoin/ckbtc/minter", "//rs/canister_client", @@ -26,10 +31,18 @@ DEPENDENCIES = [ "//rs/types/management_canister_types", "//rs/types/types", "//rs/types/types_test_utils", + "//rs/universal_canister/lib", + "@crate_index//:anyhow", + "@crate_index//:assert_matches", + "@crate_index//:bitcoincore-rpc", "@crate_index//:candid", "@crate_index//:ic-agent", "@crate_index//:ic-btc-interface", + "@crate_index//:k256", + "@crate_index//:rand", + "@crate_index//:rand_chacha", "@crate_index//:slog", + "@crate_index//:tokio", ] rust_library( @@ -39,3 +52,120 @@ rust_library( crate_name = "ic_tests_ckbtc", deps = DEPENDENCIES, ) + +CKBTC_RUNTIME_DEPS = [ + # Keep sorted. + "//rs/bitcoin/ckbtc/kyt:kyt_canister", + "//rs/bitcoin/ckbtc/minter:ckbtc_minter_debug", + "//rs/ledger_suite/icrc1/ledger:ledger_canister", + "@btc_canister//file", +] + +system_test_nns( + name = "ckbtc_minter_basics_test", + env = { + "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", + "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", + "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", + "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", + }, + extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. + flaky = True, + tags = [ + "k8s", + "long_test", # since it takes longer than 5 minutes. + ], + target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS + runtime_deps = + GUESTOS_RUNTIME_DEPS + + UNIVERSAL_VM_RUNTIME_DEPS + + CKBTC_RUNTIME_DEPS, + deps = DEPENDENCIES + [":ckbtc"], +) + +system_test_nns( + name = "ckbtc_minter_deposit_and_withdrawal", + env = { + "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", + "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", + "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", + "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", + }, + flaky = True, + tags = [ + "k8s", + "long_test", # since it takes longer than 5 minutes. + ], + target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS + runtime_deps = + GUESTOS_RUNTIME_DEPS + + UNIVERSAL_VM_RUNTIME_DEPS + + CKBTC_RUNTIME_DEPS, + deps = DEPENDENCIES + [":ckbtc"], +) + +system_test_nns( + name = "ckbtc_minter_kyt", + env = { + "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", + "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", + "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", + "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", + }, + extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. + flaky = True, + tags = [ + "k8s", + "long_test", # since it takes longer than 5 minutes. + ], + target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS + runtime_deps = + GUESTOS_RUNTIME_DEPS + + UNIVERSAL_VM_RUNTIME_DEPS + + CKBTC_RUNTIME_DEPS, + deps = DEPENDENCIES + [":ckbtc"], +) + +system_test_nns( + name = "ckbtc_minter_update_balance", + env = { + "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", + "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", + "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", + "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", + }, + extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. + flaky = True, + tags = [ + "k8s", + "long_test", # since it takes longer than 5 minutes. + ], + target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS + runtime_deps = + GUESTOS_RUNTIME_DEPS + + UNIVERSAL_VM_RUNTIME_DEPS + + CKBTC_RUNTIME_DEPS, + deps = DEPENDENCIES + [":ckbtc"], +) + +system_test_nns( + name = "ckbtc_minter_retrieve_btc", + env = { + "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", + "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", + "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", + "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", + }, + extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. + flaky = True, + tags = [ + "k8s", + "long_test", # since it takes longer than 5 minutes. + ], + target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS + runtime_deps = + GUESTOS_RUNTIME_DEPS + + UNIVERSAL_VM_RUNTIME_DEPS + + CKBTC_RUNTIME_DEPS, + deps = DEPENDENCIES + [":ckbtc"], +) diff --git a/rs/tests/ckbtc/Cargo.toml b/rs/tests/ckbtc/Cargo.toml index df96f02786f..050a8ad0790 100644 --- a/rs/tests/ckbtc/Cargo.toml +++ b/rs/tests/ckbtc/Cargo.toml @@ -7,6 +7,9 @@ description.workspace = true documentation.workspace = true [dependencies] +anyhow = { workspace = true } +assert_matches = { workspace = true } +bitcoincore-rpc = "0.15.0" candid = { workspace = true } canister-test = { path = "../../rust_canisters/canister_test" } dfn_candid = { path = "../../rust_canisters/dfn_candid" } @@ -14,6 +17,7 @@ ic-agent = { workspace = true } ic-base-types = { path = "../../types/base_types" } ic-btc-interface = { workspace = true } ic-canister-client = { path = "../../canister_client" } +ic-ckbtc-agent = { path = "../../bitcoin/ckbtc/agent" } ic-ckbtc-kyt = { path = "../../bitcoin/ckbtc/kyt" } ic-ckbtc-minter = { path = "../../bitcoin/ckbtc/minter" } ic-config = { path = "../../config" } @@ -29,7 +33,40 @@ ic-registry-subnet-type = { path = "../../registry/subnet_type" } ic-system-test-driver = { path = "../../tests/driver" } ic-types = { path = "../../types/types" } ic-types-test-utils = { path = "../../types/types_test_utils" } +ic-universal-canister = { path = "../../universal_canister/lib" } ic_consensus_threshold_sig_system_test_utils = { path = "../../tests/consensus/tecdsa/utils" } icp-ledger = { path = "../../ledger_suite/icp" } +icrc-ledger-agent = { path = "../../../packages/icrc-ledger-agent" } +icrc-ledger-types = { path = "../../../packages/icrc-ledger-types" } +k256 = { workspace = true } +rand = { workspace = true } +rand_chacha = { workspace = true } registry-canister = { path = "../../registry/canister" } +serde = { workspace = true } +serde_bytes = { workspace = true } slog = { workspace = true } +tokio = { workspace = true } + +[[bin]] +name = "ic-systest-ckbtc-minter-basics-test" +path = "ckbtc_minter_basics_test.rs" + +[[bin]] +name = "ic-systest-ckbtc-batching" +path = "ckbtc_minter_batching.rs" + +[[bin]] +name = "ic-systest-ckbtc-deposit-and-withdrawal" +path = "ckbtc_minter_deposit_and_withdrawal.rs" + +[[bin]] +name = "ic-systest-ckbtc-retrieve-btc" +path = "ckbtc_minter_retrieve_btc.rs" + +[[bin]] +name = "ic-systest-ckbtc-kyt" +path = "ckbtc_minter_kyt.rs" + +[[bin]] +name = "ic-systest-ckbtc-update-balance" +path = "ckbtc_minter_update_balance.rs" diff --git a/rs/tests/src/ckbtc/agent.rs b/rs/tests/ckbtc/ckbtc_minter_basics_test.rs similarity index 53% rename from rs/tests/src/ckbtc/agent.rs rename to rs/tests/ckbtc/ckbtc_minter_basics_test.rs index 8714300f38d..3f80e139439 100644 --- a/rs/tests/src/ckbtc/agent.rs +++ b/rs/tests/ckbtc/ckbtc_minter_basics_test.rs @@ -1,3 +1,110 @@ +use anyhow::Result; + +use candid::{Decode, Encode, Principal}; +use ic_base_types::PrincipalId; +use ic_ckbtc_agent::CkBtcMinterAgent; +use ic_ckbtc_minter::updates::{ + get_btc_address::GetBtcAddressArgs, get_withdrawal_account::compute_subaccount, + retrieve_btc::RetrieveBtcArgs, update_balance::UpdateBalanceArgs, +}; +use ic_system_test_driver::{ + driver::{ + group::SystemTestGroup, + test_env::TestEnv, + test_env_api::{HasPublicApiUrl, IcNodeContainer}, + }, + systest, + util::{assert_create_agent, block_on, runtime_from_url}, +}; +use ic_tests_ckbtc::{ + activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, + install_ledger, install_minter, set_kyt_api_key, setup, subnet_sys, ADDRESS_LENGTH, + TEST_KEY_LOCAL, +}; +use icrc_ledger_types::icrc1::account::Account; +use slog::info; + +pub fn test_ckbtc_addresses(env: TestEnv) { + let logger = env.logger(); + let subnet_sys = subnet_sys(&env); + let sys_node = subnet_sys.nodes().next().expect("No node in sys subnet."); + + block_on(async { + let runtime = runtime_from_url(sys_node.get_public_url(), sys_node.effective_canister_id()); + install_bitcoin_canister(&runtime, &logger).await; + let mut ledger_canister = create_canister(&runtime).await; + let mut minter_canister = create_canister(&runtime).await; + let mut kyt_canister = create_canister(&runtime).await; + + let minting_user = minter_canister.canister_id().get(); + let agent = assert_create_agent(sys_node.get_public_url().as_str()).await; + let agent_principal = agent.get_principal().unwrap(); + let kyt_id = install_kyt( + &mut kyt_canister, + &logger, + Principal::from(minting_user), + vec![agent_principal], + ) + .await; + + set_kyt_api_key(&agent, &kyt_id.get().0, "fake key".to_string()).await; + + let ledger_id = install_ledger(&mut ledger_canister, minting_user, &logger).await; + let minter_id = install_minter(&mut minter_canister, ledger_id, &logger, 0, kyt_id).await; + let minter = Principal::try_from_slice(minter_id.as_ref()).unwrap(); + activate_ecdsa_signature(sys_node, subnet_sys.subnet_id, TEST_KEY_LOCAL, &logger).await; + + // Call endpoint get_btc_address + info!(logger, "Calling get_btc_address endpoint..."); + let arg = GetBtcAddressArgs { + owner: None, + subaccount: None, + }; + let arg = Encode!(&arg).expect("Error while encoding arg."); + let res = agent + .update(&minter, "get_btc_address") + .with_arg(arg) + .call_and_wait() + .await + .expect("Error while calling endpoint."); + let address = Decode!(res.as_slice(), String).expect("Error while decoding response."); + + // Checking only proper format of address since ECDSA signature is non-deterministic. + assert_eq!(ADDRESS_LENGTH, address.len()); + assert!( + address.starts_with("bcrt"), + "Expected Regtest address format." + ); + + // Call endpoint get_withdrawal_account + let arg = GetBtcAddressArgs { + owner: None, + subaccount: None, + }; + let arg = Encode!(&arg).expect("Error while encoding argument."); + let res = agent + .update(&minter, "get_withdrawal_account") + .with_arg(arg) + .call_and_wait() + .await + .expect("Error while calling endpoint."); + let res = Decode!(res.as_slice(), Account).expect("Error while decoding response."); + + // Check results. + let caller = agent + .get_principal() + .expect("Error while getting principal."); + let subaccount = compute_subaccount(PrincipalId::from(caller), 0); + assert_eq!( + Account { + owner: minter_id.get().0, + subaccount: Some(subaccount), + }, + res + ); + }); +} + /* tag::catalog[] Title:: ckBTC agent. @@ -16,27 +123,6 @@ Runbook:: end::catalog[] */ -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_kyt, install_ledger, install_minter, - set_kyt_api_key, subnet_sys, ADDRESS_LENGTH, TEST_KEY_LOCAL, -}; -use candid::Principal; -use canister_test::PrincipalId; -use ic_ckbtc_agent::CkBtcMinterAgent; -use ic_ckbtc_minter::updates::{ - get_withdrawal_account::compute_subaccount, retrieve_btc::RetrieveBtcArgs, - update_balance::UpdateBalanceArgs, -}; -use ic_system_test_driver::{ - driver::{ - test_env::TestEnv, - test_env_api::{HasPublicApiUrl, IcNodeContainer}, - }, - util::{assert_create_agent, block_on, runtime_from_url}, -}; -use icrc_ledger_types::icrc1::account::Account; -use slog::info; - pub fn test_ckbtc_minter_agent(env: TestEnv) { let logger = env.logger(); let subnet_sys = subnet_sys(&env); @@ -139,3 +225,12 @@ async fn test_update_balance(agent: &CkBtcMinterAgent) { .expect("Error while decoding response."); assert!(res.is_err()); } + +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(setup) + .add_test(systest!(test_ckbtc_addresses)) + .add_test(systest!(test_ckbtc_minter_agent)) + .execute_from_args()?; + Ok(()) +} diff --git a/rs/tests/src/ckbtc/minter/test_batching.rs b/rs/tests/ckbtc/ckbtc_minter_batching.rs similarity index 93% rename from rs/tests/src/ckbtc/minter/test_batching.rs rename to rs/tests/ckbtc/ckbtc_minter_batching.rs index 1a4c5733e1f..fb5fc7cba17 100644 --- a/rs/tests/src/ckbtc/minter/test_batching.rs +++ b/rs/tests/ckbtc/ckbtc_minter_batching.rs @@ -1,30 +1,33 @@ -use crate::ckbtc::lib::install_bitcoin_canister; -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister_at_id, install_kyt, install_ledger, install_minter, - set_kyt_api_key, subnet_sys, BTC_MIN_CONFIRMATIONS, KYT_FEE, TEST_KEY_LOCAL, TRANSFER_FEE, -}; -use crate::ckbtc::minter::utils::{ - ensure_wallet, generate_blocks, get_btc_address, get_btc_client, retrieve_btc, - send_to_btc_address, wait_for_finalization_no_new_blocks, wait_for_mempool_change, - wait_for_update_balance, -}; +use anyhow::Result; + use bitcoincore_rpc::{ bitcoin::{hashes::Hash, Txid}, RpcApi, }; use candid::{CandidType, Deserialize, Nat, Principal}; -use ic_base_types::CanisterId; -use ic_base_types::PrincipalId; +use ic_base_types::{CanisterId, PrincipalId}; use ic_ckbtc_agent::CkBtcMinterAgent; use ic_ckbtc_minter::state::RetrieveBtcStatus; use ic_ckbtc_minter::updates::get_withdrawal_account::compute_subaccount; use ic_system_test_driver::{ driver::{ + group::SystemTestGroup, test_env::TestEnv, test_env_api::{HasPublicApiUrl, IcNodeContainer}, }, + systest, util::{assert_create_agent, block_on, runtime_from_url}, }; +use ic_tests_ckbtc::{ + activate_ecdsa_signature, create_canister_at_id, install_bitcoin_canister, install_kyt, + install_ledger, install_minter, set_kyt_api_key, setup, subnet_sys, + utils::{ + ensure_wallet, generate_blocks, get_btc_address, get_btc_client, retrieve_btc, + send_to_btc_address, wait_for_finalization_no_new_blocks, wait_for_mempool_change, + wait_for_update_balance, + }, + BTC_MIN_CONFIRMATIONS, KYT_FEE, TEST_KEY_LOCAL, TRANSFER_FEE, +}; use icrc_ledger_agent::Icrc1Agent; use icrc_ledger_types::icrc1::transfer::TransferArg; use serde::Serialize; @@ -324,3 +327,11 @@ pub fn test_batching(env: TestEnv) { assert_eq!(unspent_result.len(), RETRIEVE_REQUESTS_COUNT_TO_BATCH); }) } + +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(setup) + .add_test(systest!(test_batching)) + .execute_from_args()?; + Ok(()) +} diff --git a/rs/tests/src/ckbtc/minter/test_heartbeat.rs b/rs/tests/ckbtc/ckbtc_minter_deposit_and_withdrawal.rs similarity index 91% rename from rs/tests/src/ckbtc/minter/test_heartbeat.rs rename to rs/tests/ckbtc/ckbtc_minter_deposit_and_withdrawal.rs index 12252c7fa6b..c7b93653a5a 100644 --- a/rs/tests/src/ckbtc/minter/test_heartbeat.rs +++ b/rs/tests/ckbtc/ckbtc_minter_deposit_and_withdrawal.rs @@ -1,12 +1,5 @@ -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, - install_ledger, install_minter, set_kyt_api_key, subnet_sys, BTC_MIN_CONFIRMATIONS, KYT_FEE, - TEST_KEY_LOCAL, TRANSFER_FEE, -}; -use crate::ckbtc::minter::utils::{ - ensure_wallet, generate_blocks, get_btc_address, get_btc_client, send_to_btc_address, - wait_for_finalization, wait_for_mempool_change, wait_for_signed_tx, wait_for_update_balance, -}; +use anyhow::Result; + use bitcoincore_rpc::{ bitcoin::{hashes::Hash, Txid}, RpcApi, @@ -14,22 +7,34 @@ use bitcoincore_rpc::{ use candid::{Nat, Principal}; use ic_base_types::PrincipalId; use ic_ckbtc_agent::CkBtcMinterAgent; -use ic_ckbtc_minter::state::eventlog::Event; -use ic_ckbtc_minter::state::{RetrieveBtcRequest, RetrieveBtcStatus}; -use ic_ckbtc_minter::updates::get_withdrawal_account::compute_subaccount; -use ic_ckbtc_minter::updates::retrieve_btc::RetrieveBtcArgs; +use ic_ckbtc_minter::{ + state::{eventlog::Event, RetrieveBtcRequest, RetrieveBtcStatus}, + updates::{get_withdrawal_account::compute_subaccount, retrieve_btc::RetrieveBtcArgs}, +}; use ic_system_test_driver::{ driver::{ + group::SystemTestGroup, test_env::TestEnv, test_env_api::{HasPublicApiUrl, IcNodeContainer}, }, + systest, util::{assert_create_agent, block_on, runtime_from_url}, }; +use ic_tests_ckbtc::{ + activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, + install_ledger, install_minter, set_kyt_api_key, setup, subnet_sys, + utils::{ + ensure_wallet, generate_blocks, get_btc_address, get_btc_client, send_to_btc_address, + wait_for_finalization, wait_for_mempool_change, wait_for_signed_tx, + wait_for_update_balance, + }, + BTC_MIN_CONFIRMATIONS, KYT_FEE, TEST_KEY_LOCAL, TRANSFER_FEE, +}; use icrc_ledger_agent::Icrc1Agent; use icrc_ledger_types::icrc1::transfer::TransferArg; use slog::{debug, info}; -pub fn test_heartbeat(env: TestEnv) { +pub fn test_deposit_and_withdrawal(env: TestEnv) { let logger = env.logger(); let subnet_sys = subnet_sys(&env); let sys_node = subnet_sys.nodes().next().expect("No node in sys subnet."); @@ -264,3 +269,10 @@ pub fn test_heartbeat(env: TestEnv) { ); }) } +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(setup) + .add_test(systest!(test_deposit_and_withdrawal)) + .execute_from_args()?; + Ok(()) +} diff --git a/rs/tests/src/ckbtc/minter/test_kyt.rs b/rs/tests/ckbtc/ckbtc_minter_kyt.rs similarity index 93% rename from rs/tests/src/ckbtc/minter/test_kyt.rs rename to rs/tests/ckbtc/ckbtc_minter_kyt.rs index 46056ed991c..9210f0af8b5 100644 --- a/rs/tests/src/ckbtc/minter/test_kyt.rs +++ b/rs/tests/ckbtc/ckbtc_minter_kyt.rs @@ -1,33 +1,38 @@ -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, - install_ledger, install_minter, set_kyt_api_key, subnet_sys, upgrade_kyt, - BTC_MIN_CONFIRMATIONS, KYT_FEE, TEST_KEY_LOCAL, -}; -use crate::ckbtc::minter::utils::{ - assert_account_balance, assert_burn_transaction, assert_mint_transaction, assert_no_new_utxo, - assert_no_transaction, ensure_wallet, generate_blocks, get_btc_address, get_btc_client, - send_to_btc_address, start_canister, stop_canister, upgrade_canister, wait_for_bitcoin_balance, - wait_for_ledger_balance, wait_for_mempool_change, BTC_BLOCK_REWARD, -}; +use anyhow::Result; + use bitcoincore_rpc::RpcApi; -use candid::Nat; -use candid::Principal; +use candid::{Nat, Principal}; use ic_base_types::PrincipalId; use ic_ckbtc_agent::CkBtcMinterAgent; use ic_ckbtc_kyt::KytMode; -use ic_ckbtc_minter::updates::get_withdrawal_account::compute_subaccount; -use ic_ckbtc_minter::updates::retrieve_btc::{RetrieveBtcArgs, RetrieveBtcError}; -use ic_ckbtc_minter::updates::update_balance::{UpdateBalanceArgs, UpdateBalanceError, UtxoStatus}; +use ic_ckbtc_minter::updates::{ + get_withdrawal_account::compute_subaccount, + retrieve_btc::{RetrieveBtcArgs, RetrieveBtcError}, + update_balance::{UpdateBalanceArgs, UpdateBalanceError, UtxoStatus}, +}; use ic_system_test_driver::{ driver::{ + group::SystemTestGroup, test_env::TestEnv, test_env_api::{HasPublicApiUrl, IcNodeContainer}, }, + systest, util::{assert_create_agent, block_on, runtime_from_url, UniversalCanister}, }; +use ic_tests_ckbtc::{ + activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, + install_ledger, install_minter, set_kyt_api_key, setup, subnet_sys, upgrade_kyt, + utils::{ + assert_account_balance, assert_burn_transaction, assert_mint_transaction, + assert_no_new_utxo, assert_no_transaction, ensure_wallet, generate_blocks, get_btc_address, + get_btc_client, send_to_btc_address, start_canister, stop_canister, upgrade_canister, + wait_for_bitcoin_balance, wait_for_ledger_balance, wait_for_mempool_change, + BTC_BLOCK_REWARD, + }, + BTC_MIN_CONFIRMATIONS, KYT_FEE, TEST_KEY_LOCAL, +}; use icrc_ledger_agent::{CallMode, Icrc1Agent}; -use icrc_ledger_types::icrc1::account::Account; -use icrc_ledger_types::icrc1::transfer::TransferArg; +use icrc_ledger_types::icrc1::{account::Account, transfer::TransferArg}; use slog::debug; /// Test update_balance method of the minter canister. @@ -389,3 +394,10 @@ pub fn test_kyt(env: TestEnv) { assert_eq!(owed_kyt_amount, 0_f64); }); } +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(setup) + .add_test(systest!(test_kyt)) + .execute_from_args()?; + Ok(()) +} diff --git a/rs/tests/src/ckbtc/minter/test_retrieve_btc.rs b/rs/tests/ckbtc/ckbtc_minter_retrieve_btc.rs similarity index 89% rename from rs/tests/src/ckbtc/minter/test_retrieve_btc.rs rename to rs/tests/ckbtc/ckbtc_minter_retrieve_btc.rs index 52dc66f214b..fe7ebf66808 100644 --- a/rs/tests/src/ckbtc/minter/test_retrieve_btc.rs +++ b/rs/tests/ckbtc/ckbtc_minter_retrieve_btc.rs @@ -1,34 +1,39 @@ -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, - install_ledger, install_minter, set_kyt_api_key, subnet_sys, BTC_MIN_CONFIRMATIONS, KYT_FEE, - RETRIEVE_BTC_MIN_AMOUNT, TEST_KEY_LOCAL, TRANSFER_FEE, -}; -use crate::ckbtc::minter::utils::{ - assert_account_balance, assert_burn_transaction, assert_mint_transaction, ensure_wallet, - generate_blocks, get_btc_address, get_btc_client, update_balance, upgrade_canister_with_args, - wait_for_bitcoin_balance, BTC_BLOCK_REWARD, -}; +use anyhow::Result; + use bitcoincore_rpc::RpcApi; use candid::{Nat, Principal}; use ic_base_types::PrincipalId; use ic_ckbtc_agent::CkBtcMinterAgent; -use ic_ckbtc_minter::lifecycle::upgrade::UpgradeArgs; -use ic_ckbtc_minter::state::{eventlog::Event, Mode, RetrieveBtcRequest}; -use ic_ckbtc_minter::updates::update_balance::UtxoStatus; -use ic_ckbtc_minter::updates::{ - get_withdrawal_account::compute_subaccount, - retrieve_btc::{RetrieveBtcArgs, RetrieveBtcError}, +use ic_ckbtc_minter::{ + lifecycle::upgrade::UpgradeArgs, + state::{eventlog::Event, Mode, RetrieveBtcRequest}, + updates::{ + get_withdrawal_account::compute_subaccount, + retrieve_btc::{RetrieveBtcArgs, RetrieveBtcError}, + update_balance::UtxoStatus, + }, }; use ic_system_test_driver::{ driver::{ + group::SystemTestGroup, test_env::TestEnv, test_env_api::{HasPublicApiUrl, IcNodeContainer}, }, + systest, util::{assert_create_agent, block_on, runtime_from_url, UniversalCanister}, }; +use ic_tests_ckbtc::{ + activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, + install_ledger, install_minter, set_kyt_api_key, setup, subnet_sys, + utils::{ + assert_account_balance, assert_burn_transaction, assert_mint_transaction, ensure_wallet, + generate_blocks, get_btc_address, get_btc_client, update_balance, + upgrade_canister_with_args, wait_for_bitcoin_balance, BTC_BLOCK_REWARD, + }, + BTC_MIN_CONFIRMATIONS, KYT_FEE, RETRIEVE_BTC_MIN_AMOUNT, TEST_KEY_LOCAL, TRANSFER_FEE, +}; use icrc_ledger_agent::Icrc1Agent; -use icrc_ledger_types::icrc1::account::Account; -use icrc_ledger_types::icrc1::transfer::TransferArg; +use icrc_ledger_types::icrc1::{account::Account, transfer::TransferArg}; use slog::{debug, info}; /// Test retrieve_btc method of the minter canister. @@ -249,3 +254,10 @@ pub fn test_retrieve_btc(env: TestEnv) { assert_eq!(5, retrieve_result.block_index); }); } +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(setup) + .add_test(systest!(test_retrieve_btc)) + .execute_from_args()?; + Ok(()) +} diff --git a/rs/tests/src/ckbtc/minter/test_update_balance.rs b/rs/tests/ckbtc/ckbtc_minter_update_balance.rs similarity index 92% rename from rs/tests/src/ckbtc/minter/test_update_balance.rs rename to rs/tests/ckbtc/ckbtc_minter_update_balance.rs index 29c3d461e45..1a2581423c8 100644 --- a/rs/tests/src/ckbtc/minter/test_update_balance.rs +++ b/rs/tests/ckbtc/ckbtc_minter_update_balance.rs @@ -1,36 +1,42 @@ -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, - install_ledger, install_minter, set_kyt_api_key, subnet_sys, BTC_MIN_CONFIRMATIONS, KYT_FEE, - TEST_KEY_LOCAL, -}; -use crate::ckbtc::minter::utils::{ - assert_mint_transaction, assert_no_new_utxo, assert_no_transaction, - assert_temporarily_unavailable, ensure_wallet, generate_blocks, get_btc_address, - get_btc_client, start_canister, stop_canister, update_balance, upgrade_canister, - upgrade_canister_with_args, wait_for_bitcoin_balance, BTC_BLOCK_REWARD, -}; +use anyhow::Result; + use bitcoincore_rpc::RpcApi; use candid::Principal; use ic_agent::identity::Secp256k1Identity; use ic_base_types::PrincipalId; use ic_ckbtc_agent::CkBtcMinterAgent; -use ic_ckbtc_minter::lifecycle::upgrade::UpgradeArgs; -use ic_ckbtc_minter::state::Mode; -use ic_ckbtc_minter::updates::get_withdrawal_account::compute_subaccount; -use ic_ckbtc_minter::updates::update_balance::UpdateBalanceArgs; -use ic_ckbtc_minter::updates::update_balance::UtxoStatus; +use ic_ckbtc_minter::{ + lifecycle::upgrade::UpgradeArgs, + state::Mode, + updates::{ + get_withdrawal_account::compute_subaccount, + update_balance::{UpdateBalanceArgs, UtxoStatus}, + }, +}; use ic_system_test_driver::{ driver::{ + group::SystemTestGroup, test_env::TestEnv, test_env_api::{HasPublicApiUrl, IcNodeContainer}, }, + systest, util::{assert_create_agent, block_on, runtime_from_url, UniversalCanister}, }; +use ic_tests_ckbtc::{ + activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, + install_ledger, install_minter, set_kyt_api_key, setup, subnet_sys, + utils::{ + assert_mint_transaction, assert_no_new_utxo, assert_no_transaction, + assert_temporarily_unavailable, ensure_wallet, generate_blocks, get_btc_address, + get_btc_client, start_canister, stop_canister, update_balance, upgrade_canister, + upgrade_canister_with_args, wait_for_bitcoin_balance, BTC_BLOCK_REWARD, + }, + BTC_MIN_CONFIRMATIONS, KYT_FEE, TEST_KEY_LOCAL, +}; use icrc_ledger_agent::Icrc1Agent; use icrc_ledger_types::icrc1::account::Account; use k256::elliptic_curve::SecretKey; -use rand::rngs::OsRng; -use rand::SeedableRng; +use rand::{rngs::OsRng, SeedableRng}; use rand_chacha::ChaChaRng; use slog::{debug, info}; @@ -311,3 +317,10 @@ pub fn test_update_balance(env: TestEnv) { } }); } +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(setup) + .add_test(systest!(test_update_balance)) + .execute_from_args()?; + Ok(()) +} diff --git a/rs/tests/ckbtc/src/lib.rs b/rs/tests/ckbtc/src/lib.rs index dc213e5cd68..5812c4b5c71 100644 --- a/rs/tests/ckbtc/src/lib.rs +++ b/rs/tests/ckbtc/src/lib.rs @@ -58,6 +58,8 @@ use std::{ time::Duration, }; +pub mod utils; + pub const TEST_KEY_LOCAL: &str = "dfx_test_key"; pub const ADDRESS_LENGTH: usize = 44; @@ -139,7 +141,7 @@ docker run --name=bitcoind-node -d \ }); } -pub fn config(env: TestEnv) { +pub fn setup(env: TestEnv) { // Use the btc integration setup. btc_config(env.clone()); check_nodes_health(&env); diff --git a/rs/tests/src/ckbtc/minter/utils.rs b/rs/tests/ckbtc/src/utils.rs similarity index 99% rename from rs/tests/src/ckbtc/minter/utils.rs rename to rs/tests/ckbtc/src/utils.rs index 54eb5a81748..e708154688a 100644 --- a/rs/tests/src/ckbtc/minter/utils.rs +++ b/rs/tests/ckbtc/src/utils.rs @@ -19,7 +19,7 @@ Runbook:: end::catalog[] */ -use crate::ckbtc::lib::ADDRESS_LENGTH; +use crate::ADDRESS_LENGTH; use assert_matches::assert_matches; use bitcoincore_rpc::{ bitcoin::{Address, Amount, Txid}, diff --git a/rs/tests/common.bzl b/rs/tests/common.bzl index 8afa72521c8..1421e808f0b 100644 --- a/rs/tests/common.bzl +++ b/rs/tests/common.bzl @@ -87,7 +87,6 @@ DEPENDENCIES = [ "//rs/test_utilities/identity", "//rs/test_utilities/time", "//rs/test_utilities/types", - "//rs/tests/ckbtc", "//rs/tests/consensus/utils", "//rs/tests/consensus/tecdsa/utils", "//rs/tests/driver:ic-system-test-driver", diff --git a/rs/tests/execution/BUILD.bazel b/rs/tests/execution/BUILD.bazel index c5521220ed4..532c3692229 100644 --- a/rs/tests/execution/BUILD.bazel +++ b/rs/tests/execution/BUILD.bazel @@ -1,5 +1,5 @@ -load("//rs/tests:common.bzl", "GRAFANA_RUNTIME_DEPS", "GUESTOS_RUNTIME_DEPS") -load("//rs/tests:system_tests.bzl", "system_test") +load("//rs/tests:common.bzl", "GRAFANA_RUNTIME_DEPS", "GUESTOS_RUNTIME_DEPS", "UNIVERSAL_VM_RUNTIME_DEPS") +load("//rs/tests:system_tests.bzl", "system_test", "system_test_nns") package(default_visibility = ["//rs:system-tests-pkg"]) @@ -182,3 +182,36 @@ system_test( "@crate_index//:slog", ], ) + +BTC_RUNTIME_DEPS = [ + # Keep sorted. + "//rs/tests:btc_uvm_config_image", + "@btc_canister//file", +] + +system_test_nns( + name = "btc_get_balance_test", + env = { + "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", + }, + flaky = True, + tags = [ + "k8s", + ], + target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS + runtime_deps = + GUESTOS_RUNTIME_DEPS + + UNIVERSAL_VM_RUNTIME_DEPS + + BTC_RUNTIME_DEPS, + deps = [ + "//rs/registry/subnet_type", + "//rs/tests/ckbtc", + "//rs/tests/driver:ic-system-test-driver", + "//rs/types/types", + "//rs/universal_canister/lib", + "@crate_index//:anyhow", + "@crate_index//:bitcoincore-rpc", + "@crate_index//:candid", + "@crate_index//:slog", + ], +) diff --git a/rs/tests/execution/Cargo.toml b/rs/tests/execution/Cargo.toml index c46e3500668..a50cb647351 100644 --- a/rs/tests/execution/Cargo.toml +++ b/rs/tests/execution/Cargo.toml @@ -8,6 +8,7 @@ documentation.workspace = true [dependencies] anyhow = { workspace = true } +bitcoincore-rpc = "0.15.0" candid = { workspace = true } futures = { workspace = true } ic-agent = { workspace = true } @@ -17,6 +18,7 @@ ic-system-test-driver = { path = "../driver" } ic-universal-canister = { path = "../../universal_canister/lib" } ic-utils = { workspace = true } slog = { workspace = true } +ic-tests-ckbtc = { path = "../ckbtc" } ic-types = { path = "../../types/types" } ic-config = { path = "../../config" } ic-cdk = { workspace = true } @@ -66,3 +68,7 @@ path = "system_subnets_test.rs" [[bin]] name = "fill_execution_rounds_workload" path = "fill_execution_rounds_workload.rs" + +[[bin]] +name = "btc_get_balance_test" +path = "btc_get_balance_test.rs" diff --git a/rs/tests/src/btc_integration/btc.rs b/rs/tests/execution/btc_get_balance_test.rs similarity index 93% rename from rs/tests/src/btc_integration/btc.rs rename to rs/tests/execution/btc_get_balance_test.rs index bd72d4b038d..2ac36c17e05 100644 --- a/rs/tests/src/btc_integration/btc.rs +++ b/rs/tests/execution/btc_get_balance_test.rs @@ -1,3 +1,31 @@ +#[rustfmt::skip] + +use anyhow::{Result, bail}; +use bitcoincore_rpc::{Auth, Client, RpcApi}; +use candid::Decode; +use ic_registry_subnet_type::SubnetType; +use ic_system_test_driver::driver::group::SystemTestGroup; +use ic_system_test_driver::driver::test_env::TestEnv; +use ic_system_test_driver::driver::test_env_api::{ + get_dependency_path, HasPublicApiUrl, HasTopologySnapshot, IcNodeContainer, SshSession, + READY_WAIT_TIMEOUT, RETRY_BACKOFF, +}; +use ic_system_test_driver::{ + driver::{ + ic::{InternetComputer, Subnet}, + universal_vm::{UniversalVm, UniversalVms}, + }, + systest, + util::{block_on, runtime_from_url, UniversalCanister}, +}; +use ic_tests_ckbtc::install_bitcoin_canister; +use ic_types::Height; +use ic_universal_canister::{management, wasm}; +use slog::info; +use std::net::{IpAddr, SocketAddr}; +use std::sync::Arc; +use std::{io::Read, path::Path}; + /* tag::catalog[] Title:: Bitcoin integration test @@ -16,31 +44,6 @@ Success:: end::catalog[] */ -use std::net::{IpAddr, SocketAddr}; -use std::sync::Arc; - -use crate::ckbtc::lib::install_bitcoin_canister; -use anyhow::bail; -use bitcoincore_rpc::{Auth, Client, RpcApi}; -use candid::Decode; -use ic_registry_subnet_type::SubnetType; -use ic_system_test_driver::driver::test_env::TestEnv; -use ic_system_test_driver::driver::test_env_api::{ - get_dependency_path, HasPublicApiUrl, HasTopologySnapshot, IcNodeContainer, SshSession, - READY_WAIT_TIMEOUT, RETRY_BACKOFF, -}; -use ic_system_test_driver::driver::universal_vm::UniversalVms; -use ic_system_test_driver::util::runtime_from_url; -use ic_system_test_driver::util::{block_on, UniversalCanister}; -use ic_system_test_driver::{ - driver::ic::{InternetComputer, Subnet}, - driver::universal_vm::UniversalVm, -}; -use ic_types::Height; -use ic_universal_canister::{management, wasm}; -use slog::info; -use std::{io::Read, path::Path}; - const UNIVERSAL_VM_NAME: &str = "btc-node"; pub fn config(env: TestEnv) { @@ -201,3 +204,12 @@ pub fn get_balance(env: TestEnv) { // We only exit retry loop successfully if we got the expected satoshi balance res.expect("Failed to get btc balance"); } + +fn main() -> Result<()> { + SystemTestGroup::new() + .with_setup(config) + .add_test(systest!(get_balance)) + .execute_from_args()?; + + Ok(()) +} diff --git a/rs/tests/financial_integrations/BUILD.bazel b/rs/tests/financial_integrations/BUILD.bazel index b1d9158dbfa..a3605fa96eb 100644 --- a/rs/tests/financial_integrations/BUILD.bazel +++ b/rs/tests/financial_integrations/BUILD.bazel @@ -1,37 +1,13 @@ -load("//rs/tests:common.bzl", "DEPENDENCIES", "GUESTOS_RUNTIME_DEPS", "MACRO_DEPENDENCIES", "UNIVERSAL_VM_RUNTIME_DEPS") +load("//rs/tests:common.bzl", "DEPENDENCIES", "GUESTOS_RUNTIME_DEPS", "MACRO_DEPENDENCIES") load("//rs/tests:system_tests.bzl", "system_test", "system_test_nns") package(default_visibility = ["//rs:system-tests-pkg"]) -BTC_RUNTIME_DEPS = [ - # Keep sorted. - "//rs/tests:btc_uvm_config_image", - "@btc_canister//file", -] - LEDGER_CANISTER_RUNTIME_DEPS = [ # Keep sorted. "//rs/ledger_suite/icrc1/ledger:ledger_canister", ] -system_test_nns( - name = "btc_get_balance_test", - env = { - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - BTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) - system_test( name = "icrc1_agent_test", env = { diff --git a/rs/tests/financial_integrations/btc_get_balance_test.rs b/rs/tests/financial_integrations/btc_get_balance_test.rs deleted file mode 100644 index e9a2b12fbc4..00000000000 --- a/rs/tests/financial_integrations/btc_get_balance_test.rs +++ /dev/null @@ -1,16 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::btc_integration; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(btc_integration::btc::config) - .add_test(systest!(btc_integration::btc::get_balance)) - .execute_from_args()?; - - Ok(()) -} diff --git a/rs/tests/financial_integrations/ckbtc/BUILD.bazel b/rs/tests/financial_integrations/ckbtc/BUILD.bazel deleted file mode 100644 index 46808d61753..00000000000 --- a/rs/tests/financial_integrations/ckbtc/BUILD.bazel +++ /dev/null @@ -1,148 +0,0 @@ -load("//rs/tests:common.bzl", "DEPENDENCIES", "GUESTOS_RUNTIME_DEPS", "MACRO_DEPENDENCIES", "UNIVERSAL_VM_RUNTIME_DEPS") -load("//rs/tests:system_tests.bzl", "system_test_nns") - -package(default_visibility = ["//rs:system-tests-pkg"]) - -CKBTC_RUNTIME_DEPS = [ - # Keep sorted. - "//rs/bitcoin/ckbtc/kyt:kyt_canister", - "//rs/bitcoin/ckbtc/minter:ckbtc_minter_debug", - "//rs/ledger_suite/icrc1/ledger:ledger_canister", - "@btc_canister//file", -] - -system_test_nns( - name = "ckbtc_minter_basics_test", - env = { - "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", - "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", - "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - "long_test", # since it takes longer than 5 minutes. - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - CKBTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) - -system_test_nns( - name = "ckbtc_minter_batching", - env = { - "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", - "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", - "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - "long_test", # since it takes longer than 5 minutes. - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - CKBTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) - -system_test_nns( - name = "ckbtc_minter_heartbeat", - env = { - "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", - "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", - "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - "long_test", # since it takes longer than 5 minutes. - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - CKBTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) - -system_test_nns( - name = "ckbtc_minter_kyt", - env = { - "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", - "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", - "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - "long_test", # since it takes longer than 5 minutes. - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - CKBTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) - -system_test_nns( - name = "ckbtc_minter_update_balance", - env = { - "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", - "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", - "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - "long_test", # since it takes longer than 5 minutes. - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - CKBTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) - -system_test_nns( - name = "ckbtc_minter_retrieve_btc", - env = { - "IC_CKBTC_KYT_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/kyt:kyt_canister)", - "IC_CKBTC_MINTER_WASM_PATH": "$(rootpath //rs/bitcoin/ckbtc/minter:ckbtc_minter_debug)", - "LEDGER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/ledger:ledger_canister)", - "BTC_WASM_PATH": "$(rootpath @btc_canister//file)", - }, - extra_head_nns_tags = [], # don't run the head_nns variant on nightly since it aleady runs on long_test. - flaky = True, - proc_macro_deps = MACRO_DEPENDENCIES, - tags = [ - "k8s", - "long_test", # since it takes longer than 5 minutes. - ], - target_compatible_with = ["@platforms//os:linux"], # requires libssh that does not build on Mac OS - runtime_deps = - GUESTOS_RUNTIME_DEPS + - UNIVERSAL_VM_RUNTIME_DEPS + - CKBTC_RUNTIME_DEPS, - deps = DEPENDENCIES + ["//rs/tests"], -) diff --git a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_basics_test.rs b/rs/tests/financial_integrations/ckbtc/ckbtc_minter_basics_test.rs deleted file mode 100644 index 12988d2fe66..00000000000 --- a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_basics_test.rs +++ /dev/null @@ -1,18 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::ckbtc; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(ckbtc::lib::config) - .add_test(systest!( - ckbtc::minter::test_addresses::test_ckbtc_addresses - )) - .add_test(systest!(ckbtc::agent::test_ckbtc_minter_agent)) - .execute_from_args()?; - Ok(()) -} diff --git a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_batching.rs b/rs/tests/financial_integrations/ckbtc/ckbtc_minter_batching.rs deleted file mode 100644 index 316c0dd7693..00000000000 --- a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_batching.rs +++ /dev/null @@ -1,15 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::ckbtc; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(ckbtc::lib::config) - .add_test(systest!(ckbtc::minter::test_batching::test_batching)) - .execute_from_args()?; - Ok(()) -} diff --git a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_heartbeat.rs b/rs/tests/financial_integrations/ckbtc/ckbtc_minter_heartbeat.rs deleted file mode 100644 index e188db8c09f..00000000000 --- a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_heartbeat.rs +++ /dev/null @@ -1,15 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::ckbtc; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(ckbtc::lib::config) - .add_test(systest!(ckbtc::minter::test_heartbeat::test_heartbeat)) - .execute_from_args()?; - Ok(()) -} diff --git a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_kyt.rs b/rs/tests/financial_integrations/ckbtc/ckbtc_minter_kyt.rs deleted file mode 100644 index 573db4378c5..00000000000 --- a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_kyt.rs +++ /dev/null @@ -1,15 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::ckbtc; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(ckbtc::lib::config) - .add_test(systest!(ckbtc::minter::test_kyt::test_kyt)) - .execute_from_args()?; - Ok(()) -} diff --git a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_retrieve_btc.rs b/rs/tests/financial_integrations/ckbtc/ckbtc_minter_retrieve_btc.rs deleted file mode 100644 index f75a338ac53..00000000000 --- a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_retrieve_btc.rs +++ /dev/null @@ -1,17 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::ckbtc; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(ckbtc::lib::config) - .add_test(systest!( - ckbtc::minter::test_retrieve_btc::test_retrieve_btc - )) - .execute_from_args()?; - Ok(()) -} diff --git a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_update_balance.rs b/rs/tests/financial_integrations/ckbtc/ckbtc_minter_update_balance.rs deleted file mode 100644 index 4b6ce12a283..00000000000 --- a/rs/tests/financial_integrations/ckbtc/ckbtc_minter_update_balance.rs +++ /dev/null @@ -1,17 +0,0 @@ -#[rustfmt::skip] - -use anyhow::Result; - -use ic_system_test_driver::driver::group::SystemTestGroup; -use ic_system_test_driver::systest; -use ic_tests::ckbtc; - -fn main() -> Result<()> { - SystemTestGroup::new() - .with_setup(ckbtc::lib::config) - .add_test(systest!( - ckbtc::minter::test_update_balance::test_update_balance - )) - .execute_from_args()?; - Ok(()) -} diff --git a/rs/tests/src/btc_integration/mod.rs b/rs/tests/src/btc_integration/mod.rs deleted file mode 100644 index a1b498f746a..00000000000 --- a/rs/tests/src/btc_integration/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod btc; diff --git a/rs/tests/src/ckbtc/lib.rs b/rs/tests/src/ckbtc/lib.rs deleted file mode 100644 index af97e948bbe..00000000000 --- a/rs/tests/src/ckbtc/lib.rs +++ /dev/null @@ -1 +0,0 @@ -pub use ic_tests_ckbtc::*; diff --git a/rs/tests/src/ckbtc/minter/mod.rs b/rs/tests/src/ckbtc/minter/mod.rs deleted file mode 100644 index 44106f5c081..00000000000 --- a/rs/tests/src/ckbtc/minter/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub mod test_addresses; -pub mod test_batching; -pub mod test_heartbeat; -pub mod test_kyt; -pub mod test_retrieve_btc; -pub mod test_update_balance; -pub mod utils; diff --git a/rs/tests/src/ckbtc/minter/test_addresses.rs b/rs/tests/src/ckbtc/minter/test_addresses.rs deleted file mode 100644 index d15963a8dbd..00000000000 --- a/rs/tests/src/ckbtc/minter/test_addresses.rs +++ /dev/null @@ -1,100 +0,0 @@ -use crate::ckbtc::lib::install_bitcoin_canister; -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_kyt, install_ledger, install_minter, - set_kyt_api_key, subnet_sys, ADDRESS_LENGTH, TEST_KEY_LOCAL, -}; -use candid::{Decode, Encode, Principal}; -use ic_base_types::PrincipalId; -use ic_ckbtc_minter::updates::{ - get_btc_address::GetBtcAddressArgs, get_withdrawal_account::compute_subaccount, -}; -use ic_system_test_driver::{ - driver::{ - test_env::TestEnv, - test_env_api::{HasPublicApiUrl, IcNodeContainer}, - }, - util::{assert_create_agent, block_on, runtime_from_url}, -}; -use icrc_ledger_types::icrc1::account::Account; -use slog::info; - -pub fn test_ckbtc_addresses(env: TestEnv) { - let logger = env.logger(); - let subnet_sys = subnet_sys(&env); - let sys_node = subnet_sys.nodes().next().expect("No node in sys subnet."); - - block_on(async { - let runtime = runtime_from_url(sys_node.get_public_url(), sys_node.effective_canister_id()); - install_bitcoin_canister(&runtime, &logger).await; - let mut ledger_canister = create_canister(&runtime).await; - let mut minter_canister = create_canister(&runtime).await; - let mut kyt_canister = create_canister(&runtime).await; - - let minting_user = minter_canister.canister_id().get(); - let agent = assert_create_agent(sys_node.get_public_url().as_str()).await; - let agent_principal = agent.get_principal().unwrap(); - let kyt_id = install_kyt( - &mut kyt_canister, - &logger, - Principal::from(minting_user), - vec![agent_principal], - ) - .await; - - set_kyt_api_key(&agent, &kyt_id.get().0, "fake key".to_string()).await; - - let ledger_id = install_ledger(&mut ledger_canister, minting_user, &logger).await; - let minter_id = install_minter(&mut minter_canister, ledger_id, &logger, 0, kyt_id).await; - let minter = Principal::try_from_slice(minter_id.as_ref()).unwrap(); - activate_ecdsa_signature(sys_node, subnet_sys.subnet_id, TEST_KEY_LOCAL, &logger).await; - - // Call endpoint get_btc_address - info!(logger, "Calling get_btc_address endpoint..."); - let arg = GetBtcAddressArgs { - owner: None, - subaccount: None, - }; - let arg = Encode!(&arg).expect("Error while encoding arg."); - let res = agent - .update(&minter, "get_btc_address") - .with_arg(arg) - .call_and_wait() - .await - .expect("Error while calling endpoint."); - let address = Decode!(res.as_slice(), String).expect("Error while decoding response."); - - // Checking only proper format of address since ECDSA signature is non-deterministic. - assert_eq!(ADDRESS_LENGTH, address.len()); - assert!( - address.starts_with("bcrt"), - "Expected Regtest address format." - ); - - // Call endpoint get_withdrawal_account - let arg = GetBtcAddressArgs { - owner: None, - subaccount: None, - }; - let arg = Encode!(&arg).expect("Error while encoding argument."); - let res = agent - .update(&minter, "get_withdrawal_account") - .with_arg(arg) - .call_and_wait() - .await - .expect("Error while calling endpoint."); - let res = Decode!(res.as_slice(), Account).expect("Error while decoding response."); - - // Check results. - let caller = agent - .get_principal() - .expect("Error while getting principal."); - let subaccount = compute_subaccount(PrincipalId::from(caller), 0); - assert_eq!( - Account { - owner: minter_id.get().0, - subaccount: Some(subaccount), - }, - res - ); - }); -} diff --git a/rs/tests/src/ckbtc/minter/test_get_btc_address.rs b/rs/tests/src/ckbtc/minter/test_get_btc_address.rs deleted file mode 100644 index 7adb4d0b645..00000000000 --- a/rs/tests/src/ckbtc/minter/test_get_btc_address.rs +++ /dev/null @@ -1,60 +0,0 @@ -use crate::ckbtc::lib::{ - activate_ecdsa_signature, create_canister, install_bitcoin_canister, install_kyt, - install_ledger, install_minter, subnet_sys, ADDRESS_LENGTH, TEST_KEY_LOCAL, -}; -use candid::{Decode, Encode, Principal}; -use ic_ckbtc_minter::updates::get_btc_address::GetBtcAddressArgs; -use ic_system_test_driver::{ - driver::{ - test_env::TestEnv, - test_env_api::{HasPublicApiUrl, IcNodeContainer}, - }, - util::{assert_create_agent, block_on, delay, runtime_from_url}, -}; -use slog::info; - -pub fn test_get_btc_address(env: TestEnv) { - let logger = env.logger(); - let subnet_sys = subnet_sys(&env); - let sys_node = subnet_sys.nodes().next().expect("No node in sys subnet."); - - block_on(async { - let runtime = runtime_from_url(sys_node.get_public_url(), sys_node.effective_canister_id()); - install_bitcoin_canister(&runtime, &logger).await; - - let mut ledger_canister = create_canister(&runtime).await; - let mut minter_canister = create_canister(&runtime).await; - let mut kyt_canister = create_canister(&runtime).await; - - let minting_user = minter_canister.canister_id().get(); - let kyt_id = install_kyt(&mut kyt_canister, &logger, Principal::from(minting_user)).await; - - let ledger_id = install_ledger(&mut ledger_canister, minting_user, &logger).await; - let minter_id = install_minter(&mut minter_canister, ledger_id, &logger, 0, kyt_id).await; - let minter = Principal::try_from_slice(minter_id.as_ref()).unwrap(); - let agent = assert_create_agent(sys_node.get_public_url().as_str()).await; - activate_ecdsa_signature(sys_node, subnet_sys.subnet_id, TEST_KEY_LOCAL, &logger).await; - - // Call endpoint. - info!(logger, "Calling get_btc_address endpoint..."); - let arg = GetBtcAddressArgs { - owner: None, - subaccount: None, - }; - let arg = &Encode!(&arg).expect("Error while encoding arg."); - let res = agent - .update(&minter, "get_btc_address") - .with_arg(arg) - .call_and_wait(delay()) - .await - .expect("Error while calling endpoint."); - let address = Decode!(res.as_slice(), String).expect("Error while decoding response."); - - // Checking only proper format of address since ECDSA signature is non-deterministic. - assert_eq!(ADDRESS_LENGTH, address.len()); - assert!( - address.starts_with("bcrt"), - "Expected Regtest address format." - ); - }); -} diff --git a/rs/tests/src/ckbtc/mod.rs b/rs/tests/src/ckbtc/mod.rs deleted file mode 100644 index 00d3cddde41..00000000000 --- a/rs/tests/src/ckbtc/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod agent; -pub mod btc_config { - pub use super::lib::btc_config as config; -} -pub mod lib; -pub mod minter; diff --git a/rs/tests/src/lib.rs b/rs/tests/src/lib.rs index a176b1fce19..ddc8e94af86 100644 --- a/rs/tests/src/lib.rs +++ b/rs/tests/src/lib.rs @@ -1,6 +1,4 @@ pub mod api_test; -pub mod btc_integration; -pub mod ckbtc; pub mod icrc1_agent_test; pub mod ledger_tests; pub mod networking; diff --git a/rs/tests/src/rosetta_tests/governance_client.rs b/rs/tests/src/rosetta_tests/governance_client.rs index 988ea68bdaf..d6ca523f93f 100644 --- a/rs/tests/src/rosetta_tests/governance_client.rs +++ b/rs/tests/src/rosetta_tests/governance_client.rs @@ -1,4 +1,3 @@ -use crate::ckbtc::lib::subnet_sys; use candid::{Decode, Encode, Principal}; use canister_test::PrincipalId; use ic_agent::Agent; @@ -30,7 +29,7 @@ pub struct GovernanceClient { /// Create an agent to interact with the ledger. fn create_agent(env: &TestEnv) -> Agent { block_on(async { - let subnet_sys = subnet_sys(env); + let subnet_sys = super::setup::subnet_sys(env); let node = subnet_sys.nodes().next().expect("No node in sys subnet."); assert_create_agent(node.get_public_url().as_str()).await }) From 989230c6544981154aec6b684ab3900d0d668c27 Mon Sep 17 00:00:00 2001 From: gregorydemay <112856886+gregorydemay@users.noreply.github.com> Date: Thu, 24 Oct 2024 06:58:29 +0200 Subject: [PATCH 12/21] test(ckerc20): Speed-up integration tests of ledger suite orchestrator (#2135) Follow-up on #2017 that identified the ledger suite integration tests (`//rs/ethereum/ledger-suite-orchestrator:integration_tests`) as being surprisingly slow: 1. Average duration: 4m 32s 2. 90th percentile test duration: 8m This PR does the following: 1. Reduce global test duration by almost a factor **6** (from 73.2s to 12.5s, see detailed measurements below) 1. Optimize `trigger_creation_of_archive` to only require a small number of ledger transfers. 2. Remove the proptest `should_install_orchestrator_and_add_supported_erc20_tokens`. 2. Due to the above optimization, the following special flags are also removed 1. Remove the `long` timeout flag from [`0beae73`](https://github.com/dfinity/ic/commit/0beae738bd961f8dff56cfd7d0d4ed3db4d74806). 2. Remove the `long_test` flag from #2017. ### Measurements The following measurements were done on `devenv` at the corresponding commit. #### Global Measured as follows ``` bazel test //rs/ethereum/ledger-suite-orchestrator:integration_tests --runs_per_test=1 --cache_test_results=no --config=bes ``` | Target | Duration (s) [master](https://github.com/dfinity/ic/commit/5f08f33c46c5b3311785efb6cf96388f109d9378) | Duration (s) [PR](https://github.com/dfinity/ic/pull/2135/commits/2fd61ed4514b394d43967aaae44eeae859e116ae) | |--------|--------|--------| |`//rs/ethereum/ledger-suite-orchestrator:integration_tests` | 73.2 | 12.5 | #### Individual test: To ensure that every test was positively impacted by the change, individual test durations were measures as follows: ``` #!/bin/bash TESTS=( "should_change_cycles_for_canister_creation" "should_discover_new_archive_and_top_up" "should_get_canister_status_smoke_test" "should_install_orchestrator_and_add_supported_erc20_tokens" "should_not_change_ledger_suite_version_when_registering_embedded_wasms_a_second_time" "should_query_logs_and_metrics" "should_reject_adding_an_already_managed_erc20_token" "should_reject_update_calls_to_http_request" "should_reject_upgrade_with_invalid_args" "should_require_to_register_embedded_wasms_before_adding_ckerc20" "should_retrieve_orchestrator_info" "should_spawn_archive_from_ledger_with_correct_controllers" "should_spawn_ledger_with_correct_init_args" "should_top_up_spawned_canisters" "upgrade::should_have_two_different_orchestrator_versions_embedding_two_different_ledgers" "upgrade::should_upgrade_all_managed_canisters_to_same_already_installed_version" "upgrade::should_upgrade_all_managed_canisters_with_different_versions_to_same_version" "upgrade::should_upgrade_archive_created_just_before_ledger_upgrade" "upgrade::should_upgrade_canisters_managed_but_not_installed_by_orchestrator" "upgrade::should_upgrade_managed_ledgers_to_new_version" "upgrade::should_upgrade_when_some_canister_are_stopped_to_simulate_previous_upgrade_failure" "upgrade::should_upgrade_without_reinstalling" ) for i in "${TESTS[@]}" do echo "Test $i" bazel test //rs/ethereum/ledger-suite-orchestrator:integration_tests --runs_per_test 1 --cache_test_results=no --config=bes --test_arg="$i" done ``` | Test | Duration (s) [master](https://github.com/dfinity/ic/commit/5f08f33c46c5b3311785efb6cf96388f109d9378) | Duration (s) [PR](https://github.com/dfinity/ic/pull/2135/commits/2fd61ed4514b394d43967aaae44eeae859e116ae) | |--------|--------|--------| |`should_change_cycles_for_canister_creation` | 2.6 | 2.6 | |`should_discover_new_archive_and_top_up` | 17.1 | 2.9 | |`should_get_canister_status_smoke_test` | 0.96 | 0.9 | |`should_install_orchestrator_and_add_supported_erc20_tokens` | 25.2 | 0 (removed) | |`should_not_change_ledger_suite_version_when_registering_embedded_wasms_a_second_time` | 1.8 | 1.8 | |`should_query_logs_and_metrics` | 0.9 | 0.9 | |`should_reject_adding_an_already_managed_erc20_token` | 2.5 | 2.5 | |`should_reject_update_calls_to_http_request` | 0.9 | 0.9 | |`should_reject_upgrade_with_invalid_args` | 1.1 | 1.1 | |`should_require_to_register_embedded_wasms_before_adding_ckerc20` | 2.4 | 2.4 | |`should_retrieve_orchestrator_info` | 2.6 | 2.6 | |`should_spawn_archive_from_ledger_with_correct_controllers` | 17.2 | 2.8 | |`should_spawn_ledger_with_correct_init_args` | 2.5 | 2.4 | |`should_top_up_spawned_canisters` | 2.4 | 2.5 | |`upgrade::should_have_two_different_orchestrator_versions_embedding_two_different_ledgers` | 4.3 | 4.3 | |`upgrade::should_upgrade_all_managed_canisters_to_same_already_installed_version` | 46.2 | 3.7 | |`upgrade::should_upgrade_all_managed_canisters_with_different_versions_to_same_version` | 47.2 | 5 | |`upgrade::should_upgrade_archive_created_just_before_ledger_upgrade` | 17.8 | 3.3 | |`upgrade::should_upgrade_canisters_managed_but_not_installed_by_orchestrator` | 4.6 | 4.6 | |`upgrade::should_upgrade_managed_ledgers_to_new_version` | 4.3 | 4.4 | |`upgrade::should_upgrade_when_some_canister_are_stopped_to_simulate_previous_upgrade_failure` | 18.7 | 4.4 | |`upgrade::should_upgrade_without_reinstalling` | 4.2 | 4.2 | --- Cargo.lock | 1 + .../ledger-suite-orchestrator/BUILD.bazel | 4 - .../test_utils/BUILD.bazel | 1 + .../test_utils/Cargo.toml | 1 + .../test_utils/src/arbitrary.rs | 46 ---------- .../test_utils/src/flow.rs | 85 +++++++++++++++++-- .../test_utils/src/lib.rs | 39 ++++++++- .../ledger-suite-orchestrator/tests/tests.rs | 32 +------ 8 files changed, 120 insertions(+), 89 deletions(-) delete mode 100644 rs/ethereum/ledger-suite-orchestrator/test_utils/src/arbitrary.rs diff --git a/Cargo.lock b/Cargo.lock index 60754447f46..e34c445a0e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9291,6 +9291,7 @@ dependencies = [ "ic-base-types", "ic-canisters-http-types", "ic-cdk 0.16.0", + "ic-icrc1-ledger", "ic-ledger-suite-orchestrator", "ic-management-canister-types", "ic-state-machine-tests", diff --git a/rs/ethereum/ledger-suite-orchestrator/BUILD.bazel b/rs/ethereum/ledger-suite-orchestrator/BUILD.bazel index 4900a372be3..ba65126d6ac 100644 --- a/rs/ethereum/ledger-suite-orchestrator/BUILD.bazel +++ b/rs/ethereum/ledger-suite-orchestrator/BUILD.bazel @@ -140,7 +140,6 @@ rust_test( rust_ic_test( name = "integration_tests", - timeout = "long", testonly = True, srcs = ["tests/tests.rs"], data = [ @@ -161,9 +160,6 @@ rust_ic_test( "LEDGER_ARCHIVE_NODE_CANISTER_WASM_PATH": "$(rootpath //rs/ledger_suite/icrc1/archive:archive_canister_u256.wasm.gz)", }, proc_macro_deps = [], - tags = [ - "long_test", # since it takes longer than 5 minutes. - ], deps = [ # Keep sorted. ":ledger_suite_orchestrator", diff --git a/rs/ethereum/ledger-suite-orchestrator/test_utils/BUILD.bazel b/rs/ethereum/ledger-suite-orchestrator/test_utils/BUILD.bazel index 3300dee66c0..03ba35d2034 100644 --- a/rs/ethereum/ledger-suite-orchestrator/test_utils/BUILD.bazel +++ b/rs/ethereum/ledger-suite-orchestrator/test_utils/BUILD.bazel @@ -18,6 +18,7 @@ rust_library( # Keep sorted. "//packages/icrc-ledger-types:icrc_ledger_types", "//rs/ethereum/ledger-suite-orchestrator:ledger_suite_orchestrator", + "//rs/ledger_suite/icrc1/ledger", "//rs/rust_canisters/http_types", "//rs/state_machine_tests", "//rs/test_utilities/load_wasm", diff --git a/rs/ethereum/ledger-suite-orchestrator/test_utils/Cargo.toml b/rs/ethereum/ledger-suite-orchestrator/test_utils/Cargo.toml index 84fbac7acda..2196411ae16 100644 --- a/rs/ethereum/ledger-suite-orchestrator/test_utils/Cargo.toml +++ b/rs/ethereum/ledger-suite-orchestrator/test_utils/Cargo.toml @@ -12,6 +12,7 @@ candid = { workspace = true } ic-base-types = { path = "../../../types/base_types" } ic-canisters-http-types = { path = "../../../rust_canisters/http_types" } ic-cdk = { workspace = true } +ic-icrc1-ledger = { path = "../../../ledger_suite/icrc1/ledger" } ic-ledger-suite-orchestrator = { path = "../../ledger-suite-orchestrator" } ic-management-canister-types = { path = "../../../types/management_canister_types" } ic-state-machine-tests = { path = "../../../state_machine_tests" } diff --git a/rs/ethereum/ledger-suite-orchestrator/test_utils/src/arbitrary.rs b/rs/ethereum/ledger-suite-orchestrator/test_utils/src/arbitrary.rs deleted file mode 100644 index b880bd85f39..00000000000 --- a/rs/ethereum/ledger-suite-orchestrator/test_utils/src/arbitrary.rs +++ /dev/null @@ -1,46 +0,0 @@ -use candid::Principal; -use ic_ledger_suite_orchestrator::candid::{CyclesManagement, InitArg}; -use proptest::arbitrary::any; -use proptest::collection::vec; -use proptest::option; -use proptest::prelude::Strategy; - -pub fn arb_init_arg() -> impl Strategy { - // at most 10 principals, including the orchestrator's principal - ( - vec(arb_principal(), 0..=9), - option::of(arb_principal()), - option::of(arb_cycles_management()), - ) - .prop_map( - |(more_controller_ids, minter_id, cycles_management)| InitArg { - more_controller_ids, - minter_id, - cycles_management, - }, - ) -} - -pub fn arb_principal() -> impl Strategy { - vec(any::(), 0..=29).prop_map(|bytes| Principal::from_slice(&bytes)) -} - -fn arb_cycles_management() -> impl Strategy { - (arb_nat(), arb_nat(), arb_nat(), arb_nat()).prop_map( - |( - cycles_for_ledger_creation, - cycles_for_archive_creation, - cycles_for_index_creation, - cycles_top_up_increment, - )| CyclesManagement { - cycles_for_ledger_creation, - cycles_for_archive_creation, - cycles_for_index_creation, - cycles_top_up_increment, - }, - ) -} - -fn arb_nat() -> impl Strategy { - any::().prop_map(candid::Nat::from) -} diff --git a/rs/ethereum/ledger-suite-orchestrator/test_utils/src/flow.rs b/rs/ethereum/ledger-suite-orchestrator/test_utils/src/flow.rs index 22e4a01aea6..7572b1fb1d9 100644 --- a/rs/ethereum/ledger-suite-orchestrator/test_utils/src/flow.rs +++ b/rs/ethereum/ledger-suite-orchestrator/test_utils/src/flow.rs @@ -1,14 +1,17 @@ use crate::metrics::MetricsAssert; use crate::universal_canister::UniversalCanister; use crate::{ - assert_reply, out_of_band_upgrade, stop_canister, LedgerAccount, LedgerMetadataValue, - LedgerSuiteOrchestrator, MAX_TICKS, MINTER_PRINCIPAL, + assert_reply, ledger_wasm, out_of_band_upgrade, stop_canister, LedgerAccount, + LedgerMetadataValue, LedgerSuiteOrchestrator, MINTER_PRINCIPAL, }; use candid::{Decode, Encode, Nat, Principal}; use ic_base_types::{CanisterId, PrincipalId}; +use ic_icrc1_ledger::ChangeArchiveOptions; use ic_ledger_suite_orchestrator::candid::{AddErc20Arg, ManagedCanisterIds}; use ic_ledger_suite_orchestrator::state::{IndexWasm, LedgerWasm}; -use ic_management_canister_types::CanisterInfoResponse; +use ic_management_canister_types::{ + CanisterInfoResponse, CanisterInstallMode, InstallCodeArgs, Method, Payload, +}; use ic_state_machine_tests::{CanisterStatusResultV2, StateMachine}; use icrc_ledger_types::icrc1::transfer::{TransferArg, TransferError}; use icrc_ledger_types::icrc3::archive::ArchiveInfo; @@ -22,10 +25,31 @@ pub struct AddErc20TokenFlow { impl AddErc20TokenFlow { pub fn expect_new_ledger_and_index_canisters(self) -> ManagedCanistersAssert { - for _ in 0..MAX_TICKS { - self.setup.env.tick(); + let contract = self.params.contract; + let canister_ids = + self.setup.wait_for( + || match self.setup.call_orchestrator_canister_ids(&contract) { + Some(ids) if ids.ledger.is_some() && ids.index.is_some() => Ok(ids), + incomplete_ids => Err(format!( + "Not all canister IDs are available for ERC-20 {:?}: {:?}", + contract, incomplete_ids + )), + }, + ); + assert_ne!( + canister_ids.ledger, canister_ids.index, + "BUG: ledger and index canister IDs MUST be different" + ); + + self.setup + .wait_for_canister_to_be_installed_and_running(canister_ids.ledger.unwrap()); + self.setup + .wait_for_canister_to_be_installed_and_running(canister_ids.index.unwrap()); + + ManagedCanistersAssert { + setup: self.setup, + canister_ids, } - self.setup.assert_managed_canisters(&self.params.contract) } } @@ -69,8 +93,16 @@ impl ManagedCanistersAssert { } pub fn trigger_creation_of_archive(self) -> Self { - const ARCHIVE_TRIGGER_THRESHOLD: u64 = 2_000; - + const ARCHIVE_TRIGGER_THRESHOLD: usize = 10; + + // The productive value for `trigger_threshold` is `2_000`, + // which would require `2_000` transfers to trigger the creation of an archive, + // which would take in the order of 20s (order of magnitude is 10ms per transfer with state machine tests). + // We set this value to an artificially low number to speed up the test. + self.upgrade_ledger_to_change_archive_options(ChangeArchiveOptions { + trigger_threshold: Some(ARCHIVE_TRIGGER_THRESHOLD), + ..Default::default() + }); let archive_ids_before: BTreeSet<_> = self .call_ledger_archives() .into_iter() @@ -232,6 +264,43 @@ impl ManagedCanistersAssert { .expect("failed to decode transfer response") } + pub fn upgrade_ledger_to_change_archive_options(&self, archive_options: ChangeArchiveOptions) { + use ic_icrc1_ledger::{LedgerArgument, UpgradeArgs as LedgerUpgradeArgs}; + + let module_hash_before = self + .ledger_canister_status() + .module_hash() + .expect("BUG: ledger is not installed"); + + let upgrade_args = Some(LedgerArgument::Upgrade(Some(LedgerUpgradeArgs { + change_archive_options: Some(archive_options), + ..Default::default() + }))); + let res = self.setup.env.execute_ingress_as( + self.setup.ledger_suite_orchestrator_id.into(), + CanisterId::ic_00(), + Method::InstallCode, + InstallCodeArgs::new( + CanisterInstallMode::Upgrade, + self.ledger_canister_id(), + ledger_wasm().to_bytes(), + Encode!(&upgrade_args).unwrap(), + None, + None, + ) + .encode(), + ); + assert_reply(res.unwrap()); + let module_hash_after = self + .ledger_canister_status() + .module_hash() + .expect("BUG: ledger is not installed"); + assert_eq!( + module_hash_before, module_hash_after, + "BUG: ledger wasm hash changed when changing archive options" + ); + } + pub fn call_ledger_icrc3_get_blocks(&self, request: &Vec) -> GetBlocksResult { Decode!( &self diff --git a/rs/ethereum/ledger-suite-orchestrator/test_utils/src/lib.rs b/rs/ethereum/ledger-suite-orchestrator/test_utils/src/lib.rs index 1d7d3aecf25..1dfd894ed15 100644 --- a/rs/ethereum/ledger-suite-orchestrator/test_utils/src/lib.rs +++ b/rs/ethereum/ledger-suite-orchestrator/test_utils/src/lib.rs @@ -22,7 +22,6 @@ pub use icrc_ledger_types::icrc::generic_metadata_value::MetadataValue as Ledger pub use icrc_ledger_types::icrc1::account::Account as LedgerAccount; use std::sync::Arc; -pub mod arbitrary; pub mod flow; pub mod metrics; pub mod universal_canister; @@ -310,6 +309,44 @@ impl LedgerSuiteOrchestrator { let canister_id = self.ledger_suite_orchestrator_id; MetricsAssert::from_querying_metrics(self, canister_id) } + + pub fn wait_for(&self, f: F) -> T + where + F: Fn() -> Result, + E: std::fmt::Debug, + { + let mut last_error = None; + for _ in 0..MAX_TICKS { + self.env.tick(); + match f() { + Ok(t) => return t, + Err(e) => { + last_error = Some(e); + } + } + } + panic!( + "Failed to get result after {} ticks: {:?}", + MAX_TICKS, last_error + ); + } + + pub fn wait_for_canister_to_be_installed_and_running(&self, canister_id: Principal) { + let canister_id = PrincipalId(canister_id).try_into().unwrap(); + self.wait_for(|| { + let ledger_status = self.canister_status_of(canister_id); + if ledger_status.status() == CanisterStatusType::Running + && ledger_status.module_hash().is_some() + { + Ok(()) + } else { + Err(format!( + "Canister {} is not ready {:?}", + canister_id, ledger_status + )) + } + }); + } } pub fn default_init_arg() -> InitArg { diff --git a/rs/ethereum/ledger-suite-orchestrator/tests/tests.rs b/rs/ethereum/ledger-suite-orchestrator/tests/tests.rs index 0cef5086a67..29f33000c2d 100644 --- a/rs/ethereum/ledger-suite-orchestrator/tests/tests.rs +++ b/rs/ethereum/ledger-suite-orchestrator/tests/tests.rs @@ -7,17 +7,14 @@ use ic_ledger_suite_orchestrator::candid::{ ManagedCanisters, ManagedLedgerSuite, OrchestratorArg, OrchestratorInfo, UpdateCyclesManagement, UpgradeArg, }; -use ic_ledger_suite_orchestrator_test_utils::arbitrary::{arb_init_arg, arb_principal}; use ic_ledger_suite_orchestrator_test_utils::{ assert_reply, cketh_installed_canisters, default_init_arg, ledger_suite_orchestrator_wasm, - new_state_machine, supported_erc20_tokens, usdc, usdc_erc20_contract, usdt, - LedgerSuiteOrchestrator, GIT_COMMIT_HASH_UPGRADE, MINTER_PRINCIPAL, NNS_ROOT_PRINCIPAL, + new_state_machine, usdc, usdc_erc20_contract, usdt, LedgerSuiteOrchestrator, + GIT_COMMIT_HASH_UPGRADE, MINTER_PRINCIPAL, NNS_ROOT_PRINCIPAL, }; use ic_state_machine_tests::ErrorCode; use icrc_ledger_types::icrc::generic_metadata_value::MetadataValue as LedgerMetadataValue; use icrc_ledger_types::icrc1::account::Account as LedgerAccount; -use proptest::prelude::ProptestConfig; -use proptest::proptest; use std::sync::Arc; const MAX_TICKS: usize = 10; @@ -25,31 +22,6 @@ const GIT_COMMIT_HASH: &str = "6a8e5fca2c6b4e12966638c444e994e204b42989"; pub const TEN_TRILLIONS: u64 = 10_000_000_000_000; // 10 TC -proptest! { - #![proptest_config(ProptestConfig { - cases: 10, - .. ProptestConfig::default() - })] - #[test] - fn should_install_orchestrator_and_add_supported_erc20_tokens(mut init_arg in arb_init_arg(), minter_id in arb_principal()) { - init_arg.minter_id = Some(minter_id); - let more_controllers = init_arg.more_controller_ids.clone(); - let mut orchestrator = LedgerSuiteOrchestrator::new(Arc::new(new_state_machine()), init_arg).register_embedded_wasms(); - let orchestrator_principal: Principal = orchestrator.ledger_suite_orchestrator_id.get().into(); - let controllers: Vec<_> = std::iter::once(orchestrator_principal).chain(more_controllers.into_iter()).collect(); - - for token in supported_erc20_tokens() { - orchestrator = orchestrator - .add_erc20_token(token) - .expect_new_ledger_and_index_canisters() - .assert_all_controlled_by(&controllers) - .assert_ledger_icrc1_total_supply(0_u8) - .assert_index_has_correct_ledger_id() - .setup; - } - } -} - #[test] fn should_spawn_ledger_with_correct_init_args() { const CKETH_TOKEN_LOGO: &str = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTQ2IiBoZWlnaHQ9IjE0NiIgdmlld0JveD0iMCAwIDE0NiAxNDYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDYiIGhlaWdodD0iMTQ2IiByeD0iNzMiIGZpbGw9IiMzQjAwQjkiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNi4zODM3IDc3LjIwNTJDMTguNDM0IDEwNS4yMDYgNDAuNzk0IDEyNy41NjYgNjguNzk0OSAxMjkuNjE2VjEzNS45NEMzNy4zMDg3IDEzMy44NjcgMTIuMTMzIDEwOC42OTEgMTAuMDYwNSA3Ny4yMDUySDE2LjM4MzdaIiBmaWxsPSJ1cmwoI3BhaW50MF9saW5lYXJfMTEwXzU4NikiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik02OC43NjQ2IDE2LjM1MzRDNDAuNzYzOCAxOC40MDM2IDE4LjQwMzcgNDAuNzYzNyAxNi4zNTM1IDY4Ljc2NDZMMTAuMDMwMyA2OC43NjQ2QzEyLjEwMjcgMzcuMjc4NCAzNy4yNzg1IDEyLjEwMjYgNjguNzY0NiAxMC4wMzAyTDY4Ljc2NDYgMTYuMzUzNFoiIGZpbGw9IiMyOUFCRTIiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMjkuNjE2IDY4LjczNDNDMTI3LjU2NiA0MC43MzM0IDEwNS4yMDYgMTguMzczMyA3Ny4yMDUxIDE2LjMyMzFMNzcuMjA1MSA5Ljk5OTk4QzEwOC42OTEgMTIuMDcyNCAxMzMuODY3IDM3LjI0ODEgMTM1LjkzOSA2OC43MzQzTDEyOS42MTYgNjguNzM0M1oiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcl8xMTBfNTg2KSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTc3LjIzNTQgMTI5LjU4NkMxMDUuMjM2IDEyNy41MzYgMTI3LjU5NiAxMDUuMTc2IDEyOS42NDcgNzcuMTc0OUwxMzUuOTcgNzcuMTc0OUMxMzMuODk3IDEwOC42NjEgMTA4LjcyMiAxMzMuODM3IDc3LjIzNTQgMTM1LjkwOUw3Ny4yMzU0IDEyOS41ODZaIiBmaWxsPSIjMjlBQkUyIi8+CjxwYXRoIGQ9Ik03My4xOTA0IDMxVjYxLjY4MThMOTkuMTIzIDczLjI2OTZMNzMuMTkwNCAzMVoiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNiIvPgo8cGF0aCBkPSJNNzMuMTkwNCAzMUw0Ny4yNTQ0IDczLjI2OTZMNzMuMTkwNCA2MS42ODE4VjMxWiIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTczLjE5MDQgOTMuMTUyM1YxMTRMOTkuMTQwMyA3OC4wOTg0TDczLjE5MDQgOTMuMTUyM1oiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNiIvPgo8cGF0aCBkPSJNNzMuMTkwNCAxMTRWOTMuMTQ4OEw0Ny4yNTQ0IDc4LjA5ODRMNzMuMTkwNCAxMTRaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNzMuMTkwNCA4OC4zMjY5TDk5LjEyMyA3My4yNjk2TDczLjE5MDQgNjEuNjg4N1Y4OC4zMjY5WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC4yIi8+CjxwYXRoIGQ9Ik00Ny4yNTQ0IDczLjI2OTZMNzMuMTkwNCA4OC4zMjY5VjYxLjY4ODdMNDcuMjU0NCA3My4yNjk2WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC42Ii8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMTEwXzU4NiIgeDE9IjUzLjQ3MzYiIHkxPSIxMjIuNzkiIHgyPSIxNC4wMzYyIiB5Mj0iODkuNTc4NiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgo8c3RvcCBvZmZzZXQ9IjAuMjEiIHN0b3AtY29sb3I9IiNFRDFFNzkiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjNTIyNzg1Ii8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8xMTBfNTg2IiB4MT0iMTIwLjY1IiB5MT0iNTUuNjAyMSIgeDI9IjgxLjIxMyIgeTI9IjIyLjM5MTQiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agb2Zmc2V0PSIwLjIxIiBzdG9wLWNvbG9yPSIjRjE1QTI0Ii8+CjxzdG9wIG9mZnNldD0iMC42ODQxIiBzdG9wLWNvbG9yPSIjRkJCMDNCIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg=="; From 5194f6861f973da2c6d3eb36c7e5a15ec9fa6d8b Mon Sep 17 00:00:00 2001 From: Alin Sinpalean <58422065+alin-at-dfinity@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:16:37 +0200 Subject: [PATCH 13/21] chore: Fix intermittent `cargo check` errors (#1860) `cargo check` intermittently fails to build with `strum::EnumIter` as a derive macro, switch to `strum_derive::EnumIter`. From 55b7f5503b69c5846e622feca250ccc5cb6f444d Mon Sep 17 00:00:00 2001 From: NikolasHai <113891786+NikolasHai@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:24:43 +0200 Subject: [PATCH 14/21] feat(ICP-Rosetta): FI-1543: add auto stake change (#2186) This MR proposes the following changes: 1. Add a function for the ICP Rosetta Client to change auto stake maturity. --- rs/rosetta-api/icp/client/src/lib.rs | 98 +++++++++++++++++++ .../test_cases/neuron_management.rs | 98 +++++++++++++++++++ 2 files changed, 196 insertions(+) diff --git a/rs/rosetta-api/icp/client/src/lib.rs b/rs/rosetta-api/icp/client/src/lib.rs index cadf7f398f4..ed24817f8f8 100644 --- a/rs/rosetta-api/icp/client/src/lib.rs +++ b/rs/rosetta-api/icp/client/src/lib.rs @@ -10,6 +10,7 @@ use ic_rosetta_api::models::ConstructionDeriveRequestMetadata; use ic_rosetta_api::models::ConstructionMetadataRequestOptions; use ic_rosetta_api::models::ConstructionPayloadsRequestMetadata; use ic_rosetta_api::models::OperationIdentifier; +use ic_rosetta_api::request_types::ChangeAutoStakeMaturityMetadata; use ic_rosetta_api::request_types::NeuronIdentifierMetadata; use ic_rosetta_api::request_types::RequestType; use ic_rosetta_api::request_types::SetDissolveTimestampMetadata; @@ -296,6 +297,35 @@ impl RosettaClient { }]) } + pub async fn build_change_auto_stake_maturity_operations( + signer_principal: Principal, + neuron_index: u64, + requested_setting_for_auto_stake_maturity: bool, + ) -> anyhow::Result> { + Ok(vec![Operation { + operation_identifier: OperationIdentifier { + index: 0, + network_index: None, + }, + related_operations: None, + type_: "CHANGE_AUTO_STAKE_MATURITY".to_string(), + status: None, + account: Some(rosetta_core::identifiers::AccountIdentifier::from( + AccountIdentifier::new(PrincipalId(signer_principal), None), + )), + amount: None, + coin_change: None, + metadata: Some( + ChangeAutoStakeMaturityMetadata { + neuron_index, + requested_setting_for_auto_stake_maturity, + } + .try_into() + .map_err(|e| anyhow::anyhow!("Failed to convert metadata: {:?}", e))?, + ), + }]) + } + pub async fn network_list(&self) -> anyhow::Result { self.call_endpoint("/network/list", &MetadataRequest { metadata: None }) .await @@ -818,6 +848,34 @@ impl RosettaClient { ) .await } + + /// A neuron can be set to automatically restake its maturity. + pub async fn change_auto_stake_maturity( + &self, + network_identifier: NetworkIdentifier, + signer_keypair: &T, + change_auto_stake_maturity_args: RosettaChangeAutoStakeMaturityArgs, + ) -> anyhow::Result + where + T: RosettaSupportedKeyPair, + { + let change_auto_stake_maturity_operations = + RosettaClient::build_change_auto_stake_maturity_operations( + signer_keypair.generate_principal_id()?.0, + change_auto_stake_maturity_args.neuron_index.unwrap_or(0), + change_auto_stake_maturity_args.requested_setting_for_auto_stake_maturity, + ) + .await?; + + self.make_submit_and_wait_for_transaction( + signer_keypair, + network_identifier, + change_auto_stake_maturity_operations, + None, + None, + ) + .await + } } pub struct RosettaTransferArgs { @@ -989,3 +1047,43 @@ impl RosettaSetNeuronDissolveDelayArgsBuilder { } } } + +pub struct RosettaChangeAutoStakeMaturityArgs { + pub neuron_index: Option, + pub requested_setting_for_auto_stake_maturity: bool, +} + +impl RosettaChangeAutoStakeMaturityArgs { + pub fn builder( + requested_setting_for_auto_stake_maturity: bool, + ) -> RosettaChangeAutoStakeMaturityArgsBuilder { + RosettaChangeAutoStakeMaturityArgsBuilder::new(requested_setting_for_auto_stake_maturity) + } +} + +pub struct RosettaChangeAutoStakeMaturityArgsBuilder { + requested_setting_for_auto_stake_maturity: bool, + neuron_index: Option, +} + +impl RosettaChangeAutoStakeMaturityArgsBuilder { + pub fn new(requested_setting_for_auto_stake_maturity: bool) -> Self { + Self { + requested_setting_for_auto_stake_maturity, + neuron_index: None, + } + } + + pub fn with_neuron_index(mut self, neuron_index: u64) -> Self { + self.neuron_index = Some(neuron_index); + self + } + + pub fn build(self) -> RosettaChangeAutoStakeMaturityArgs { + RosettaChangeAutoStakeMaturityArgs { + requested_setting_for_auto_stake_maturity: self + .requested_setting_for_auto_stake_maturity, + neuron_index: self.neuron_index, + } + } +} diff --git a/rs/rosetta-api/icp/tests/system_tests/test_cases/neuron_management.rs b/rs/rosetta-api/icp/tests/system_tests/test_cases/neuron_management.rs index 7713e2e4b8a..07aea329301 100644 --- a/rs/rosetta-api/icp/tests/system_tests/test_cases/neuron_management.rs +++ b/rs/rosetta-api/icp/tests/system_tests/test_cases/neuron_management.rs @@ -3,6 +3,7 @@ use crate::common::{ utils::{get_test_agent, list_neurons, test_identity}, }; use ic_agent::{identity::BasicIdentity, Identity}; +use ic_icp_rosetta_client::RosettaChangeAutoStakeMaturityArgs; use ic_icp_rosetta_client::{RosettaCreateNeuronArgs, RosettaSetNeuronDissolveDelayArgs}; use ic_nns_governance::pb::v1::neuron::DissolveState; use ic_rosetta_api::request::transaction_operation_results::TransactionOperationResults; @@ -288,3 +289,100 @@ fn test_start_and_stop_neuron_dissolve() { )); }); } + +#[test] +fn test_change_auto_stake_maturity() { + let rt = Runtime::new().unwrap(); + rt.block_on(async { + let env = RosettaTestingEnvironment::builder() + .with_initial_balances( + vec![( + AccountIdentifier::from(TEST_IDENTITY.sender().unwrap()), + // A hundred million ICP should be enough + icp_ledger::Tokens::from_tokens(100_000_000).unwrap(), + )] + .into_iter() + .collect(), + ) + .with_governance_canister() + .build() + .await; + + // Stake the minimum amount 100 million e8s + let staked_amount = 100_000_000u64; + let neuron_index = 0; + let from_subaccount = [0; 32]; + + env.rosetta_client + .create_neuron( + env.network_identifier.clone(), + &(*TEST_IDENTITY).clone(), + RosettaCreateNeuronArgs::builder(staked_amount.into()) + .with_from_subaccount(from_subaccount) + .with_neuron_index(neuron_index) + .build(), + ) + .await + .unwrap(); + + // See if the neuron was created successfully + let agent = get_test_agent(env.pocket_ic.url().unwrap().port().unwrap()).await; + let neuron = list_neurons(&agent).await.full_neurons[0].to_owned(); + // The neuron should not have auto stake maturity set + assert!(neuron.auto_stake_maturity.is_none()); + + // Change the auto stake maturity to true + let change_auto_stake_maturity_response = TransactionOperationResults::try_from( + env.rosetta_client + .change_auto_stake_maturity( + env.network_identifier.clone(), + &(*TEST_IDENTITY).clone(), + RosettaChangeAutoStakeMaturityArgs::builder(true) + .with_neuron_index(neuron_index) + .build(), + ) + .await + .unwrap() + .metadata, + ) + .unwrap(); + + assert_eq!( + change_auto_stake_maturity_response + .operations + .first() + .unwrap() + .status, + Some("COMPLETED".to_owned()) + ); + let neuron = list_neurons(&agent).await.full_neurons[0].to_owned(); + assert!(neuron.auto_stake_maturity.unwrap()); + + // Change the auto stake maturity to false + let change_auto_stake_maturity_response = TransactionOperationResults::try_from( + env.rosetta_client + .change_auto_stake_maturity( + env.network_identifier.clone(), + &(*TEST_IDENTITY).clone(), + RosettaChangeAutoStakeMaturityArgs::builder(false) + .with_neuron_index(neuron_index) + .build(), + ) + .await + .unwrap() + .metadata, + ) + .unwrap(); + + assert_eq!( + change_auto_stake_maturity_response + .operations + .first() + .unwrap() + .status, + Some("COMPLETED".to_owned()) + ); + let neuron = list_neurons(&agent).await.full_neurons[0].to_owned(); + assert!(neuron.auto_stake_maturity.is_none()); + }); +} From 856f04845dc30395e72435642181f7fc67ce50a3 Mon Sep 17 00:00:00 2001 From: r-birkner <103420898+r-birkner@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:14:12 +0200 Subject: [PATCH 15/21] chore: update ic-boundary README (#2212) The README was outdated and included some options that have been removed. Now, --- rs/boundary_node/ic_boundary/README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/rs/boundary_node/ic_boundary/README.md b/rs/boundary_node/ic_boundary/README.md index dc2103a4a83..5b7ecf3d69d 100644 --- a/rs/boundary_node/ic_boundary/README.md +++ b/rs/boundary_node/ic_boundary/README.md @@ -6,15 +6,21 @@ The `ic-boundary` is a service that handles all the responsibilities of the API ## Usage +To run a minimal `ic-boundary` instance, use the following command: + ```sh ic-boundary \ --nns-pub-key-pem \ - --nns-url \ + --nns-urls \ --local-store-path \ - --nftables-system-replicas-path \ - --nftables-system-replicas-var \ - --min_registry_version \ - --min_ok_count \ - --max_height_lag \ - --metrics-addr + --http-port \ + --log-stdout ``` + +Where: +* `` points to a file containing the NNS root public key; +* `` consists of at least one URL pointing to a NNS-replica; +* `` points to a directory where `ic-boundary` will keep the local copy of the registry; +* `` specifies the port `ic-boundary` is listening on (e.g., `80`); + +`ic-boundary` offers many more configuration options. For a full list, run `ic-boundary --help`. From 35a25eaf6d146a9a8d0faca84d0e9347cf36cb47 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Thu, 24 Oct 2024 10:44:59 +0200 Subject: [PATCH 16/21] chore(IDX): proc-macro2: 1.0.88 -> 1.0.89 & remove rules_rust.patch (#2224) proc-macro2-1.0.89 [contains](https://github.com/dtolnay/proc-macro2/compare/1.0.88...1.0.89 ) a fix for build reproducibility issue https://github.com/dtolnay/proc-macro2/issues/473 which means we can remove our `rules_rust.patch`. --- Cargo.Bazel.Fuzzing.json.lock | 222 +++++++++++++++++----------------- Cargo.Bazel.Fuzzing.toml.lock | 4 +- Cargo.Bazel.json.lock | 222 +++++++++++++++++----------------- Cargo.Bazel.toml.lock | 4 +- Cargo.toml | 2 +- WORKSPACE.bazel | 1 - bazel/external_crates.bzl | 2 +- bazel/rules_rust.patch | 27 ----- 8 files changed, 228 insertions(+), 256 deletions(-) delete mode 100644 bazel/rules_rust.patch diff --git a/Cargo.Bazel.Fuzzing.json.lock b/Cargo.Bazel.Fuzzing.json.lock index 9b485d39985..61cb633008e 100644 --- a/Cargo.Bazel.Fuzzing.json.lock +++ b/Cargo.Bazel.Fuzzing.json.lock @@ -1,5 +1,5 @@ { - "checksum": "816dcb40bf126158fa3e9fba90b474a27d1632c2001a5d1958f33be1a971846a", + "checksum": "f87bc097c5f4900250a6243a052dafcacb570cd5c8c8fbaaa38839acf498722b", "crates": { "abnf 0.12.0": { "name": "abnf", @@ -1068,7 +1068,7 @@ "target": "actix_router" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -2689,7 +2689,7 @@ "target": "mime_guess" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -2932,7 +2932,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -2992,7 +2992,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -3669,7 +3669,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -3900,7 +3900,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -4001,7 +4001,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -4252,7 +4252,7 @@ "target": "proc_macro_error" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -4785,7 +4785,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -6056,7 +6056,7 @@ "target": "prettyplease" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -6187,7 +6187,7 @@ "target": "lazycell" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -6347,7 +6347,7 @@ "target": "either" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -7949,7 +7949,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -8000,7 +8000,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -8055,7 +8055,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -8816,7 +8816,7 @@ "target": "proc_macro_error" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -9159,7 +9159,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -9744,7 +9744,7 @@ "target": "darling" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -10088,7 +10088,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -10291,7 +10291,7 @@ "target": "lazy_static" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -11881,7 +11881,7 @@ "target": "proc_macro_error" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -11947,7 +11947,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -12555,7 +12555,7 @@ "target": "convert_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -12615,7 +12615,7 @@ "target": "convert_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -15727,7 +15727,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16105,7 +16105,7 @@ "target": "ident_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16179,7 +16179,7 @@ "target": "ident_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16253,7 +16253,7 @@ "target": "ident_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16835,7 +16835,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16958,7 +16958,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -17013,7 +17013,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -17104,7 +17104,7 @@ "target": "convert_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -18126,7 +18126,7 @@ "target": "priority_queue" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -18980,7 +18980,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -19711,7 +19711,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -20165,7 +20165,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -20225,7 +20225,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -20289,7 +20289,7 @@ "target": "num_traits" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -23391,7 +23391,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -26346,7 +26346,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29066,7 +29066,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29133,7 +29133,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29200,7 +29200,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29267,7 +29267,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29334,7 +29334,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -31695,7 +31695,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -32319,7 +32319,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -37191,7 +37191,7 @@ "target": "fnv" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -38808,7 +38808,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -39394,7 +39394,7 @@ "target": "cfg_if" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -39470,7 +39470,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -40050,7 +40050,7 @@ "target": "either" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -41627,7 +41627,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -42207,7 +42207,7 @@ "target": "bytes" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -44166,7 +44166,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -45207,7 +45207,7 @@ "target": "pest_meta" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -45705,7 +45705,7 @@ "target": "phf_shared" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -45953,7 +45953,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -47613,7 +47613,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -48016,7 +48016,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -48111,7 +48111,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -48210,14 +48210,14 @@ ], "license_file": "LICENSE-APACHE" }, - "proc-macro2 1.0.88": { + "proc-macro2 1.0.89": { "name": "proc-macro2", - "version": "1.0.88", + "version": "1.0.89", "package_url": "https://github.com/dtolnay/proc-macro2", "repository": { "Http": { - "url": "https://static.crates.io/crates/proc-macro2/1.0.88/download", - "sha256": "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" + "url": "https://static.crates.io/crates/proc-macro2/1.0.89/download", + "sha256": "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" } }, "targets": [ @@ -48261,7 +48261,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "build_script_build" }, { @@ -48272,7 +48272,7 @@ "selects": {} }, "edition": "2021", - "version": "1.0.88" + "version": "1.0.89" }, "build_script_attrs": { "data_glob": [ @@ -48801,7 +48801,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -49204,7 +49204,7 @@ "target": "itertools" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -49267,7 +49267,7 @@ "target": "itertools" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -49647,7 +49647,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -50381,7 +50381,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" } ], @@ -53702,7 +53702,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -53866,7 +53866,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -54222,7 +54222,7 @@ "target": "glob" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -56538,7 +56538,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -56740,7 +56740,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58377,7 +58377,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58433,7 +58433,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58750,7 +58750,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58806,7 +58806,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58861,7 +58861,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -59120,7 +59120,7 @@ "target": "darling" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -59180,7 +59180,7 @@ "target": "darling" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62003,7 +62003,7 @@ "target": "phf_shared" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62131,7 +62131,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62196,7 +62196,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62368,7 +62368,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62436,7 +62436,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62806,7 +62806,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62887,7 +62887,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -63042,7 +63042,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -63611,7 +63611,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -64115,7 +64115,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -64394,7 +64394,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -65342,7 +65342,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -65583,7 +65583,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -66666,7 +66666,7 @@ "target": "prettyplease" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -67508,7 +67508,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -70371,7 +70371,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -70776,7 +70776,7 @@ "target": "once_cell" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -70963,7 +70963,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -71931,7 +71931,7 @@ "target": "anyhow" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -72463,7 +72463,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76610,7 +76610,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76724,7 +76724,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76833,7 +76833,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76947,7 +76947,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -77068,7 +77068,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -78615,7 +78615,7 @@ "pretty-bytes 0.2.2", "pretty_assertions 1.4.0", "priority-queue 1.3.2", - "proc-macro2 1.0.88", + "proc-macro2 1.0.89", "procfs 0.9.1", "prometheus 0.13.4", "prometheus-parse 0.2.4", diff --git a/Cargo.Bazel.Fuzzing.toml.lock b/Cargo.Bazel.Fuzzing.toml.lock index 4a794d95823..9eecd85a16d 100644 --- a/Cargo.Bazel.Fuzzing.toml.lock +++ b/Cargo.Bazel.Fuzzing.toml.lock @@ -8261,9 +8261,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] diff --git a/Cargo.Bazel.json.lock b/Cargo.Bazel.json.lock index 3220cef7e02..33e3a52e4e1 100644 --- a/Cargo.Bazel.json.lock +++ b/Cargo.Bazel.json.lock @@ -1,5 +1,5 @@ { - "checksum": "49a18edb724b2045277fefd84b4f75cbd79c6848b8599ca216219b614a343a22", + "checksum": "1af0a1c776d32823a68c85613fc4dc21dc84e38bda584a3058b479f58c588eaf", "crates": { "abnf 0.12.0": { "name": "abnf", @@ -1072,7 +1072,7 @@ "target": "actix_router" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -2693,7 +2693,7 @@ "target": "mime_guess" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -2936,7 +2936,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -2996,7 +2996,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -3673,7 +3673,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -3904,7 +3904,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -4005,7 +4005,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -4256,7 +4256,7 @@ "target": "proc_macro_error" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -4789,7 +4789,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -6035,7 +6035,7 @@ "target": "prettyplease" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -6166,7 +6166,7 @@ "target": "lazycell" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -6326,7 +6326,7 @@ "target": "either" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -7862,7 +7862,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -7913,7 +7913,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -7968,7 +7968,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -8729,7 +8729,7 @@ "target": "proc_macro_error" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -9072,7 +9072,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -9657,7 +9657,7 @@ "target": "darling" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -10001,7 +10001,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -10182,7 +10182,7 @@ "target": "lazy_static" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -11772,7 +11772,7 @@ "target": "proc_macro_error" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -11838,7 +11838,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -12446,7 +12446,7 @@ "target": "convert_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -12506,7 +12506,7 @@ "target": "convert_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -15550,7 +15550,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -15928,7 +15928,7 @@ "target": "ident_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16002,7 +16002,7 @@ "target": "ident_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16076,7 +16076,7 @@ "target": "ident_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16658,7 +16658,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16781,7 +16781,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16836,7 +16836,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -16927,7 +16927,7 @@ "target": "convert_case" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -17949,7 +17949,7 @@ "target": "priority_queue" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -18803,7 +18803,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -19534,7 +19534,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -19988,7 +19988,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -20048,7 +20048,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -20112,7 +20112,7 @@ "target": "num_traits" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -23234,7 +23234,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -26193,7 +26193,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -28913,7 +28913,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -28980,7 +28980,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29047,7 +29047,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29114,7 +29114,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -29181,7 +29181,7 @@ "target": "candid" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -31520,7 +31520,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -32144,7 +32144,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -37185,7 +37185,7 @@ "target": "fnv" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -38801,7 +38801,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -39387,7 +39387,7 @@ "target": "cfg_if" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -39463,7 +39463,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -40043,7 +40043,7 @@ "target": "either" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -41590,7 +41590,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -42170,7 +42170,7 @@ "target": "bytes" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -44129,7 +44129,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -45165,7 +45165,7 @@ "target": "pest_meta" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -45663,7 +45663,7 @@ "target": "phf_shared" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -45911,7 +45911,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -47571,7 +47571,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -47974,7 +47974,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -48069,7 +48069,7 @@ "target": "build_script_build" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -48168,14 +48168,14 @@ ], "license_file": "LICENSE-APACHE" }, - "proc-macro2 1.0.88": { + "proc-macro2 1.0.89": { "name": "proc-macro2", - "version": "1.0.88", + "version": "1.0.89", "package_url": "https://github.com/dtolnay/proc-macro2", "repository": { "Http": { - "url": "https://static.crates.io/crates/proc-macro2/1.0.88/download", - "sha256": "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" + "url": "https://static.crates.io/crates/proc-macro2/1.0.89/download", + "sha256": "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" } }, "targets": [ @@ -48219,7 +48219,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "build_script_build" }, { @@ -48230,7 +48230,7 @@ "selects": {} }, "edition": "2021", - "version": "1.0.88" + "version": "1.0.89" }, "build_script_attrs": { "data_glob": [ @@ -48759,7 +48759,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -49162,7 +49162,7 @@ "target": "itertools" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -49225,7 +49225,7 @@ "target": "itertools" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -49605,7 +49605,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -50339,7 +50339,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" } ], @@ -53704,7 +53704,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -53868,7 +53868,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -54224,7 +54224,7 @@ "target": "glob" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -56663,7 +56663,7 @@ "target": "proc_macro_crate" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -56865,7 +56865,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58502,7 +58502,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58558,7 +58558,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58875,7 +58875,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58931,7 +58931,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -58986,7 +58986,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -59245,7 +59245,7 @@ "target": "darling" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -59305,7 +59305,7 @@ "target": "darling" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62128,7 +62128,7 @@ "target": "phf_shared" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62256,7 +62256,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62321,7 +62321,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62493,7 +62493,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62561,7 +62561,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -62931,7 +62931,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -63012,7 +63012,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -63167,7 +63167,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -63736,7 +63736,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -64240,7 +64240,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -64519,7 +64519,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -65467,7 +65467,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -65708,7 +65708,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -66791,7 +66791,7 @@ "target": "prettyplease" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -67633,7 +67633,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -70496,7 +70496,7 @@ "target": "heck" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -70901,7 +70901,7 @@ "target": "once_cell" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -71088,7 +71088,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -72034,7 +72034,7 @@ "target": "anyhow" }, { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -72566,7 +72566,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76708,7 +76708,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76822,7 +76822,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -76931,7 +76931,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -77045,7 +77045,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -77166,7 +77166,7 @@ "deps": { "common": [ { - "id": "proc-macro2 1.0.88", + "id": "proc-macro2 1.0.89", "target": "proc_macro2" }, { @@ -78813,7 +78813,7 @@ "pretty-bytes 0.2.2", "pretty_assertions 1.4.0", "priority-queue 1.3.2", - "proc-macro2 1.0.88", + "proc-macro2 1.0.89", "procfs 0.9.1", "prometheus 0.13.4", "prometheus-parse 0.2.4", diff --git a/Cargo.Bazel.toml.lock b/Cargo.Bazel.toml.lock index e950bb30d85..04e15cfe162 100644 --- a/Cargo.Bazel.toml.lock +++ b/Cargo.Bazel.toml.lock @@ -8268,9 +8268,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] diff --git a/Cargo.toml b/Cargo.toml index 6fed6e894fe..e424d11839d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -617,7 +617,7 @@ pprof = { version = "0.13.0", default-features = false, features = [ ] } predicates = "3.1.2" pretty_assertions = "1.4.0" -proc-macro2 = "1.0.88" +proc-macro2 = "1.0.89" prometheus = { version = "0.13.4", features = ["process"] } prometheus-parse = { version = "0.2.4" } proptest = "1.5.0" diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index fd44e315026..57c24210bc5 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -82,7 +82,6 @@ sol_register_toolchains( http_archive( name = "rules_rust", patch_args = ["-p1"], - patches = ["//bazel:rules_rust.patch"], sha256 = "24b378ed97006f1f7012be498a26f81ddb9901318b88380aee8522fdfbe8b735", urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.42.1/rules_rust-v0.42.1.tar.gz"], ) diff --git a/bazel/external_crates.bzl b/bazel/external_crates.bzl index c72cb56777c..09c9ef67acc 100644 --- a/bazel/external_crates.bzl +++ b/bazel/external_crates.bzl @@ -902,7 +902,7 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable ], ), "proc-macro2": crate.spec( - version = "^1.0.88", + version = "^1.0.89", ), "procfs": crate.spec( version = "^0.9", diff --git a/bazel/rules_rust.patch b/bazel/rules_rust.patch deleted file mode 100644 index 767cf6d564f..00000000000 --- a/bazel/rules_rust.patch +++ /dev/null @@ -1,27 +0,0 @@ -# workaround for proc-macro2 build determinism issues -# https://github.com/dtolnay/proc-macro2/issues/473 -diff --git a/cargo/cargo_build_script_runner/bin.rs b/cargo/cargo_build_script_runner/bin.rs -index 8730c809..f8eda5db 100644 ---- a/cargo/cargo_build_script_runner/bin.rs -+++ b/cargo/cargo_build_script_runner/bin.rs -@@ -84,7 +84,7 @@ fn run_buildrs() -> Result<(), String> { - command - .current_dir(&working_directory) - .envs(target_env_vars) -- .env("OUT_DIR", out_dir_abs) -+ .env("OUT_DIR", out_dir_abs.clone()) - .env("CARGO_MANIFEST_DIR", manifest_dir) - .env("RUSTC", rustc) - .env("RUST_BACKTRACE", "full"); -@@ -195,6 +195,11 @@ fn run_buildrs() -> Result<(), String> { - .unwrap_or_else(|_| panic!("Unable to write file {:?}", link_flags_file)); - write(&link_search_paths_file, link_search_paths.as_bytes()) - .unwrap_or_else(|_| panic!("Unable to write file {:?}", link_search_paths_file)); -+ -+ let proc_macro2_d = out_dir_abs.join("proc_macro2.d"); -+ if Path::new(&proc_macro2_d).exists() { -+ std::fs::remove_file(proc_macro2_d).unwrap(); -+ } - Ok(()) - } - From ac6c9d1e5ee34cb91614f55c4f301aede2698a72 Mon Sep 17 00:00:00 2001 From: stiegerc Date: Thu, 24 Oct 2024 10:47:37 +0200 Subject: [PATCH 17/21] feat: Reduce the limit for messages in `Stream` from 50k to 10k. (#2185) Since streams can be oversized by design, there is no check for this limit that would trigger a staged rollout. It's just that building streams will respect the new limit henceforth (except the usual oversizing due to reject responses). Meaning streams with more messages will just chew through them and not include new messages until they are below the new limit. Note that 50k was way higher than anything realistically attainable considering bottlenecks are elsewhere. Even 10k is still generous. --- rs/messaging/src/routing/stream_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/messaging/src/routing/stream_builder.rs b/rs/messaging/src/routing/stream_builder.rs index 61ca0060e5a..198dada5d22 100644 --- a/rs/messaging/src/routing/stream_builder.rs +++ b/rs/messaging/src/routing/stream_builder.rs @@ -62,7 +62,7 @@ const TARGET_STREAM_SIZE_BYTES: usize = 10 * 1024 * 1024; /// /// At most `MAX_STREAM_MESSAGES` are enqueued into a stream; but only until its /// `count_bytes()` is greater than or equal to `TARGET_STREAM_SIZE_BYTES`. -const MAX_STREAM_MESSAGES: usize = 50_000; +const MAX_STREAM_MESSAGES: usize = 10_000; const METRIC_STREAM_MESSAGES: &str = "mr_stream_messages"; const METRIC_STREAM_BYTES: &str = "mr_stream_bytes"; From 44a8e8d766e1b61156b1f52d55f6a9196544c8b7 Mon Sep 17 00:00:00 2001 From: oggy-dfin <89794951+oggy-dfin@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:01:41 +0200 Subject: [PATCH 18/21] feat(RES-153): deal with Apalache state explosion (#2188) #1982 added a test with a large number of neurons (>100). While the test itself (`test_rate_limiting_neuron_creation`) doesn't invoke the TLA traces check, the current TLA instrumentation implementation causes the traces of the instrumented methods to be picked up by the other tests in the same file (it wasn't immediately clear how to improve this). When the trace of this test is then checked against the TLA model, this creates large TLA states, which in turn causes Apalache to consume a lot of time and memory. This PR adds a size gauge to TLA states, and skips checks of governance transitions involving large states. I'll work on eliminating the cross-talk between the tests that I mentioned above, but it seems like a good idea anyway to have this limit. Maybe we can do something smarter in the future (e.g., maybe the large strings representing ledger account identifiers are problematic for Apalache, so maybe we could shorten those), but given that the link between the code and the model is best-effort, it's acceptable for the moment IMO. --------- Co-authored-by: Lara Schmid <73884086+LaraAS@users.noreply.github.com> --- rs/nns/governance/feature_flags.bzl | 4 ++-- rs/nns/governance/src/governance/tla/mod.rs | 6 ++++++ .../tla_instrumentation/src/tla_state.rs | 8 +++++++ .../tla_instrumentation/src/tla_value.rs | 18 ++++++++++++++++ .../tla_instrumentation/tests/structs.rs | 21 +++++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/rs/nns/governance/feature_flags.bzl b/rs/nns/governance/feature_flags.bzl index d8604b6fc49..cf2fe6f6781 100644 --- a/rs/nns/governance/feature_flags.bzl +++ b/rs/nns/governance/feature_flags.bzl @@ -4,7 +4,7 @@ Feature flags for turning TLA-based checks on and off. def test_with_tla(): return select({ - # Add "tla" here to enable TLA-related checks in the CI - "//conditions:default": ["test"], + # Add/remove "tla" here to enable/disable TLA-related checks in the CI + "//conditions:default": ["test", "tla"], "//rs/nns/governance:tla_disabled": ["test"], }) diff --git a/rs/nns/governance/src/governance/tla/mod.rs b/rs/nns/governance/src/governance/tla/mod.rs index 07c2f3d82dc..4d1194de14f 100644 --- a/rs/nns/governance/src/governance/tla/mod.rs +++ b/rs/nns/governance/src/governance/tla/mod.rs @@ -208,6 +208,10 @@ fn get_tla_module_path(module: &str) -> PathBuf { /// It's assumed that the corresponding model is called `_Apalache.tla`, where PID is the /// `process_id`` field used in the `Update` value for the corresponding method. pub fn check_traces() { + // Large states make Apalache time and memory consumption explode. We'll look at + // improving that later, for now we introduce a hard limit on the state size, and + // skip checking states larger than the limit + const STATE_SIZE_LIMIT: u64 = 500; let traces = { // Introduce a scope to drop the write lock immediately, in order // not to poison the lock if we panic later @@ -229,6 +233,7 @@ pub fn check_traces() { let all_pairs = traces.into_iter().flat_map(|t| { t.state_pairs .into_iter() + .filter(|p| p.start.size() < STATE_SIZE_LIMIT && p.end.size() < STATE_SIZE_LIMIT) .map(move |p| (t.update.clone(), t.constants.clone(), p)) }); let chunks = all_pairs.chunks(chunk_size); @@ -241,6 +246,7 @@ pub fn check_traces() { // NOTE: We adopt the convention to reuse the 'process_id" as the tla module name let tla_module = format!("{}_Apalache.tla", update.process_id); let tla_module = get_tla_module_path(&tla_module); + let handle = thread::spawn(move || { check_tla_code_link( &apalache, diff --git a/rs/tla_instrumentation/tla_instrumentation/src/tla_state.rs b/rs/tla_instrumentation/tla_instrumentation/src/tla_state.rs index ee176f4734b..d9338b2f088 100644 --- a/rs/tla_instrumentation/tla_instrumentation/src/tla_state.rs +++ b/rs/tla_instrumentation/tla_instrumentation/src/tla_state.rs @@ -15,6 +15,10 @@ impl VarAssignment { Self(BTreeMap::new()) } + pub fn size(&self) -> u64 { + self.0.len() as u64 + self.0.values().map(|x| x.size()).sum::() + } + pub fn update(&mut self, locals: Vec<(String, TlaValue)>) { self.0.extend(locals) } @@ -64,6 +68,10 @@ impl GlobalState { Self(VarAssignment::new()) } + pub fn size(&self) -> u64 { + self.0.size() + } + pub fn merge(&self, other: GlobalState) -> GlobalState { GlobalState(self.0.merge(other.0)) } diff --git a/rs/tla_instrumentation/tla_instrumentation/src/tla_value.rs b/rs/tla_instrumentation/tla_instrumentation/src/tla_value.rs index 836419e7288..9031811750d 100644 --- a/rs/tla_instrumentation/tla_instrumentation/src/tla_value.rs +++ b/rs/tla_instrumentation/tla_instrumentation/src/tla_value.rs @@ -19,6 +19,24 @@ pub enum TlaValue { Variant { tag: String, value: Box }, } +impl TlaValue { + /// An approximation of the size of the TLA value, in terms of the number of atoms. + /// Ignores string lengths or number sizes. + pub fn size(&self) -> u64 { + match self { + TlaValue::Set(set) => set.iter().map(|x| x.size()).sum(), + TlaValue::Record(map) => map.iter().map(|(_k, v)| 1 + v.size()).sum(), + TlaValue::Function(map) => map.iter().map(|(k, v)| k.size() + v.size()).sum(), + TlaValue::Seq(vec) => vec.iter().map(|x| x.size()).sum(), + TlaValue::Literal(_s) => 1_u64, + TlaValue::Constant(_s) => 1_u64, + TlaValue::Bool(_) => 1, + TlaValue::Int(_) => 1, + TlaValue::Variant { tag: _, value } => 1 + value.size(), + } + } +} + impl Display for TlaValue { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { diff --git a/rs/tla_instrumentation/tla_instrumentation/tests/structs.rs b/rs/tla_instrumentation/tla_instrumentation/tests/structs.rs index 01c1cff0ee5..375fad20ff9 100644 --- a/rs/tla_instrumentation/tla_instrumentation/tests/structs.rs +++ b/rs/tla_instrumentation/tla_instrumentation/tests/structs.rs @@ -172,6 +172,27 @@ fn get_tla_module_path(module: &str) -> PathBuf { }) } +#[test] +fn size_test() { + let myval = TlaValue::Record(BTreeMap::from([ + ( + "field1".to_string(), + TlaValue::Function(BTreeMap::from([( + 1_u64.to_tla_value(), + true.to_tla_value(), + )])), + ), + ( + "field2".to_string(), + TlaValue::Variant { + tag: "tag".to_string(), + value: Box::new("abc".to_tla_value()), + }, + ), + ])); + assert_eq!(myval.size(), 6); +} + #[test] fn struct_test() { unsafe { From 51c7046cca106d107373e144b43a7086a27fef27 Mon Sep 17 00:00:00 2001 From: Carly Gundy <47304080+cgundy@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:04:22 +0200 Subject: [PATCH 19/21] feat(IDX): add override for buf-breaking (#2227) Co-authored-by: IDX GitHub Automation --- .github/workflows-source/ci-pr-only.yml | 2 ++ .github/workflows/ci-pr-only.yml | 2 ++ ci/scripts/pre-commit.sh | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows-source/ci-pr-only.yml b/.github/workflows-source/ci-pr-only.yml index 63c3f36eea6..7a1f2859202 100644 --- a/.github/workflows-source/ci-pr-only.yml +++ b/.github/workflows-source/ci-pr-only.yml @@ -120,6 +120,8 @@ jobs: id: pre-commit shell: bash run: ./ci/scripts/pre-commit.sh + env: + CI_OVERRIDE_BUF_BREAKING: ${{ contains(github.event.pull_request.labels.*.name, 'CI_OVERRIDE_BUF_BREAKING') }} dependencies-check: name: Dependency Scan for PR diff --git a/.github/workflows/ci-pr-only.yml b/.github/workflows/ci-pr-only.yml index 7647d3aba4c..b70d6bb1816 100644 --- a/.github/workflows/ci-pr-only.yml +++ b/.github/workflows/ci-pr-only.yml @@ -115,6 +115,8 @@ jobs: id: pre-commit shell: bash run: ./ci/scripts/pre-commit.sh + env: + CI_OVERRIDE_BUF_BREAKING: ${{ contains(github.event.pull_request.labels.*.name, 'CI_OVERRIDE_BUF_BREAKING') }} dependencies-check: name: Dependency Scan for PR runs-on: diff --git a/ci/scripts/pre-commit.sh b/ci/scripts/pre-commit.sh index 109013a67cd..43a6ed3983c 100755 --- a/ci/scripts/pre-commit.sh +++ b/ci/scripts/pre-commit.sh @@ -5,8 +5,14 @@ rustup default stable export PATH="$HOME/.local/bin:$PATH" PIP_BREAK_SYSTEM_PACKAGES=1 pip3 install pre-commit +if [ "${CI_OVERRIDE_BUF_BREAKING:-false}" = "true" ]; then + SKIP_CHECKS="bazel_rust_format_check,bazel_smoke,buf-breaking" +else + SKIP_CHECKS="bazel_rust_format_check,bazel_smoke" +fi + # Make sure CI can pull from the private repo. -if ! SKIP=bazel_rust_format_check,bazel_smoke pre-commit run -a --hook-stage=manual; then +if ! SKIP=$SKIP_CHECKS pre-commit run -a --hook-stage=manual; then echo "Pre-commit checks failed. Here is the diff of the changes:" git diff echo From 1b17a0f626efb94f88e22c45f446844184329b22 Mon Sep 17 00:00:00 2001 From: Marko Kosmerl Date: Thu, 24 Oct 2024 11:32:35 +0200 Subject: [PATCH 20/21] chore(IDX): disable verbose rclone logs (#2226) Disabling verbose logs as we don't have any issues with deterministic builds where logs benefit the root cause analysis. --- ci/src/artifacts/upload.bash.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/src/artifacts/upload.bash.template b/ci/src/artifacts/upload.bash.template index a012181d9ff..4303efa94db 100644 --- a/ci/src/artifacts/upload.bash.template +++ b/ci/src/artifacts/upload.bash.template @@ -52,7 +52,7 @@ fi --s3-upload-cutoff=5G \ copy \ "$f" \ - "public-s3:dfinity-download-public/ic/${VERSION}/@@REMOTE_SUBDIR@@/" -vv + "public-s3:dfinity-download-public/ic/${VERSION}/@@REMOTE_SUBDIR@@/" # Upload to Cloudflare's R2 (S3) unset RCLONE_S3_ENDPOINT @@ -64,7 +64,7 @@ AWS_PROFILE=cf "@@RCLONE@@" \ --s3-upload-cutoff=5G \ copy \ "$f" \ - "public-s3-cf:dfinity-download-public/ic/${VERSION}/@@REMOTE_SUBDIR@@/" -vv + "public-s3-cf:dfinity-download-public/ic/${VERSION}/@@REMOTE_SUBDIR@@/" URL_PATH="ic/${VERSION}/@@REMOTE_SUBDIR@@/$(basename $f)" echo "https://download.dfinity.systems/${URL_PATH}" > "$2" From c5e9e2af13630e17c90f5f308cbd7d9507fb8680 Mon Sep 17 00:00:00 2001 From: kpop-dfinity <125868903+kpop-dfinity@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:42:19 +0200 Subject: [PATCH 21/21] feat(consensus): reduce consensus bouncer function refresh period from 3 seconds to 1 second. (#1885) The combination of 3 seconds refresh period and [LOOK_AHEAD](https://sourcegraph.com/github.com/dfinity/ic/-/blob/rs/consensus/src/idkg.rs?L236) being set to 10 heights, means that a node which is lagging behind the other nodes, will catch up at the rate at most `LOOK_AHEAD / REFRESH_PERIOD = 10 / 3 = 3.(3)` blocks per second. Since the notary delay is now set to `0.3s`, some subnets achieve up to `2.5` blocks per second finalization rate, which is not that far away from the maximum achievable catch up rate. Reducing the refresh period to `1s` means that in theory we could catch up 10 blocks per second. Note that computing the bouncer function is very fast- 0.0002s on average according to `consensus_bouncer_update_duration` metric. --- rs/consensus/src/consensus.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rs/consensus/src/consensus.rs b/rs/consensus/src/consensus.rs index b30c0cc0ca9..64efefa9593 100644 --- a/rs/consensus/src/consensus.rs +++ b/rs/consensus/src/consensus.rs @@ -613,7 +613,7 @@ impl BouncerFactory for Consensus } fn refresh_period(&self) -> Duration { - Duration::from_secs(3) + Duration::from_secs(1) } }