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

View File

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

View File

@ -1367,6 +1367,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use alloy_genesis::{Genesis, GenesisAccount};
use assert_matches::assert_matches; use assert_matches::assert_matches;
use linked_hash_set::LinkedHashSet; use linked_hash_set::LinkedHashSet;
use reth_chainspec::{ChainSpecBuilder, MAINNET}; use reth_chainspec::{ChainSpecBuilder, MAINNET};
@ -1384,8 +1385,8 @@ mod tests {
keccak256, keccak256,
proofs::calculate_transaction_root, proofs::calculate_transaction_root,
revm_primitives::AccountInfo, revm_primitives::AccountInfo,
Account, Address, Genesis, GenesisAccount, Header, Signature, Transaction, Account, Address, Header, Signature, Transaction, TransactionSigned,
TransactionSigned, TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256, TransactionSignedEcRecovered, TxEip1559, Withdrawals, B256,
}; };
use reth_provider::{ use reth_provider::{
test_utils::{blocks::BlockchainTestData, create_test_provider_factory_with_chain_spec}, 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-testing-utils.workspace = true
reth-exex-types.workspace = true reth-exex-types.workspace = true
reth-prune-types.workspace = true reth-prune-types.workspace = true
alloy-genesis.workspace = true
assert_matches.workspace = true assert_matches.workspace = true

View File

@ -2490,8 +2490,9 @@ mod tests {
mod new_payload { mod new_payload {
use super::*; use super::*;
use alloy_genesis::Genesis;
use reth_db::test_utils::create_test_static_files_dir; 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::{ use reth_provider::{
providers::StaticFileProvider, test_utils::blocks::BlockchainTestData, providers::StaticFileProvider, test_utils::blocks::BlockchainTestData,
}; };

View File

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

View File

@ -1,8 +1,9 @@
use crate::EthVersion; use crate::EthVersion;
use alloy_genesis::Genesis;
use alloy_rlp::{RlpDecodable, RlpEncodable}; use alloy_rlp::{RlpDecodable, RlpEncodable};
use reth_chainspec::{Chain, ChainSpec, NamedChain, MAINNET}; use reth_chainspec::{Chain, ChainSpec, NamedChain, MAINNET};
use reth_codecs_derive::derive_arbitrary; 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")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt::{Debug, Display}; use std::fmt::{Debug, Display};
@ -228,10 +229,11 @@ impl StatusBuilder {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::{EthVersion, Status}; use crate::{EthVersion, Status};
use alloy_genesis::Genesis;
use alloy_rlp::{Decodable, Encodable}; use alloy_rlp::{Decodable, Encodable};
use rand::Rng; use rand::Rng;
use reth_chainspec::{Chain, ChainSpec, ForkCondition, NamedChain}; 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; use std::str::FromStr;
#[test] #[test]

View File

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

View File

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

View File

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

View File

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

View File

@ -135,10 +135,8 @@ pub fn calculate_ommers_root(ommers: &[Header]) -> B256 {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::{ use crate::{bloom, constants::EMPTY_ROOT_HASH, hex_literal::hex, Block, Log, TxType, U256};
bloom, constants::EMPTY_ROOT_HASH, hex_literal::hex, Block, GenesisAccount, Log, TxType, use alloy_genesis::GenesisAccount;
U256,
};
use alloy_primitives::{b256, Address, LogData}; use alloy_primitives::{b256, Address, LogData};
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use reth_chainspec::{GOERLI, HOLESKY, MAINNET, SEPOLIA}; 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-dyn-abi = { workspace = true, features = ["eip712"] }
alloy-primitives.workspace = true alloy-primitives.workspace = true
alloy-sol-types.workspace = true alloy-sol-types.workspace = true
alloy-genesis.workspace = true
revm = { workspace = true, features = [ revm = { workspace = true, features = [
"optional_block_gas_limit", "optional_block_gas_limit",
"optional_eip3607", "optional_eip3607",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@
//! The rollup contract accepts blocks of transactions and deposits of ETH and is deployed on //! 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>. //! 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 alloy_sol_types::{sol, SolEventInterface, SolInterface};
use db::Database; use db::Database;
use execution::execute_block; use execution::execute_block;
@ -13,7 +14,7 @@ use reth_execution_types::Chain;
use reth_exex::{ExExContext, ExExEvent}; use reth_exex::{ExExContext, ExExEvent};
use reth_node_api::FullNodeComponents; use reth_node_api::FullNodeComponents;
use reth_node_ethereum::EthereumNode; 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 reth_tracing::tracing::{error, info};
use rusqlite::Connection; use rusqlite::Connection;
use std::sync::Arc; use std::sync::Arc;

View File

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

View File

@ -2,6 +2,7 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(not(test), warn(unused_crate_dependencies))]
use alloy_genesis::Genesis;
use parking_lot::RwLock; use parking_lot::RwLock;
use reth::{ use reth::{
builder::{components::ExecutorBuilder, BuilderContext, NodeBuilder}, 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_node_ethereum::{EthEvmConfig, EthExecutorProvider, EthereumNode};
use reth_primitives::{ use reth_primitives::{
revm_primitives::{SpecId, StatefulPrecompileMut}, revm_primitives::{SpecId, StatefulPrecompileMut},
Genesis, Header, TransactionSigned, Header, TransactionSigned,
}; };
use reth_tracing::{RethTracer, Tracer}; use reth_tracing::{RethTracer, Tracer};
use schnellru::{ByLength, LruMap}; use schnellru::{ByLength, LruMap};