Skip to content

Commit

Permalink
feat(models): add prev_shuffle_mc_validators to ConsensusInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Oct 31, 2024
1 parent 8a7fc22 commit b65941d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/models/config/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;
use crate::boc::BocRepr;
use crate::models::ShardStateUnsplit;
use crate::prelude::Boc;

#[cfg(not(feature = "tycho"))]
Expand Down Expand Up @@ -336,7 +335,7 @@ fn create_config() {
#[cfg(not(feature = "tycho"))]
#[test]
fn validator_subset() {
use crate::models::ShardIdent;
use crate::models::{ShardIdent, ShardStateUnsplit};

let master_state =
BocRepr::decode::<ShardStateUnsplit, _>(&include_bytes!("test_state_2_master.boc"))
Expand Down
13 changes: 9 additions & 4 deletions src/models/shard/shard_extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,30 +194,35 @@ pub struct ValidatorBaseInfo {
/// prev_config_round:uint32
/// genesis_round:uint32
/// genesis_millis:uint64
/// prev_shuffle_mc_validators:Bool
/// = ConsensusInfo;
/// ```
#[derive(Default, Debug, Copy, Clone, Eq, PartialEq, Store, Load)]
pub struct ConsensusInfo {
/// The most recent round from which the mempool session starts.
pub config_update_round: u32,
pub vset_switch_round: u32,

/// The round from which the previous mempool session was started.
pub prev_config_round: u32,
pub prev_vset_switch_round: u32,

/// Mempool genesis round (affects the overlay id).
pub genesis_round: u32,

/// Mempool genesis generation timestamp in milliseconds (affects the overlay id).
pub genesis_millis: u64,

/// Previous state of the `shuffle_mc_validators` flags.
pub prev_shuffle_mc_validators: bool,
}

impl ConsensusInfo {
/// Initial consensus info state.
pub const ZEROSTATE: Self = Self {
config_update_round: 0,
prev_config_round: 0,
vset_switch_round: 0,
prev_vset_switch_round: 0,
genesis_round: 0,
genesis_millis: 0,
prev_shuffle_mc_validators: false,
};

/// Returns whether this info corresponds to the zerostate info.
Expand Down

0 comments on commit b65941d

Please sign in to comment.