From 2d1720d73ec73fdfed418930e28131a8841da22f Mon Sep 17 00:00:00 2001 From: sanlee42 Date: Mon, 11 Mar 2024 12:15:51 +0800 Subject: [PATCH 1/3] Revert "Reset to main 16801958 and forbid the tx" This reverts commit d0e1ed20d100d9be0ccd8a28ed688434222ae7e4. Revert "Forbid all txns and reset block number to 21306000 on barnard" This reverts commit 5a6816c3c1052b44b94dc65a5c4429d0eb079457. Revert "cargo fmt" This reverts commit 8e7d414c54b9f10e02217e038edc65a23fa81f50. Revert "testing blacklist" This reverts commit 29845e9439a16392f5897835c9f1506c4643c45a. Revert "verifier: Verify if the block contain txn in blacklist" This reverts commit 09d21fc169625ebf4c93ee09de5737e1846a72c2. Revert "miner: Excluded transactions from blacklisted addresses during create block template" This reverts commit 7811626819cd86895b5dc3a2786819773a4cc587. --- chain/open-block/src/lib.rs | 28 ++++------------------------ chain/src/verifier/mod.rs | 14 -------------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/chain/open-block/src/lib.rs b/chain/open-block/src/lib.rs index 54104c4440..7df7510ecd 100644 --- a/chain/open-block/src/lib.rs +++ b/chain/open-block/src/lib.rs @@ -10,7 +10,6 @@ use starcoin_logger::prelude::*; use starcoin_state_api::{ChainStateReader, ChainStateWriter}; use starcoin_statedb::ChainStateDB; use starcoin_storage::Store; -use starcoin_types::block::BlockNumber; use starcoin_types::genesis_config::{ChainId, ConsensusStrategy}; use starcoin_types::vm_error::KeptVMStatus; use starcoin_types::{ @@ -137,17 +136,9 @@ impl OpenedBlock { /// as the internal state may be corrupted. /// TODO: make the function can be called again even last call returns error. pub fn push_txns(&mut self, user_txns: Vec) -> Result { - let mut discard_txns: Vec = Vec::new(); let mut txns: Vec<_> = user_txns - .into_iter() - .filter(|txn| { - let is_blacklisted = AddressFilter::is_blacklisted(txn, self.block_number()); - // Discard the txns send by the account in black list after a block number. - if is_blacklisted { - discard_txns.push(txn.clone()); - } - !is_blacklisted - }) + .iter() + .cloned() .map(Transaction::UserTransaction) .collect(); @@ -174,6 +165,8 @@ impl OpenedBlock { .map(|t| t.try_into().expect("user txn")) .collect() }; + + let mut discard_txns: Vec = Vec::new(); debug_assert_eq!(txns.len(), txn_outputs.len()); for (txn, output) in txns.into_iter().zip(txn_outputs.into_iter()) { let txn_hash = txn.id(); @@ -295,16 +288,3 @@ impl OpenedBlock { Ok(block_template) } } -pub struct AddressFilter; -//static BLACKLIST: [&str; 0] = []; -impl AddressFilter { - const ACTIVATION_BLOCK_NUMBER: BlockNumber = 16801958; - pub fn is_blacklisted(_raw_txn: &SignedUserTransaction, block_number: BlockNumber) -> bool { - block_number > Self::ACTIVATION_BLOCK_NUMBER - /*&& BLACKLIST - .iter() - .map(|&s| AccountAddress::from_str(s).expect("account address decode must success")) - .any(|x| x == raw_txn.sender()) - */ - } -} diff --git a/chain/src/verifier/mod.rs b/chain/src/verifier/mod.rs index 3994d99f8d..247129eb35 100644 --- a/chain/src/verifier/mod.rs +++ b/chain/src/verifier/mod.rs @@ -8,7 +8,6 @@ use starcoin_chain_api::{ }; use starcoin_consensus::{Consensus, ConsensusVerifyError}; use starcoin_logger::prelude::debug; -use starcoin_open_block::AddressFilter; use starcoin_types::block::{Block, BlockHeader, ALLOWED_FUTURE_BLOCKTIME}; use std::{collections::HashSet, str::FromStr}; @@ -69,7 +68,6 @@ pub trait BlockVerifier { watch(CHAIN_WATCH_NAME, "n11"); //verify header let new_block_header = new_block.header(); - Self::verify_blacklisted_txns(&new_block)?; Self::verify_header(current_chain, new_block_header)?; watch(CHAIN_WATCH_NAME, "n12"); StaticVerifier::verify_body_hash(&new_block)?; @@ -84,18 +82,6 @@ pub trait BlockVerifier { Ok(VerifiedBlock(new_block)) } - fn verify_blacklisted_txns(new_block: &Block) -> Result<()> { - let block_number = new_block.header().number(); - for txn in new_block.transactions() { - verify_block!( - VerifyBlockField::Body, - !AddressFilter::is_blacklisted(txn, block_number), - "Invalid block: the sender of transaction in block must be not blacklisted" - ); - } - Ok(()) - } - fn verify_uncles( current_chain: &R, uncles: &[BlockHeader], From 8985138d0164c3da2de39411657a719a4291a9b2 Mon Sep 17 00:00:00 2001 From: sanlee42 Date: Mon, 11 Mar 2024 12:21:50 +0800 Subject: [PATCH 2/3] Set barnard rollback height to 21306000 --- storage/src/upgrade.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/src/upgrade.rs b/storage/src/upgrade.rs index d4a57a38e1..6336bbca83 100644 --- a/storage/src/upgrade.rs +++ b/storage/src/upgrade.rs @@ -22,10 +22,10 @@ use std::cmp::Ordering; pub struct DBUpgrade; -pub static BARNARD_HARD_FORK_HEIGHT: BlockNumber = 16057420; +pub static BARNARD_HARD_FORK_HEIGHT: BlockNumber = 21306000; pub static BARNARD_HARD_FORK_HASH: Lazy = Lazy::new(|| { HashValue::from_hex_literal( - "0x602bb269e3a221510f82b0b812304e767457f73ac3203663bd401ef3d29bcc97", + "0x0956f14b6d593e9b8758b386cf2cae098dffb1f0d0d1dba0137ff7f8f13cc088", ) .expect("") }); From f55d007b7014e73c10dda05ff4c249967a2dbfed Mon Sep 17 00:00:00 2001 From: welbon Date: Mon, 11 Mar 2024 14:30:57 +0800 Subject: [PATCH 3/3] set barnard test image --- kube/manifest/starcoin-barnard.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kube/manifest/starcoin-barnard.yaml b/kube/manifest/starcoin-barnard.yaml index fc1242e044..fc4ced5af3 100644 --- a/kube/manifest/starcoin-barnard.yaml +++ b/kube/manifest/starcoin-barnard.yaml @@ -23,7 +23,7 @@ spec: starcoin/node-pool: seed-pool containers: - name: starcoin - image: ghcr.io/starcoinorg/starcoin:v1.13.8 + image: ghcr.io/starcoinorg/starcoin:v1.13.10-alpha.0.barnard imagePullPolicy: Always command: - bash