refactor(ethereum, primitives, evm): use Alloy EIP-4788 constants (#8208)

This commit is contained in:
Alexey Shekhirin
2024-05-12 15:43:15 +03:00
committed by GitHub
parent d9f9504dbd
commit 3efab64218
8 changed files with 86 additions and 94 deletions

View File

@ -24,4 +24,6 @@ revm-primitives.workspace = true
tracing.workspace = true
[dev-dependencies]
reth-revm = { workspace = true, features = ["test-utils"] }
reth-revm = { workspace = true, features = ["test-utils"] }
alloy-eips.workspace = true

View File

@ -443,31 +443,26 @@ where
#[cfg(test)]
mod tests {
use super::*;
use reth_primitives::{
bytes,
constants::{BEACON_ROOTS_ADDRESS, SYSTEM_ADDRESS},
keccak256, Account, Block, Bytes, ChainSpecBuilder, ForkCondition, B256,
};
use alloy_eips::eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS};
use reth_primitives::{keccak256, Account, Block, ChainSpecBuilder, ForkCondition, B256};
use reth_revm::{
database::StateProviderDatabase, test_utils::StateProviderTest, TransitionState,
};
use std::collections::HashMap;
static BEACON_ROOT_CONTRACT_CODE: Bytes = bytes!("3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500");
fn create_state_provider_with_beacon_root_contract() -> StateProviderTest {
let mut db = StateProviderTest::default();
let beacon_root_contract_account = Account {
balance: U256::ZERO,
bytecode_hash: Some(keccak256(BEACON_ROOT_CONTRACT_CODE.clone())),
bytecode_hash: Some(keccak256(BEACON_ROOTS_CODE.clone())),
nonce: 1,
};
db.insert_account(
BEACON_ROOTS_ADDRESS,
beacon_root_contract_account,
Some(BEACON_ROOT_CONTRACT_CODE.clone()),
Some(BEACON_ROOTS_CODE.clone()),
HashMap::new(),
);