Skip to content

Commit

Permalink
fix: add exception for slash system transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Jul 15, 2024
1 parent f3d8db9 commit 40192d9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/bsc/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use reth_evm::{
};
use reth_primitives::{
parlia::{ParliaConfig, Snapshot, VoteAddress, CHECKPOINT_INTERVAL},
system_contracts::get_upgrade_system_contracts,
system_contracts::{get_upgrade_system_contracts, SLASH_CONTRACT},
Address, BlockNumber, BlockWithSenders, Bytes, Header, Receipt, Transaction, TransactionSigned,
B256, BSC_MAINNET, U256,
};
Expand All @@ -34,7 +34,7 @@ use revm_primitives::{
BlockEnv, CfgEnvWithHandlerCfg, EVMError, EnvWithHandlerCfg, ResultAndState, TransactTo,
};
use std::{collections::HashMap, num::NonZeroUsize, sync::Arc, time::Instant};
use tracing::debug;
use tracing::{debug, warn};

const SNAP_CACHE_NUM: usize = 2048;

Expand Down Expand Up @@ -605,6 +605,14 @@ where
transaction.set_nonce(nonce);
let hash = transaction.signature_hash();
if system_txs.is_empty() || hash != system_txs[0].signature_hash() {
// slash tx could fail and not in the block
if let Some(to) = transaction.to() {
if to == SLASH_CONTRACT.parse().unwrap() {
warn!("slash validator failed");
return Ok(());
}
}

debug!("unexpected transaction: {:?}", transaction);
for tx in system_txs.iter() {
debug!("left system tx: {:?}", tx);
Expand Down

0 comments on commit 40192d9

Please sign in to comment.