Skip to content

Commit

Permalink
bump reth to v1.0.8 (kkrt-labs#1427)
Browse files Browse the repository at this point in the history
* bump reth to v1.0.8

* fix

* fmt

* fix tests

* trunk fmt

* fix tests

* fix features

* fix clippy

* cargo update

* small fix

* some fix

* fix new reth rev after address serialization patch

* cargo update

* fix conflicts

* update submodule
  • Loading branch information
tcoratger authored Oct 9, 2024
1 parent a6dff03 commit e90bed0
Show file tree
Hide file tree
Showing 70 changed files with 1,540 additions and 1,030 deletions.
1,767 changes: 1,127 additions & 640 deletions Cargo.lock

Large diffs are not rendered by default.

50 changes: 28 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,38 @@ num-traits = { version = "0.2", default-features = false }

# Ethereum dependencies
alloy-rlp = { version = "0.3.8", default-features = false }
alloy-sol-types = { version = "0.8.3", default-features = false }
alloy-sol-types = { version = "0.8.4", default-features = false }
alloy-contract = { version = "0.3.6", default-features = false }
alloy-rpc-types = { version = "0.4.2", features = [
"eth",
"arbitrary",
], default-features = false }
alloy-consensus = { version = "0.4.2", 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 }
jsonrpsee = { version = "0.24", features = ["macros", "server"] }
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false, features = [
reth-chainspec = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false, features = [
"std",
] }
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false, features = [
reth-evm-ethereum = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false, features = [
"std",
] }
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false, features = [
reth-node-api = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false }
reth-primitives = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false, features = [
"alloy-compat",
"std",
"arbitrary",
] }
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false, features = [
reth-revm = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false, features = [
"std",
] }
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false, features = [
"arbitrary",
] }
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false, optional = true }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", tag = "v1.0.7", default-features = false }
revm-inspectors = "0.7.4"
reth-rpc-eth-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false }
reth-testing-utils = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false, optional = true }
reth-transaction-pool = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false }
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false }
reth-execution-types = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false }
reth-rpc = { git = "https://github.com/paradigmxyz/reth.git", rev = "e427eb2", default-features = false }
revm-inspectors = "0.8.1"

# Error
eyre = { version = "0.6", default-features = false }
Expand Down Expand Up @@ -140,11 +145,13 @@ http-body-util = { version = "0.1", default-features = false }
pin-project-lite = { version = "0.2", default-features = false }

