chore(ethereum): replace reth-primitives with alloy (#11155)

Signed-off-by: Abhishekkochar <abhishekkochar2@gmail.com>
This commit is contained in:
Abhishek kochar
2024-09-24 19:33:11 +08:00
committed by GitHub
parent c851a1740c
commit 6e64a14a6f
13 changed files with 39 additions and 19 deletions

5
Cargo.lock generated
View File

@ -7188,6 +7188,7 @@ dependencies = [
name = "reth-ethereum-consensus"
version = "1.0.7"
dependencies = [
"alloy-primitives",
"reth-chainspec",
"reth-consensus",
"reth-consensus-common",
@ -7199,6 +7200,8 @@ dependencies = [
name = "reth-ethereum-engine-primitives"
version = "1.0.7"
dependencies = [
"alloy-eips",
"alloy-primitives",
"alloy-rlp",
"reth-chain-state",
"reth-chainspec",
@ -7235,6 +7238,7 @@ dependencies = [
name = "reth-ethereum-payload-builder"
version = "1.0.7"
dependencies = [
"alloy-primitives",
"reth-basic-payload-builder",
"reth-chain-state",
"reth-errors",
@ -7288,6 +7292,7 @@ name = "reth-evm-ethereum"
version = "1.0.7"
dependencies = [
"alloy-eips",
"alloy-primitives",
"alloy-sol-types",
"reth-chainspec",
"reth-ethereum-consensus",

View File

@ -17,4 +17,7 @@ reth-consensus-common.workspace = true
reth-primitives.workspace = true
reth-consensus.workspace = true
# alloy
alloy-primitives.workspace = true
tracing.workspace = true

View File

@ -8,6 +8,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use alloy_primitives::U256;
use reth_chainspec::{EthChainSpec, EthereumHardfork, EthereumHardforks};
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
use reth_consensus_common::validation::{
@ -18,7 +19,7 @@ use reth_consensus_common::validation::{
};
use reth_primitives::{
constants::MINIMUM_GAS_LIMIT, BlockWithSenders, Header, SealedBlock, SealedHeader,
EMPTY_OMMER_ROOT_HASH, U256,
EMPTY_OMMER_ROOT_HASH,
};
use std::{fmt::Debug, sync::Arc, time::SystemTime};
@ -232,8 +233,9 @@ impl<ChainSpec: Send + Sync + EthChainSpec + EthereumHardforks + Debug> Consensu
#[cfg(test)]
mod tests {
use super::*;
use alloy_primitives::{Sealable, B256};
use reth_chainspec::{ChainSpec, ChainSpecBuilder};
use reth_primitives::{alloy_primitives::Sealable, proofs, B256};
use reth_primitives::proofs;
fn header_with_gas_limit(gas_limit: u64) -> SealedHeader {
let header = Header { gas_limit: gas_limit.into(), ..Default::default() };

View File

@ -1,8 +1,7 @@
use alloy_primitives::{Bloom, B256};
use reth_chainspec::EthereumHardforks;
use reth_consensus::ConsensusError;
use reth_primitives::{
gas_spent_by_transactions, BlockWithSenders, Bloom, GotExpected, Receipt, Request, B256,
};
use reth_primitives::{gas_spent_by_transactions, BlockWithSenders, GotExpected, Receipt, Request};
/// Validate a block with regard to execution results:
///

View File

@ -21,6 +21,10 @@ reth-rpc-types-compat.workspace = true
alloy-rlp.workspace = true
reth-chain-state.workspace = true
# alloy
alloy-primitives.workspace = true
alloy-eips.workspace = true
# misc
serde.workspace = true
sha2.workspace = true

View File

@ -1,9 +1,11 @@
//! Contains types required for building a payload.
use alloy_eips::eip4844::BlobTransactionSidecar;
use alloy_primitives::{Address, B256, U256};
use alloy_rlp::Encodable;
use reth_chain_state::ExecutedBlock;
use reth_payload_primitives::{BuiltPayload, PayloadBuilderAttributes};
use reth_primitives::{Address, BlobTransactionSidecar, SealedBlock, Withdrawals, B256, U256};
use reth_primitives::{SealedBlock, Withdrawals};
use reth_rpc_types::engine::{
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
ExecutionPayloadV1, PayloadAttributes, PayloadId,

View File

@ -25,6 +25,7 @@ reth-execution-types.workspace = true
revm-primitives.workspace = true
# Alloy
alloy-primitives.workspace = true
alloy-eips.workspace = true
alloy-sol-types.workspace = true

View File

@ -1,7 +1,7 @@
//! DAO Fork related constants from [EIP-779](https://eips.ethereum.org/EIPS/eip-779).
//! It happened on Ethereum block 1_920_000
use reth_primitives::{address, Address};
use alloy_primitives::{address, Address};
/// Dao hardfork beneficiary that received ether from accounts from DAO and DAO creator children.
pub static DAO_HARDFORK_BENEFICIARY: Address = address!("bf4ed7b27f1d666546e30d74d50d173d20bca754");

View File

@ -1,11 +1,11 @@
//! EIP-6110 deposit requests parsing
use alloc::{string::ToString, vec::Vec};
use alloy_eips::eip6110::{DepositRequest, MAINNET_DEPOSIT_CONTRACT_ADDRESS};
use alloy_primitives::Log;
use alloy_sol_types::{sol, SolEvent};
use reth_chainspec::ChainSpec;
use reth_evm::execute::BlockValidationError;
use reth_primitives::{Receipt, Request};
use revm_primitives::Log;
sol! {
#[allow(missing_docs)]

View File

@ -5,6 +5,7 @@ use crate::{
EthEvmConfig,
};
use alloc::{boxed::Box, sync::Arc, vec, vec::Vec};
use alloy_primitives::{BlockNumber, U256};
use core::fmt::Display;
use reth_chainspec::{ChainSpec, EthereumHardforks, MAINNET};
use reth_ethereum_consensus::validate_block_post_execution;
@ -20,9 +21,7 @@ use reth_evm::{
ConfigureEvm,
};
use reth_execution_types::ExecutionOutcome;
use reth_primitives::{
BlockNumber, BlockWithSenders, EthereumHardfork, Header, Receipt, Request, U256,
};
use reth_primitives::{BlockWithSenders, EthereumHardfork, Header, Receipt, Request};
use reth_prune_types::PruneModes;
use reth_revm::{
batch::BlockBatchRecord,
@ -478,17 +477,17 @@ mod tests {
eip4788::{BEACON_ROOTS_ADDRESS, BEACON_ROOTS_CODE, SYSTEM_ADDRESS},
eip7002::{WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS, WITHDRAWAL_REQUEST_PREDEPLOY_CODE},
};
use alloy_primitives::{b256, fixed_bytes, keccak256, Bytes, TxKind, B256};
use reth_chainspec::{ChainSpecBuilder, ForkCondition};
use reth_primitives::{
constants::{EMPTY_ROOT_HASH, ETH_TO_WEI},
keccak256, public_key_to_address, Account, Block, BlockBody, Transaction, TxKind, TxLegacy,
B256,
public_key_to_address, Account, Block, BlockBody, Transaction, TxLegacy,
};
use reth_revm::{
database::StateProviderDatabase, test_utils::StateProviderTest, TransitionState,
};
use reth_testing_utils::generators::{self, sign_tx_with_key_pair};
use revm_primitives::{b256, fixed_bytes, Bytes, BLOCKHASH_SERVE_WINDOW};
use revm_primitives::BLOCKHASH_SERVE_WINDOW;
use secp256k1::{Keypair, Secp256k1};
use std::collections::HashMap;

View File

@ -12,12 +12,12 @@
extern crate alloc;
use alloc::vec::Vec;
use alloy_primitives::{Address, Bytes, TxKind, U256};
use reth_chainspec::{ChainSpec, Head};
use reth_evm::{ConfigureEvm, ConfigureEvmEnv, NextBlockEnvAttributes};
use reth_primitives::{transaction::FillTxEnv, Address, Header, TransactionSigned, U256};
use reth_primitives::{transaction::FillTxEnv, Header, TransactionSigned};
use revm_primitives::{
AnalysisKind, BlobExcessGasAndPrice, BlockEnv, Bytes, CfgEnv, CfgEnvWithHandlerCfg, Env,
SpecId, TxEnv, TxKind,
AnalysisKind, BlobExcessGasAndPrice, BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, Env, SpecId, TxEnv,
};
use std::sync::Arc;
@ -194,11 +194,12 @@ impl ConfigureEvm for EthEvmConfig {
#[cfg(test)]
mod tests {
use super::*;
use alloy_primitives::{B256, U256};
use reth_chainspec::{Chain, ChainSpec, MAINNET};
use reth_evm::execute::ProviderError;
use reth_primitives::{
revm_primitives::{BlockEnv, CfgEnv, SpecId},
Genesis, Header, B256, KECCAK_EMPTY, U256,
Genesis, Header, KECCAK_EMPTY,
};
use reth_revm::{
db::{CacheDB, EmptyDBTyped},

View File

@ -30,5 +30,8 @@ reth-chain-state.workspace = true
# ethereum
revm.workspace = true
# alloy
alloy-primitives.workspace = true
# misc
tracing.workspace = true

View File

@ -9,6 +9,7 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![allow(clippy::useless_let_if_seq)]
use alloy_primitives::U256;
use reth_basic_payload_builder::{
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
PayloadConfig, WithdrawalsOutcome,
@ -33,7 +34,7 @@ use reth_primitives::{
proofs::{self, calculate_requests_root},
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, EthereumHardforks, Header, IntoRecoveredTransaction, Receipt,
EMPTY_OMMER_ROOT_HASH, U256,
EMPTY_OMMER_ROOT_HASH,
};
use reth_provider::StateProviderFactory;
use reth_revm::database::StateProviderDatabase;