From 3fc84840839a50bb4bac85fb93bff313bb01c38d Mon Sep 17 00:00:00 2001 From: Michael Weigelt Date: Wed, 23 Oct 2024 09:39:40 +0000 Subject: [PATCH] renaming --- .../src/canister_manager.rs | 2 +- .../src/execution_environment.rs | 17 +++++++++-------- .../src/execution_environment_metrics.rs | 2 +- .../src/ic00_permissions.rs | 2 +- rs/execution_environment/src/scheduler.rs | 4 ++-- rs/execution_environment/tests/dts.rs | 2 +- rs/system_api/src/routing.rs | 4 ++-- rs/system_api/src/sandbox_safe_system_state.rs | 2 +- rs/types/management_canister_types/src/lib.rs | 14 +++++++------- rs/types/types/src/messages/ingress_messages.rs | 2 +- rs/types/types/src/messages/inter_canister.rs | 2 +- 11 files changed, 27 insertions(+), 26 deletions(-) diff --git a/rs/execution_environment/src/canister_manager.rs b/rs/execution_environment/src/canister_manager.rs index 7ff12636a26..35c59e5a2f1 100644 --- a/rs/execution_environment/src/canister_manager.rs +++ b/rs/execution_environment/src/canister_manager.rs @@ -477,7 +477,7 @@ impl CanisterManager { | Ok(Ic00Method::BitcoinSendTransactionInternal) | Ok(Ic00Method::BitcoinGetCurrentFeePercentiles) | Ok(Ic00Method::NodeMetricsHistory) - | Ok(Ic00Method::SubnetStats) => Err(UserError::new( + | Ok(Ic00Method::SubnetMetrics) => Err(UserError::new( ErrorCode::CanisterRejectedMessage, format!("Only canisters can call ic00 method {}", method_name), )), diff --git a/rs/execution_environment/src/execution_environment.rs b/rs/execution_environment/src/execution_environment.rs index 737a54355aa..e77a4f32952 100644 --- a/rs/execution_environment/src/execution_environment.rs +++ b/rs/execution_environment/src/execution_environment.rs @@ -39,7 +39,7 @@ use ic_management_canister_types::{ LoadCanisterSnapshotArgs, MasterPublicKeyId, Method as Ic00Method, NodeMetricsHistoryArgs, Payload as Ic00Payload, ProvisionalCreateCanisterWithCyclesArgs, ProvisionalTopUpCanisterArgs, SchnorrPublicKeyArgs, SchnorrPublicKeyResponse, SetupInitialDKGArgs, SignWithECDSAArgs, - SignWithSchnorrArgs, StoredChunksArgs, SubnetStatsArgs, SubnetStatsResponse, + SignWithSchnorrArgs, StoredChunksArgs, SubnetMetricsArgs, SubnetMetricsResponse, TakeCanisterSnapshotArgs, UninstallCodeArgs, UpdateSettingsArgs, UploadChunkArgs, IC_00, }; use ic_metrics::MetricsRegistry; @@ -1378,9 +1378,9 @@ impl ExecutionEnvironment { } } - Ok(Ic00Method::SubnetStats) => { - let res = SubnetStatsArgs::decode(payload) - .and_then(|args| self.subnet_stats(&state, args)); + Ok(Ic00Method::SubnetMetrics) => { + let res = SubnetMetricsArgs::decode(payload) + .and_then(|args| self.subnet_stats(®istry_settings, args)); ExecuteSubnetMessageResult::Finished { response: res, refund: msg.take_cycles(), @@ -2236,8 +2236,8 @@ impl ExecutionEnvironment { fn subnet_stats( &self, - state: &ReplicatedState, - args: SubnetStatsArgs, + registry_settings: &RegistryExecutionSettings, + args: SubnetMetricsArgs, ) -> Result, UserError> { // TODO: Check taken from node_metric_history; but is this actually needed? Can such a call be routed wrong? if args.subnet_id != self.own_subnet_id.get() { @@ -2249,8 +2249,9 @@ impl ExecutionEnvironment { ), )); } - let replica_version = String::from(state.metadata.replica_version.clone()); - let res = SubnetStatsResponse { replica_version }; + let res = SubnetMetricsResponse { + replica_version: registry_settings.replica_version.clone(), + }; Ok(Encode!(&res).unwrap()) } diff --git a/rs/execution_environment/src/execution_environment_metrics.rs b/rs/execution_environment/src/execution_environment_metrics.rs index 90b40a942c1..85338440b51 100644 --- a/rs/execution_environment/src/execution_environment_metrics.rs +++ b/rs/execution_environment/src/execution_environment_metrics.rs @@ -193,7 +193,7 @@ impl ExecutionEnvironmentMetrics { | ic00::Method::BitcoinSendTransaction | ic00::Method::BitcoinGetCurrentFeePercentiles | ic00::Method::NodeMetricsHistory - | ic00::Method::SubnetStats + | ic00::Method::SubnetMetrics | ic00::Method::FetchCanisterLogs | ic00::Method::ProvisionalCreateCanisterWithCycles | ic00::Method::ProvisionalTopUpCanister diff --git a/rs/execution_environment/src/ic00_permissions.rs b/rs/execution_environment/src/ic00_permissions.rs index 4b54973bf20..9b8f4f006dd 100644 --- a/rs/execution_environment/src/ic00_permissions.rs +++ b/rs/execution_environment/src/ic00_permissions.rs @@ -153,7 +153,7 @@ impl Ic00MethodPermissions { allow_remote_subnet_sender: true, allow_only_nns_subnet_sender: false, }, - Ic00Method::SubnetStats => Self { + Ic00Method::SubnetMetrics => Self { method, allow_remote_subnet_sender: true, allow_only_nns_subnet_sender: false, diff --git a/rs/execution_environment/src/scheduler.rs b/rs/execution_environment/src/scheduler.rs index 5bb3c87ff42..523469e5ccb 100644 --- a/rs/execution_environment/src/scheduler.rs +++ b/rs/execution_environment/src/scheduler.rs @@ -2403,7 +2403,7 @@ fn can_execute_subnet_msg( | Ic00Method::BitcoinSendTransactionInternal | Ic00Method::BitcoinGetSuccessors | Ic00Method::NodeMetricsHistory - | Ic00Method::SubnetStats + | Ic00Method::SubnetMetrics | Ic00Method::FetchCanisterLogs | Ic00Method::ProvisionalCreateCanisterWithCycles | Ic00Method::ProvisionalTopUpCanister @@ -2467,7 +2467,7 @@ fn get_instructions_limits_for_subnet_message( | BitcoinGetCurrentFeePercentiles | BitcoinGetSuccessors | NodeMetricsHistory - | SubnetStats + | SubnetMetrics | FetchCanisterLogs | ProvisionalCreateCanisterWithCycles | ProvisionalTopUpCanister diff --git a/rs/execution_environment/tests/dts.rs b/rs/execution_environment/tests/dts.rs index f9c642bff90..a5ca493baab 100644 --- a/rs/execution_environment/tests/dts.rs +++ b/rs/execution_environment/tests/dts.rs @@ -1165,7 +1165,7 @@ fn dts_aborted_execution_does_not_block_subnet_messages() { | Method::BitcoinSendTransactionInternal | Method::BitcoinGetSuccessors | Method::NodeMetricsHistory - | Method::SubnetStats + | Method::SubnetMetrics | Method::ProvisionalCreateCanisterWithCycles | Method::ProvisionalTopUpCanister => {} // Unsupported methods accepting just one argument. diff --git a/rs/system_api/src/routing.rs b/rs/system_api/src/routing.rs index a9b9b7f1195..278c0d8e8cd 100644 --- a/rs/system_api/src/routing.rs +++ b/rs/system_api/src/routing.rs @@ -11,7 +11,7 @@ use ic_management_canister_types::{ ECDSAPublicKeyArgs, InstallChunkedCodeArgs, InstallCodeArgsV2, ListCanisterSnapshotArgs, LoadCanisterSnapshotArgs, MasterPublicKeyId, Method as Ic00Method, NodeMetricsHistoryArgs, Payload, ProvisionalTopUpCanisterArgs, SchnorrPublicKeyArgs, SignWithECDSAArgs, - SignWithSchnorrArgs, StoredChunksArgs, SubnetStatsArgs, TakeCanisterSnapshotArgs, + SignWithSchnorrArgs, StoredChunksArgs, SubnetMetricsArgs, TakeCanisterSnapshotArgs, UninstallCodeArgs, UpdateSettingsArgs, UploadChunkArgs, }; use ic_replicated_state::NetworkTopology; @@ -168,7 +168,7 @@ pub(super) fn resolve_destination( Ok(Ic00Method::NodeMetricsHistory) => { Ok(NodeMetricsHistoryArgs::decode(payload)?.subnet_id) } - Ok(Ic00Method::SubnetStats) => Ok(SubnetStatsArgs::decode(payload)?.subnet_id), + Ok(Ic00Method::SubnetMetrics) => Ok(SubnetMetricsArgs::decode(payload)?.subnet_id), Ok(Ic00Method::FetchCanisterLogs) => { Err(ResolveDestinationError::UserError(UserError::new( ic_error_types::ErrorCode::CanisterRejectedMessage, diff --git a/rs/system_api/src/sandbox_safe_system_state.rs b/rs/system_api/src/sandbox_safe_system_state.rs index 2e37dd64230..94abe6ed6a8 100644 --- a/rs/system_api/src/sandbox_safe_system_state.rs +++ b/rs/system_api/src/sandbox_safe_system_state.rs @@ -255,7 +255,7 @@ impl SystemStateChanges { | Ok(Ic00Method::BitcoinSendTransaction) | Ok(Ic00Method::BitcoinGetCurrentFeePercentiles) | Ok(Ic00Method::NodeMetricsHistory) - | Ok(Ic00Method::SubnetStats) + | Ok(Ic00Method::SubnetMetrics) | Ok(Ic00Method::FetchCanisterLogs) | Ok(Ic00Method::UploadChunk) | Ok(Ic00Method::StoredChunks) diff --git a/rs/types/management_canister_types/src/lib.rs b/rs/types/management_canister_types/src/lib.rs index 3d945f677f5..5d83cf09fe3 100644 --- a/rs/types/management_canister_types/src/lib.rs +++ b/rs/types/management_canister_types/src/lib.rs @@ -99,7 +99,7 @@ pub enum Method { // Subnet information NodeMetricsHistory, - SubnetStats, + SubnetMetrics, FetchCanisterLogs, @@ -2588,31 +2588,31 @@ pub enum QueryMethod { FetchCanisterLogs, } -/// `CandidType` for `SubnetStatsArgs` +/// `CandidType` for `SubnetMetricsArgs` /// ```text /// record { /// subnet_id: principal; /// } /// ``` #[derive(Clone, Debug, Default, CandidType, Deserialize)] -pub struct SubnetStatsArgs { +pub struct SubnetMetricsArgs { pub subnet_id: PrincipalId, } -impl Payload<'_> for SubnetStatsArgs {} +impl Payload<'_> for SubnetMetricsArgs {} -/// `CandidType` for `SubnetStatsResponse` +/// `CandidType` for `SubnetMetricsResponse` /// ```text /// record { /// replica_version: text; /// } /// ``` #[derive(Clone, Debug, Default, CandidType, Deserialize)] -pub struct SubnetStatsResponse { +pub struct SubnetMetricsResponse { pub replica_version: String, } -impl Payload<'_> for SubnetStatsResponse {} +impl Payload<'_> for SubnetMetricsResponse {} /// `CandidType` for `NodeMetricsHistoryArgs` /// ```text diff --git a/rs/types/types/src/messages/ingress_messages.rs b/rs/types/types/src/messages/ingress_messages.rs index b9cc4e9fcb9..b0d1433258b 100644 --- a/rs/types/types/src/messages/ingress_messages.rs +++ b/rs/types/types/src/messages/ingress_messages.rs @@ -570,7 +570,7 @@ pub fn extract_effective_canister_id( | Ok(Method::BitcoinGetSuccessors) | Ok(Method::BitcoinGetCurrentFeePercentiles) | Ok(Method::NodeMetricsHistory) - | Ok(Method::SubnetStats) + | Ok(Method::SubnetMetrics) | Ok(Method::FetchCanisterLogs) => { // Subnet method not allowed for ingress. Err(ParseIngressError::SubnetMethodNotAllowed) diff --git a/rs/types/types/src/messages/inter_canister.rs b/rs/types/types/src/messages/inter_canister.rs index 612fbe95847..41c4d681bce 100644 --- a/rs/types/types/src/messages/inter_canister.rs +++ b/rs/types/types/src/messages/inter_canister.rs @@ -221,7 +221,7 @@ impl Request { | Ok(Method::BitcoinGetSuccessors) | Ok(Method::BitcoinGetCurrentFeePercentiles) | Ok(Method::NodeMetricsHistory) - | Ok(Method::SubnetStats) => { + | Ok(Method::SubnetMetrics) => { // No effective canister id. None }