Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor corrections on consensus #3987

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions massa-consensus-exports/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,12 @@ pub struct ConsensusConfig {
pub genesis_key: KeyPair,
/// Maximum number of blocks allowed in discarded blocks.
pub max_discarded_blocks: usize,
/// If a block `is future_block_processing_max_periods` periods in the future, it is just discarded.
pub future_block_processing_max_periods: u64,
/// Maximum number of blocks allowed in `FutureIncomingBlocks`.
pub max_future_processing_blocks: usize,
/// Maximum number of blocks allowed in `DependencyWaitingBlocks`.
pub max_dependency_blocks: usize,
/// max event send wait
pub max_send_wait: MassaTime,
/// old blocks are pruned every `block_db_prune_interval`
pub block_db_prune_interval: MassaTime,
/// max number of items returned while querying
pub max_item_return_count: usize,
/// Max gas per block for the execution configuration
pub max_gas_per_block: u64,
/// Threshold for fitness.
Expand Down
3 changes: 0 additions & 3 deletions massa-consensus-exports/src/test_exports/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ impl Default for ConsensusConfig {
thread_count: THREAD_COUNT,
genesis_key: GENESIS_KEY.clone(),
max_discarded_blocks: 10000,
future_block_processing_max_periods: 100,
max_future_processing_blocks: 100,
max_dependency_blocks: 2048,
max_send_wait: MassaTime::from_millis(100),
block_db_prune_interval: MassaTime::from_millis(5000),
max_item_return_count: 100,
max_gas_per_block: MAX_GAS_PER_BLOCK,
delta_f0: DELTA_F0,
operation_validity_periods: OPERATION_VALIDITY_PERIODS,
Expand Down
14 changes: 0 additions & 14 deletions massa-consensus-worker/src/state/verifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,7 @@ impl ConsensusState {
/// - Slot above 0.
/// - Valid thread.
/// - Check that the block is older than the latest final one in thread.
/// - Check that the block slot is not too much into the future,
/// as determined by the configuration `future_block_processing_max_periods`.
/// - Check if it was the creator's turn to create this block.
/// - TODO: check for double staking.
/// - Check parents are present.
/// - Check the topological consistency of the parents.
/// - Check endorsements.
Expand Down Expand Up @@ -326,17 +323,6 @@ impl ConsensusState {
return Ok(HeaderCheckOutcome::Discard(DiscardReason::Stale));
}

// check if block slot is too much in the future
if let Some(cur_slot) = current_slot {
if header.content.slot.period
> cur_slot
.period
.saturating_add(self.config.future_block_processing_max_periods)
{
return Ok(HeaderCheckOutcome::WaitForSlot);
}
}

// check if it was the creator's turn to create this block
// (step 1 in consensus/pos.md)
let slot_draw_address = match self
Expand Down
6 changes: 0 additions & 6 deletions massa-node/base_config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,18 @@
[consensus]
# max number of previously discarded blocks kept in RAM
max_discarded_blocks = 100
# if a block is at least future_block_processing_max_periods periods in the future, it is just discarded
future_block_processing_max_periods = 100
# max number of blocks in the future kept in RAM
max_future_processing_blocks = 400
# max number of blocks waiting for dependencies
max_dependency_blocks = 2048
# number of final periods that must be kept at all times (increase to more resilience to short network disconnections, high values will increase RAM usage.)
force_keep_final_periods = 10

# max milliseconds to wait while sending an event before dropping it
max_send_wait = 0
# useless blocks are pruned every block_db_prune_interval ms
block_db_prune_interval = 5000

# considered timespan for stats info
stats_timespan = 60000
# max number of item returned per query
max_item_return_count = 100

# blocks headers channel capacity
broadcast_blocks_headers_channel_capacity = 128
Expand Down
3 changes: 0 additions & 3 deletions massa-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,18 +624,15 @@ async fn launch(
t0: T0,
genesis_key: GENESIS_KEY.clone(),
max_discarded_blocks: SETTINGS.consensus.max_discarded_blocks,
future_block_processing_max_periods: SETTINGS.consensus.future_block_processing_max_periods,
max_future_processing_blocks: SETTINGS.consensus.max_future_processing_blocks,
max_dependency_blocks: SETTINGS.consensus.max_dependency_blocks,
delta_f0: DELTA_F0,
operation_validity_periods: OPERATION_VALIDITY_PERIODS,
periods_per_cycle: PERIODS_PER_CYCLE,
stats_timespan: SETTINGS.consensus.stats_timespan,
max_send_wait: SETTINGS.consensus.max_send_wait,
force_keep_final_periods: SETTINGS.consensus.force_keep_final_periods,
endorsement_count: ENDORSEMENT_COUNT,
block_db_prune_interval: SETTINGS.consensus.block_db_prune_interval,
max_item_return_count: SETTINGS.consensus.max_item_return_count,
max_gas_per_block: MAX_GAS_PER_BLOCK,
channel_size: CHANNEL_SIZE,
bootstrap_part_size: CONSENSUS_BOOTSTRAP_PART_SIZE,
Expand Down
6 changes: 0 additions & 6 deletions massa-node/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,16 @@ pub struct Settings {
pub struct ConsensusSettings {
/// Maximum number of blocks allowed in discarded blocks.
pub max_discarded_blocks: usize,
/// If a block is `future_block_processing_max_periods` periods in the future, it is just discarded.
pub future_block_processing_max_periods: u64,
/// Maximum number of blocks allowed in `FutureIncomingBlocks`.
pub max_future_processing_blocks: usize,
/// Maximum number of blocks allowed in `DependencyWaitingBlocks`.
pub max_dependency_blocks: usize,
/// stats time span
pub stats_timespan: MassaTime,
/// max event send wait
pub max_send_wait: MassaTime,
/// force keep at least this number of final periods in RAM for each thread
pub force_keep_final_periods: u64,
/// old blocks are pruned every `block_db_prune_interval`
pub block_db_prune_interval: MassaTime,
/// max number of items returned while querying
pub max_item_return_count: usize,
/// blocks headers channel capacity
pub broadcast_blocks_headers_channel_capacity: usize,
/// blocks channel capacity
Expand Down
3 changes: 0 additions & 3 deletions massa-node/src/tests/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@

[consensus]
max_discarded_blocks = 100
future_block_processing_max_periods = 100
max_future_processing_blocks = 400
max_dependency_blocks = 2048
max_send_wait = 500
force_keep_final_periods = 20
staking_wallet_path = "../massa-node/config/staking_keys.json"
stats_timespan = 60000
block_db_prune_interval = 5000
max_item_return_count = 100
genesis_timestamp = 1638931299263
end_timestammp = 1638931299263

Expand Down