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

fix: system account status issue #53

Merged
merged 1 commit into from
Jul 2, 2024
Merged
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
16 changes: 8 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,17 @@ 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