From 64f38434101be5f131b621124c122b5676b92b28 Mon Sep 17 00:00:00 2001 From: bsh98 <31482749+bsh98@users.noreply.github.com> Date: Fri, 6 Dec 2024 06:37:14 -0500 Subject: [PATCH] chore: bumps select alloy crates to 0.6 (#1854) * chore: update select alloy crates to 0.6 * fix: bumped types * Update examples/block_traces/src/main.rs * Update examples/block_traces/src/main.rs * Update examples/block_traces/src/main.rs --- Cargo.lock | 168 ++++++++++++++++------- crates/database/Cargo.toml | 6 +- crates/database/src/alloydb.rs | 7 +- crates/revm/Cargo.toml | 2 +- examples/block_traces/Cargo.toml | 5 +- examples/block_traces/src/main.rs | 34 +++-- examples/uniswap_get_reserves/Cargo.toml | 4 +- examples/uniswap_v2_usdc_swap/Cargo.toml | 6 +- 8 files changed, 156 insertions(+), 76 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a20a7947de..fa90de124f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,6 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", "zerocopy", @@ -67,9 +68,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705687d5bfd019fee57cf9e206b27b30a9a9617535d5590a02b171e813208f8e" +checksum = "ae09ffd7c29062431dd86061deefe4e3c6f07fa0d674930095f8dcedb0baf02c" dependencies = [ "alloy-eips", "alloy-primitives", @@ -104,14 +105,26 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-eip7702" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6cee6a35793f3db8a5ffe60e86c695f321d081a567211245f503e8c498fce8" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "derive_more 1.0.0", + "serde", +] + [[package]] name = "alloy-eips" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ffb906284a1e1f63c4607da2068c8197458a352d0b3e9796e67353d72a9be85" +checksum = "5b6aa3961694b30ba53d41006131a2fca3bdab22e4c344e46db2c639e7c2dfdd" dependencies = [ "alloy-eip2930", - "alloy-eip7702", + "alloy-eip7702 0.4.1", "alloy-primitives", "alloy-rlp", "alloy-serde", @@ -124,9 +137,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a438d4486b5d525df3b3004188f9d5cd1d65cd30ecc41e5a3ccef6f6342e8af9" +checksum = "b84c506bf264110fa7e90d9924f742f40ef53c6572ea56a0b0bd714a567ed389" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -136,9 +149,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8fa8a1a3c4cbd221f2b8e3693aeb328fca79a757fe556ed08e47bbbc2a70db7" +checksum = "3694b7e480728c0b3e228384f223937f14c10caef5a4c766021190fc8f283d35" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -150,9 +163,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fa23a6a9d612b52e402c995f2d582c25165ec03ac6edf64c861a76bc5b87cd" +checksum = "ea94b8ceb5c75d7df0a93ba0acc53b55a22b47b532b600a800a87ef04eb5b0b4" dependencies = [ "alloy-consensus", "alloy-eips", @@ -166,14 +179,16 @@ dependencies = [ "async-trait", "auto_impl", "futures-utils-wasm", + "serde", + "serde_json", "thiserror", ] [[package]] name = "alloy-network-primitives" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801492711d4392b2ccf5fc0bc69e299fa1aab15167d74dcaa9aab96a54f684bd" +checksum = "df9f3e281005943944d15ee8491534a1c7b3cbf7a7de26f8c433b842b93eb5f9" dependencies = [ "alloy-consensus", "alloy-eips", @@ -184,9 +199,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260d3ff3bff0bb84599f032a2f2c6828180b0ea0cd41fdaf44f39cef3ba41861" +checksum = "9fce5dbd6a4f118eecc4719eaa9c7ffc31c315e6c5ccde3642db927802312425" dependencies = [ "alloy-rlp", "arbitrary", @@ -195,8 +210,9 @@ dependencies = [ "const-hex", "derive_arbitrary", "derive_more 1.0.0", + "foldhash", "getrandom", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "hex-literal", "indexmap", "itoa", @@ -215,9 +231,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcfaa4ffec0af04e3555686b8aacbcdf7d13638133a0672749209069750f78a6" +checksum = "40c1f9eede27bf4c13c099e8e64d54efd7ce80ef6ea47478aa75d5d74e2dba3b" dependencies = [ "alloy-chains", "alloy-consensus", @@ -237,21 +253,24 @@ dependencies = [ "futures", "futures-utils-wasm", "lru", + "parking_lot", "pin-project", "reqwest", + "schnellru", "serde", "serde_json", "thiserror", "tokio", "tracing", "url", + "wasmtimer", ] [[package]] name = "alloy-rlp" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" +checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -260,9 +279,9 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" +checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" dependencies = [ "proc-macro2", "quote", @@ -271,9 +290,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370143ed581aace6e663342d21d209c6b2e34ee6142f7d6675adb518deeaf0dc" +checksum = "374dbe0dc3abdc2c964f36b3d3edf9cdb3db29d16bda34aa123f03d810bec1dd" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -289,13 +308,14 @@ dependencies = [ "tower 0.5.1", "tracing", "url", + "wasmtimer", ] [[package]] name = "alloy-rpc-types-eth" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413f4aa3ccf2c3e4234a047c5fa4727916d7daf25a89f9b765df0ba09784fd87" +checksum = "a8a477281940d82d29315846c7216db45b15e90bcd52309da9f54bcf7ad94a11" dependencies = [ "alloy-consensus", "alloy-eips", @@ -312,9 +332,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dff0ab1cdd43ca001e324dc27ee0e8606bd2161d6623c63e0e0b8c4dfc13600" +checksum = "4dfa4a7ccf15b2492bb68088692481fd6b2604ccbee1d0d6c44c21427ae4df83" dependencies = [ "alloy-primitives", "serde", @@ -323,9 +343,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd4e0ad79c81a27ca659be5d176ca12399141659fef2bcbfdc848da478f4504" +checksum = "2e10aec39d60dc27edcac447302c7803d2371946fb737245320a05b78eb2fafd" dependencies = [ "alloy-primitives", "async-trait", @@ -337,9 +357,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e7f6e8fe5b443f82b3f1e15abfa191128f71569148428e49449d01f6f49e8b" +checksum = "9343289b4a7461ed8bab8618504c995c049c082b70c7332efd7b32125633dc05" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -351,9 +371,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b96ce28d2fde09abb6135f410c41fad670a3a770b6776869bd852f1df102e6f" +checksum = "4222d70bec485ceccc5d8fd4f2909edd65b5d5e43d4aca0b5dcee65d519ae98f" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -369,9 +389,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "906746396a8296537745711630d9185746c0b50c033d5e9d18b0a6eba3d53f90" +checksum = "2e17f2677369571b976e51ea1430eb41c3690d344fef567b840bfc0b01b6f83a" dependencies = [ "const-hex", "dunce", @@ -384,9 +404,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc85178909a49c8827ffccfc9103a7ce1767ae66a801b69bdc326913870bf8e6" +checksum = "aa64d80ae58ffaafdff9d5d84f58d03775f66c84433916dc9a64ed16af5755da" dependencies = [ "serde", "winnow", @@ -394,9 +414,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86a533ce22525969661b25dfe296c112d35eb6861f188fd284f8bd4bb3842ae" +checksum = "6520d427d4a8eb7aa803d852d7a52ceb0c519e784c292f64bb339e636918cf27" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -407,9 +427,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac3e97dad3d31770db0fc89bd6a63b789fbae78963086733f960cf32c483904" +checksum = "f99acddb34000d104961897dbb0240298e8b775a7efffb9fda2a1a3efedd65b3" dependencies = [ "alloy-json-rpc", "base64", @@ -422,13 +442,14 @@ dependencies = [ "tower 0.5.1", "tracing", "url", + "wasmtimer", ] [[package]] name = "alloy-transport-http" -version = "0.4.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b367dcccada5b28987c2296717ee04b9a5637aacd78eacb1726ef211678b5212" +checksum = "5dc013132e34eeadaa0add7e74164c1503988bfba8bae885b32e0918ba85a8a6" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -1382,6 +1403,7 @@ dependencies = [ name = "example-block-traces" version = "0.0.0" dependencies = [ + "alloy-consensus", "alloy-eips", "alloy-provider", "anyhow", @@ -1510,6 +1532,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1721,6 +1749,12 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + [[package]] name = "hashbrown" version = "0.14.5" @@ -1729,7 +1763,6 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", - "serde", ] [[package]] @@ -1737,6 +1770,10 @@ name = "hashbrown" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "foldhash", + "serde", +] [[package]] name = "heck" @@ -2444,6 +2481,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + [[package]] name = "parking_lot_core" version = "0.9.10" @@ -3097,7 +3144,7 @@ name = "revm-specification" version = "1.0.0" dependencies = [ "alloy-eip2930", - "alloy-eip7702", + "alloy-eip7702 0.1.1", "alloy-primitives", "enumn", "revm-primitives", @@ -3455,6 +3502,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "schnellru" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" +dependencies = [ + "ahash", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -3790,9 +3848,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.5" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab661c8148c2261222a4d641ad5477fd4bea79406a99056096a0b41b35617a5" +checksum = "f76fe0a3e1476bdaa0775b9aec5b869ed9520c2b2fedfe9c6df3618f8ea6290b" dependencies = [ "paste", "proc-macro2", @@ -4299,6 +4357,20 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasmtimer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4f099acbc1043cc752b91615b24b02d7f6fcd975bd781fed9f50b3c3e15bf7" +dependencies = [ + "futures", + "js-sys", + "parking_lot", + "pin-utils", + "slab", + "wasm-bindgen", +] + [[package]] name = "web-sys" version = "0.3.69" diff --git a/crates/database/Cargo.toml b/crates/database/Cargo.toml index 6296dfbf9d..329db4acc7 100644 --- a/crates/database/Cargo.toml +++ b/crates/database/Cargo.toml @@ -41,9 +41,9 @@ tokio = { version = "1.40", features = [ "rt-multi-thread", "macros", ], optional = true } -alloy-provider = { version = "0.4.2", optional = true, default-features = false } -alloy-eips = { version = "0.4.2", optional = true, default-features = false } -alloy-transport = { version = "0.4.2", optional = true, default-features = false } +alloy-provider = { version = "0.6", optional = true, default-features = false } +alloy-eips = { version = "0.6", optional = true, default-features = false } +alloy-transport = { version = "0.6", optional = true, default-features = false } [dev-dependencies] diff --git a/crates/database/src/alloydb.rs b/crates/database/src/alloydb.rs index 59f43c0c56..60fcdd7887 100644 --- a/crates/database/src/alloydb.rs +++ b/crates/database/src/alloydb.rs @@ -1,6 +1,9 @@ pub use alloy_eips::BlockId; use alloy_provider::{ - network::{BlockResponse, HeaderResponse}, + network::{ + primitives::{BlockTransactionsKind, HeaderResponse}, + BlockResponse, + }, Network, Provider, }; use alloy_transport::{Transport, TransportError}; @@ -78,7 +81,7 @@ impl> DatabaseAsyncRef for A let block = self .provider // SAFETY: We know number <= u64::MAX, so we can safely convert it to u64 - .get_block_by_number(number.into(), false) + .get_block_by_number(number.into(), BlockTransactionsKind::Hashes) .await?; // SAFETY: If the number is given, the block is supposed to be finalized, so unwrapping is safe. Ok(B256::new(*block.unwrap().header().hash())) diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 9098136484..fd74481132 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -54,7 +54,7 @@ indicatif = "0.17" reqwest = { version = "0.12" } rstest = "0.22.0" -alloy-provider = "0.4.2" +alloy-provider = "0.6" [features] default = ["std", "c-kzg", "secp256k1", "portable", "blst"] diff --git a/examples/block_traces/Cargo.toml b/examples/block_traces/Cargo.toml index 46e0454b56..f63c732be9 100644 --- a/examples/block_traces/Cargo.toml +++ b/examples/block_traces/Cargo.toml @@ -30,8 +30,9 @@ inspector = { workspace = true, features = ["std", "serde-json"] } tokio = { version = "1.40", features = ["rt-multi-thread", "macros"] } # alloy -alloy-eips = "0.4.2" -alloy-provider = "0.4.2" +alloy-eips = "0.6" +alloy-provider = "0.6" +alloy-consensus = "0.6" # progress bar indicatif = "0.17" diff --git a/examples/block_traces/src/main.rs b/examples/block_traces/src/main.rs index 2aa4cc5780..511f510bb4 100644 --- a/examples/block_traces/src/main.rs +++ b/examples/block_traces/src/main.rs @@ -1,8 +1,12 @@ //! Optimism-specific constants, types, and helpers. #![cfg_attr(not(test), warn(unused_crate_dependencies))] +use alloy_consensus::Transaction; use alloy_eips::{BlockId, BlockNumberOrTag}; -use alloy_provider::{network::primitives::BlockTransactions, Provider, ProviderBuilder}; +use alloy_provider::{ + network::primitives::{BlockTransactions, BlockTransactionsKind}, + Provider, ProviderBuilder, +}; use database::{AlloyDB, CacheDB, StateBuilder}; use indicatif::ProgressBar; use inspector::{inspectors::TracerEip3155, InspectorContext, InspectorEthFrame, InspectorMainEvm}; @@ -56,7 +60,10 @@ async fn main() -> anyhow::Result<()> { // Fetch the transaction-rich block let block = match client - .get_block_by_number(BlockNumberOrTag::Number(block_number), true) + .get_block_by_number( + BlockNumberOrTag::Number(block_number), + BlockTransactionsKind::Full, + ) .await { Ok(Some(block)) => block, @@ -79,7 +86,7 @@ async fn main() -> anyhow::Result<()> { .with_db(&mut state) .modify_block_chained(|b| { b.number = U256::from(block.header.number); - b.beneficiary = block.header.miner; + b.beneficiary = block.header.beneficiary; b.timestamp = U256::from(block.header.timestamp); b.difficulty = block.header.difficulty; @@ -120,23 +127,20 @@ async fn main() -> anyhow::Result<()> { for tx in transactions { evm.context.inner.modify_tx(|etx| { etx.caller = tx.from; - etx.gas_limit = tx.gas; - etx.gas_price = U256::from( - tx.gas_price - .unwrap_or(tx.max_fee_per_gas.unwrap_or_default()), - ); - etx.value = tx.value; - etx.data = tx.input.0.into(); - etx.gas_priority_fee = tx.max_priority_fee_per_gas.map(U256::from); + etx.gas_limit = tx.gas_limit(); + etx.gas_price = U256::from(tx.gas_price().unwrap_or(tx.inner.max_fee_per_gas())); + etx.value = tx.value(); + etx.data = tx.input().to_owned(); + etx.gas_priority_fee = tx.max_priority_fee_per_gas().map(U256::from); etx.chain_id = Some(chain_id); - etx.nonce = tx.nonce; - if let Some(access_list) = tx.access_list { - etx.access_list = access_list; + etx.nonce = tx.nonce(); + if let Some(access_list) = tx.access_list() { + etx.access_list = access_list.to_owned(); } else { etx.access_list = Default::default(); } - etx.transact_to = match tx.to { + etx.transact_to = match tx.to() { Some(to_address) => TxKind::Call(to_address), None => TxKind::Create, }; diff --git a/examples/uniswap_get_reserves/Cargo.toml b/examples/uniswap_get_reserves/Cargo.toml index 583672b7f5..8aba1d6ae8 100644 --- a/examples/uniswap_get_reserves/Cargo.toml +++ b/examples/uniswap_get_reserves/Cargo.toml @@ -33,8 +33,8 @@ tokio = { version = "1.40", features = ["rt-multi-thread", "macros"] } alloy-sol-types = { version = "0.8.2", default-features = false, features = [ "std", ] } -alloy-eips = "0.4.2" -alloy-provider = "0.4.2" +alloy-eips = "0.6" +alloy-provider = "0.6" # mics anyhow = "1.0.89" diff --git a/examples/uniswap_v2_usdc_swap/Cargo.toml b/examples/uniswap_v2_usdc_swap/Cargo.toml index af41bf77c5..532b8fb601 100644 --- a/examples/uniswap_v2_usdc_swap/Cargo.toml +++ b/examples/uniswap_v2_usdc_swap/Cargo.toml @@ -32,8 +32,8 @@ tokio = { version = "1.40", features = ["rt-multi-thread", "macros"] } alloy-sol-types = { version = "0.8.2", default-features = false, features = [ "std", ] } -alloy-eips = "0.4.2" -alloy-transport-http = "0.4.2" -alloy-provider = "0.4.2" +alloy-eips = "0.6" +alloy-transport-http = "0.6" +alloy-provider = "0.6" reqwest = { version = "0.12" } anyhow = "1.0.89"