From ecb4f2d0f4920dd1dfd26a7c3f82ae5e62ba0d8c Mon Sep 17 00:00:00 2001 From: modship Date: Fri, 3 Jan 2025 10:54:15 +0100 Subject: [PATCH] add current_mip_version to get_status --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- massa-api-exports/src/node.rs | 2 ++ massa-api/src/public.rs | 7 +++++++ massa-client/src/display.rs | 1 + massa-grpc/src/private.rs | 1 + massa-grpc/src/public.rs | 1 + massa-node/base_config/openrpc.json | 8 ++++++-- 8 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 08c69832ce0..3090c0b4683 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2915,7 +2915,7 @@ dependencies = [ [[package]] name = "massa-proto-rs" version = "0.1.0" -source = "git+https://github.com/massalabs/massa-proto-rs?rev=b5267178eaf266ec724691d7de163e4c34343416#b5267178eaf266ec724691d7de163e4c34343416" +source = "git+https://github.com/massalabs/massa-proto-rs?rev=c9a7c55914f3d308996113df0936f15d96490313#c9a7c55914f3d308996113df0936f15d96490313" dependencies = [ "glob", "prost", @@ -2929,7 +2929,7 @@ dependencies = [ [[package]] name = "massa-sc-runtime" version = "0.10.0" -source = "git+https://github.com/massalabs/massa-sc-runtime?rev=f5a584b9f8050f332c9ed332bd0a40f8e0372807#f5a584b9f8050f332c9ed332bd0a40f8e0372807" +source = "git+https://github.com/massalabs/massa-sc-runtime?rev=cd14c775aff31b8c0f49064613118f428f9dd45f#cd14c775aff31b8c0f49064613118f428f9dd45f" dependencies = [ "anyhow", "as-ffi-bindings", diff --git a/Cargo.toml b/Cargo.toml index ab0a91e3c62..92009e4a3da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -111,8 +111,8 @@ massa_event_cache = { path = "./massa-event-cache" } # Massa projects dependencies # massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", branch = "deferred_calls" } # massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "branch" = "deferred_calls" } -massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", "rev" = "b5267178eaf266ec724691d7de163e4c34343416" } -massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "rev" = "f5a584b9f8050f332c9ed332bd0a40f8e0372807" } +massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", "rev" = "c9a7c55914f3d308996113df0936f15d96490313" } +massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "rev" = "cd14c775aff31b8c0f49064613118f428f9dd45f" } peernet = { git = "https://github.com/massalabs/PeerNet", "rev" = "04b05ddd320fbe76cc858115af7b5fc28bdb8310" } # Dev only - use local dependencies diff --git a/massa-api-exports/src/node.rs b/massa-api-exports/src/node.rs index 9676aab2dd7..117978a1a25 100644 --- a/massa-api-exports/src/node.rs +++ b/massa-api-exports/src/node.rs @@ -46,6 +46,8 @@ pub struct NodeStatus { pub chain_id: u64, /// minimal fees to include an operation in a block pub minimal_fees: Amount, + /// current mip version + pub current_mip_version: u32, } impl std::fmt::Display for NodeStatus { diff --git a/massa-api/src/public.rs b/massa-api/src/public.rs index e28d638fe0e..1b0ea13e0d1 100644 --- a/massa-api/src/public.rs +++ b/massa-api/src/public.rs @@ -458,6 +458,12 @@ impl MassaRpcServer for API { let config = CompactConfig::default(); let now = MassaTime::now(); + let current_mip_version = self + .0 + .keypair_factory + .mip_store + .get_network_version_current(); + let last_slot_result = get_latest_block_slot_at_timestamp( api_settings.thread_count, api_settings.t0, @@ -555,6 +561,7 @@ impl MassaRpcServer for API { current_cycle, chain_id: self.0.api_settings.chain_id, minimal_fees: self.0.api_settings.minimal_fees, + current_mip_version, }) } diff --git a/massa-client/src/display.rs b/massa-client/src/display.rs index 5973228ef5b..f7bdc433016 100644 --- a/massa-client/src/display.rs +++ b/massa-client/src/display.rs @@ -275,6 +275,7 @@ impl Output for NodeStatus { println!(); println!("Chain id: {}", self.chain_id); + println!("Current MIP version: {}", self.current_mip_version); } } diff --git a/massa-grpc/src/private.rs b/massa-grpc/src/private.rs index dc362bf2a60..ab2fd0d5407 100644 --- a/massa-grpc/src/private.rs +++ b/massa-grpc/src/private.rs @@ -305,6 +305,7 @@ pub(crate) fn get_node_status( execution_stats: Some(execution_stats.into()), config: Some(config.into()), chain_id: grpc.grpc_config.chain_id, + current_mip_version: grpc.mip_store.get_network_version_current(), }; Ok(grpc_api::GetNodeStatusResponse { diff --git a/massa-grpc/src/public.rs b/massa-grpc/src/public.rs index 6dd98bed3c1..7dd1ec2e0f9 100644 --- a/massa-grpc/src/public.rs +++ b/massa-grpc/src/public.rs @@ -960,6 +960,7 @@ pub(crate) fn get_status( config: Some(config.into()), chain_id: grpc.grpc_config.chain_id, minimal_fees: Some(grpc.grpc_config.minimal_fees.into()), + current_mip_version: grpc.keypair_factory.mip_store.get_network_version_current(), }; Ok(grpc_api::GetStatusResponse { diff --git a/massa-node/base_config/openrpc.json b/massa-node/base_config/openrpc.json index b6d2b090e6c..6c049080890 100644 --- a/massa-node/base_config/openrpc.json +++ b/massa-node/base_config/openrpc.json @@ -1999,7 +1999,6 @@ "candidate_value": { "description": "The candidate datastore entry value bytes", "$ref": "#/components/schemas/BytesOption" - }, "final_value": { "description": "The final datastore entry value bytes", @@ -2781,7 +2780,8 @@ "pool_stats", "version", "execution_stats", - "chain_id" + "chain_id", + "current_mip_version" ], "type": "object", "properties": { @@ -2859,6 +2859,10 @@ "minimal_fees": { "description": "Minimal fee", "$ref": "#/components/schemas/Amount" + }, + "current_mip_version": { + "description": "Current MIP version", + "type": "number" } }, "additionalProperties": false