From 812b02075e34c9ea3fb235835dfdbcf0976f507a Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Fri, 2 Aug 2024 11:42:29 -0300 Subject: [PATCH 1/5] export type of alloy_consenseus --- crates/primitives-traits/src/account.rs | 1 + crates/primitives-traits/src/lib.rs | 2 +- crates/primitives/src/lib.rs | 2 +- crates/rpc/rpc-eth-api/src/core.rs | 10 +++++----- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/crates/primitives-traits/src/account.rs b/crates/primitives-traits/src/account.rs index 6099e713118c..1b87916ef6f1 100644 --- a/crates/primitives-traits/src/account.rs +++ b/crates/primitives-traits/src/account.rs @@ -8,6 +8,7 @@ use reth_codecs::{reth_codec, Compact}; use revm_primitives::{AccountInfo, Bytecode as RevmBytecode, JumpTable}; use serde::{Deserialize, Serialize}; +pub use alloy_consensus::Account as AccountTrie; /// An Ethereum account. #[reth_codec] #[derive(Clone, Copy, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index c8c1cbd8dd95..49f937123218 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -22,7 +22,7 @@ pub use constants::gas_units::{format_gas, format_gas_throughput}; /// Minimal account pub mod account; -pub use account::{Account, Bytecode}; +pub use account::{Account, Bytecode, AccountTrie}; mod integer_list; pub use integer_list::{IntegerList, RoaringBitmapError}; diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 0858d5901fe7..44cb8337b25a 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -54,7 +54,7 @@ pub use receipt::{ }; pub use reth_primitives_traits::{ logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log, - LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, + LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, AccountTrie }; pub use static_file::StaticFileSegment; diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index d77f15cf42d3..3a99ccfc342b 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -4,8 +4,8 @@ use alloy_dyn_abi::TypedData; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{ - transaction::AccessListResult, Account, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, - U256, U64, + transaction::AccessListResult, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, + U256, U64, AccountTrie }; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; use reth_rpc_types::{ @@ -13,7 +13,7 @@ use reth_rpc_types::{ state::{EvmOverrides, StateOverride}, AnyTransactionReceipt, BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Header, Index, RichBlock, StateContext, SyncStatus, Transaction, - TransactionRequest, Work, + TransactionRequest, Work }; use tracing::trace; @@ -250,7 +250,7 @@ pub trait EthApi { /// Returns the account details by specifying an address and a block number/tag #[method(name = "getAccount")] - async fn get_account(&self, address: Address, block: BlockId) -> RpcResult; + async fn get_account(&self, address: Address, block: BlockId) -> RpcResult; /// Introduced in EIP-1559, returns suggestion for the priority for dynamic fee transactions. #[method(name = "maxPriorityFeePerGas")] @@ -626,7 +626,7 @@ where } /// Handler for: `eth_getAccount` - async fn get_account(&self, _address: Address, _block: BlockId) -> RpcResult { + async fn get_account(&self, _address: Address, _block: BlockId) -> RpcResult { Err(internal_rpc_err("unimplemented")) } From d97d3358901d712c47da0ade218e683e5b218f18 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Fri, 2 Aug 2024 11:44:01 -0300 Subject: [PATCH 2/5] linting --- crates/rpc/rpc-eth-api/src/core.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 3a99ccfc342b..2b234ff765c9 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -4,8 +4,8 @@ use alloy_dyn_abi::TypedData; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{ - transaction::AccessListResult, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, - U256, U64, AccountTrie + transaction::AccessListResult, AccountTrie, Address, BlockId, BlockNumberOrTag, Bytes, B256, + B64, U256, U64, }; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; use reth_rpc_types::{ @@ -13,7 +13,7 @@ use reth_rpc_types::{ state::{EvmOverrides, StateOverride}, AnyTransactionReceipt, BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Header, Index, RichBlock, StateContext, SyncStatus, Transaction, - TransactionRequest, Work + TransactionRequest, Work, }; use tracing::trace; From 851fb82fc3c9f72481ded0caa3b461cb18365465 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Fri, 2 Aug 2024 11:49:08 -0300 Subject: [PATCH 3/5] fmt --- crates/primitives-traits/src/lib.rs | 2 +- crates/primitives/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index 49f937123218..e6ce1686d9ba 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -22,7 +22,7 @@ pub use constants::gas_units::{format_gas, format_gas_throughput}; /// Minimal account pub mod account; -pub use account::{Account, Bytecode, AccountTrie}; +pub use account::{Account, AccountTrie, Bytecode}; mod integer_list; pub use integer_list::{IntegerList, RoaringBitmapError}; diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 44cb8337b25a..88059b984687 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -53,8 +53,8 @@ pub use receipt::{ gas_spent_by_transactions, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts, }; pub use reth_primitives_traits::{ - logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log, - LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, AccountTrie + logs_bloom, Account, AccountTrie, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, + Log, LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, }; pub use static_file::StaticFileSegment; From 6a7c3465da3d02e59dd9b8513114ffbf3f5cbedc Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Fri, 2 Aug 2024 12:17:08 -0300 Subject: [PATCH 4/5] change export way --- crates/primitives-traits/src/account.rs | 1 - crates/primitives-traits/src/lib.rs | 2 +- crates/primitives/src/lib.rs | 2 +- crates/rpc/rpc-eth-api/src/core.rs | 6 +++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/primitives-traits/src/account.rs b/crates/primitives-traits/src/account.rs index 1b87916ef6f1..6099e713118c 100644 --- a/crates/primitives-traits/src/account.rs +++ b/crates/primitives-traits/src/account.rs @@ -8,7 +8,6 @@ use reth_codecs::{reth_codec, Compact}; use revm_primitives::{AccountInfo, Bytecode as RevmBytecode, JumpTable}; use serde::{Deserialize, Serialize}; -pub use alloy_consensus::Account as AccountTrie; /// An Ethereum account. #[reth_codec] #[derive(Clone, Copy, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] diff --git a/crates/primitives-traits/src/lib.rs b/crates/primitives-traits/src/lib.rs index e6ce1686d9ba..c8c1cbd8dd95 100644 --- a/crates/primitives-traits/src/lib.rs +++ b/crates/primitives-traits/src/lib.rs @@ -22,7 +22,7 @@ pub use constants::gas_units::{format_gas, format_gas_throughput}; /// Minimal account pub mod account; -pub use account::{Account, AccountTrie, Bytecode}; +pub use account::{Account, Bytecode}; mod integer_list; pub use integer_list::{IntegerList, RoaringBitmapError}; diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 88059b984687..a99d679679b3 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -53,7 +53,7 @@ pub use receipt::{ gas_spent_by_transactions, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts, }; pub use reth_primitives_traits::{ - logs_bloom, Account, AccountTrie, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, + logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log, LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, }; pub use static_file::StaticFileSegment; diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 2b234ff765c9..166561809458 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -4,7 +4,7 @@ use alloy_dyn_abi::TypedData; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{ - transaction::AccessListResult, AccountTrie, Address, BlockId, BlockNumberOrTag, Bytes, B256, + transaction::AccessListResult, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64, }; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; @@ -250,7 +250,7 @@ pub trait EthApi { /// Returns the account details by specifying an address and a block number/tag #[method(name = "getAccount")] - async fn get_account(&self, address: Address, block: BlockId) -> RpcResult; + async fn get_account(&self, address: Address, block: BlockId) -> RpcResult; /// Introduced in EIP-1559, returns suggestion for the priority for dynamic fee transactions. #[method(name = "maxPriorityFeePerGas")] @@ -626,7 +626,7 @@ where } /// Handler for: `eth_getAccount` - async fn get_account(&self, _address: Address, _block: BlockId) -> RpcResult { + async fn get_account(&self, _address: Address, _block: BlockId) -> RpcResult { Err(internal_rpc_err("unimplemented")) } From a21ccab7126fd959098bdc5fc95a12003e69efd6 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Fri, 2 Aug 2024 12:18:17 -0300 Subject: [PATCH 5/5] fmt --- crates/primitives/src/lib.rs | 4 ++-- crates/rpc/rpc-eth-api/src/core.rs | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index a99d679679b3..0858d5901fe7 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -53,8 +53,8 @@ pub use receipt::{ gas_spent_by_transactions, Receipt, ReceiptWithBloom, ReceiptWithBloomRef, Receipts, }; pub use reth_primitives_traits::{ - logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, - Log, LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, + logs_bloom, Account, Bytecode, GotExpected, GotExpectedBoxed, Header, HeaderError, Log, + LogData, Request, Requests, SealedHeader, StorageEntry, Withdrawal, Withdrawals, }; pub use static_file::StaticFileSegment; diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 166561809458..4f90e1686e46 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -4,8 +4,7 @@ use alloy_dyn_abi::TypedData; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; use reth_primitives::{ - transaction::AccessListResult, Address, BlockId, BlockNumberOrTag, Bytes, B256, - B64, U256, U64, + transaction::AccessListResult, Address, BlockId, BlockNumberOrTag, Bytes, B256, B64, U256, U64, }; use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult}; use reth_rpc_types::{ @@ -250,7 +249,11 @@ pub trait EthApi { /// Returns the account details by specifying an address and a block number/tag #[method(name = "getAccount")] - async fn get_account(&self, address: Address, block: BlockId) -> RpcResult; + async fn get_account( + &self, + address: Address, + block: BlockId, + ) -> RpcResult; /// Introduced in EIP-1559, returns suggestion for the priority for dynamic fee transactions. #[method(name = "maxPriorityFeePerGas")] @@ -626,7 +629,11 @@ where } /// Handler for: `eth_getAccount` - async fn get_account(&self, _address: Address, _block: BlockId) -> RpcResult { + async fn get_account( + &self, + _address: Address, + _block: BlockId, + ) -> RpcResult { Err(internal_rpc_err("unimplemented")) }