Skip to content

Commit

Permalink
reth v1.0.6 (#165)
Browse files Browse the repository at this point in the history
## 📝 Summary

Updates reth to v1.0.6

it was tested in backtest on 1.5k block and outputs are identical

## 💡 Motivation and Context

<!--- (Optional) Why is this change required? What problem does it
solve? Remove this section if not applicable. -->

---

## ✅ I have completed the following steps:

* [x] Run `make lint`
* [x] Run `make test`
* [x] Added tests (if applicable)
  • Loading branch information
dvush authored Sep 12, 2024
1 parent ea64a8a commit 12ece40
Show file tree
Hide file tree
Showing 10 changed files with 1,100 additions and 1,737 deletions.
2,722 changes: 1,043 additions & 1,679 deletions Cargo.lock

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,56 +22,56 @@ version = "0.1.0"
edition = "2021"

[workspace.dependencies]
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-libmdbx = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3", features = ["test-utils"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.3" }
reth = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-db = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-db-common = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-errors = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-libmdbx = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-node-api = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-trie = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-trie-parallel = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-basic-payload-builder = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-node-core = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-primitives = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-provider = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6", features = ["test-utils"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-evm = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth", tag = "v1.0.6" }

# version is copied from reth "v1.0.3" dependencies
revm = { version = "12.1.0", features = [
# version is copied from reth "v1.0.6" dependencies
revm = { version = "14.0.0", features = [
"std",
"secp256k1",
"optional_balance_check",
], default-features = false }
revm-primitives = { version = "7.1.0", features = [
revm-inspectors = "0.6"
revm-primitives = { version = "9.0.0", features = [
"std",
], default-features = false }
revm-inspectors = "0.5"

ethereum_ssz_derive = "0.5"
ethereum_ssz = "0.5"
ethereum_ssz_derive = "0.7"
ethereum_ssz = "0.7"

alloy-primitives = "0.7.2"
alloy-primitives = { version = "0.8.0", default-features = false }
alloy-rlp = "0.3.4"
alloy-chains = "0.1.23"
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032", features = ["ipc", "pubsub"] }
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-eips = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-transport-http = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032", features = ["kzg"] }
alloy-serde = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-rpc-types-beacon = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032", features = [
alloy-provider = { version = "0.3.0", features = ["ipc", "pubsub"] }
alloy-pubsub = { version = "0.3.0" }
alloy-eips = { version = "0.3.0" }
alloy-rpc-types = { version = "0.3.0" }
alloy-json-rpc = { version = "0.3.0" }
alloy-transport-http = { version = "0.3.0" }
alloy-network = { version = "0.3.0" }
alloy-transport = { version = "0.3.0" }
alloy-node-bindings = { version = "0.3.0" }
alloy-consensus = { version = "0.3.0", features = ["kzg"] }
alloy-serde = { version = "0.3.0" }
alloy-rpc-types-beacon = { version = "0.3.0", features = [
"ssz",
] }
alloy-rpc-types-engine = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032", features = [
alloy-rpc-types-engine = { version = "0.3.0", features = [
"ssz",
] }
alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-signer-local = { git = "https://github.com/alloy-rs/alloy", rev = "f2d80032" }
alloy-rpc-types-eth = { version = "0.3.0" }
alloy-signer-local = { version = "0.3.0" }
9 changes: 5 additions & 4 deletions crates/rbuilder/benches/benchmarks/txpool_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ async fn txpool_receive_util(count: u32) {
.with_max_priority_fee_per_gas(eip1559_est.max_priority_fee_per_gas);

tokio::spawn(async move {
for _ in 0..count {
let _ = provider.send_transaction(tx.clone()).await.unwrap();
for i in 0..count {
let tx = tx.clone().with_nonce(i.into());
let _ = provider.send_transaction(tx).await.unwrap();
}
});

Expand All @@ -63,8 +64,8 @@ fn bench_txpool_receive(c: &mut Criterion) {
group.bench_function("txn_fetcher_normal_10", |b| {
b.to_async(&rt).iter(|| txpool_receive_util(10));
});
group.bench_function("txn_fetcher_normal_100", |b| {
b.to_async(&rt).iter(|| txpool_receive_util(100));
group.bench_function("txn_fetcher_normal_50", |b| {
b.to_async(&rt).iter(|| txpool_receive_util(50));
});
}

Expand Down
3 changes: 1 addition & 2 deletions crates/rbuilder/src/backtest/backtest_build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ async fn read_block_data(

println!(
"Block: {} {:?}",
block_data.block_number,
block_data.onchain_block.header.hash.unwrap_or_default()
block_data.block_number, block_data.onchain_block.header.hash
);
println!(
"bid value: {}",
Expand Down
6 changes: 5 additions & 1 deletion crates/rbuilder/src/backtest/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,11 @@ impl HistoricalDataFetcher {

let mut orders: Vec<OrdersWithTimestamp> = vec![];
let mut built_block_data = None;
let block_ref = BlockRef::new(block_number, block_timestamp, onchain_block.header.hash);
let block_ref = BlockRef::new(
block_number,
block_timestamp,
Some(onchain_block.header.hash),
);

for datasource in &self.data_sources {
let mut data = datasource.get_data(block_ref).await?;
Expand Down
2 changes: 1 addition & 1 deletion crates/rbuilder/src/backtest/redistribute/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn process_redisribution<ConfigType: LiveBuilderConfig + Send + Sync>(
distribute_to_mempool_txs: bool,
) -> eyre::Result<()> {
let block_number = block_data.block_number;
let block_hash = block_data.onchain_block.header.hash.unwrap_or_default();
let block_hash = block_data.onchain_block.header.hash;
info!(block_number, "Calculating redistribution for a block");
let redistribution_values = match calc_redistributions(
provider_factory.clone(),
Expand Down
4 changes: 2 additions & 2 deletions crates/rbuilder/src/backtest/redistribute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ fn get_available_orders(
}
if distribute_to_mempool_txs {
for tx in block_data.onchain_block.transactions.hashes() {
let id = OrderId::Tx(*tx);
let id = OrderId::Tx(tx);
if let Some(order) = orders_by_id.get(&id) {
included_orders_available.insert(order.order.id(), order.clone());
}
Expand Down Expand Up @@ -720,7 +720,7 @@ fn collect_redistribution_result(
) -> RedistributionBlockOutput {
let mut result = RedistributionBlockOutput {
block_number: block_data.block_number,
block_hash: block_data.onchain_block.header.hash.unwrap_or_default(),
block_hash: block_data.onchain_block.header.hash,
block_profit: onchain_block_profit,
identities: Vec::new(),
landed_orders: Vec::new(),
Expand Down
7 changes: 2 additions & 5 deletions crates/rbuilder/src/backtest/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ mod test {
};
use alloy_primitives::{hex, Address, Bloom, Bytes, B256};
use alloy_rpc_types::{Block, BlockTransactions, Header, Signature, Transaction};
use alloy_serde::OtherFields;
use reth_primitives::{U256, U64};
use time::OffsetDateTime;
#[tokio::test]
Expand Down Expand Up @@ -724,7 +723,7 @@ mod test {

fn create_empty_block_header() -> Header {
Header {
hash: None,
hash: B256::default(),
parent_hash: B256::default(),
uncles_hash: B256::default(),
miner: Address::default(),
Expand All @@ -733,7 +732,7 @@ mod test {
receipts_root: B256::default(),
logs_bloom: Bloom::default(),
difficulty: U256::default(),
number: None,
number: 0,
gas_limit: 0,
gas_used: 0,
timestamp: 0,
Expand All @@ -759,7 +758,6 @@ mod test {
transactions: BlockTransactions::Full(vec![create_test_tx()]),
size: None,
withdrawals: None,
other: OtherFields::default(),
}
}

Expand Down Expand Up @@ -789,7 +787,6 @@ mod test {
max_fee_per_gas: Some(21),
max_priority_fee_per_gas: Some(22),
max_fee_per_blob_gas: None,
other: Default::default(),
authorization_list: None,
}
}
Expand Down
6 changes: 2 additions & 4 deletions crates/rbuilder/src/building/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl BlockBuildingContext {
suggested_fee_recipient: Address,
builder_signer: Option<Signer>,
) -> BlockBuildingContext {
let block_number = onchain_block.header.number.unwrap_or(1);
let block_number = onchain_block.header.number;

let blob_excess_gas_and_price =
if chain_spec.is_cancun_active_at_timestamp(onchain_block.header.timestamp) {
Expand Down Expand Up @@ -230,7 +230,7 @@ impl BlockBuildingContext {

/// Useless BlockBuildingContext for testing in contexts where we can't avoid having a BlockBuildingContext.
pub fn dummy_for_testing() -> Self {
let mut onchain_block = alloy_rpc_types::Block::default();
let mut onchain_block: alloy_rpc_types::Block = Default::default();
onchain_block.header.base_fee_per_gas = Some(0);
BlockBuildingContext::from_onchain_block(
onchain_block,
Expand Down Expand Up @@ -708,8 +708,6 @@ impl<Tracer: SimulationTracer> PartialBlock<Tracer> {
&ctx.chain_spec,
&ctx.initialized_cfg,
&ctx.block_env,
ctx.block_env.number.to(),
ctx.attributes.timestamp(),
ctx.attributes.parent_beacon_block_root(),
)?;
db.as_mut().merge_transitions(BundleRetention::Reverts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub async fn spawn_clean_orderpool_job<DB: Database + Clone + 'static>(
while let Some(block) = new_block_stream.next().await {
let provider_factory = provider_factory.provider_factory_unchecked();

let block_number = block.header.number.unwrap_or_default();
let block_number = block.header.number;
set_current_block(block_number);
let state = match provider_factory.latest() {
Ok(state) => state,
Expand Down

0 comments on commit 12ece40

Please sign in to comment.