diff --git a/Cargo.lock b/Cargo.lock index 719ed497e..75d6b7cc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8068,11 +8068,13 @@ dependencies = [ "curve25519-dalek", "dkg", "dockertest", + "ethereum-serai", "hex", "monero-serai", "parity-scale-codec", "rand_core", "serai-client", + "serai-db", "serai-docker-tests", "serai-message-queue", "serai-message-queue-tests", diff --git a/coins/ethereum/src/lib.rs b/coins/ethereum/src/lib.rs index eda54c720..322b5f839 100644 --- a/coins/ethereum/src/lib.rs +++ b/coins/ethereum/src/lib.rs @@ -1,14 +1,17 @@ use thiserror::Error; -pub use alloy_core; -pub use alloy_sol_types; - -pub use alloy_consensus; -pub use alloy_network; -pub use alloy_rpc_types; -pub use alloy_simple_request_transport; -pub use alloy_rpc_client; -pub use alloy_provider; +pub mod alloy { + pub use alloy_core::primitives; + pub use alloy_core as core; + pub use alloy_sol_types as sol_types; + + pub use alloy_consensus as consensus; + pub use alloy_network as network; + pub use alloy_rpc_types as rpc_types; + pub use alloy_simple_request_transport as simple_request_transport; + pub use alloy_rpc_client as rpc_client; + pub use alloy_provider as provider; +} pub mod crypto; diff --git a/processor/src/networks/ethereum.rs b/processor/src/networks/ethereum.rs index f3d562d7c..7ffe70410 100644 --- a/processor/src/networks/ethereum.rs +++ b/processor/src/networks/ethereum.rs @@ -11,11 +11,13 @@ use ciphersuite::{group::GroupEncoding, Ciphersuite, Secp256k1}; use frost::ThresholdKeys; use ethereum_serai::{ - alloy_core::primitives::U256, - alloy_rpc_types::{BlockNumberOrTag, Transaction}, - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, + alloy::{ + primitives::U256, + rpc_types::{BlockNumberOrTag, Transaction}, + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + }, crypto::{PublicKey, Signature}, erc20::Erc20, deployer::Deployer, @@ -23,7 +25,7 @@ use ethereum_serai::{ machine::*, }; #[cfg(test)] -use ethereum_serai::alloy_core::primitives::B256; +use ethereum_serai::alloy::primitives::B256; use tokio::{ time::sleep, @@ -112,7 +114,7 @@ impl TryInto> for Address { impl fmt::Display for Address { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - ethereum_serai::alloy_core::primitives::Address::from(self.0).fmt(f) + ethereum_serai::alloy::primitives::Address::from(self.0).fmt(f) } } @@ -181,7 +183,7 @@ impl Output> for EthereumInInstruction { let mut id = [0; 40]; id[.. 32].copy_from_slice(&self.id.0); id[32 ..].copy_from_slice(&self.id.1.to_le_bytes()); - *ethereum_serai::alloy_core::primitives::keccak256(id) + *ethereum_serai::alloy::primitives::keccak256(id) } fn tx_id(&self) -> [u8; 32] { self.id.0 @@ -853,7 +855,7 @@ impl Network for Ethereum { async fn test_send(&self, send_to: Self::Address) -> Self::Block { use rand_core::OsRng; use ciphersuite::group::ff::Field; - use ethereum_serai::alloy_sol_types::SolCall; + use ethereum_serai::alloy::sol_types::SolCall; let key = ::F::random(&mut OsRng); let address = ethereum_serai::crypto::address(&(Secp256k1::generator() * key)); @@ -869,12 +871,12 @@ impl Network for Ethereum { .unwrap(); let value = U256::from_str_radix("1000000000000000000", 10).unwrap(); - let tx = ethereum_serai::alloy_consensus::TxLegacy { + let tx = ethereum_serai::alloy::consensus::TxLegacy { chain_id: None, nonce: 0, gas_price: 1_000_000_000u128, gas_limit: 200_000u128, - to: ethereum_serai::alloy_core::primitives::TxKind::Call(send_to.0.into()), + to: ethereum_serai::alloy::primitives::TxKind::Call(send_to.0.into()), // 1 ETH value, input: ethereum_serai::router::abi::inInstructionCall::new(( @@ -886,7 +888,7 @@ impl Network for Ethereum { .into(), }; - use ethereum_serai::alloy_consensus::SignableTransaction; + use ethereum_serai::alloy::consensus::SignableTransaction; let sig = k256::ecdsa::SigningKey::from(k256::elliptic_curve::NonZeroScalar::new(key).unwrap()) .sign_prehash_recoverable(tx.signature_hash().as_ref()) .unwrap(); diff --git a/processor/src/tests/literal/mod.rs b/processor/src/tests/literal/mod.rs index cecd5a3bf..5c5f3203b 100644 --- a/processor/src/tests/literal/mod.rs +++ b/processor/src/tests/literal/mod.rs @@ -314,10 +314,12 @@ mod ethereum { ) -> impl Fn(MemDb) -> Pin>>> { use std::sync::Arc; use ethereum_serai::{ - alloy_core::primitives::U256, - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, + alloy::{ + primitives::U256, + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + }, deployer::Deployer, }; diff --git a/tests/processor/src/lib.rs b/tests/processor/src/lib.rs index 66aa28c46..5e854272c 100644 --- a/tests/processor/src/lib.rs +++ b/tests/processor/src/lib.rs @@ -182,11 +182,11 @@ impl Coordinator { } } NetworkId::Ethereum => { - use ethereum_serai::{ - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, - alloy_network::Ethereum, + use ethereum_serai::alloy::{ + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + network::Ethereum, }; let provider = RootProvider::<_, Ethereum>::new( @@ -293,12 +293,12 @@ impl Coordinator { (hash, block_buf) } NetworkId::Ethereum => { - use ethereum_serai::{ - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_types::BlockNumberOrTag, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, - alloy_network::Ethereum, + use ethereum_serai::alloy::{ + simple_request_transport::SimpleRequest, + rpc_types::BlockNumberOrTag, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + network::Ethereum, }; let provider = RootProvider::<_, Ethereum>::new( @@ -395,11 +395,11 @@ impl Coordinator { } } NetworkId::Ethereum => { - use ethereum_serai::{ - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, - alloy_network::Ethereum, + use ethereum_serai::alloy::{ + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + network::Ethereum, }; let provider = RootProvider::<_, Ethereum>::new( @@ -464,11 +464,11 @@ impl Coordinator { rpc.send_raw_transaction(&Transaction::consensus_decode(&mut &*tx).unwrap()).await.unwrap(); } NetworkId::Ethereum => { - use ethereum_serai::{ - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, - alloy_network::Ethereum, + use ethereum_serai::alloy::{ + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + network::Ethereum, }; let provider = RootProvider::<_, Ethereum>::new( @@ -517,12 +517,12 @@ impl Coordinator { } } NetworkId::Ethereum => { - use ethereum_serai::{ - alloy_simple_request_transport::SimpleRequest, - alloy_consensus::{TxLegacy, Signed}, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, - alloy_network::Ethereum, + use ethereum_serai::alloy::{ + consensus::{TxLegacy, Signed}, + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + network::Ethereum, }; let provider = RootProvider::<_, Ethereum>::new( diff --git a/tests/processor/src/networks.rs b/tests/processor/src/networks.rs index 7a81062aa..5b54cc01c 100644 --- a/tests/processor/src/networks.rs +++ b/tests/processor/src/networks.rs @@ -156,12 +156,12 @@ impl Wallet { NetworkId::Ethereum => { use ciphersuite::{group::ff::Field, Ciphersuite, Secp256k1}; - use ethereum_serai::{ - alloy_core::primitives::{U256, Address}, - alloy_simple_request_transport::SimpleRequest, - alloy_rpc_client::ClientBuilder, - alloy_provider::{Provider, RootProvider}, - alloy_network::Ethereum, + use ethereum_serai::alloy::{ + primitives::{U256, Address}, + simple_request_transport::SimpleRequest, + rpc_client::ClientBuilder, + provider::{Provider, RootProvider}, + network::Ethereum, }; let key = ::F::random(&mut OsRng); @@ -330,7 +330,7 @@ impl Wallet { Wallet::Ethereum { key, ref mut nonce } => { /* - use ethereum_serai::alloy_core::primitives::U256; + use ethereum_serai::alloy::primitives::U256; let eight_decimals = U256::from(100_000_000u64); let nine_decimals = eight_decimals * U256::from(10u64);