Skip to content

Commit 2d1720d

Browse files
committed
Revert "Reset to main 16801958 and forbid the tx"
This reverts commit d0e1ed2. Revert "Forbid all txns and reset block number to 21306000 on barnard" This reverts commit 5a6816c. Revert "cargo fmt" This reverts commit 8e7d414. Revert "testing blacklist" This reverts commit 29845e9. Revert "verifier: Verify if the block contain txn in blacklist" This reverts commit 09d21fc. Revert "miner: Excluded transactions from blacklisted addresses during create block template" This reverts commit 7811626.
1 parent 216781c commit 2d1720d

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed

chain/open-block/src/lib.rs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use starcoin_logger::prelude::*;
1010
use starcoin_state_api::{ChainStateReader, ChainStateWriter};
1111
use starcoin_statedb::ChainStateDB;
1212
use starcoin_storage::Store;
13-
use starcoin_types::block::BlockNumber;
1413
use starcoin_types::genesis_config::{ChainId, ConsensusStrategy};
1514
use starcoin_types::vm_error::KeptVMStatus;
1615
use starcoin_types::{
@@ -137,17 +136,9 @@ impl OpenedBlock {
137136
/// as the internal state may be corrupted.
138137
/// TODO: make the function can be called again even last call returns error.
139138
pub fn push_txns(&mut self, user_txns: Vec<SignedUserTransaction>) -> Result<ExcludedTxns> {
140-
let mut discard_txns: Vec<SignedUserTransaction> = Vec::new();
141139
let mut txns: Vec<_> = user_txns
142-
.into_iter()
143-
.filter(|txn| {
144-
let is_blacklisted = AddressFilter::is_blacklisted(txn, self.block_number());
145-
// Discard the txns send by the account in black list after a block number.
146-
if is_blacklisted {
147-
discard_txns.push(txn.clone());
148-
}
149-
!is_blacklisted
150-
})
140+
.iter()
141+
.cloned()
151142
.map(Transaction::UserTransaction)
152143
.collect();
153144

@@ -174,6 +165,8 @@ impl OpenedBlock {
174165
.map(|t| t.try_into().expect("user txn"))
175166
.collect()
176167
};
168+
169+
let mut discard_txns: Vec<SignedUserTransaction> = Vec::new();
177170
debug_assert_eq!(txns.len(), txn_outputs.len());
178171
for (txn, output) in txns.into_iter().zip(txn_outputs.into_iter()) {
179172
let txn_hash = txn.id();
@@ -295,16 +288,3 @@ impl OpenedBlock {
295288
Ok(block_template)
296289
}
297290
}
298-
pub struct AddressFilter;
299-
//static BLACKLIST: [&str; 0] = [];
300-
impl AddressFilter {
301-
const ACTIVATION_BLOCK_NUMBER: BlockNumber = 16801958;
302-
pub fn is_blacklisted(_raw_txn: &SignedUserTransaction, block_number: BlockNumber) -> bool {
303-
block_number > Self::ACTIVATION_BLOCK_NUMBER
304-
/*&& BLACKLIST
305-
.iter()
306-
.map(|&s| AccountAddress::from_str(s).expect("account address decode must success"))
307-
.any(|x| x == raw_txn.sender())
308-
*/
309-
}
310-
}

chain/src/verifier/mod.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use starcoin_chain_api::{
88
};
99
use starcoin_consensus::{Consensus, ConsensusVerifyError};
1010
use starcoin_logger::prelude::debug;
11-
use starcoin_open_block::AddressFilter;
1211
use starcoin_types::block::{Block, BlockHeader, ALLOWED_FUTURE_BLOCKTIME};
1312
use std::{collections::HashSet, str::FromStr};
1413

@@ -69,7 +68,6 @@ pub trait BlockVerifier {
6968
watch(CHAIN_WATCH_NAME, "n11");
7069
//verify header
7170
let new_block_header = new_block.header();
72-
Self::verify_blacklisted_txns(&new_block)?;
7371
Self::verify_header(current_chain, new_block_header)?;
7472
watch(CHAIN_WATCH_NAME, "n12");
7573
StaticVerifier::verify_body_hash(&new_block)?;
@@ -84,18 +82,6 @@ pub trait BlockVerifier {
8482
Ok(VerifiedBlock(new_block))
8583
}
8684

87-
fn verify_blacklisted_txns(new_block: &Block) -> Result<()> {
88-
let block_number = new_block.header().number();
89-
for txn in new_block.transactions() {
90-
verify_block!(
91-
VerifyBlockField::Body,
92-
!AddressFilter::is_blacklisted(txn, block_number),
93-
"Invalid block: the sender of transaction in block must be not blacklisted"
94-
);
95-
}
96-
Ok(())
97-
}
98-
9985
fn verify_uncles<R>(
10086
current_chain: &R,
10187
uncles: &[BlockHeader],

0 commit comments

Comments
 (0)