diff --git a/massa-node/src/main.rs b/massa-node/src/main.rs index 297339e0630..fa603af3b4e 100644 --- a/massa-node/src/main.rs +++ b/massa-node/src/main.rs @@ -79,11 +79,14 @@ use massa_protocol_exports::{ProtocolConfig, ProtocolManager}; use massa_protocol_worker::{create_protocol_controller, start_protocol_controller}; use massa_storage::Storage; use massa_time::MassaTime; -use massa_versioning::versioning::{MipComponent, MipInfo, MipState, MipStatsConfig, MipStore}; +use massa_versioning::{ + mips::MIP_LIST, + versioning::{MipStatsConfig, MipStore}, +}; use massa_wallet::Wallet; use parking_lot::RwLock; use peernet::transports::TransportType; -use std::collections::{BTreeMap, HashMap}; +use std::collections::HashMap; use std::path::PathBuf; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Condvar, Mutex}; @@ -234,24 +237,8 @@ async fn launch( block_count_considered: MIP_STORE_STATS_BLOCK_CONSIDERED, counters_max: MIP_STORE_STATS_COUNTERS_MAX, }; - let mip_store = MipStore::try_from(( - [( - MipInfo { - name: "MIP-0000".to_string(), - version: 0, - components: BTreeMap::from([ - (MipComponent::Address, 0), - (MipComponent::KeyPair, 0), - ]), - start: MassaTime::from_millis(0), - timeout: MassaTime::from_millis(0), - activation_delay: MassaTime::from_millis(0), - }, - MipState::new(MassaTime::from_millis(0)), - )], - mip_stats_config, - )) - .expect("mip store creation failed"); + let mip_store = + MipStore::try_from((MIP_LIST, mip_stats_config)).expect("mip store creation failed"); // Create final state, either from a snapshot, or from scratch let final_state = Arc::new(parking_lot::RwLock::new( diff --git a/massa-versioning/src/lib.rs b/massa-versioning/src/lib.rs index 35b3feb445e..0af2efe14f1 100644 --- a/massa-versioning/src/lib.rs +++ b/massa-versioning/src/lib.rs @@ -9,6 +9,7 @@ //! MIPState -> Deployment state of a MIPInfo //! MIPStore -> A map of MIPInfo -> MipState //! +//! //! # Notes on MipInfo versions //! //! There is 2 different 'versions': @@ -17,11 +18,11 @@ //! //! # Notes on MipInfo timings and stats //! -//! So in the execution module and after a block become final, we update the MipStore stats (in a blocking way) then continue one. +//! So in the execution module and after a block become final, we update the MipStore stats (in a blocking way). //! By updating the stats, we mean sending: (Slot timestamp, Option<(current: u32, advertising: Option)>). //! Using the slot timestamp, ensure that the trigger (and the trigger timeout) is a consensus by all nodes //! (This means that the trigger and the trigger timeout are not timer based). -//! In order to have all nodes in sync (because of node various delays), the state is se to active +//! In order to have all nodes in sync (because of node various delays), the state is set to active //! after an activation delay (duration is required to be > 1 cycle). //! //! # Notes on MipState @@ -53,6 +54,7 @@ pub mod address_factory; pub mod grpc_mapping; pub mod keypair_factory; +pub mod mips; pub mod versioning; pub mod versioning_factory; pub mod versioning_ser_der; diff --git a/massa-versioning/src/mips.rs b/massa-versioning/src/mips.rs new file mode 100644 index 00000000000..2230c7573fa --- /dev/null +++ b/massa-versioning/src/mips.rs @@ -0,0 +1,20 @@ +#[allow(unused_imports)] +use crate::versioning::{MipComponent, MipInfo, MipState}; + +pub const MIP_LIST: [(MipInfo, MipState); 0] = [ + // MIP placeholder +/* ( + MipInfo { + name: "MIP-0000".to_string(), + version: 0, + components: BTreeMap::from([ + (MipComponent::Address, 0), + (MipComponent::KeyPair, 0), + ]), + start: MassaTime::from_millis(0), + timeout: MassaTime::from_millis(0), + activation_delay: MassaTime::from_millis(0), + }, + MipState::new(MassaTime::from_millis(0)), +) */ +];