# Testing crates
alloy-dyn-abi = { version = "0.8.3", default-features = false }
alloy-json-abi = { version = "0.8.3", default-features = false, optional = true }
alloy-primitives = { version = "0.8.3", default-features = false, optional = true }
alloy-signer-local = { version = "0.3.6", default-features = false, optional = true }
alloy-signer = { version = "0.3.6", default-features = false, optional = true }
alloy-dyn-abi = { version = "0.8.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-eips = { version = "0.4.2", default-features = false }
anyhow = { version = "1", default-features = false, optional = true }
arbitrary = { version = "1", features = ["derive"], optional = true }
foundry-config = { git = "https://github.com/foundry-rs/foundry", branch = "master", optional = true }
Expand All @@ -171,7 +178,7 @@ clap = { version = "4.5.17", optional = true }

starknet_api = { version = "0.13.0-rc.0", optional = true }
revm-interpreter = { version = "10.0", default-features = false, optional = true }
revm-primitives = { version = "9.0", default-features = false, optional = true }
revm-primitives = { version = "10.0", default-features = false, optional = true }
starknet-crypto = { version = "0.7", optional = true }

[dev-dependencies]
Expand All @@ -184,7 +191,6 @@ tempfile = "3.8"
[features]
testing = [
"alloy-json-abi",
"alloy-primitives",
"alloy-signer-local",
"alloy-signer",
"anyhow",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ the following tests are skipped:
- debug_getRawHeader/get-invalid-number: debug API is currently not supported by
the Kakarot RPC.
- debug_getRawTransaction/get-invalid-hash: the Kakarot implementation of the
debug_getRawTransaction endpoint uses `reth_primitives::B256` type when
debug_getRawTransaction endpoint uses `alloy_primitives::B256` type when
deserializing the hash. This test is expected to fail as the provided hash in
the query doesn't start with `0x`. As this test doesn't bring much, we decide
to skip it.
Expand Down Expand Up @@ -589,7 +589,7 @@ the following tests are skipped:
- eth_getProof/get-account-proof: the getProof endpoint is currently not
supported by the Kakarot RPC.
- eth_getStorage/get-storage-invalid-key-too-large: the Kakarot implementation
of the eth_getStorage endpoint uses `reth_primitives::U256` type when
of the eth_getStorage endpoint uses `alloy_primitives::U256` type when
deserializing the number. This test is expected to fail as the provided block
number in the query doesn't start with exceeds 32 bytes. As this test doesn't
bring much, we decide to skip it.
Expand Down
3 changes: 2 additions & 1 deletion src/bin/hive_chain.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#![allow(clippy::significant_drop_tightening)]

use alloy_primitives::bytes::{Buf, BytesMut};
use alloy_rlp::Decodable;
use clap::Parser;
use kakarot_rpc::{
constants::STARKNET_CHAIN_ID,
into_via_try_wrapper,
providers::{eth_provider::starknet::relayer::LockedRelayer, sn_provider::StarknetProvider},
};
use reth_primitives::{bytes::Buf, Block, BlockBody, BytesMut};
use reth_primitives::{Block, BlockBody};
use starknet::{
core::types::{BlockId, BlockTag, Felt},
providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider},
Expand Down
2 changes: 1 addition & 1 deletion src/bin/katana_genesis.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use alloy_primitives::{B256, U256};
use dotenvy::dotenv;
use kakarot_rpc::test_utils::katana::genesis::KatanaGenesisBuilder;
use reth_primitives::{B256, U256};
use starknet::core::types::Felt;
use std::{
env::var,
Expand Down
20 changes: 15 additions & 5 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ use crate::{
sn_provider::StarknetProvider,
},
};
use alloy_eips::eip2718::Encodable2718;
use alloy_primitives::{Address, Bytes, B256};
use alloy_rlp::Decodable;
use alloy_rpc_types::Transaction;
use alloy_rpc_types_txpool::TxpoolContent;
use alloy_serde::WithOtherFields;
use async_trait::async_trait;
use reth_chainspec::ChainSpec;
use reth_primitives::{Address, Bytes, TransactionSigned, TransactionSignedEcRecovered, B256};
use reth_primitives::{TransactionSigned, TransactionSignedEcRecovered};
use reth_rpc_eth_types::TransactionSource;
use reth_rpc_types::{txpool::TxpoolContent, Transaction, WithOtherFields};
use reth_transaction_pool::{
blobstore::NoopBlobStore, AllPoolTransactions, EthPooledTransaction, PoolConfig, PoolTransaction,
TransactionOrigin, TransactionPool,
Expand Down Expand Up @@ -103,7 +107,8 @@ where
let transaction_signed_ec_recovered =
TransactionSignedEcRecovered::from_signed_transaction(transaction_signed.clone(), signer);

let encoded_length = transaction_signed_ec_recovered.clone().length_without_header();
let encoded_length = transaction_signed_ec_recovered.clone().encode_2718_len();

let pool_transaction = EthPooledTransaction::new(transaction_signed_ec_recovered, encoded_length);

// Deploy EVM transaction signer if Hive feature is enabled
Expand All @@ -130,7 +135,9 @@ where
) {
content.entry(tx.sender()).or_default().insert(
tx.nonce().to_string(),
reth_rpc_types_compat::transaction::from_recovered(tx.clone().into_consensus()),
reth_rpc_types_compat::transaction::from_recovered::<reth_rpc::eth::EthTxBuilder>(
tx.clone().into_consensus(),
),
);
}

Expand Down Expand Up @@ -161,7 +168,10 @@ where
Ok(self
.pool
.get(&hash)
.map(|transaction| TransactionSource::Pool(transaction.transaction.transaction().clone()).into())
.map(|transaction| {
TransactionSource::Pool(transaction.transaction.transaction().clone())
.into_transaction::<reth_rpc::eth::EthTxBuilder>()
})
.or(self.eth_provider.transaction_by_hash(hash).await?))
}
}
2 changes: 1 addition & 1 deletion src/eth_rpc/api/alchemy_api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::models::token::{TokenBalances, TokenMetadata};
use alloy_primitives::{Address, U256};
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_primitives::{Address, U256};

