feat: add eth state cache (#1561)

This commit is contained in:
Matthias Seitz
2023-02-28 20:46:25 +01:00
committed by GitHub
parent dc2f6047db
commit 7a01e1e231
12 changed files with 364 additions and 22 deletions

View File

@ -3,18 +3,19 @@ use reth_primitives::{
Address, ChainSpec, Head, Header, Transaction, TransactionKind, TransactionSigned, TxEip1559,
TxEip2930, TxLegacy, U256,
};
use revm::primitives::{AnalysisKind, BlockEnv, CfgEnv, Env, SpecId, TransactTo, TxEnv};
use revm::primitives::{AnalysisKind, BlockEnv, CfgEnv, SpecId, TransactTo, TxEnv};
/// Convenience function to call both [fill_cfg_env] and [fill_block_env]
pub fn fill_cfg_and_block_env(
env: &mut Env,
cfg: &mut CfgEnv,
block_env: &mut BlockEnv,
chain_spec: &ChainSpec,
header: &Header,
total_difficulty: U256,
) {
fill_cfg_env(&mut env.cfg, chain_spec, header, total_difficulty);
let after_merge = env.cfg.spec_id >= SpecId::MERGE;
fill_block_env(&mut env.block, header, after_merge);
fill_cfg_env(cfg, chain_spec, header, total_difficulty);
let after_merge = cfg.spec_id >= SpecId::MERGE;
fill_block_env(block_env, header, after_merge);
}
/// Fill [CfgEnv] fields according to the chain spec and given header