Skip to content

Commit

Permalink
fix: system account status issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Jul 1, 2024
1 parent 45d0df2 commit 630ee02
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions crates/bsc/evm/src/post_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use reth_primitives::{
Address, BlockWithSenders, GotExpected, Header, Receipt, TransactionSigned, U256,
};
use reth_provider::ParliaProvider;
use reth_revm::{bsc::SYSTEM_ADDRESS, db::AccountStatus};
use reth_revm::bsc::SYSTEM_ADDRESS;
use revm_primitives::{db::Database, EnvWithHandlerCfg};
use std::collections::HashMap;
use tracing::log::debug;
Expand Down Expand Up @@ -269,17 +269,16 @@ where
.state
.load_cache_account(SYSTEM_ADDRESS)
.map_err(|err| BscBlockExecutionError::ProviderInnerError { error: err.into() })?;
if system_account.status == AccountStatus::LoadedNotExisting ||
system_account.status == AccountStatus::DestroyedAgain
{
return Ok(());
}

let (mut block_reward, transition) = system_account.drain_balance();
self.state.apply_transition(vec![(SYSTEM_ADDRESS, transition)]);
if block_reward == 0 {
if header.number == 1 {
// We have to apply the transition to the system account even if the block reward is 0
// because the system account is initialized in genesis.
self.state.apply_transition(vec![(SYSTEM_ADDRESS, transition)]);
}
return Ok(());
}
self.state.apply_transition(vec![(SYSTEM_ADDRESS, transition)]);

let mut balance_increment = HashMap::new();
balance_increment.insert(validator, block_reward);
Expand Down

0 comments on commit 630ee02

Please sign in to comment.