#[rpc(server, namespace = "alchemy")]
#[async_trait]
Expand Down
8 changes: 3 additions & 5 deletions src/eth_rpc/api/debug_api.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use alloy_primitives::{Bytes, B256};
use alloy_rpc_types::{BlockId, BlockNumberOrTag, TransactionRequest};
use alloy_rpc_types_trace::geth::{GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult};
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_primitives::{Bytes, B256};
use reth_rpc_types::{
trace::geth::{GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult},
BlockId, BlockNumberOrTag, TransactionRequest,
};

/// Debug API
/// Taken from Reth's DebugApi trait:
Expand Down
10 changes: 6 additions & 4 deletions src/eth_rpc/api/eth_api.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64};
use reth_rpc_types::{
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types::{
serde_helpers::JsonStorageKey, state::StateOverride, AccessListResult, Block, BlockOverrides,
EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Index, SyncStatus, Transaction as EthTransaction,
TransactionReceipt, TransactionRequest, WithOtherFields, Work,
TransactionReceipt, TransactionRequest, Work,
};
use alloy_serde::WithOtherFields;
use jsonrpsee::{core::RpcResult as Result, 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/api/net_api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::U64;
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_primitives::U64;

// TODO: Define and implement of methods of Net API
#[rpc(server, namespace = "net")]
Expand Down
3 changes: 2 additions & 1 deletion src/eth_rpc/api/trace_api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_rpc_types::BlockId;
use alloy_rpc_types_trace::parity::LocalizedTransactionTrace;
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_rpc_types::{trace::parity::LocalizedTransactionTrace, BlockId};

/// Trace API
#[rpc(server, namespace = "trace")]
Expand Down
9 changes: 4 additions & 5 deletions src/eth_rpc/api/txpool_api.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use alloy_primitives::Address;
use alloy_rpc_types::Transaction;
use alloy_rpc_types_txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus};
use alloy_serde::WithOtherFields;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_primitives::Address;
use reth_rpc_types::{
txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus},
Transaction, WithOtherFields,
};

/// Txpool API
#[rpc(server, namespace = "txpool")]
Expand Down
2 changes: 1 addition & 1 deletion src/eth_rpc/api/web3_api.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_primitives::{Bytes, B256};
use jsonrpsee::{core::RpcResult as Result, proc_macros::rpc};
use reth_primitives::{Bytes, B256};

#[rpc(server, namespace = "web3")]
#[async_trait]
Expand Down
2 changes: 1 addition & 1 deletion src/eth_rpc/servers/alchemy_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use crate::{
models::token::{TokenBalances, TokenMetadata},
providers::alchemy_provider::AlchemyProvider,
};
use alloy_primitives::{Address, U256};
use async_trait::async_trait;
use jsonrpsee::core::RpcResult as Result;
use reth_primitives::{Address, U256};

/// The RPC module for the Ethereum protocol required by Kakarot.
#[derive(Debug)]
Expand Down
8 changes: 3 additions & 5 deletions src/eth_rpc/servers/debug_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#![allow(clippy::blocks_in_conditions)]
use crate::{eth_rpc::api::debug_api::DebugApiServer, providers::debug_provider::DebugProvider};
use alloy_primitives::{Bytes, B256};
use alloy_rpc_types::{BlockId, BlockNumberOrTag, TransactionRequest};
use alloy_rpc_types_trace::geth::{GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult};
use jsonrpsee::core::{async_trait, RpcResult as Result};
use reth_primitives::{Bytes, B256};
use reth_rpc_types::{
trace::geth::{GethDebugTracingCallOptions, GethDebugTracingOptions, GethTrace, TraceResult},
BlockId, BlockNumberOrTag, TransactionRequest,
};

