mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: simplify get precompiles (#4681)
This commit is contained in:
@ -376,7 +376,7 @@ where
|
||||
// can consume the list since we're not using the request anymore
|
||||
let initial = request.access_list.take().unwrap_or_default();
|
||||
|
||||
let precompiles = get_precompiles(&env.cfg.spec_id);
|
||||
let precompiles = get_precompiles(env.cfg.spec_id);
|
||||
let mut inspector = AccessListInspector::new(initial, from, to, precompiles);
|
||||
let (result, _env) = inspect(&mut db, env, &mut inspector)?;
|
||||
|
||||
|
||||
@ -92,26 +92,10 @@ impl FillableTransaction for TransactionSigned {
|
||||
}
|
||||
|
||||
/// Returns the addresses of the precompiles corresponding to the SpecId.
|
||||
pub(crate) fn get_precompiles(spec_id: &SpecId) -> Vec<reth_primitives::H160> {
|
||||
let spec = match spec_id {
|
||||
SpecId::FRONTIER | SpecId::FRONTIER_THAWING => return vec![],
|
||||
SpecId::HOMESTEAD | SpecId::DAO_FORK | SpecId::TANGERINE | SpecId::SPURIOUS_DRAGON => {
|
||||
PrecompilesSpecId::HOMESTEAD
|
||||
}
|
||||
SpecId::BYZANTIUM | SpecId::CONSTANTINOPLE | SpecId::PETERSBURG => {
|
||||
PrecompilesSpecId::BYZANTIUM
|
||||
}
|
||||
SpecId::ISTANBUL | SpecId::MUIR_GLACIER => PrecompilesSpecId::ISTANBUL,
|
||||
SpecId::BERLIN |
|
||||
SpecId::LONDON |
|
||||
SpecId::ARROW_GLACIER |
|
||||
SpecId::GRAY_GLACIER |
|
||||
SpecId::MERGE |
|
||||
SpecId::SHANGHAI => PrecompilesSpecId::BERLIN,
|
||||
SpecId::CANCUN => PrecompilesSpecId::CANCUN,
|
||||
SpecId::LATEST => PrecompilesSpecId::LATEST,
|
||||
};
|
||||
Precompiles::new(spec).addresses().into_iter().map(Address::from).collect()
|
||||
#[inline]
|
||||
pub(crate) fn get_precompiles(spec_id: SpecId) -> impl IntoIterator<Item = Address> {
|
||||
let spec = PrecompilesSpecId::from_spec_id(spec_id);
|
||||
Precompiles::new(spec).addresses().into_iter().copied().map(Address::from)
|
||||
}
|
||||
|
||||
/// Executes the [Env] against the given [Database] without committing state changes.
|
||||
|
||||
Reference in New Issue
Block a user