Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ccae4eb
feat: Alloy type migration (#4674)
DaniPopes Sep 23, 2023
dbd877a
feat: migrate RLP to alloy-rlp (take 2) (#4749)
DaniPopes Sep 23, 2023
3a37ad9
chore: drop `smol_str` (#4751)
DaniPopes Sep 23, 2023
9e613b4
Merge branch 'main' into alloy
DaniPopes Sep 25, 2023
ba8110d
use alloy `GenericContractError` in `reth_primitives::abi::decode_rev…
alessandromazza98 Sep 26, 2023
7095a60
Merge branch 'main' into alloy
DaniPopes Sep 26, 2023
c1711d7
feat: migrate rpc signing code to alloy (#4758)
supernovahs Sep 26, 2023
4bd8cdd
chore: use upstream eip191_hash_message
DaniPopes Sep 26, 2023
5dce2ec
chore: add alloy-rlp, remove {rlp,primitive_types} features from ruin…
DaniPopes Sep 26, 2023
a7343fc
Merge branch 'main' into alloy
DaniPopes Sep 26, 2023
a4a62ec
chore: use b256 macro more
DaniPopes Sep 26, 2023
452ebf4
chore: simplify trie root bench (#4802)
DaniPopes Sep 26, 2023
7ed7c21
chore: update revm
DaniPopes Sep 26, 2023
c4e4400
move `decode_revert_reason` to alloy (#4803)
alessandromazza98 Sep 26, 2023
2bebf25
Merge branch 'main' into alloy
DaniPopes Sep 26, 2023
3ddf4b9
chore: clean up remaining uses of ethers-core (#4807)
DaniPopes Sep 26, 2023
3a03f97
Merge branch 'main' into alloy
DaniPopes Sep 26, 2023
f09e6e9
feat: remove `ethers-core` from prod (#4808)
DaniPopes Sep 26, 2023
57fec6f
chore: deprecate h types (#4823)
supernovahs Sep 27, 2023
238f3b0
update
DaniPopes Sep 27, 2023
073265b
Merge branch 'main' into alloy
DaniPopes Sep 27, 2023
0f16d20
chore: clippy
DaniPopes Sep 27, 2023
b6b26c8
Merge branch 'main' into alloy
DaniPopes Sep 28, 2023
637ea57
update
DaniPopes Sep 28, 2023
4ed4eb0
Merge branch 'main' into alloy
DaniPopes Sep 28, 2023
c325215
update fork
DaniPopes Sep 28, 2023
38ceaf1
update deny
DaniPopes Sep 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
636 changes: 324 additions & 312 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ members = [
"crates/revm",
"crates/revm/revm-primitives",
"crates/revm/revm-inspectors",
"crates/rlp",
"crates/rlp/rlp-derive",
"crates/rpc/ipc",
"crates/rpc/rpc",
"crates/rpc/rpc-api",
Expand Down Expand Up @@ -91,7 +89,6 @@ reth-primitives = { path = "./crates/primitives" }
reth-interfaces = { path = "./crates/interfaces" }
reth-provider = { path = "./crates/storage/provider" }
reth-db = { path = "./crates/storage/db" }
reth-rlp = { path = "./crates/rlp" }
reth-rpc-types = { path = "./crates/rpc/rpc-types" }
reth-rpc-builder = { path = "./crates/rpc/rpc-builder" }
reth-blockchain-tree = { path = "./crates/blockchain-tree" }
Expand All @@ -109,15 +106,19 @@ reth-eth-wire = { path = "./crates/net/eth-wire" }
reth-ecies = { path = "./crates/net/ecies" }

# revm
revm = { git = "https://github.com/bluealloy/revm", rev = "516f62cc" }
revm-primitives = { git = "https://github.com/bluealloy/revm", rev = "516f62cc" }
# TODO: Switch back to bluealloy/revm once #724 lands
revm = { git = "https://github.com/Danipopes/revm/", branch = "alloy-rebase2" }
revm-primitives = { git = "https://github.com/Danipopes/revm/", branch = "alloy-rebase2" }

## eth
alloy-primitives = "0.3"
alloy-dyn-abi = "0.3"
alloy-sol-types = "0.3"
alloy-rlp = "0.3"
ethers-core = { version = "2.0", default-features = false }
ethers-providers = { version = "2.0", default-features = false }
ethers-signers = { version = "2.0", default-features = false }
ethers-middleware = { version = "2.0", default-features = false }

discv5 = { git = "https://github.com/sigp/discv5", rev = "d2e30e04ee62418b9e57278cee907c02b99d5bd1" }
igd = { git = "https://github.com/stevefan1999-personal/rust-igd", rev = "c2d1f83eb1612a462962453cb0703bc93258b173" }

Expand Down Expand Up @@ -183,3 +184,13 @@ assert_matches = "1.5.0"
proptest = "1.0"
proptest-derive = "0.4"
serial_test = "2"

# TODO: Use Alloy 0.4 once it's released
[patch.crates-io]
alloy-dyn-abi = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
alloy-json-abi = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
alloy-primitives = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
alloy-sol-macro = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
alloy-sol-type-parser = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
alloy-sol-types = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
syn-solidity = { git = "https://github.com/alloy-rs/core", rev = "cd4985caf45f4ac6b2aee91d1f06fcdeb665415a" }
3 changes: 1 addition & 2 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ reth-rpc-builder = { path = "../../crates/rpc/rpc-builder" }
reth-rpc = { path = "../../crates/rpc/rpc" }
reth-rpc-types = { path = "../../crates/rpc/rpc-types" }
reth-rpc-api = { path = "../../crates/rpc/rpc-api" }
reth-rlp.workspace = true
reth-network = { path = "../../crates/net/network", features = ["serde"] }
reth-network-api.workspace = true
reth-downloaders = { path = "../../crates/net/downloaders", features = ["test-utils"] }
Expand All @@ -51,6 +50,7 @@ reth-prune = { path = "../../crates/prune" }
reth-trie = { path = "../../crates/trie" }

# crypto
alloy-rlp.workspace = true
secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] }

# tracing
Expand Down Expand Up @@ -95,7 +95,6 @@ eyre = "0.6.8"
clap = { version = "4", features = ["derive"] }
tempfile = { version = "3.3.0" }
backon = "0.4"
hex = "0.4"
thiserror.workspace = true
pretty_assertions = "1.3.0"
humantime = "2.1.0"
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/args/debug_args.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! clap [Args](clap::Args) for debugging purposes

use clap::Args;
use reth_primitives::{TxHash, H256};
use reth_primitives::{TxHash, B256};

/// Parameters for debugging purposes
#[derive(Debug, Args, PartialEq, Default)]
Expand All @@ -21,7 +21,7 @@ pub struct DebugArgs {
///
/// NOTE: This is a temporary flag
#[arg(long = "debug.tip", help_heading = "Debug", conflicts_with = "continuous")]
pub tip: Option<H256>,
pub tip: Option<B256>,

/// Runs the sync only up to the specified block.
#[arg(long = "debug.max-block", help_heading = "Debug")]
Expand Down
3 changes: 1 addition & 2 deletions bin/reth/src/args/secret_key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use hex::encode as hex_encode;
use reth_network::config::rng_secret_key;
use reth_primitives::{fs, fs::FsPathError};
use reth_primitives::{fs, fs::FsPathError, hex::encode as hex_encode};
use secp256k1::{Error as SecretKeyBaseError, SecretKey};
use std::{
io,
Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/args/utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Clap parser utilities

use reth_primitives::{
fs, AllGenesisFormats, BlockHashOrNumber, ChainSpec, DEV, GOERLI, HOLESKY, MAINNET, SEPOLIA,
fs, AllGenesisFormats, BlockHashOrNumber, ChainSpec, B256, DEV, GOERLI, HOLESKY, MAINNET,
SEPOLIA,
};
use reth_revm::primitives::B256 as H256;
use std::{
net::{IpAddr, Ipv4Addr, SocketAddr, ToSocketAddrs},
path::PathBuf,
Expand Down Expand Up @@ -53,7 +53,7 @@ pub fn genesis_value_parser(s: &str) -> eyre::Result<Arc<ChainSpec>, eyre::Error

/// Parse [BlockHashOrNumber]
pub fn hash_or_num_value_parser(value: &str) -> eyre::Result<BlockHashOrNumber, eyre::Error> {
match H256::from_str(value) {
match B256::from_str(value) {
Ok(hash) => Ok(BlockHashOrNumber::Hash(hash)),
Err(_) => Ok(BlockHashOrNumber::Number(value.parse()?)),
}
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/chain/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use reth_downloaders::{
headers::reverse_headers::ReverseHeadersDownloaderBuilder, test_utils::FileClient,
};
use reth_interfaces::consensus::Consensus;
use reth_primitives::{stage::StageId, ChainSpec, H256};
use reth_primitives::{stage::StageId, ChainSpec, B256};
use reth_stages::{
prelude::*,
stages::{
Expand Down Expand Up @@ -156,7 +156,7 @@ impl ImportCommand {
.build(file_client.clone(), consensus.clone(), db.clone())
.into_task();

let (tip_tx, tip_rx) = watch::channel(H256::zero());
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);
let factory = reth_revm::Factory::new(self.chain.clone());

let max_block = file_client.max_block().unwrap_or(0);
Expand Down
8 changes: 4 additions & 4 deletions bin/reth/src/cli/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Config traits for various node components.

use reth_revm::primitives::bytes::BytesMut;
use reth_rlp::Encodable;
use alloy_rlp::Encodable;
use reth_primitives::{Bytes, BytesMut};
use reth_rpc::{eth::gas_oracle::GasPriceOracleConfig, JwtError, JwtSecret};
use reth_rpc_builder::{
auth::AuthServerConfig, error::RpcError, EthConfig, IpcServerBuilder, RpcServerConfig,
Expand Down Expand Up @@ -72,10 +72,10 @@ pub trait PayloadBuilderConfig {
fn extradata(&self) -> Cow<'_, str>;

/// Returns the rlp-encoded extradata bytes.
fn extradata_rlp_bytes(&self) -> reth_primitives::bytes::Bytes {
fn extradata_rlp_bytes(&self) -> Bytes {
let mut extradata = BytesMut::new();
self.extradata().as_bytes().encode(&mut extradata);
extradata.freeze()
extradata.freeze().into()
}

/// The interval at which the job should build a new payload after the last.
Expand Down
10 changes: 5 additions & 5 deletions bin/reth/src/db/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod tests {
models::{storage_sharded_key::StorageShardedKey, ShardedKey},
AccountHistory, HashedAccount, Headers, StorageHistory, SyncStage,
};
use reth_primitives::{H160, H256};
use reth_primitives::{Address, B256};
use std::str::FromStr;

/// A helper type to parse Args more easily
Expand All @@ -104,7 +104,7 @@ mod tests {
.args;
assert_eq!(
args.table_key::<HashedAccount>().unwrap(),
H256::from_str("0x0ac361fe774b78f8fc4e86c1916930d150865c3fc2e21dca2e58833557608bac")
B256::from_str("0x0ac361fe774b78f8fc4e86c1916930d150865c3fc2e21dca2e58833557608bac")
.unwrap()
);
}
Expand All @@ -122,8 +122,8 @@ mod tests {
assert_eq!(
args.table_key::<StorageHistory>().unwrap(),
StorageShardedKey::new(
H160::from_str("0x01957911244e546ce519fbac6f798958fafadb41").unwrap(),
H256::from_str(
Address::from_str("0x01957911244e546ce519fbac6f798958fafadb41").unwrap(),
B256::from_str(
"0x0000000000000000000000000000000000000000000000000000000000000003"
)
.unwrap(),
Expand All @@ -138,7 +138,7 @@ mod tests {
assert_eq!(
args.table_key::<AccountHistory>().unwrap(),
ShardedKey::new(
H160::from_str("0x4448e1273fd5a8bfdb9ed111e96889c960eee145").unwrap(),
Address::from_str("0x4448e1273fd5a8bfdb9ed111e96889c960eee145").unwrap(),
18446744073709551615
)
);
Expand Down
1 change: 1 addition & 0 deletions bin/reth/src/db/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::utils::{DbTool, ListFilter};
use clap::Parser;
use eyre::WrapErr;
use reth_db::{database::Database, table::Table, DatabaseEnvRO, TableType, TableViewer, Tables};
use reth_primitives::hex;
use std::cell::RefCell;
use tracing::error;

Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/debug_cmd/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use reth_interfaces::{
};
use reth_network::NetworkHandle;
use reth_network_api::NetworkInfo;
use reth_primitives::{fs, stage::StageId, BlockHashOrNumber, BlockNumber, ChainSpec, H256};
use reth_primitives::{fs, stage::StageId, BlockHashOrNumber, BlockNumber, ChainSpec, B256};
use reth_provider::{BlockExecutionWriter, ProviderFactory, StageCheckpointReader};
use reth_stages::{
sets::DefaultStages,
Expand Down Expand Up @@ -112,7 +112,7 @@ impl Command {

let stage_conf = &config.stages;

let (tip_tx, tip_rx) = watch::channel(H256::zero());
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);
let factory = reth_revm::Factory::new(self.chain.clone());

let header_mode = HeaderSyncMode::Tip(tip_rx);
Expand Down Expand Up @@ -186,7 +186,7 @@ impl Command {
&self,
client: Client,
block: BlockNumber,
) -> eyre::Result<H256> {
) -> eyre::Result<B256> {
info!(target: "reth::cli", ?block, "Fetching block from the network.");
loop {
match get_single_header(&client, BlockHashOrNumber::Number(block)).await {
Expand Down
20 changes: 10 additions & 10 deletions bin/reth/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use reth_db::{
};
use reth_interfaces::{db::DatabaseError, RethError};
use reth_primitives::{
stage::StageId, Account, Bytecode, ChainSpec, Receipts, StorageEntry, H256, U256,
stage::StageId, Account, Bytecode, ChainSpec, Receipts, StorageEntry, B256, U256,
};
use reth_provider::{
bundle_state::{BundleStateInit, RevertsInit},
Expand All @@ -28,9 +28,9 @@ pub enum InitDatabaseError {
#[error("Genesis hash in the database does not match the specified chainspec: chainspec is {chainspec_hash}, database is {database_hash}")]
GenesisHashMismatch {
/// Expected genesis hash.
chainspec_hash: H256,
chainspec_hash: B256,
/// Actual genesis hash.
database_hash: H256,
database_hash: B256,
},

/// Low-level database error.
Expand All @@ -47,7 +47,7 @@ pub enum InitDatabaseError {
pub fn init_genesis<DB: Database>(
db: Arc<DB>,
chain: Arc<ChainSpec>,
) -> Result<H256, InitDatabaseError> {
) -> Result<B256, InitDatabaseError> {
let genesis = chain.genesis();

let hash = chain.genesis_hash();
Expand Down Expand Up @@ -97,11 +97,11 @@ pub fn insert_genesis_state<DB: Database>(
) -> Result<(), InitDatabaseError> {
let mut state_init: BundleStateInit = HashMap::new();
let mut reverts_init = HashMap::new();
let mut contracts: HashMap<H256, Bytecode> = HashMap::new();
let mut contracts: HashMap<B256, Bytecode> = HashMap::new();

for (address, account) in &genesis.alloc {
let bytecode_hash = if let Some(code) = &account.code {
let bytecode = Bytecode::new_raw(code.0.clone());
let bytecode = Bytecode::new_raw(code.clone());
let hash = bytecode.hash_slow();
contracts.insert(hash, bytecode);
Some(hash)
Expand Down Expand Up @@ -289,9 +289,9 @@ mod tests {

#[test]
fn init_genesis_history() {
let address_with_balance = Address::from_low_u64_be(1);
let address_with_storage = Address::from_low_u64_be(2);
let storage_key = H256::from_low_u64_be(1);
let address_with_balance = Address::with_last_byte(1);
let address_with_storage = Address::with_last_byte(2);
let storage_key = B256::with_last_byte(1);
let chain_spec = Arc::new(ChainSpec {
chain: Chain::Id(1),
genesis: Genesis {
Expand All @@ -303,7 +303,7 @@ mod tests {
(
address_with_storage,
GenesisAccount {
storage: Some(HashMap::from([(storage_key, H256::random())])),
storage: Some(HashMap::from([(storage_key, B256::random())])),
..Default::default()
},
),
Expand Down
6 changes: 3 additions & 3 deletions bin/reth/src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use reth_primitives::{
constants::eip4844::{LoadKzgSettingsError, MAINNET_KZG_TRUSTED_SETUP},
kzg::KzgSettings,
stage::StageId,
BlockHashOrNumber, BlockNumber, ChainSpec, DisplayHardforks, Head, SealedHeader, H256,
BlockHashOrNumber, BlockNumber, ChainSpec, DisplayHardforks, Head, SealedHeader, B256,
};
use reth_provider::{
providers::BlockchainProvider, BlockHashReader, BlockReader, CanonStateSubscriptions,
Expand Down Expand Up @@ -705,7 +705,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
&self,
db: DB,
client: Client,
tip: H256,
tip: B256,
) -> RethResult<u64>
where
DB: Database,
Expand Down Expand Up @@ -811,7 +811,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
builder = builder.with_max_block(max_block)
}

let (tip_tx, tip_rx) = watch::channel(H256::zero());
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);
use reth_revm_inspectors::stack::InspectorStackConfig;
let factory = reth_revm::Factory::new(self.chain.clone());

Expand Down
Loading