diff --git a/Cargo.toml b/Cargo.toml index 28b48c3..1e7198d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,17 +26,18 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] alloy-primitives = { version = "0.8.5", features = ["map"] } -alloy-provider = { version = "0.5", default-features = false } -alloy-rpc-types = { version = "0.5", features = ["eth"] } -alloy-serde = { version = "0.5", default-features = false } -alloy-transport = { version = "0.5", default-features = false } +alloy-provider = { version = "0.6", default-features = false } +alloy-rpc-types = { version = "0.6", features = ["eth"] } +alloy-serde = { version = "0.6", default-features = false } +alloy-transport = { version = "0.6", default-features = false } +alloy-consensus = { version = "0.6", default-features = false } eyre = "0.6" futures = "0.3" parking_lot = "0.12" -revm = { version = "17.0.0", default-features = false, features = [ +revm = { version = "18.0.0", default-features = false, features = [ "std", "serde", ] } @@ -51,5 +52,5 @@ tracing = "0.1" url = "2" [dev-dependencies] -alloy-rpc-client = "0.5" -alloy-transport-http = "0.5" +alloy-rpc-client = "0.6" +alloy-transport-http = "0.6" diff --git a/deny.toml b/deny.toml index 52be297..9e9019c 100644 --- a/deny.toml +++ b/deny.toml @@ -24,6 +24,7 @@ allow = [ "Unicode-DFS-2016", "Unlicense", "Zlib", + "Unicode-3.0", ] exceptions = [ @@ -48,4 +49,4 @@ license-files = [{ path = "LICENSE", hash = 0x001c7e6c }] [sources] unknown-registry = "deny" -unknown-git = "deny" \ No newline at end of file +unknown-git = "deny" diff --git a/src/backend.rs b/src/backend.rs index 26cdc8e..ef50397 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -5,8 +5,11 @@ use crate::{ error::{DatabaseError, DatabaseResult}, }; use alloy_primitives::{keccak256, Address, Bytes, B256, U256}; -use alloy_provider::{network::AnyNetwork, Provider}; -use alloy_rpc_types::{Block, BlockId, Transaction}; +use alloy_provider::{ + network::{AnyNetwork, AnyRpcBlock, AnyRpcTransaction, AnyTxEnvelope}, + Provider, +}; +use alloy_rpc_types::{BlockId, Transaction}; use alloy_serde::WithOtherFields; use alloy_transport::Transport; use eyre::WrapErr; @@ -47,29 +50,16 @@ type AccountFuture = type StorageFuture = Pin, Address, U256)> + Send>>; type BlockHashFuture = Pin, u64)> + Send>>; type FullBlockFuture = Pin< - Box< - dyn Future< - Output = ( - FullBlockSender, - Result>>>, Err>, - BlockId, - ), - > + Send, - >, ->; -type TransactionFuture = Pin< - Box< - dyn Future, Err>, B256)> - + Send, - >, + Box, Err>, BlockId)> + Send>, >; +type TransactionFuture = + Pin, B256)> + Send>>; type AccountInfoSender = OneshotSender>; type StorageSender = OneshotSender>; type BlockHashSender = OneshotSender>; -type FullBlockSender = - OneshotSender>>>>; -type TransactionSender = OneshotSender>>; +type FullBlockSender = OneshotSender>; +type TransactionSender = OneshotSender>; type AddressData = AddressHashMap; type StorageData = AddressHashMap; @@ -318,7 +308,10 @@ where let provider = self.provider.clone(); let fut = Box::pin(async move { let block = provider - .get_block_by_number(number.into(), false) + .get_block_by_number( + number.into(), + alloy_rpc_types::BlockTransactionsKind::Hashes, + ) .await .wrap_err("failed to get block"); @@ -679,10 +672,7 @@ impl SharedBackend { } /// Returns the full block for the given block identifier - pub fn get_full_block( - &self, - block: impl Into, - ) -> DatabaseResult>>> { + pub fn get_full_block(&self, block: impl Into) -> DatabaseResult { self.blocking_mode.run(|| { let (sender, rx) = oneshot_channel(); let req = BackendRequest::FullBlock(block.into(), sender); @@ -692,7 +682,10 @@ impl SharedBackend { } /// Returns the transaction for the hash - pub fn get_transaction(&self, tx: B256) -> DatabaseResult> { + pub fn get_transaction( + &self, + tx: B256, + ) -> DatabaseResult>> { self.blocking_mode.run(|| { let (sender, rx) = oneshot_channel(); let req = BackendRequest::Transaction(tx, sender); diff --git a/src/cache.rs b/src/cache.rs index 6d7998c..8e9552c 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -1,6 +1,7 @@ //! Cache related abstraction +use alloy_consensus::BlockHeader; use alloy_primitives::{Address, B256, U256}; -use alloy_provider::network::{HeaderResponse, TransactionResponse}; +use alloy_provider::network::TransactionResponse; use parking_lot::RwLock; use revm::{ primitives::{ @@ -150,7 +151,7 @@ impl BlockchainDbMeta { pub fn with_block(mut self, block: &alloy_rpc_types::Block) -> Self { self.block_env = BlockEnv { number: U256::from(block.header.number()), - coinbase: block.header.coinbase(), + coinbase: block.header.beneficiary(), timestamp: U256::from(block.header.timestamp()), difficulty: U256::from(block.header.difficulty()), basefee: block.header.base_fee_per_gas().map(U256::from).unwrap_or_default(),