Skip to content

Commit

Permalink
bump reth to 1.1.1 (kkrt-labs#1527)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Nov 6, 2024
1 parent 655e8a3 commit 3e7c0ae
Show file tree
Hide file tree
Showing 32 changed files with 1,470 additions and 506 deletions.
1,819 changes: 1,386 additions & 433 deletions Cargo.lock

Large diffs are not rendered by default.

51 changes: 25 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,40 @@ starknet = { version = "0.12", default-features = false }
num-traits = { version = "0.2", default-features = false }

# Ethereum dependencies
alloy-consensus = { version = "0.4.2", default-features = false, optional = true }
alloy-contract = { version = "0.3.6", default-features = false }
alloy-provider = { version = "0.4.2", default-features = false, optional = true }
alloy-consensus = { version = "0.5.4", default-features = false }
alloy-contract = { version = "0.5.4", default-features = false }
alloy-provider = { version = "0.5.4", default-features = false, optional = true }
alloy-rlp = { version = "0.3.8", default-features = false }
alloy-rpc-types = { version = "0.4.2", features = [
alloy-rpc-types = { version = "0.5.4", features = [
"eth",
"arbitrary",
], default-features = false }
alloy-rpc-types-txpool = { version = "0.4.2", default-features = false }
alloy-rpc-types-trace = { version = "0.4.2", default-features = false }
alloy-rpc-types-txpool = { version = "0.5.4", default-features = false }
alloy-rpc-types-trace = { version = "0.5.4", default-features = false }
alloy-sol-types = { version = "0.8.4", default-features = false }
jsonrpsee = { version = "0.24", features = ["macros", "server"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false, features = [
"std",
] }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false, features = [
"std",
] }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false, features = [
"alloy-compat",
"std",
"arbitrary",
] }
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, features = [
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false, features = [
"std",
] }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false, optional = true }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.0", default-features = false }
revm-inspectors = "0.8.1"
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false, optional = true }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.1.1", default-features = false }
revm-inspectors = "0.10.0"

# Error
eyre = { version = "0.6", default-features = false }
Expand Down Expand Up @@ -152,17 +152,17 @@ pin-project-lite = { version = "0.2", default-features = false }
#### Testing crates ####
# Ethereum
foundry-config = { git = "https://github.com/foundry-rs/foundry", branch = "master", optional = true }
revm-interpreter = { version = "10.0", default-features = false, optional = true }
revm-primitives = { version = "10.0", default-features = false, optional = true }
revm-interpreter = { version = "13.0", default-features = false, optional = true }
revm-primitives = { version = "13.0", default-features = false, optional = true }

# Alloy
alloy-dyn-abi = { version = "0.8.4", default-features = false }
alloy-eips = { version = "0.4.2", default-features = false }
alloy-eips = { version = "0.5.4", default-features = false }
alloy-json-abi = { version = "0.8.4", default-features = false, optional = true }
alloy-primitives = { version = "0.8.4", default-features = false }
alloy-signer-local = { version = "0.4.2", default-features = false, optional = true }
alloy-signer = { version = "0.4.2", default-features = false, optional = true }
alloy-serde = { version = "0.4.2", default-features = false }
alloy-primitives = { version = "0.8.9", default-features = false }
alloy-signer-local = { version = "0.5.4", default-features = false, optional = true }
alloy-signer = { version = "0.5.4", default-features = false, optional = true }
alloy-serde = { version = "0.5.4", default-features = false }

# Starknet
dojo-test-utils = { git = 'https://github.com/dojoengine/dojo', tag = "v1.0.0-alpha.15", default-features = false, optional = true }
Expand Down Expand Up @@ -201,7 +201,6 @@ tempfile = "3.8"

