chore: use alloy-genesis imports for Genesis (#8973)

This commit is contained in:
Dan Cline
2024-06-19 19:14:25 -04:00
committed by GitHub
parent bf9cac7571
commit 8b6ca877d6
24 changed files with 52 additions and 21 deletions

11
Cargo.lock generated
View File

@ -2789,6 +2789,7 @@ dependencies = [
name = "example-custom-engine-types"
version = "0.0.0"
dependencies = [
"alloy-genesis",
"eyre",
"reth",
"reth-basic-payload-builder",
@ -2810,6 +2811,7 @@ dependencies = [
name = "example-custom-evm"
version = "0.0.0"
dependencies = [
"alloy-genesis",
"eyre",
"reth",
"reth-chainspec",
@ -2931,6 +2933,7 @@ name = "example-exex-rollup"
version = "0.0.0"
dependencies = [
"alloy-consensus",
"alloy-genesis",
"alloy-rlp",
"alloy-sol-types",
"eyre",
@ -3049,6 +3052,7 @@ dependencies = [
name = "example-stateful-precompile"
version = "0.0.0"
dependencies = [
"alloy-genesis",
"eyre",
"parking_lot 0.12.3",
"reth",
@ -6422,6 +6426,7 @@ dependencies = [
name = "reth-beacon-consensus"
version = "1.0.0-rc.2"
dependencies = [
"alloy-genesis",
"assert_matches",
"futures",
"itertools 0.12.1",
@ -6513,6 +6518,7 @@ dependencies = [
name = "reth-blockchain-tree"
version = "1.0.0-rc.2"
dependencies = [
"alloy-genesis",
"aquamarine",
"assert_matches",
"linked_hash_set",
@ -6744,6 +6750,7 @@ dependencies = [
name = "reth-db-common"
version = "1.0.0-rc.2"
dependencies = [
"alloy-genesis",
"eyre",
"reth-chainspec",
"reth-codecs",
@ -6997,6 +7004,7 @@ dependencies = [
name = "reth-eth-wire-types"
version = "1.0.0-rc.2"
dependencies = [
"alloy-genesis",
"alloy-rlp",
"arbitrary",
"async-stream",
@ -7523,6 +7531,7 @@ dependencies = [
name = "reth-node-core"
version = "1.0.0-rc.2"
dependencies = [
"alloy-genesis",
"alloy-rpc-types-engine",
"clap",
"const-str",
@ -7641,6 +7650,7 @@ dependencies = [
name = "reth-node-optimism"
version = "1.0.0-rc.2"
dependencies = [
"alloy-genesis",
"alloy-primitives",
"async-trait",
"clap",
@ -7949,6 +7959,7 @@ name = "reth-rpc"
version = "1.0.0-rc.2"
dependencies = [
"alloy-dyn-abi",
"alloy-genesis",
"alloy-primitives",
"alloy-rlp",
"alloy-sol-types",

View File

@ -54,6 +54,7 @@ reth-revm.workspace = true
reth-evm-ethereum.workspace = true
parking_lot.workspace = true
assert_matches.workspace = true
alloy-genesis.workspace = true
[features]
test-utils = []

View File

@ -1367,6 +1367,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_genesis::{Genesis, GenesisAccount};
use assert_matches::assert_matches;
use linked_hash_set::LinkedHashSet;
use reth_chainspec::{ChainSpecBuilder, MAINNET};
@ -1384,8 +1385,8 @@ mod tests {
keccak256,
proofs::calculate_transaction_root,
revm_primitives::AccountInfo,
Account, Address, Genesis, GenesisAccount, Header, Signature, Transaction,
TransactionSigned, TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256,
Account, Address, Header, Signature, Transaction, TransactionSigned,
TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256,
};
use reth_provider::{
test_utils::{blocks::BlockchainTestData, create_test_provider_factory_with_chain_spec},

View File

@ -69,6 +69,7 @@ reth-config.workspace = true
reth-testing-utils.workspace = true
reth-exex-types.workspace = true
reth-prune-types.workspace = true
alloy-genesis.workspace = true
assert_matches.workspace = true

View File

@ -2490,8 +2490,9 @@ mod tests {
mod new_payload {
use super::*;
use alloy_genesis::Genesis;
use reth_db::test_utils::create_test_static_files_dir;
use reth_primitives::{genesis::Genesis, Hardfork, U256};
use reth_primitives::{Hardfork, U256};
use reth_provider::{
providers::StaticFileProvider, test_utils::blocks::BlockchainTestData,
};

View File

@ -17,6 +17,7 @@ reth-chainspec.workspace = true
reth-codecs-derive.workspace = true
reth-primitives.workspace = true
alloy-rlp = { workspace = true, features = ["derive"] }
alloy-genesis.workspace = true
bytes.workspace = true
derive_more.workspace = true

View File

@ -1,8 +1,9 @@
use crate::EthVersion;
use alloy_genesis::Genesis;
use alloy_rlp::{RlpDecodable, RlpEncodable};
use reth_chainspec::{Chain, ChainSpec, NamedChain, MAINNET};
use reth_codecs_derive::derive_arbitrary;
use reth_primitives::{hex, ForkId, Genesis, Hardfork, Head, B256, U256};
use reth_primitives::{hex, ForkId, Hardfork, Head, B256, U256};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::fmt::{Debug, Display};
@ -228,10 +229,11 @@ impl StatusBuilder {
#[cfg(test)]
mod tests {
use crate::{EthVersion, Status};
use alloy_genesis::Genesis;
use alloy_rlp::{Decodable, Encodable};
use rand::Rng;
use reth_chainspec::{Chain, ChainSpec, ForkCondition, NamedChain};
use reth_primitives::{hex, ForkHash, ForkId, Genesis, Hardfork, Head, B256, U256};
use reth_primitives::{hex, ForkHash, ForkId, Hardfork, Head, B256, U256};
use std::str::FromStr;
#[test]

View File

@ -98,6 +98,7 @@ procfs = "0.16.0"
[dev-dependencies]
# test vectors generation
proptest.workspace = true
alloy-genesis.workspace = true
[features]
optimism = [

View File

@ -168,9 +168,10 @@ pub fn parse_socket_address(value: &str) -> eyre::Result<SocketAddr, SocketAddre
#[cfg(test)]
mod tests {
use super::*;
use alloy_genesis::{ChainConfig, Genesis, GenesisAccount};
use proptest::prelude::Rng;
use reth_chainspec::ChainSpecBuilder;
use reth_primitives::{hex, Address, ChainConfig, Genesis, GenesisAccount, U256};
use reth_primitives::{hex, Address, U256};
use secp256k1::rand::thread_rng;
use std::collections::HashMap;

View File

@ -57,6 +57,7 @@ reth-revm = { workspace = true, features = ["test-utils"] }
reth-e2e-test-utils.workspace = true
tokio.workspace = true
alloy-primitives.workspace = true
alloy-genesis.workspace = true
[features]
optimism = [

View File

@ -1,9 +1,10 @@
use alloy_genesis::Genesis;
use reth::{rpc::types::engine::PayloadAttributes, tasks::TaskManager};
use reth_chainspec::{ChainSpecBuilder, BASE_MAINNET};
use reth_e2e_test_utils::{transaction::TransactionTestContext, wallet::Wallet, NodeHelperType};
use reth_node_optimism::{OptimismBuiltPayload, OptimismNode, OptimismPayloadBuilderAttributes};
use reth_payload_builder::EthPayloadBuilderAttributes;
use reth_primitives::{Address, Genesis, B256};
use reth_primitives::{Address, B256};
use std::sync::Arc;
use tokio::sync::Mutex;

View File

@ -135,10 +135,8 @@ pub fn calculate_ommers_root(ommers: &[Header]) -> B256 {
#[cfg(test)]
mod tests {
use super::*;
use crate::{
bloom, constants::EMPTY_ROOT_HASH, hex_literal::hex, Block, GenesisAccount, Log, TxType,
U256,
};
use crate::{bloom, constants::EMPTY_ROOT_HASH, hex_literal::hex, Block, Log, TxType, U256};
use alloy_genesis::GenesisAccount;
use alloy_primitives::{b256, Address, LogData};
use alloy_rlp::Decodable;
use reth_chainspec::{GOERLI, HOLESKY, MAINNET, SEPOLIA};

View File

@ -39,6 +39,7 @@ alloy-rlp.workspace = true
alloy-dyn-abi = { workspace = true, features = ["eip712"] }
alloy-primitives.workspace = true
alloy-sol-types.workspace = true
alloy-genesis.workspace = true
revm = { workspace = true, features = [
"optional_block_gas_limit",
"optional_eip3607",

View File

@ -1,11 +1,11 @@
use crate::result::ToRpcResult;
use alloy_genesis::ChainConfig;
use alloy_primitives::B256;
use async_trait::async_trait;
use jsonrpsee::core::RpcResult;
use reth_chainspec::ChainSpec;
use reth_network_api::{NetworkInfo, PeerKind, Peers};
use reth_network_peers::{AnyNode, NodeRecord};
use reth_primitives::ChainConfig;
use reth_rpc_api::AdminApiServer;
use reth_rpc_types::{
admin::{EthProtocolInfo, NodeInfo, Ports, ProtocolInfo},

View File

@ -20,6 +20,9 @@ reth-etl.workspace = true
reth-codecs.workspace = true
reth-stages-types.workspace = true
# eth
alloy-genesis.workspace = true
# misc
eyre.workspace = true
thiserror.workspace = true

View File

@ -1,5 +1,6 @@
//! Reth genesis initialization utility functions.
use alloy_genesis::GenesisAccount;
use reth_chainspec::ChainSpec;
use reth_codecs::Compact;
use reth_config::config::EtlConfig;
@ -7,8 +8,7 @@ use reth_db::tables;
use reth_db_api::{database::Database, transaction::DbTxMut, DatabaseError};
use reth_etl::Collector;
use reth_primitives::{
Account, Address, Bytecode, GenesisAccount, Receipts, StaticFileSegment, StorageEntry, B256,
U256,
Account, Address, Bytecode, Receipts, StaticFileSegment, StorageEntry, B256, U256,
};
use reth_provider::{
bundle_state::{BundleStateInit, RevertsInit},
@ -525,6 +525,7 @@ struct GenesisAccountWithAddress {
#[cfg(test)]
mod tests {
use super::*;
use alloy_genesis::Genesis;
use reth_chainspec::{Chain, GOERLI, MAINNET, SEPOLIA};
use reth_db::DatabaseEnv;
use reth_db_api::{
@ -533,9 +534,7 @@ mod tests {
table::{Table, TableRow},
transaction::DbTx,
};
use reth_primitives::{
Genesis, GOERLI_GENESIS_HASH, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH,
};
use reth_primitives::{GOERLI_GENESIS_HASH, MAINNET_GENESIS_HASH, SEPOLIA_GENESIS_HASH};
use reth_primitives_traits::IntegerList;
use reth_provider::test_utils::create_test_provider_factory_with_chain_spec;

View File

@ -17,6 +17,7 @@ reth-basic-payload-builder.workspace = true
reth-ethereum-payload-builder.workspace = true
reth-node-ethereum.workspace = true
reth-tracing.workspace = true
alloy-genesis.workspace = true
eyre.workspace = true
tokio.workspace = true

View File

@ -22,6 +22,7 @@ use std::convert::Infallible;
use serde::{Deserialize, Serialize};
use thiserror::Error;
use alloy_genesis::Genesis;
use reth::{
api::PayloadTypes,
builder::{
@ -51,7 +52,7 @@ use reth_payload_builder::{
error::PayloadBuilderError, EthBuiltPayload, EthPayloadBuilderAttributes, PayloadBuilderHandle,
PayloadBuilderService,
};
use reth_primitives::{Address, Genesis, Header, Withdrawals, B256};
use reth_primitives::{Address, Header, Withdrawals, B256};
use reth_rpc_types::{
engine::{
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,

View File

@ -13,6 +13,7 @@ reth-node-core.workspace = true
reth-primitives.workspace = true
reth-node-ethereum.workspace = true
reth-tracing.workspace = true
alloy-genesis.workspace = true
eyre.workspace = true
tokio.workspace = true

View File

@ -2,6 +2,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_genesis::Genesis;
use reth::{
builder::{components::ExecutorBuilder, BuilderContext, NodeBuilder},
primitives::{
@ -21,7 +22,7 @@ use reth_chainspec::{Chain, ChainSpec};
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv, FullNodeTypes};
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider, EthereumNode};
use reth_primitives::{Genesis, Header, TransactionSigned};
use reth_primitives::{Header, TransactionSigned};
use reth_tracing::{RethTracer, Tracer};
use std::sync::Arc;

View File

@ -24,6 +24,7 @@ tokio.workspace = true
# misc
alloy-consensus = { workspace = true, features = ["kzg"] }
alloy-genesis.workspace = true
alloy-rlp.workspace = true
alloy-sol-types = { workspace = true, features = ["json"] }
eyre.workspace = true

View File

@ -4,6 +4,7 @@
//! The rollup contract accepts blocks of transactions and deposits of ETH and is deployed on
//! Holesky at [ROLLUP_CONTRACT_ADDRESS], see <https://github.com/init4tech/zenith/blob/e0481e930947513166881a83e276b316c2f38502/src/Zenith.sol>.
use alloy_genesis::Genesis;
use alloy_sol_types::{sol, SolEventInterface, SolInterface};
use db::Database;
use execution::execute_block;
@ -13,7 +14,7 @@ use reth_execution_types::Chain;
use reth_exex::{ExExContext, ExExEvent};
use reth_node_api::FullNodeComponents;
use reth_node_ethereum::EthereumNode;
use reth_primitives::{address, Address, Genesis, SealedBlockWithSenders, TransactionSigned, U256};
use reth_primitives::{address, Address, SealedBlockWithSenders, TransactionSigned, U256};
use reth_tracing::tracing::{error, info};
use rusqlite::Connection;
use std::sync::Arc;

View File

@ -13,6 +13,7 @@ reth-node-core.workspace = true
reth-primitives.workspace = true
reth-node-ethereum.workspace = true
reth-tracing.workspace = true
alloy-genesis.workspace = true
eyre.workspace = true
parking_lot.workspace = true

View File

@ -2,6 +2,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_genesis::Genesis;
use parking_lot::RwLock;
use reth::{
builder::{components::ExecutorBuilder, BuilderContext, NodeBuilder},
@ -23,7 +24,7 @@ use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider, EthereumNode};
use reth_primitives::{
revm_primitives::{SpecId, StatefulPrecompileMut},
Genesis, Header, TransactionSigned,
Header, TransactionSigned,
};
use reth_tracing::{RethTracer, Tracer};
use schnellru::{ByLength, LruMap};