/// The RPC module for the implementing Net api
#[derive(Debug)]
Expand Down
10 changes: 6 additions & 4 deletions src/eth_rpc/servers/eth_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ use crate::{
ReceiptProvider, StateProvider, TransactionProvider,
},
};
use jsonrpsee::core::{async_trait, RpcResult as Result};
use reth_primitives::{Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64};
use reth_rpc_types::{
use alloy_primitives::{Address, Bytes, B256, B64, U256, U64};
use alloy_rpc_types::{
serde_helpers::JsonStorageKey, state::StateOverride, AccessListResult, Block, BlockOverrides,
EIP1186AccountProofResponse, FeeHistory, Filter, FilterChanges, Index, SyncStatus, Transaction, TransactionReceipt,
TransactionRequest, WithOtherFields, Work,
TransactionRequest, Work,
};
use alloy_serde::WithOtherFields;
use jsonrpsee::core::{async_trait, RpcResult as Result};
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/eth_rpc/servers/net_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{eth_rpc::api::net_api::NetApiServer, providers::eth_provider::provider::EthereumProvider};
use alloy_primitives::U64;
use jsonrpsee::core::{async_trait, RpcResult as Result};
use reth_primitives::U64;

/// The RPC module for the implementing Net api
#[derive(Debug)]
Expand Down
3 changes: 2 additions & 1 deletion src/eth_rpc/servers/trace_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use crate::{
eth_rpc::api::trace_api::TraceApiServer, providers::eth_provider::provider::EthereumProvider,
tracing::builder::TracerBuilder,
};
use alloy_rpc_types::BlockId;
use alloy_rpc_types_trace::parity::LocalizedTransactionTrace;
use jsonrpsee::core::{async_trait, RpcResult as Result};
use reth_rpc_types::{trace::parity::LocalizedTransactionTrace, BlockId};
use revm_inspectors::tracing::TracingInspectorConfig;
use std::sync::Arc;

Expand Down
9 changes: 4 additions & 5 deletions src/eth_rpc/servers/txpool_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use crate::{eth_rpc::api::txpool_api::TxPoolApiServer, providers::pool_provider::PoolProvider};
use alloy_primitives::Address;
use alloy_rpc_types::Transaction;
use alloy_rpc_types_txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus};
use alloy_serde::WithOtherFields;
use jsonrpsee::core::{async_trait, RpcResult as Result};
use reth_primitives::Address;
use reth_rpc_types::{
txpool::{TxpoolContent, TxpoolContentFrom, TxpoolInspect, TxpoolStatus},
Transaction, WithOtherFields,
};
use tracing::instrument;

/// The RPC module for implementing the Txpool api
Expand Down
2 changes: 1 addition & 1 deletion src/eth_rpc/servers/web3_rpc.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::eth_rpc::api::web3_api::Web3ApiServer;
use alloy_primitives::{keccak256, Bytes, B256};
use jsonrpsee::core::{async_trait, RpcResult as Result};
use reth_primitives::{keccak256, Bytes, B256};

/// The RPC module for the implementing Web3 Api { i.e rpc endpoints prefixed with web3_ }
#[derive(Default, Debug)]
Expand Down
3 changes: 2 additions & 1 deletion src/models/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use crate::{
into_via_try_wrapper,
providers::eth_provider::{constant::STARKNET_MODULUS, error::EthereumDataFormatError},
};
use reth_primitives::{BlockId as EthereumBlockId, BlockNumberOrTag, U256};
use alloy_primitives::U256;
use reth_primitives::{BlockId as EthereumBlockId, BlockNumberOrTag};
use starknet::core::types::{BlockId as StarknetBlockId, BlockTag};

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion src/models/felt.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::providers::eth_provider::error::EthereumDataFormatError;
use reth_primitives::{Address, B256, U256, U64};
use alloy_primitives::{Address, B256, U256, U64};
use starknet::core::types::{EthAddress, Felt};
use std::ops::{Deref, DerefMut};

Expand Down
2 changes: 1 addition & 1 deletion src/models/token.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use reth_primitives::{Address, U256};
use alloy_primitives::{Address, U256};
use serde::{Deserialize, Serialize};

/// Represents the balance of a specific ERC20 token.
Expand Down
Loading

0 comments on commit e90bed0

Please sign in to comment.