feat: Alloy migration (#4737)

Co-authored-by: Alessandro Mazza <121622391+alessandromazza98@users.noreply.github.com>
Co-authored-by: Supernovahs.eth <91280922+supernovahs@users.noreply.github.com>
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
This commit is contained in:
DaniPopes
2023-09-28 17:55:39 +02:00
committed by GitHub
parent 3ef0364e42
commit 5f9a917fb1
348 changed files with 3593 additions and 7066 deletions

View File

@ -10,7 +10,7 @@ use ethers_middleware::SignerMiddleware;
use ethers_providers::Middleware;
use ethers_signers::Signer;
use reth_network::test_utils::enr_to_peer_id;
use reth_primitives::PeerId;
use reth_primitives::{hex, PeerId};
use thiserror::Error;
use tracing::trace;

View File

@ -1,6 +1,6 @@
use crate::clique::{CliqueGethInstance, CliqueMiddleware};
use ethers_core::{
types::{transaction::eip2718::TypedTransaction, Eip1559TransactionRequest, H160, U64},
types::{transaction::eip2718::TypedTransaction, Address, Eip1559TransactionRequest},
utils::Geth,
};
use ethers_providers::Middleware;
@ -113,7 +113,7 @@ async fn init_geth() -> (CliqueGethInstance, Arc<ChainSpec>) {
let txs = nonces.map(|nonce| {
// create a tx that just sends to the zero addr
TypedTransaction::Eip1559(
Eip1559TransactionRequest::new().to(H160::zero()).value(1u64).nonce(nonce),
Eip1559TransactionRequest::new().to(Address::zero()).value(1u64).nonce(nonce),
)
});
tracing::info!("generated transactions for blocks");
@ -122,7 +122,7 @@ async fn init_geth() -> (CliqueGethInstance, Arc<ChainSpec>) {
clique.provider.send_requests(txs).await.unwrap();
let block = clique.provider.get_block_number().await.unwrap();
assert!(block > U64::zero());
assert!(block.as_u64() > 0);
(clique, Arc::new(chainspec))
}

View File

@ -9,7 +9,7 @@ use reth_network::test_utils::{NetworkEventStream, Testnet};
use reth_network_api::{NetworkInfo, Peers};
use reth_primitives::{
Block, BlockBody, Bytes, Header, HeadersDirection, Signature, Transaction, TransactionKind,
TransactionSigned, TxEip2930, H256, U256,
TransactionSigned, TxEip2930, U256,
};
use reth_provider::test_utils::MockEthProvider;
use std::sync::Arc;
@ -58,7 +58,7 @@ async fn test_get_body() {
// request some blocks
for _ in 0..100 {
// Set a new random block to the mock storage and request it via the network
let block_hash = H256::random();
let block_hash = rng.gen();
let mut block = Block::default();
block.body.push(rng_transaction(&mut rng));
@ -100,12 +100,12 @@ async fn test_get_header() {
assert_eq!(connected, *handle1.peer_id());
let start: u64 = rng.gen();
let mut hash = H256::random();
let mut hash = rng.gen();
// request some headers
for idx in 0..100 {
// Set a new random header to the mock storage and request it via the network
let header = Header { number: start + idx, parent_hash: hash, ..Default::default() };
hash = H256::random();
hash = rng.gen();
mock_provider.add_header(hash, header.clone());