mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: Fix subtle error
This commit is contained in:
@ -8,7 +8,7 @@ use alloc::{boxed::Box, sync::Arc, vec::Vec};
|
||||
use alloy_consensus::{Header, Transaction};
|
||||
use alloy_eips::{eip4895::Withdrawals, eip6110, eip7685::Requests};
|
||||
use alloy_evm::FromRecoveredTx;
|
||||
use alloy_primitives::{b256, Address, B256};
|
||||
use alloy_primitives::{Address, B256};
|
||||
use reth_chainspec::{ChainSpec, EthereumHardfork, EthereumHardforks, MAINNET};
|
||||
use reth_evm::{
|
||||
execute::{
|
||||
@ -198,7 +198,8 @@ where
|
||||
self.evm.transact(&tx).map_err(move |err| BlockExecutionError::evm(err, *hash))?;
|
||||
self.system_caller
|
||||
.on_state(StateChangeSource::Transaction(self.receipts.len()), &result_and_state.state);
|
||||
let ResultAndState { result, state } = result_and_state;
|
||||
let ResultAndState { result, mut state } = result_and_state;
|
||||
crate::fix::fix_state_diff(self.input.number, self.receipts.len(), &mut state);
|
||||
self.evm.db_mut().commit(state);
|
||||
|
||||
let gas_used = result.gas_used();
|
||||
@ -208,16 +209,6 @@ where
|
||||
self.gas_used += gas_used;
|
||||
}
|
||||
|
||||
// hotfix for https://hyperliquid.cloud.blockscout.com/tx/0xbf0e48e39ff2d65b04d181c698918530aa82809f9c5e67df58f55567abb34a06?tab=index
|
||||
// hl node returns 337981 for this tx, but reth returns 337967, causing the block to be invalid
|
||||
let problematic_txs = [
|
||||
b256!("0xbf0e48e39ff2d65b04d181c698918530aa82809f9c5e67df58f55567abb34a06"),
|
||||
b256!("0x9a9de0bc28ac9432aeace2c2efaf9ed38d93af7b48440b49f53927ff5863497a"),
|
||||
];
|
||||
if problematic_txs.contains(hash) {
|
||||
self.gas_used += 14;
|
||||
}
|
||||
|
||||
// Push transaction changeset and calculate header bloom filter for receipt.
|
||||
self.receipts.push(Receipt {
|
||||
tx_type: tx.tx_type(),
|
||||
|
||||
38
crates/ethereum/evm/src/fix.rs
Normal file
38
crates/ethereum/evm/src/fix.rs
Normal file
@ -0,0 +1,38 @@
|
||||
use alloy_primitives::{address, map::HashMap, Address};
|
||||
use reth_revm::state::Account;
|
||||
|
||||
pub(crate) fn fix_state_diff(
|
||||
block_number: u64,
|
||||
tx_index: usize,
|
||||
changes: &mut HashMap<Address, Account>,
|
||||
) {
|
||||
// Improper self destructs
|
||||
const TX_LIST: [(u64, usize, Address); 18] = [
|
||||
(1467569, 0, address!("0x33f6fe38c55cb100ce27b3138e5d2d041648364f")),
|
||||
(1467631, 0, address!("0x33f6fe38c55cb100ce27b3138e5d2d041648364f")),
|
||||
(1499313, 2, address!("0xe27bfc0a812b38927ff646f24af9149f45deb550")),
|
||||
(1499406, 0, address!("0xe27bfc0a812b38927ff646f24af9149f45deb550")),
|
||||
(1499685, 0, address!("0xfee3932b75a87e86930668a6ab3ed43b404c8a30")),
|
||||
(1514843, 0, address!("0x723e5fbbeed025772a91240fd0956a866a41a603")),
|
||||
(1514936, 0, address!("0x723e5fbbeed025772a91240fd0956a866a41a603")),
|
||||
(1530529, 2, address!("0xa694e8fd8f4a177dd23636d838e9f1fb2138d87a")),
|
||||
(1530622, 2, address!("0xa694e8fd8f4a177dd23636d838e9f1fb2138d87a")),
|
||||
(1530684, 3, address!("0xa694e8fd8f4a177dd23636d838e9f1fb2138d87a")),
|
||||
(1530777, 3, address!("0xa694e8fd8f4a177dd23636d838e9f1fb2138d87a")),
|
||||
(1530839, 2, address!("0x692a343fc401a7755f8fc2facf61af426adaf061")),
|
||||
(1530901, 0, address!("0xfd9716f16596715ce765dabaee11787870e04b8a")),
|
||||
(1530994, 3, address!("0xfd9716f16596715ce765dabaee11787870e04b8a")),
|
||||
(1531056, 4, address!("0xdc67c2b8349ca20f58760e08371fc9271e82b5a4")),
|
||||
(1531149, 0, address!("0xdc67c2b8349ca20f58760e08371fc9271e82b5a4")),
|
||||
(1531211, 3, address!("0xdc67c2b8349ca20f58760e08371fc9271e82b5a4")),
|
||||
(1531366, 1, address!("0x9a90a517d27a9e60e454c96fefbbe94ff244ed6f")),
|
||||
];
|
||||
if block_number < 1467569 || block_number > 1531366 {
|
||||
return;
|
||||
}
|
||||
for (block_num, idx, address) in TX_LIST {
|
||||
if block_number == block_num && tx_index == idx {
|
||||
changes.remove(&address);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -50,6 +50,7 @@ use std::io::Write;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
mod config;
|
||||
mod fix;
|
||||
use alloy_eips::eip1559::INITIAL_BASE_FEE;
|
||||
pub use config::{revm_spec, revm_spec_by_timestamp_and_block_number};
|
||||
use reth_ethereum_forks::EthereumHardfork;
|
||||
|
||||
Reference in New Issue
Block a user