[features]
testing = [
"alloy-consensus",
"alloy-json-abi",
"alloy-signer-local",
"alloy-signer",
Expand Down
15 changes: 11 additions & 4 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{Address, Bytes, B256};
use alloy_rlp::Decodable;
use alloy_rpc_types_txpool::TxpoolContent;
use alloy_serde::WithOtherFields;
use async_trait::async_trait;
use reth_chainspec::ChainSpec;
use reth_primitives::{TransactionSigned, TransactionSignedEcRecovered};
use reth_rpc::eth::EthTxBuilder;
use reth_rpc_eth_types::TransactionSource;
use reth_transaction_pool::{
blobstore::NoopBlobStore, AllPoolTransactions, EthPooledTransaction, PoolConfig, PoolTransaction,
Expand Down Expand Up @@ -145,8 +147,11 @@ where
) {
content.entry(tx.sender()).or_default().insert(
tx.nonce().to_string(),
reth_rpc_types_compat::transaction::from_recovered::<reth_rpc::eth::EthTxBuilder>(
tx.clone().into_consensus(),
WithOtherFields::new(
reth_rpc_types_compat::transaction::from_recovered::<reth_rpc::eth::EthTxBuilder>(
tx.clone().into_consensus(),
&EthTxBuilder {},
),
),
);
}
Expand Down Expand Up @@ -182,8 +187,10 @@ where
.pool
.get(&hash)
.map(|transaction| {
TransactionSource::Pool(transaction.transaction.transaction().clone())
.into_transaction::<reth_rpc::eth::EthTxBuilder>()
WithOtherFields::new(
TransactionSource::Pool(transaction.transaction.transaction().clone())
.into_transaction(&EthTxBuilder {}),
)
})
.or(self.eth_provider.transaction_by_hash(hash).await?);

Expand Down
2 changes: 1 addition & 1 deletion src/eth_rpc/api/eth_api.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::providers::eth_provider::database::types::receipt::ExtendedTxReceipt;
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types::{
serde_helpers::JsonStorageKey, state::StateOverride, AccessListResult, Block, BlockOverrides,
Expand All @@ -7,7 +8,6 @@ use alloy_rpc_types::{
};
use alloy_serde::WithOtherFields;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::{BlockId, BlockNumberOrTag};

/// Ethereum JSON-RPC API Trait
/// Mostly based on <https://github.com/paradigmxyz/reth/blob/559124ac5a0b25030250203babcd8a94693df648/crates/rpc/rpc-api/src/eth.rs#L15>
Expand Down
2 changes: 1 addition & 1 deletion src/eth_rpc/servers/eth_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ use crate::{
BlockProvider, ChainProvider, GasProvider, LogProvider, ReceiptProvider, StateProvider, TransactionProvider,
},
};
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types::{
serde_helpers::JsonStorageKey, state::StateOverride, AccessListResult, BlockOverrides, EIP1186AccountProofResponse,
FeeHistory, Filter, FilterChanges, Index, SyncStatus, TransactionRequest, Work,
};
use jsonrpsee::core::{async_trait, RpcResult};
use reth_primitives::{BlockId, BlockNumberOrTag};
use serde_json::Value;
use starknet::providers::Provider;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion src/models/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::{
into_via_try_wrapper,
providers::eth_provider::{constant::STARKNET_MODULUS, error::EthereumDataFormatError},
};
use alloy_eips::{BlockId as EthereumBlockId, BlockNumberOrTag};
use alloy_primitives::U256;
use reth_primitives::{BlockId as EthereumBlockId, BlockNumberOrTag};
use starknet::core::types::{BlockId as StarknetBlockId, BlockTag};

#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions src/models/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::providers::eth_provider::{
starknet::kakarot_core::{ETH_SEND_TRANSACTION, KAKAROT_ADDRESS},
utils::split_u256,
};
use alloy_consensus::transaction::Transaction as _;
use alloy_rlp::Encodable;
use reth_primitives::{transaction::legacy_parity, Transaction, TransactionSigned};
use starknet::core::types::Felt;
Expand Down Expand Up @@ -90,9 +91,8 @@ pub fn transaction_data_to_starknet_calldata(
mod tests {
use super::*;
use alloy_consensus::TxEip2930;
use alloy_primitives::{bytes, hex, TxKind, U256};
use alloy_primitives::{bytes, hex, Signature, TxKind, U256};
use alloy_rlp::Decodable;
use reth_primitives::Signature;
use std::str::FromStr;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/pool/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use crate::{
pool::constants::ONE_TENTH_ETH,
providers::eth_provider::{database::state::EthDatabase, starknet::relayer::Relayer, BlockProvider},
};
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{Address, U256};
use rand::{seq::SliceRandom, SeedableRng};
use reth_chainspec::ChainSpec;
use reth_execution_types::ChangedAccount;
use reth_primitives::BlockNumberOrTag;
use reth_revm::DatabaseRef;
use reth_transaction_pool::{
blobstore::NoopBlobStore, BlockInfo, CanonicalStateUpdate, CoinbaseTipOrdering, EthPooledTransaction, Pool,
Expand Down
6 changes: 2 additions & 4 deletions src/pool/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ use crate::providers::eth_provider::{
database::state::EthDatabase, provider::EthereumProvider,
starknet::kakarot_core::get_white_listed_eip_155_transaction_hashes,
};
use alloy_consensus::constants::{EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, LEGACY_TX_TYPE_ID};
use alloy_rpc_types::BlockNumberOrTag;
use reth_chainspec::ChainSpec;
use reth_primitives::{
GotExpected, InvalidTransactionError, SealedBlock, EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use reth_primitives::{GotExpected, InvalidTransactionError, SealedBlock};
use reth_revm::DatabaseRef;
use reth_transaction_pool::{
error::InvalidPoolTransactionError,
Expand Down
2 changes: 1 addition & 1 deletion src/providers/alchemy_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use crate::{
provider::{EthApiResult, EthereumProvider},
},
};
use alloy_eips::BlockNumberOrTag;
use alloy_primitives::{Address, U256};
use async_trait::async_trait;
use auto_impl::auto_impl;
use eyre::Result;
use futures::future::join_all;
use mongodb::bson::doc;
use reth_primitives::BlockNumberOrTag;

#[async_trait]
#[auto_impl(Arc, &)]
Expand Down
11 changes: 6 additions & 5 deletions src/providers/debug_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ use crate::{
},
tracing::builder::TracerBuilder,
};
use alloy_eips::eip2718::Encodable2718;
use alloy_eips::{eip2718::Encodable2718, BlockId, BlockNumberOrTag};
use alloy_primitives::{Bytes, B256};
use alloy_rlp::Encodable;
use alloy_rpc_types::TransactionRequest;
use alloy_rpc_types_trace::geth::{GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult};
use async_trait::async_trait;
use auto_impl::auto_impl;
use reth_primitives::{Block, BlockId, BlockNumberOrTag, Header, Log, Receipt, ReceiptWithBloom, TransactionSigned};
use reth_primitives::{Block, Header, Log, Receipt, ReceiptWithBloom, TransactionSigned};
use std::sync::Arc;

#[async_trait]
Expand Down Expand Up @@ -88,7 +88,7 @@ impl<P: EthereumProvider + Send + Sync + 'static> DebugProvider for DebugDataPro
let signature = tx.signature.ok_or_else(|| EthApiError::from(SignatureError::MissingSignature))?;
let bytes = TransactionSigned::from_transaction_and_signature(
tx.try_into()?,
reth_primitives::Signature::from_rs_and_parity(
alloy_primitives::Signature::from_rs_and_parity(
signature.r,
signature.s,
signature.y_parity.map_or(false, |v| v.0),
Expand All @@ -111,7 +111,7 @@ impl<P: EthereumProvider + Send + Sync + 'static> DebugProvider for DebugDataPro
let signature = t.signature.ok_or_else(|| EthApiError::from(SignatureError::MissingSignature))?;
let bytes = TransactionSigned::from_transaction_and_signature(
t.try_into()?,
reth_primitives::Signature::from_rs_and_parity(
alloy_primitives::Signature::from_rs_and_parity(
signature.r,
signature.s,
signature.y_parity.map_or(false, |v| v.0),
Expand Down Expand Up @@ -157,7 +157,8 @@ impl<P: EthereumProvider + Send + Sync + 'static> DebugProvider for DebugDataPro
},
bloom: *receipt.inner.inner.logs_bloom(),
}
.envelope_encoded(),
.encoded_2718()
.into(),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/eth_provider/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use crate::providers::eth_provider::{
database::ethereum::EthereumTransactionStore,
provider::{EthApiResult, EthDataProvider},
};
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{B256, U256, U64};
use alloy_rpc_types::Header;
use async_trait::async_trait;
use auto_impl::auto_impl;
use mongodb::bson::doc;
use reth_primitives::{BlockId, BlockNumberOrTag};
use tracing::Instrument;
/// Ethereum block provider trait.
#[async_trait]
Expand Down
2 changes: 1 addition & 1 deletion src/providers/eth_provider/contracts/erc20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use crate::providers::eth_provider::{
provider::{EthApiResult, EthereumProvider},
};
use alloy_dyn_abi::DynSolType;
use alloy_eips::BlockId;
use alloy_primitives::{Address, Bytes, TxKind, U256};
use alloy_rpc_types::{request::TransactionInput, TransactionRequest};
use alloy_sol_types::{sol, SolCall};
use reth_primitives::BlockId;

sol! {
#[sol(rpc)]
Expand Down
3 changes: 2 additions & 1 deletion src/providers/eth_provider/database/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ use crate::providers::eth_provider::{
database::types::transaction::{EthStarknetHashes, StoredEthStarknetTransactionHash},
error::EthApiError,
};
use alloy_consensus::constants::EMPTY_ROOT_HASH;
use alloy_primitives::{B256, U256};
use alloy_rlp::Encodable;
use alloy_rpc_types::{Block, BlockHashOrNumber, BlockTransactions, Header};
use alloy_serde::WithOtherFields;
use async_trait::async_trait;
use mongodb::bson::doc;
use reth_primitives::{constants::EMPTY_ROOT_HASH, BlockBody};
use reth_primitives::BlockBody;
use tracing::instrument;

/// Trait for interacting with a database that stores Ethereum typed
Expand Down
2 changes: 1 addition & 1 deletion src/providers/eth_provider/database/types/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use serde::{Deserialize, Serialize};
use std::ops::Deref;
#[cfg(any(test, feature = "arbitrary", feature = "testing"))]
use {
alloy_consensus::constants::EMPTY_ROOT_HASH,
alloy_primitives::{B256, B64, U256},
arbitrary::Arbitrary,
reth_primitives::constants::EMPTY_ROOT_HASH,
};

/// Type alias for a block that contains extended transactions and additional fields.
Expand Down
1 change: 0 additions & 1 deletion src/providers/eth_provider/database/types/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ impl<'a> arbitrary::Arbitrary<'a> for StoredTransactionReceipt {
from: Address::arbitrary(u)?,
to: Some(Address::arbitrary(u)?),
contract_address: Some(Address::arbitrary(u)?),
state_root: Some(B256::arbitrary(u)?),
inner: match u.int_in_range(0..=3)? {
0 => alloy_consensus::ReceiptEnvelope::Legacy(receipt),
1 => alloy_consensus::ReceiptEnvelope::Eip2930(receipt),
Expand Down
1 change: 1 addition & 0 deletions src/providers/eth_provider/database/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use starknet::core::types::Felt;
use std::ops::Deref;
#[cfg(any(test, feature = "arbitrary", feature = "testing"))]
use {
alloy_consensus::Transaction as _,
alloy_primitives::U256,
arbitrary::Arbitrary,
rand::Rng,
Expand Down
2 changes: 1 addition & 1 deletion src/providers/eth_provider/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ use crate::{
provider::{EthApiResult, EthDataProvider},
},
};
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{U256, U64};
use alloy_rpc_types::{FeeHistory, TransactionRequest};
use async_trait::async_trait;
use auto_impl::auto_impl;
use eyre::eyre;
use mongodb::bson::doc;
use reth_primitives::{BlockId, BlockNumberOrTag};
use tracing::Instrument;

#[async_trait]
Expand Down
2 changes: 1 addition & 1 deletion src/providers/eth_provider/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ use crate::{
sn_provider::StarknetProvider,
},
};
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::{TxKind, U256};
use alloy_rpc_types::{BlockHashOrNumber, TransactionRequest};
use cainome::cairo_serde::CairoArrayLegacy;
use eyre::Result;
use itertools::Itertools;
use mongodb::bson::doc;
use num_traits::cast::ToPrimitive;
use reth_primitives::{BlockId, BlockNumberOrTag};
use starknet::core::types::Felt;
use tracing::{instrument, Instrument};
#[cfg(feature = "hive")]
Expand Down
2 changes: 1 addition & 1 deletion src/providers/eth_provider/receipts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use crate::providers::eth_provider::{
},
provider::{EthApiResult, EthDataProvider},
};
use alloy_eips::{BlockId, BlockNumberOrTag};
use alloy_primitives::B256;
use async_trait::async_trait;
use auto_impl::auto_impl;
use mongodb::bson::doc;
use reth_primitives::{BlockId, BlockNumberOrTag};

#[async_trait]
#[auto_impl(Arc, &)]
Expand Down
Loading

0 comments on commit 3e7c0ae

Please sign in to comment.