From 81e70e0e68718600324fdeef0bd30b8c6eb6e1e3 Mon Sep 17 00:00:00 2001 From: Chris Smith <1979423+chris13524@users.noreply.github.com> Date: Tue, 10 Sep 2024 03:15:56 -0700 Subject: [PATCH] chore: upgrade alloy (#16) --- crates/yttrium/Cargo.toml | 3 +-- crates/yttrium/src/entry_point.rs | 14 ++++++++++++++ crates/yttrium/src/smart_accounts/nonce.rs | 4 ++-- crates/yttrium/src/transaction/send/safe_test.rs | 8 +++++--- .../src/transaction/send/simple_account_test.rs | 2 +- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/crates/yttrium/Cargo.toml b/crates/yttrium/Cargo.toml index ade879b..c0fd830 100644 --- a/crates/yttrium/Cargo.toml +++ b/crates/yttrium/Cargo.toml @@ -6,7 +6,7 @@ rust-version.workspace = true [dependencies] # Ethereum -alloy = { git = "https://github.com/alloy-rs/alloy", rev = "b000e16", features = [ +alloy = { git = "https://github.com/alloy-rs/alloy", version = "0.3.2", features = [ "contract", "network", "providers", @@ -48,5 +48,4 @@ wiremock = "0.6.0" reqwest.workspace = true [build-dependencies] -alloy-primitives = { version = "0.7.0" } serde_json = "1" diff --git a/crates/yttrium/src/entry_point.rs b/crates/yttrium/src/entry_point.rs index fd7f56c..54326c0 100644 --- a/crates/yttrium/src/entry_point.rs +++ b/crates/yttrium/src/entry_point.rs @@ -40,6 +40,20 @@ pub const ENTRYPOINT_ADDRESS_V07: &str = pub const ENTRYPOINT_V06_TYPE: &str = "v0.6"; pub const ENTRYPOINT_V07_TYPE: &str = "v0.7"; +sol! ( + struct PackedUserOperation { + address sender; + uint256 nonce; + bytes initCode; + bytes callData; + bytes32 accountGasLimits; + uint256 preVerificationGas; + bytes32 gasFees; + bytes paymasterAndData; + bytes signature; + } +); + sol!( #[allow(missing_docs)] #[sol(rpc)] diff --git a/crates/yttrium/src/smart_accounts/nonce.rs b/crates/yttrium/src/smart_accounts/nonce.rs index f32ee1d..d086468 100644 --- a/crates/yttrium/src/smart_accounts/nonce.rs +++ b/crates/yttrium/src/smart_accounts/nonce.rs @@ -1,4 +1,4 @@ -use alloy::primitives::U256; +use alloy::primitives::aliases::U192; pub async fn get_nonce( provider: &P, @@ -14,7 +14,7 @@ where entry_point_address.to_address(), provider, ); - let key = U256::ZERO; + let key = U192::ZERO; let get_nonce_call = entry_point_instance.getNonce(address.to_address(), key).call().await?; diff --git a/crates/yttrium/src/transaction/send/safe_test.rs b/crates/yttrium/src/transaction/send/safe_test.rs index 01a6777..b5090fa 100644 --- a/crates/yttrium/src/transaction/send/safe_test.rs +++ b/crates/yttrium/src/transaction/send/safe_test.rs @@ -61,7 +61,9 @@ mod tests { use alloy::{ dyn_abi::{DynSolValue, Eip712Domain}, network::Ethereum, - primitives::{Address, Bytes, FixedBytes, Uint, U128, U256}, + primitives::{ + aliases::U48, Address, Bytes, FixedBytes, Uint, U128, U256, + }, providers::{ext::AnvilApi, Provider, ReqwestProvider}, signers::{k256::ecdsa::SigningKey, local::LocalSigner, SignerSync}, sol, @@ -243,8 +245,8 @@ mod tests { op }; - let valid_after = 0; - let valid_until = 0; + let valid_after = U48::from(0); + let valid_until = U48::from(0); sol!( struct SafeOp { diff --git a/crates/yttrium/src/transaction/send/simple_account_test.rs b/crates/yttrium/src/transaction/send/simple_account_test.rs index bbaa7e7..2a595be 100644 --- a/crates/yttrium/src/transaction/send/simple_account_test.rs +++ b/crates/yttrium/src/transaction/send/simple_account_test.rs @@ -63,7 +63,7 @@ mod tests { providers::ProviderBuilder, signers::local::LocalSigner, }; - use std::{str::FromStr, time::Duration}; + use std::str::FromStr; async fn send_transaction( transaction: Transaction,