diff --git a/Cargo.lock b/Cargo.lock index eb2843d62a1..188bf399c2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9796,6 +9796,7 @@ dependencies = [ "ic-base-types", "ic-icp-index", "ic-ledger-core", + "ic-management-canister-types", "ic-nns-constants", "ic-state-machine-tests", "icp-ledger", @@ -9876,6 +9877,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "ic-management-canister-types" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadff40906491c8c61a3c886cce4ee02f48a4798684d8a10e4a14891a217a284" +dependencies = [ + "candid", + "serde", + "serde_bytes", +] + [[package]] name = "ic-management-canister-types-private" version = "0.9.0" @@ -10041,6 +10053,7 @@ dependencies = [ "cycles-minting-canister", "ic-agent", "ic-base-types", + "ic-management-canister-types", "ic-nervous-system-clients", "ic-nns-common", "ic-nns-constants", @@ -10281,6 +10294,7 @@ dependencies = [ "ic-icrc1-tokens-u64", "ic-interfaces-registry", "ic-ledger-core", + "ic-management-canister-types", "ic-management-canister-types-private", "ic-nervous-system-agent", "ic-nervous-system-clients", @@ -11969,6 +11983,7 @@ dependencies = [ "ic-ledger-hash-of", "ic-ledger-test-utils", "ic-limits", + "ic-management-canister-types", "ic-nns-common", "ic-nns-constants", "ic-nns-governance-api", @@ -12611,6 +12626,7 @@ dependencies = [ "futures", "ic-base-types", "ic-cdk 0.17.1", + "ic-management-canister-types", "ic-management-canister-types-private", "ic-nervous-system-agent", "ic-nervous-system-integration-tests", @@ -17772,6 +17788,7 @@ dependencies = [ "ic-cdk 0.17.1", "ic-certification 3.0.3", "ic-error-types", + "ic-management-canister-types", "ic-transport-types", "k256 0.13.4", "lazy_static", @@ -18794,6 +18811,7 @@ dependencies = [ "canister-test", "ic-base-types", "ic-crypto-sha2", + "ic-management-canister-types", "ic-nervous-system-integration-tests", "ic-nns-constants", "ic-nns-test-utils", diff --git a/packages/pocket-ic/BUILD.bazel b/packages/pocket-ic/BUILD.bazel index 3cbe06bfe13..88d7318c299 100644 --- a/packages/pocket-ic/BUILD.bazel +++ b/packages/pocket-ic/BUILD.bazel @@ -9,6 +9,7 @@ DEPENDENCIES = [ "@crate_index//:candid", "@crate_index//:hex", "@crate_index//:ic-certification", + "@crate_index//:ic-management-canister-types", "@crate_index//:ic-transport-types", "@crate_index//:reqwest", "@crate_index//:schemars", diff --git a/packages/pocket-ic/Cargo.toml b/packages/pocket-ic/Cargo.toml index 2f607c8ed66..1960df3ae1f 100644 --- a/packages/pocket-ic/Cargo.toml +++ b/packages/pocket-ic/Cargo.toml @@ -25,6 +25,7 @@ base64 = { workspace = true } candid = { workspace = true } hex = { workspace = true } ic-certification = { workspace = true } +ic-management-canister-types = { workspace = true } ic-transport-types = { workspace = true } reqwest = { workspace = true } schemars = "0.8.16" diff --git a/packages/pocket-ic/src/lib.rs b/packages/pocket-ic/src/lib.rs index f84553dc1ab..631dfc12345 100644 --- a/packages/pocket-ic/src/lib.rs +++ b/packages/pocket-ic/src/lib.rs @@ -58,10 +58,6 @@ use crate::{ InstanceId, MockCanisterHttpResponse, RawEffectivePrincipal, RawMessageId, SubnetId, SubnetKind, SubnetSpec, Topology, }, - management_canister::{ - CanisterId, CanisterInstallMode, CanisterLogRecord, CanisterSettings, CanisterStatusResult, - Snapshot, - }, nonblocking::PocketIc as PocketIcAsync, }; use candid::{ @@ -69,7 +65,11 @@ use candid::{ utils::{ArgumentDecoder, ArgumentEncoder}, Principal, }; +use ic_management_canister_types::{ + CanisterId, CanisterInstallMode, CanisterSettings, CanisterStatusResult, Snapshot, +}; use ic_transport_types::SubnetMetrics; +use management_canister::CanisterLogRecord; use reqwest::{StatusCode, Url}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/packages/pocket-ic/src/management_canister.rs b/packages/pocket-ic/src/management_canister.rs index e76660c5237..451dfc9e153 100644 --- a/packages/pocket-ic/src/management_canister.rs +++ b/packages/pocket-ic/src/management_canister.rs @@ -1,3 +1,10 @@ +// ========================================================================= // +// Types associated with the IC management canister that are not specified, +// but nevertheless useful for PocketIC. +// +// TODO: These should be moved to a separate module in the public crate +// ic-management-canister-types + use candid::{CandidType, Deserialize, Principal}; pub type CanisterId = Principal; @@ -8,184 +15,139 @@ pub struct CanisterIdRecord { pub canister_id: CanisterId, } -// canister settings - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum LogVisibility { - #[serde(rename = "controllers")] - Controllers, - #[serde(rename = "public")] - Public, - #[serde(rename = "allowed_viewers")] - AllowedViewers(Vec), -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct DefiniteCanisterSettings { - pub freezing_threshold: candid::Nat, - pub controllers: Vec, - pub reserved_cycles_limit: candid::Nat, - pub log_visibility: LogVisibility, - pub wasm_memory_limit: candid::Nat, - pub memory_allocation: candid::Nat, - pub compute_allocation: candid::Nat, -} - -#[derive(CandidType, Deserialize, Debug, Clone, Default)] -pub struct CanisterSettings { - pub freezing_threshold: Option, - pub controllers: Option>, - pub reserved_cycles_limit: Option, - pub log_visibility: Option, - pub wasm_memory_limit: Option, - pub memory_allocation: Option, - pub compute_allocation: Option, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct UpdateSettingsArgs { - pub canister_id: CanisterId, - pub settings: CanisterSettings, - pub sender_canister_version: Option, -} - -// canister status - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum CanisterStatusResultStatus { - #[serde(rename = "stopped")] - Stopped, - #[serde(rename = "stopping")] - Stopping, - #[serde(rename = "running")] - Running, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct CanisterStatusResultQueryStats { - pub response_payload_bytes_total: candid::Nat, - pub num_instructions_total: candid::Nat, - pub num_calls_total: candid::Nat, - pub request_payload_bytes_total: candid::Nat, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct CanisterStatusResult { - pub status: CanisterStatusResultStatus, - pub memory_size: candid::Nat, - pub cycles: candid::Nat, - pub settings: DefiniteCanisterSettings, - pub query_stats: CanisterStatusResultQueryStats, - pub idle_cycles_burned_per_day: candid::Nat, - pub module_hash: Option>, - pub reserved_cycles: candid::Nat, -} - -// canister code installation - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum CanisterInstallModeUpgradeInnerWasmMemoryPersistenceInner { - #[serde(rename = "keep")] - Keep, - #[serde(rename = "replace")] - Replace, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct CanisterInstallModeUpgradeInner { - pub wasm_memory_persistence: Option, - pub skip_pre_upgrade: Option, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum CanisterInstallMode { - #[serde(rename = "reinstall")] - Reinstall, - #[serde(rename = "upgrade")] - Upgrade(Option), - #[serde(rename = "install")] - Install, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct InstallCodeArgs { - pub arg: Vec, - pub wasm_module: Vec, - pub mode: CanisterInstallMode, - pub canister_id: CanisterId, - pub sender_canister_version: Option, -} - -// canister code uninstallation - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct UninstallCodeArgs { - pub canister_id: CanisterId, - pub sender_canister_version: Option, -} - -// canister chunks - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct ChunkHash { - pub hash: Vec, -} - -pub type StoredChunksResult = Vec; - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct UploadChunkArgs { - pub canister_id: CanisterId, - pub chunk: Vec, -} - -pub type UploadChunkResult = ChunkHash; - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct InstallChunkedCodeArgs { - pub arg: Vec, - pub wasm_module_hash: Vec, - pub mode: CanisterInstallMode, - pub chunk_hashes_list: Vec, - pub target_canister: CanisterId, - pub store_canister: Option, - pub sender_canister_version: Option, -} - -// canister snapshots - -pub type SnapshotId = Vec; - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct Snapshot { - pub id: SnapshotId, - pub total_size: u64, - pub taken_at_timestamp: u64, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct DeleteCanisterSnapshotArgs { - pub canister_id: CanisterId, - pub snapshot_id: SnapshotId, -} - -pub type ListCanisterSnapshotsResult = Vec; - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct LoadCanisterSnapshotArgs { - pub canister_id: CanisterId, - pub sender_canister_version: Option, - pub snapshot_id: SnapshotId, +use ic_management_canister_types::{EcdsaKeyId, SchnorrKeyId}; +use serde::Serialize; +use strum_macros::{Display, EnumCount, EnumIter, EnumString}; + +/// Methods exported by ic:00. +#[derive(Copy, Clone, Eq, PartialEq, Debug, Display, EnumIter, EnumString)] +#[strum(serialize_all = "snake_case")] +pub enum Ic00Method { + CanisterStatus, + CanisterInfo, + CreateCanister, + DeleteCanister, + DepositCycles, + HttpRequest, + ECDSAPublicKey, + InstallCode, + InstallChunkedCode, + RawRand, + SetupInitialDKG, + SignWithECDSA, + StartCanister, + StopCanister, + UninstallCode, + UpdateSettings, + ComputeInitialIDkgDealings, + ReshareChainKey, + + // Schnorr interface. + SchnorrPublicKey, + SignWithSchnorr, + + // VetKd interface. + #[strum(serialize = "vetkd_public_key")] + VetKdPublicKey, + #[strum(serialize = "vetkd_derive_encrypted_key")] + VetKdDeriveEncryptedKey, + + // Bitcoin Interface. + BitcoinGetBalance, + BitcoinGetUtxos, + BitcoinGetBlockHeaders, + BitcoinSendTransaction, + BitcoinGetCurrentFeePercentiles, + // Private APIs used exclusively by the bitcoin canisters. + BitcoinSendTransactionInternal, // API for sending transactions to the network. + BitcoinGetSuccessors, // API for fetching blocks from the network. + + // Subnet information + NodeMetricsHistory, + SubnetInfo, + + FetchCanisterLogs, + + // These methods are only available on test IC instances where there is a + // need to fabricate cycles without burning ICP first. + ProvisionalCreateCanisterWithCycles, + ProvisionalTopUpCanister, + + // Support for chunked uploading of Wasm modules. + UploadChunk, + StoredChunks, + ClearChunkStore, + + // Support for canister snapshots. + TakeCanisterSnapshot, + LoadCanisterSnapshot, + ListCanisterSnapshots, + DeleteCanisterSnapshot, +} + +/// Types of curves that can be used for threshold key derivation (vetKD). +/// ```text +/// (variant { bls12_381_g2; }) +/// ``` +#[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + Debug, + CandidType, + Deserialize, + EnumIter, + Serialize, +)] +pub enum VetKdCurve { + #[serde(rename = "bls12_381_g2")] + #[allow(non_camel_case_types)] + Bls12_381_G2, +} + +/// Unique identifier for a key that can be used for threshold key derivation +/// (vetKD). The name is just an identifier, but it may be used to convey +/// some information about the key (e.g. that the key is meant to be used for +/// testing purposes). +/// ```text +/// (record { curve: vetkd_curve; name: text}) +/// ``` +#[derive( + Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, CandidType, Deserialize, Serialize, +)] +pub struct VetKdKeyId { + pub curve: VetKdCurve, + pub name: String, } -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct TakeCanisterSnapshotArgs { - pub replace_snapshot: Option, - pub canister_id: CanisterId, +/// Unique identifier for a key that can be used for one of the signature schemes +/// supported on the IC. +/// ```text +/// (variant { EcdsaKeyId; SchnorrKeyId }) +/// ``` +#[derive( + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Hash, + Debug, + CandidType, + Deserialize, + EnumCount, + Serialize, +)] +pub enum MasterPublicKeyId { + Ecdsa(EcdsaKeyId), + Schnorr(SchnorrKeyId), + VetKd(VetKdKeyId), } -pub type TakeCanisterSnapshotResult = Snapshot; - // canister logs #[derive(CandidType, Deserialize, Debug, Clone)] @@ -200,270 +162,11 @@ pub struct FetchCanisterLogsResult { pub canister_log_records: Vec, } -// provisional API - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct ProvisionalCreateCanisterWithCyclesArgs { - pub settings: Option, - pub specified_id: Option, - pub amount: Option, - pub sender_canister_version: Option, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct ProvisionalTopUpCanisterArgs { - pub canister_id: Principal, - pub amount: candid::Nat, -} - -// The following types can only be used in inter-canister calls, i.e., -// these types CANNOT be used in ingress messages to the management canister. - -// canister creation - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct CreateCanisterArgs { - pub settings: Option, - pub sender_canister_version: Option, -} - -// canister info - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct CanisterInfoArgs { - pub canister_id: CanisterId, - pub num_requested_changes: Option, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SubnetInfoArgs { - pub subnet_id: SubnetId, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum ChangeOrigin { - #[serde(rename = "from_user")] - FromUser { user_id: Principal }, - #[serde(rename = "from_canister")] - FromCanister { - canister_version: Option, - canister_id: Principal, - }, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum ChangeDetailsCodeDeploymentMode { - #[serde(rename = "reinstall")] - Reinstall, - #[serde(rename = "upgrade")] - Upgrade, - #[serde(rename = "install")] - Install, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum ChangeDetails { - #[serde(rename = "creation")] - Creation { controllers: Vec }, - #[serde(rename = "code_deployment")] - CodeDeployment { - mode: ChangeDetailsCodeDeploymentMode, - module_hash: Vec, - }, - #[serde(rename = "load_snapshot")] - LoadSnapshot { - canister_version: u64, - taken_at_timestamp: u64, - snapshot_id: SnapshotId, - }, - #[serde(rename = "controllers_change")] - ControllersChange { controllers: Vec }, - #[serde(rename = "code_uninstall")] - CodeUninstall, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct Change { - pub timestamp_nanos: u64, - pub canister_version: u64, - pub origin: ChangeOrigin, - pub details: ChangeDetails, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct CanisterInfoResult { - pub controllers: Vec, - pub module_hash: Option>, - pub recent_changes: Vec, - pub total_num_changes: u64, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SubnetInfoResult { - pub replica_version: String, -} - -// raw randomness - -pub type RawRandResult = Vec; - -// node metrics - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct NodeMetricsHistoryArgs { - pub start_at_timestamp_nanos: u64, - pub subnet_id: Principal, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct NodeMetrics { - pub num_block_failures_total: u64, - pub node_id: Principal, - pub num_blocks_proposed_total: u64, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct NodeMetricsHistoryResultItem { - pub timestamp_nanos: u64, - pub node_metrics: Vec, -} - -pub type NodeMetricsHistoryResult = Vec; - -// canister http - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum HttpRequestArgsMethod { - #[serde(rename = "get")] - Get, - #[serde(rename = "head")] - Head, - #[serde(rename = "post")] - Post, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct HttpHeader { - pub value: String, - pub name: String, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct HttpRequestArgsTransformInnerFunctionArg { - pub context: Vec, - pub response: HttpRequestResult, -} - -candid::define_function!(pub HttpRequestArgsTransformInnerFunction : ( - HttpRequestArgsTransformInnerFunctionArg, - ) -> (HttpRequestResult) query); - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct HttpRequestArgsTransformInner { - pub function: HttpRequestArgsTransformInnerFunction, - pub context: Vec, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct HttpRequestArgs { - pub url: String, - pub method: HttpRequestArgsMethod, - pub max_response_bytes: Option, - pub body: Option>, - pub transform: Option, - pub headers: Vec, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct HttpRequestResult { - pub status: candid::Nat, - pub body: Vec, - pub headers: Vec, -} - -// ecdsa - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum EcdsaCurve { - #[serde(rename = "secp256k1")] - Secp256K1, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct EcdsaPublicKeyArgsKeyId { - pub name: String, - pub curve: EcdsaCurve, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct EcdsaPublicKeyArgs { - pub key_id: EcdsaPublicKeyArgsKeyId, - pub canister_id: Option, - pub derivation_path: Vec>, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct EcdsaPublicKeyResult { - pub public_key: Vec, - pub chain_code: Vec, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SignWithEcdsaArgsKeyId { - pub name: String, - pub curve: EcdsaCurve, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SignWithEcdsaArgs { - pub key_id: SignWithEcdsaArgsKeyId, - pub derivation_path: Vec>, - pub message_hash: Vec, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SignWithEcdsaResult { - pub signature: Vec, -} - -// schnorr - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub enum SchnorrAlgorithm { - #[serde(rename = "ed25519")] - Ed25519, - #[serde(rename = "bip340secp256k1")] - Bip340Secp256K1, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SchnorrPublicKeyArgsKeyId { - pub algorithm: SchnorrAlgorithm, - pub name: String, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SchnorrPublicKeyArgs { - pub key_id: SchnorrPublicKeyArgsKeyId, - pub canister_id: Option, - pub derivation_path: Vec>, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SchnorrPublicKeyResult { - pub public_key: Vec, - pub chain_code: Vec, -} - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SignWithSchnorrArgsKeyId { - pub algorithm: SchnorrAlgorithm, - pub name: String, -} - +// more recent version of the public crate: +// TODO: remove #[derive(CandidType, Deserialize, Debug, Clone)] pub struct SignWithSchnorrArgs { - pub key_id: SignWithSchnorrArgsKeyId, + pub key_id: SchnorrKeyId, pub derivation_path: Vec>, pub message: Vec, pub aux: Option, @@ -479,101 +182,3 @@ pub enum SignWithSchnorrAux { pub struct SignWithBip341Aux { pub merkle_root_hash: Vec, } - -#[derive(CandidType, Deserialize, Debug, Clone)] -pub struct SignWithSchnorrResult { - pub signature: Vec, -} - -// bitcoin - -#[derive(CandidType, Deserialize)] -pub enum BitcoinNetwork { - #[serde(rename = "mainnet")] - Mainnet, - #[serde(rename = "testnet")] - Testnet, -} - -pub type BitcoinAddress = String; - -#[derive(CandidType, Deserialize)] -pub struct BitcoinGetBalanceArgs { - pub network: BitcoinNetwork, - pub address: BitcoinAddress, - pub min_confirmations: Option, -} - -pub type Satoshi = u64; - -pub type BitcoinGetBalanceResult = Satoshi; - -#[derive(CandidType, Deserialize)] -pub enum BitcoinGetUtxosArgsFilterInner { - #[serde(rename = "page")] - Page(Vec), - #[serde(rename = "min_confirmations")] - MinConfirmations(u32), -} - -#[derive(CandidType, Deserialize)] -pub struct BitcoinGetUtxosArgs { - pub network: BitcoinNetwork, - pub filter: Option, - pub address: BitcoinAddress, -} - -pub type BitcoinBlockHeight = u32; - -pub type BitcoinBlockHash = Vec; - -#[derive(CandidType, Deserialize)] -pub struct Outpoint { - pub txid: Vec, - pub vout: u32, -} - -#[derive(CandidType, Deserialize)] -pub struct Utxo { - pub height: u32, - pub value: Satoshi, - pub outpoint: Outpoint, -} - -#[derive(CandidType, Deserialize)] -pub struct BitcoinGetUtxosResult { - pub next_page: Option>, - pub tip_height: BitcoinBlockHeight, - pub tip_block_hash: BitcoinBlockHash, - pub utxos: Vec, -} - -#[derive(CandidType, Deserialize)] -pub struct BitcoinSendTransactionArgs { - pub transaction: Vec, - pub network: BitcoinNetwork, -} - -#[derive(CandidType, Deserialize)] -pub struct BitcoinGetCurrentFeePercentilesArgs { - pub network: BitcoinNetwork, -} - -pub type MillisatoshiPerByte = u64; - -pub type BitcoinGetCurrentFeePercentilesResult = Vec; - -#[derive(CandidType, Deserialize)] -pub struct BitcoinGetBlockHeadersArgs { - pub start_height: BitcoinBlockHeight, - pub end_height: Option, - pub network: BitcoinNetwork, -} - -pub type BitcoinBlockHeader = Vec; - -#[derive(CandidType, Deserialize)] -pub struct BitcoinGetBlockHeadersResult { - pub tip_height: BitcoinBlockHeight, - pub block_headers: Vec, -} diff --git a/packages/pocket-ic/src/nonblocking.rs b/packages/pocket-ic/src/nonblocking.rs index 84d04a1f141..658b941be7a 100644 --- a/packages/pocket-ic/src/nonblocking.rs +++ b/packages/pocket-ic/src/nonblocking.rs @@ -8,12 +8,7 @@ use crate::common::rest::{ RawTime, RawVerifyCanisterSigArg, SubnetId, TickConfigs, Topology, }; use crate::management_canister::{ - CanisterId, CanisterIdRecord, CanisterInstallMode, CanisterInstallModeUpgradeInner, - CanisterInstallModeUpgradeInnerWasmMemoryPersistenceInner, CanisterLogRecord, CanisterSettings, - CanisterStatusResult, ChunkHash, DeleteCanisterSnapshotArgs, FetchCanisterLogsResult, - InstallChunkedCodeArgs, InstallCodeArgs, LoadCanisterSnapshotArgs, - ProvisionalCreateCanisterWithCyclesArgs, Snapshot, StoredChunksResult, - TakeCanisterSnapshotArgs, UpdateSettingsArgs, UploadChunkArgs, UploadChunkResult, + CanisterId, CanisterIdRecord, CanisterLogRecord, FetchCanisterLogsResult, }; pub use crate::DefaultEffectiveCanisterIdError; use crate::{IngressStatusResult, PocketIcBuilder, RejectResponse}; @@ -25,6 +20,14 @@ use candid::{ Principal, }; use ic_certification::{Certificate, Label, LookupResult}; +use ic_management_canister_types::{ + CanisterInstallMode, CanisterSettings, CanisterStatusResult, ChunkHash, + DeleteCanisterSnapshotArgs, InstallChunkedCodeArgs, InstallCodeArgs, LoadCanisterSnapshotArgs, + ProvisionalCreateCanisterWithCyclesArgs, Snapshot, StoredChunksResult, + TakeCanisterSnapshotArgs, UpdateSettingsArgs, UpgradeFlags as CanisterInstallModeUpgradeInner, + UploadChunkArgs, UploadChunkResult, + WasmMemoryPersistence as CanisterInstallModeUpgradeInnerWasmMemoryPersistenceInner, +}; use ic_transport_types::Envelope; use ic_transport_types::EnvelopeContent::ReadState; use ic_transport_types::{ReadStateResponse, SubnetMetrics}; diff --git a/packages/pocket-ic/tests/management_canister.rs b/packages/pocket-ic/tests/management_canister.rs deleted file mode 100644 index fe1c68e261e..00000000000 --- a/packages/pocket-ic/tests/management_canister.rs +++ /dev/null @@ -1,196 +0,0 @@ -use ic_cdk::{query, update}; -use pocket_ic::management_canister::*; - -#[update] -fn create_canister(_: CreateCanisterArgs) -> CanisterIdRecord { - unreachable!() -} - -#[update] -fn update_settings(_: UpdateSettingsArgs) { - unreachable!() -} - -#[update] -fn upload_chunk(_: UploadChunkArgs) -> UploadChunkResult { - unreachable!() -} - -#[update] -fn clear_chunk_store(_: CanisterIdRecord) { - unreachable!() -} - -#[update] -fn stored_chunks(_: CanisterIdRecord) -> StoredChunksResult { - unreachable!() -} - -#[update] -fn install_code(_: InstallCodeArgs) { - unreachable!() -} - -#[update] -fn install_chunked_code(_: InstallChunkedCodeArgs) { - unreachable!() -} - -#[update] -fn uninstall_code(_: UninstallCodeArgs) { - unreachable!() -} - -#[update] -fn start_canister(_: CanisterIdRecord) { - unreachable!() -} - -#[update] -fn stop_canister(_: CanisterIdRecord) { - unreachable!() -} - -#[update] -fn canister_status(_: CanisterIdRecord) -> CanisterStatusResult { - unreachable!() -} - -#[update] -fn canister_info(_: CanisterInfoArgs) -> CanisterInfoResult { - unreachable!() -} - -#[update] -fn subnet_info(_: SubnetInfoArgs) -> SubnetInfoResult { - unreachable!() -} - -#[update] -fn delete_canister(_: CanisterIdRecord) { - unreachable!() -} - -#[update] -fn deposit_cycles(_: CanisterIdRecord) { - unreachable!() -} - -#[update] -fn raw_rand() -> RawRandResult { - unreachable!() -} - -#[update] -fn http_request(_: HttpRequestArgs) -> HttpRequestResult { - unreachable!() -} - -#[update] -fn ecdsa_public_key(_: EcdsaPublicKeyArgs) -> EcdsaPublicKeyResult { - unreachable!() -} - -#[update] -fn sign_with_ecdsa(_: SignWithEcdsaArgs) -> SignWithEcdsaResult { - unreachable!() -} - -#[update] -fn schnorr_public_key(_: SchnorrPublicKeyArgs) -> SchnorrPublicKeyResult { - unreachable!() -} - -#[update] -fn sign_with_schnorr(_: SignWithSchnorrArgs) -> SignWithSchnorrResult { - unreachable!() -} - -#[update] -fn bitcoin_get_balance(_: BitcoinGetBalanceArgs) -> BitcoinGetBalanceResult { - unreachable!() -} - -#[update] -fn bitcoin_get_utxos(_: BitcoinGetUtxosArgs) -> BitcoinGetUtxosResult { - unreachable!() -} - -#[update] -fn bitcoin_send_transaction(_: BitcoinSendTransactionArgs) { - unreachable!() -} - -#[update] -fn bitcoin_get_current_fee_percentiles( - _: BitcoinGetCurrentFeePercentilesArgs, -) -> BitcoinGetCurrentFeePercentilesResult { - unreachable!() -} - -#[update] -fn bitcoin_get_block_headers(_: BitcoinGetBlockHeadersArgs) -> BitcoinGetBlockHeadersResult { - unreachable!() -} - -#[update] -fn node_metrics_history(_: NodeMetricsHistoryArgs) -> NodeMetricsHistoryResult { - unreachable!() -} - -#[update] -fn provisional_create_canister_with_cycles( - _: ProvisionalCreateCanisterWithCyclesArgs, -) -> CanisterIdRecord { - unreachable!() -} - -#[update] -fn provisional_top_up_canister(_: ProvisionalTopUpCanisterArgs) { - unreachable!() -} - -#[update] -fn take_canister_snapshot(_: TakeCanisterSnapshotArgs) -> TakeCanisterSnapshotResult { - unreachable!() -} - -#[update] -fn load_canister_snapshot(_: LoadCanisterSnapshotArgs) { - unreachable!() -} - -#[update] -fn list_canister_snapshots(_: CanisterIdRecord) -> ListCanisterSnapshotsResult { - unreachable!() -} - -#[update] -fn delete_canister_snapshot(_: DeleteCanisterSnapshotArgs) { - unreachable!() -} - -#[query] -fn fetch_canister_logs(_: CanisterIdRecord) -> FetchCanisterLogsResult { - unreachable!() -} - -#[cfg(test)] -mod test { - use candid_parser::utils::{service_equal, CandidSource}; - use pocket_ic::management_canister::*; - - #[test] - fn candid_equality_test() { - let declared_interface_str = - std::fs::read_to_string(std::env::var_os("IC_DID").unwrap()).unwrap(); - let declared_interface = CandidSource::Text(&declared_interface_str); - - candid::export_service!(); - let implemented_interface_str = __export_service(); - let implemented_interface = CandidSource::Text(&implemented_interface_str); - - let result = service_equal(declared_interface, implemented_interface); - assert!(result.is_ok(), "{:?}\n\n", result.unwrap_err()); - } -} diff --git a/packages/pocket-ic/tests/tests.rs b/packages/pocket-ic/tests/tests.rs index 8e9874b52e9..7ec44282d1d 100644 --- a/packages/pocket-ic/tests/tests.rs +++ b/packages/pocket-ic/tests/tests.rs @@ -1,14 +1,15 @@ use candid::{decode_one, encode_one, CandidType, Decode, Deserialize, Encode, Principal}; use ic_certification::Label; +use ic_management_canister_types::{ + CanisterInstallMode, CanisterSettings, EcdsaPublicKeyResult, HttpRequestResult, + NodeMetricsHistoryArgs, NodeMetricsHistoryRecord as NodeMetricsHistoryResultItem, + ProvisionalCreateCanisterWithCyclesArgs, SchnorrAlgorithm, + SchnorrKeyId as SchnorrPublicKeyArgsKeyId, SchnorrPublicKeyResult, +}; use ic_transport_types::Envelope; use ic_transport_types::EnvelopeContent::ReadState; use pocket_ic::common::rest::{BlockmakerConfigs, RawSubnetBlockmaker, TickConfigs}; -use pocket_ic::management_canister::{ - CanisterIdRecord, CanisterInstallMode, CanisterSettings, EcdsaPublicKeyResult, - HttpRequestResult, NodeMetricsHistoryArgs, NodeMetricsHistoryResultItem, - ProvisionalCreateCanisterWithCyclesArgs, SchnorrAlgorithm, SchnorrPublicKeyArgsKeyId, - SchnorrPublicKeyResult, SignWithBip341Aux, SignWithSchnorrAux, -}; +use pocket_ic::management_canister::{CanisterIdRecord, SignWithBip341Aux, SignWithSchnorrAux}; use pocket_ic::{ common::rest::{ BlobCompression, CanisterHttpReply, CanisterHttpResponse, MockCanisterHttpResponse, @@ -928,11 +929,11 @@ fn test_schnorr() { Some(SignWithSchnorrAux::Bip341(SignWithBip341Aux { merkle_root_hash: b"Hello, aux!=====================".to_vec(), })); - for algorithm in [SchnorrAlgorithm::Bip340Secp256K1, SchnorrAlgorithm::Ed25519] { + for algorithm in [SchnorrAlgorithm::Bip340secp256k1, SchnorrAlgorithm::Ed25519] { for name in ["key_1", "test_key_1", "dfx_test_key"] { for aux in [None, some_aux.clone()] { let key_id = SchnorrPublicKeyArgsKeyId { - algorithm: algorithm.clone(), + algorithm, name: name.to_string(), }; @@ -965,7 +966,7 @@ fn test_schnorr() { // We verify the Schnorr signature. match key_id.algorithm { - SchnorrAlgorithm::Bip340Secp256K1 => { + SchnorrAlgorithm::Bip340secp256k1 => { use k256::ecdsa::signature::hazmat::PrehashVerifier; use k256::schnorr::{Signature, VerifyingKey}; let bip340_public_key = schnorr_public_key.public_key[1..].to_vec(); @@ -2303,8 +2304,8 @@ fn test_custom_blockmaker_metrics() { .unwrap(); assert_eq!(blockmaker_1_metrics.num_blocks_proposed_total, daily_blocks); - assert_eq!(blockmaker_1_metrics.num_block_failures_total, 0); + assert_eq!(blockmaker_1_metrics.num_blocks_failures_total, 0); assert_eq!(blockmaker_2_metrics.num_blocks_proposed_total, 0); - assert_eq!(blockmaker_2_metrics.num_block_failures_total, daily_blocks); + assert_eq!(blockmaker_2_metrics.num_blocks_failures_total, daily_blocks); } diff --git a/rs/boundary_node/rate_limits/integration_tests/BUILD.bazel b/rs/boundary_node/rate_limits/integration_tests/BUILD.bazel index 5f78c064fb8..b7941aa9bd2 100644 --- a/rs/boundary_node/rate_limits/integration_tests/BUILD.bazel +++ b/rs/boundary_node/rate_limits/integration_tests/BUILD.bazel @@ -10,6 +10,7 @@ DEPENDENCIES = [ "//rs/types/base_types", "@crate_index//:assert_matches", "@crate_index//:candid", + "@crate_index//:ic-management-canister-types", "@crate_index//:serde", "@crate_index//:tokio", ] + select({ diff --git a/rs/boundary_node/rate_limits/integration_tests/Cargo.toml b/rs/boundary_node/rate_limits/integration_tests/Cargo.toml index 26ff978f688..4e7f34fbc84 100644 --- a/rs/boundary_node/rate_limits/integration_tests/Cargo.toml +++ b/rs/boundary_node/rate_limits/integration_tests/Cargo.toml @@ -8,6 +8,7 @@ documentation.workspace = true [dependencies] rate-limits-api = { path = "../api" } +ic-management-canister-types = { workspace = true } ic-nervous-system-integration-tests = { path = "../../../nervous_system/integration_tests" } ic-base-types = { path = "../../../types/base_types" } assert_matches = { workspace = true } @@ -23,4 +24,3 @@ ic-registry-keys = { path = "../../../registry/keys" } ic-registry-transport = { path = "../../../registry/transport" } canister-test = { path = "../../../rust_canisters/canister_test" } ic-nns-test-utils = { path = "../../../nns/test_utils" } - diff --git a/rs/boundary_node/rate_limits/integration_tests/src/pocket_ic_helpers.rs b/rs/boundary_node/rate_limits/integration_tests/src/pocket_ic_helpers.rs index 02c2ea31af4..b3f06678dc7 100644 --- a/rs/boundary_node/rate_limits/integration_tests/src/pocket_ic_helpers.rs +++ b/rs/boundary_node/rate_limits/integration_tests/src/pocket_ic_helpers.rs @@ -2,15 +2,15 @@ use candid::{CandidType, Decode, Encode, Principal}; use canister_test::Project; use canister_test::Wasm; use ic_crypto_sha2::Sha256; +use ic_management_canister_types::CanisterSettings; use ic_nns_constants::{REGISTRY_CANISTER_ID, ROOT_CANISTER_ID}; use ic_nns_test_utils::common::{ build_mainnet_registry_wasm, build_registry_wasm, NnsInitPayloadsBuilder, }; use ic_registry_transport::pb::v1::RegistryAtomicMutateRequest; -use pocket_ic::{management_canister::CanisterSettings, nonblocking::PocketIc, PocketIcBuilder}; +use pocket_ic::{nonblocking::PocketIc, PocketIcBuilder}; use rate_limits_api::InitArg; use serde::de::DeserializeOwned; - /// Builds the WASM for the rate-limit canister. pub fn build_rate_limits_wasm() -> Wasm { Project::cargo_bin_maybe_from_env("rate-limits-canister", &[]) diff --git a/rs/ledger_suite/icp/test_utils/BUILD.bazel b/rs/ledger_suite/icp/test_utils/BUILD.bazel index e3f533dab01..e0dd83bb7ea 100644 --- a/rs/ledger_suite/icp/test_utils/BUILD.bazel +++ b/rs/ledger_suite/icp/test_utils/BUILD.bazel @@ -23,6 +23,7 @@ rust_library( "//rs/types/base_types", "@crate_index//:candid", "@crate_index//:hex", + "@crate_index//:ic-management-canister-types", "@crate_index//:serde", ], ) diff --git a/rs/ledger_suite/icp/test_utils/Cargo.toml b/rs/ledger_suite/icp/test_utils/Cargo.toml index 3b0cc0ad234..2253a4090f5 100644 --- a/rs/ledger_suite/icp/test_utils/Cargo.toml +++ b/rs/ledger_suite/icp/test_utils/Cargo.toml @@ -15,6 +15,7 @@ ic-icp-index = { path = "../index" } ic-ledger-core = { path = "../../common/ledger_core" } ic-nns-constants = { path = "../../../nns/constants" } ic-state-machine-tests = { path = "../../../state_machine_tests" } +ic-management-canister-types = { workspace = true } icp-ledger = { path = ".." } icrc-ledger-types = { path = "../../../../packages/icrc-ledger-types" } on_wire = { path = "../../../rust_canisters/on_wire" } diff --git a/rs/ledger_suite/icp/test_utils/src/pocket_ic_helpers/mod.rs b/rs/ledger_suite/icp/test_utils/src/pocket_ic_helpers/mod.rs index 5d4050f78f8..b9219acb28a 100644 --- a/rs/ledger_suite/icp/test_utils/src/pocket_ic_helpers/mod.rs +++ b/rs/ledger_suite/icp/test_utils/src/pocket_ic_helpers/mod.rs @@ -1,7 +1,7 @@ use candid::{CandidType, Decode, Encode, Nat, Principal}; use ic_base_types::{CanisterId, PrincipalId}; +use ic_management_canister_types::CanisterSettings; use ic_nns_constants::ALL_NNS_CANISTER_IDS; -use pocket_ic::management_canister::CanisterSettings; use pocket_ic::PocketIc; use serde::Deserialize; diff --git a/rs/nervous_system/agent/BUILD.bazel b/rs/nervous_system/agent/BUILD.bazel index b4d3f3435b0..552a5a97e92 100644 --- a/rs/nervous_system/agent/BUILD.bazel +++ b/rs/nervous_system/agent/BUILD.bazel @@ -19,6 +19,7 @@ DEPENDENCIES = [ "@crate_index//:anyhow", "@crate_index//:candid", "@crate_index//:ic-agent", + "@crate_index//:ic-management-canister-types", "@crate_index//:itertools", "@crate_index//:serde", "@crate_index//:serde_cbor", diff --git a/rs/nervous_system/agent/Cargo.toml b/rs/nervous_system/agent/Cargo.toml index 5a80705b0e0..447323962d6 100644 --- a/rs/nervous_system/agent/Cargo.toml +++ b/rs/nervous_system/agent/Cargo.toml @@ -12,6 +12,7 @@ anyhow = { workspace = true } candid = { workspace = true } ic-agent = { workspace = true } ic-base-types = { path = "../../types/base_types" } +ic-management-canister-types = { workspace = true } ic-nns-common = { path = "../../nns/common" } ic-nervous-system-clients = { path = "../clients" } ic-nns-governance-api = { path = "../../nns/governance/api" } diff --git a/rs/nervous_system/agent/src/pocketic_impl.rs b/rs/nervous_system/agent/src/pocketic_impl.rs index 64a22a04290..590c3d38553 100644 --- a/rs/nervous_system/agent/src/pocketic_impl.rs +++ b/rs/nervous_system/agent/src/pocketic_impl.rs @@ -4,9 +4,10 @@ use crate::management_canister::requests::{ use crate::Request; use crate::{CallCanisters, CanisterInfo}; use candid::Principal; +use ic_management_canister_types::{CanisterStatusResult, DefiniteCanisterSettings}; use pocket_ic::common::rest::RawEffectivePrincipal; -use pocket_ic::management_canister::DefiniteCanisterSettings; -use pocket_ic::{management_canister::CanisterStatusResult, nonblocking::PocketIc}; +use pocket_ic::nonblocking::PocketIc; + use thiserror::Error; /// A wrapper around PocketIc that specifies a sender for the requests. diff --git a/rs/nervous_system/integration_tests/BUILD.bazel b/rs/nervous_system/integration_tests/BUILD.bazel index 111a3dee5ed..188b97b4d93 100644 --- a/rs/nervous_system/integration_tests/BUILD.bazel +++ b/rs/nervous_system/integration_tests/BUILD.bazel @@ -34,6 +34,7 @@ BASE_DEPENDENCIES = [ "@crate_index//:assert_matches", "@crate_index//:candid", "@crate_index//:futures", + "@crate_index//:ic-management-canister-types", "@crate_index//:itertools", "@crate_index//:lazy_static", "@crate_index//:prost", diff --git a/rs/nervous_system/integration_tests/Cargo.toml b/rs/nervous_system/integration_tests/Cargo.toml index e71c7d2eac4..802996c7752 100644 --- a/rs/nervous_system/integration_tests/Cargo.toml +++ b/rs/nervous_system/integration_tests/Cargo.toml @@ -15,6 +15,7 @@ futures = { workspace = true } ic-base-types = { path = "../../types/base_types" } ic-interfaces-registry = { path = "../../interfaces/registry" } ic-ledger-core = { path = "../../ledger_suite/common/ledger_core" } +ic-management-canister-types = { workspace = true } ic-nervous-system-agent = { path = "../agent" } ic-nervous-system-clients = { path = "../clients" } ic-nervous-system-common = { path = "../common" } diff --git a/rs/nervous_system/integration_tests/src/pocket_ic_helpers.rs b/rs/nervous_system/integration_tests/src/pocket_ic_helpers.rs index d4288026ccf..6242a6936c1 100644 --- a/rs/nervous_system/integration_tests/src/pocket_ic_helpers.rs +++ b/rs/nervous_system/integration_tests/src/pocket_ic_helpers.rs @@ -4,6 +4,7 @@ use futures::{stream, StreamExt}; use ic_base_types::{CanisterId, PrincipalId, SubnetId}; use ic_interfaces_registry::{RegistryDataProvider, ZERO_REGISTRY_VERSION}; use ic_ledger_core::Tokens; +use ic_management_canister_types::CanisterSettings; use ic_nervous_system_agent::{ pocketic_impl::{PocketIcAgent, PocketIcCallError}, sns::Sns, @@ -70,10 +71,7 @@ use icrc_ledger_types::icrc1::{ }; use itertools::{EitherOrBoth, Itertools}; use maplit::btreemap; -use pocket_ic::{ - management_canister::CanisterSettings, nonblocking::PocketIc, ErrorCode, PocketIcBuilder, - RejectResponse, -}; +use pocket_ic::{nonblocking::PocketIc, ErrorCode, PocketIcBuilder, RejectResponse}; use prost::Message; use rust_decimal::prelude::ToPrimitive; use std::{collections::BTreeMap, fmt::Write, ops::Range, path::Path, time::Duration}; diff --git a/rs/rosetta-api/icp/BUILD.bazel b/rs/rosetta-api/icp/BUILD.bazel index ba8d176fb85..00da1c88bef 100644 --- a/rs/rosetta-api/icp/BUILD.bazel +++ b/rs/rosetta-api/icp/BUILD.bazel @@ -38,6 +38,7 @@ DEPENDENCIES = [ "@crate_index//:clap", "@crate_index//:hex", "@crate_index//:ic-agent", + "@crate_index//:ic-management-canister-types", "@crate_index//:lazy_static", "@crate_index//:num-bigint", "@crate_index//:prometheus", diff --git a/rs/rosetta-api/icp/Cargo.toml b/rs/rosetta-api/icp/Cargo.toml index 8fa6e32fa84..336691a4d3a 100644 --- a/rs/rosetta-api/icp/Cargo.toml +++ b/rs/rosetta-api/icp/Cargo.toml @@ -26,6 +26,7 @@ ic-ledger-canister-blocks-synchronizer = { path = "ledger_canister_blocks_synchr ic-ledger-canister-core = { path = "../../ledger_suite/common/ledger_canister_core" } ic-ledger-core = { path = "../../ledger_suite/common/ledger_core" } ic-ledger-hash-of = { path = "../../../packages/ic-ledger-hash-of" } +ic-management-canister-types = { workspace = true } ic-nns-common = { path = "../../nns/common" } ic-nns-constants = { path = "../../nns/constants" } ic-nns-governance-api = { path = "../../nns/governance/api" } diff --git a/rs/rosetta-api/icp/tests/system_tests/common/system_test_environment.rs b/rs/rosetta-api/icp/tests/system_tests/common/system_test_environment.rs index 549a477da87..ebde28468e6 100644 --- a/rs/rosetta-api/icp/tests/system_tests/common/system_test_environment.rs +++ b/rs/rosetta-api/icp/tests/system_tests/common/system_test_environment.rs @@ -18,6 +18,7 @@ use ic_icrc1_test_utils::LedgerEndpointArg; use ic_icrc1_tokens_u256::U256; use ic_ledger_test_utils::build_ledger_wasm; use ic_ledger_test_utils::pocket_ic_helpers::ledger::LEDGER_CANISTER_ID; +use ic_management_canister_types::CanisterSettings; use ic_nns_common::init::LifelineCanisterInitPayloadBuilder; use ic_nns_constants::GOVERNANCE_CANISTER_ID; use ic_nns_constants::LIFELINE_CANISTER_ID; @@ -35,7 +36,7 @@ use icp_ledger::{AccountIdentifier, LedgerCanisterInitPayload}; use icrc_ledger_agent::Icrc1Agent; use icrc_ledger_types::icrc1::account::Account; use num_traits::cast::ToPrimitive; -use pocket_ic::{management_canister::CanisterSettings, nonblocking::PocketIc, PocketIcBuilder}; +use pocket_ic::{nonblocking::PocketIc, PocketIcBuilder}; use prost::Message; use registry_canister::init::RegistryCanisterInitPayloadBuilder; use rosetta_core::identifiers::NetworkIdentifier; diff --git a/rs/sns/testing/BUILD.bazel b/rs/sns/testing/BUILD.bazel index b63f3efa11c..1f54f36ffa4 100644 --- a/rs/sns/testing/BUILD.bazel +++ b/rs/sns/testing/BUILD.bazel @@ -17,6 +17,7 @@ DEPENDENCIES = [ "//rs/types/management_canister_types", "@crate_index//:candid", "@crate_index//:clap", + "@crate_index//:ic-management-canister-types", "@crate_index//:futures", "@crate_index//:reqwest", "@crate_index//:tokio", diff --git a/rs/sns/testing/Cargo.toml b/rs/sns/testing/Cargo.toml index 08df81b2fb9..84d04e3ee96 100644 --- a/rs/sns/testing/Cargo.toml +++ b/rs/sns/testing/Cargo.toml @@ -24,6 +24,7 @@ clap = { workspace = true } futures = { workspace = true } ic-base-types = { path = "../../types/base_types" } ic-cdk = { workspace = true } +ic-management-canister-types = { workspace = true } ic-management-canister-types-private = { path = "../../types/management_canister_types" } ic-nervous-system-agent = { path = "../../nervous_system/agent" } ic-nervous-system-integration-tests = { path = "../../nervous_system/integration_tests" } @@ -36,4 +37,3 @@ pocket-ic = { path = "../../../packages/pocket-ic" } reqwest = { workspace = true } serde = { workspace = true } tokio = { workspace = true } - diff --git a/rs/sns/testing/src/sns.rs b/rs/sns/testing/src/sns.rs index 9235c3b3ddc..daafadfaa20 100644 --- a/rs/sns/testing/src/sns.rs +++ b/rs/sns/testing/src/sns.rs @@ -1,6 +1,7 @@ use candid::{CandidType, Encode}; use canister_test::Wasm; use ic_base_types::CanisterId; +use ic_management_canister_types::CanisterStatusType as CanisterStatusResultStatus; use ic_management_canister_types_private::CanisterInstallMode; use ic_nervous_system_agent::sns::Sns; use ic_nervous_system_integration_tests::{ @@ -19,7 +20,7 @@ use ic_nns_common::pb::v1::ProposalId; use ic_nns_constants::ROOT_CANISTER_ID; use ic_sns_governance_api::pb::v1::UpgradeSnsControlledCanister; use ic_sns_swap::pb::v1::Lifecycle; -use pocket_ic::{management_canister::CanisterStatusResultStatus, nonblocking::PocketIc}; +use pocket_ic::nonblocking::PocketIc; // TODO @rvem: I don't like the fact that this struct definition is copy-pasted from 'canister/canister.rs'. // We should extract it into a separate crate and reuse in both canister and this crates.