From 4cadef76ab32c03850936c1d61e29feff4cf49dc Mon Sep 17 00:00:00 2001 From: Luis Rubio Date: Sun, 18 Oct 2020 19:35:36 +0200 Subject: [PATCH] fix(superblock): modify committee to sign superblocks --- node/src/actors/chain_manager/mod.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/node/src/actors/chain_manager/mod.rs b/node/src/actors/chain_manager/mod.rs index 76463273b..03309fa5c 100644 --- a/node/src/actors/chain_manager/mod.rs +++ b/node/src/actors/chain_manager/mod.rs @@ -58,7 +58,7 @@ use witnet_data_structures::{ vrf::VrfCtx, }; use witnet_rad::types::RadonTypes; -use witnet_util::timestamp::{get_timestamp, seconds_to_human_string}; +use witnet_util::timestamp::seconds_to_human_string; use witnet_validations::validations::{ compare_block_candidates, validate_block, validate_block_transactions, validate_new_transaction, verify_signatures, VrfSlots, @@ -1300,19 +1300,16 @@ impl ChainManager { let chain_info = act.chain_state.chain_info.as_ref().unwrap(); let reputation_engine = act.chain_state.reputation_engine.as_ref().unwrap(); let last_superblock_signed_by_bootstrap = last_superblock_signed_by_bootstrap(&chain_info.consensus_constants); - let now = get_timestamp(); + + let is_superblock_hack_period = superblock_index > 750 && superblock_index < 1344; let ars_members = // Before reaching the epoch activity_period + collateral_age the bootstrap committee signs the superblock // collateral_age is measured in blocks instead of epochs, but this only means that the period in which // the bootstrap committee signs is at least epoch activity_period + collateral_age - // FIXME(#1646): Remove this hack - // Wednesday, October 21, 2020 09:00:00 AM UTC - if now >= 1_603_270_800 { - reputation_engine.get_rep_ordered_ars_list() - } else { + if is_superblock_hack_period { // Bootstrap committee - let bootstrapping_committee = [ + let hack_bootstrapping_committee = [ "wit1asdpcspwysf0hg5kgwvgsp2h6g65y5kg9gj5dz", "wit13l337znc5yuualnxfg9s2hu9txylntq5pyazty", "wit17nnjuxmfuu92l6rxhque2qc3u2kvmx2fske4l9", @@ -1321,7 +1318,16 @@ impl ChainManager { "wit1g0rkajsgwqux9rnmkfca5tz6djg0f87x7ms5qx", "wit1etherz02v4fvqty6jhdawefd0pl33qtevy7s4z" ]; - bootstrapping_committee + hack_bootstrapping_committee + .iter() + .map(|add| add.parse().expect("Malformed bootstrapping committee")) + .collect() + } else if superblock_index >= last_superblock_signed_by_bootstrap { + reputation_engine.get_rep_ordered_ars_list() + } else { + chain_info + .consensus_constants + .bootstrapping_committee .iter() .map(|add| add.parse().expect("Malformed bootstrapping committee")) .collect()