From 446bea4efd3431fa80e35a50914b2488740dcdc9 Mon Sep 17 00:00:00 2001 From: Vincent Zhang <118719397+vincent-dfinity@users.noreply.github.com> Date: Wed, 15 Jan 2025 21:04:32 +0800 Subject: [PATCH] feat: Add `CanisterInfo`. (#628) * Add CanisterInfo for management canister. * Update changelog. * Fixed format. * Force to use ubuntu-22.04 as node 14 is not supported on ubuntu-24.04. --- .github/workflows/e2e.yml | 2 +- CHANGELOG.md | 2 ++ ic-utils/src/interfaces/management_canister.rs | 2 ++ icx/src/main.rs | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a8fbb42e..8843cd6d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-13-large, ubuntu-latest ] + os: [ macos-13-large, ubuntu-22.04 ] dfx: [ '0.8.4', '0.9.2', '0.10.1', '0.11.1' ] steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a8f3b53..dcda350e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added `wasm_memory_threshold` field to `CanisterSettings`. +* Added `CanisterInfo` to `MgmtMethod`. + ## [0.39.2] - 2024-12-20 * Bumped `ic-certification` to `3.0.0`. diff --git a/ic-utils/src/interfaces/management_canister.rs b/ic-utils/src/interfaces/management_canister.rs index e5f24eb9..d498d6dc 100644 --- a/ic-utils/src/interfaces/management_canister.rs +++ b/ic-utils/src/interfaces/management_canister.rs @@ -93,6 +93,8 @@ pub enum MgmtMethod { BitcoinGetBlockHeaders, /// There is no corresponding agent function as only canisters can call it. NodeMetricsHistory, + /// There is no corresponding agent function as only canisters can call it. + CanisterInfo, } impl<'agent> ManagementCanister<'agent> { diff --git a/icx/src/main.rs b/icx/src/main.rs index db1d1ba1..95bd116c 100644 --- a/icx/src/main.rs +++ b/icx/src/main.rs @@ -326,7 +326,8 @@ pub fn get_effective_canister_id( | MgmtMethod::BitcoinGetBlockHeaders | MgmtMethod::EcdsaPublicKey | MgmtMethod::SignWithEcdsa - | MgmtMethod::NodeMetricsHistory => { + | MgmtMethod::NodeMetricsHistory + | MgmtMethod::CanisterInfo => { bail!("Management canister method {method_name} can only be run from canisters"); } }