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

Revert tx forbid #4019

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
28 changes: 4 additions & 24 deletions chain/open-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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<SignedUserTransaction>) -> Result<ExcludedTxns> {
let mut discard_txns: Vec<SignedUserTransaction> = 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();

Expand All @@ -174,6 +165,8 @@ impl OpenedBlock {
.map(|t| t.try_into().expect("user txn"))
.collect()
};

let mut discard_txns: Vec<SignedUserTransaction> = 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();
Expand Down Expand Up @@ -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())
*/
}
}
14 changes: 0 additions & 14 deletions chain/src/verifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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)?;
Expand All @@ -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<R>(
current_chain: &R,
uncles: &[BlockHeader],
Expand Down
2 changes: 1 addition & 1 deletion kube/manifest/starcoin-barnard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions storage/src/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<HashValue> = Lazy::new(|| {
HashValue::from_hex_literal(
"0x602bb269e3a221510f82b0b812304e767457f73ac3203663bd401ef3d29bcc97",
"0x0956f14b6d593e9b8758b386cf2cae098dffb1f0d0d1dba0137ff7f8f13cc088",
)
.expect("")
});
Expand Down
Loading