From 9d4b9b5be570bbafa24fac4a3f144c2ad540220a Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Mon, 27 Feb 2023 13:08:39 -0700 Subject: [PATCH] test: disable signer integration tests temporarily --- ethers-middleware/tests/signer.rs | 163 +++++++++++++++--------------- 1 file changed, 83 insertions(+), 80 deletions(-) diff --git a/ethers-middleware/tests/signer.rs b/ethers-middleware/tests/signer.rs index f496f1143..0129deca1 100644 --- a/ethers-middleware/tests/signer.rs +++ b/ethers-middleware/tests/signer.rs @@ -90,86 +90,89 @@ async fn send_with_chain_id_anvil() { let _err = res.unwrap_err(); } -#[tokio::test] -#[cfg(not(feature = "celo"))] -async fn pending_txs_with_confirmations_testnet() { - let provider = GOERLI.provider().interval(Duration::from_millis(3000)); - let chain_id = provider.get_chainid().await.unwrap(); - let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); - let address = wallet.address(); - let provider = SignerMiddleware::new(provider, wallet); - generic_pending_txs_test(provider, address).await; -} - -// different keys to avoid nonce errors -#[tokio::test] -#[cfg(not(feature = "celo"))] -async fn websocket_pending_txs_with_confirmations_testnet() { - let provider = GOERLI.ws().await.interval(Duration::from_millis(3000)); - let chain_id = provider.get_chainid().await.unwrap(); - let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); - let address = wallet.address(); - let provider = SignerMiddleware::new(provider, wallet); - generic_pending_txs_test(provider, address).await; -} - -#[cfg(not(feature = "celo"))] -async fn generic_pending_txs_test(provider: M, who: Address) { - let tx = TransactionRequest::new().to(who).from(who); - let pending_tx = provider.send_transaction(tx, None).await.unwrap(); - let tx_hash = *pending_tx; - let receipt = pending_tx.confirmations(1).await.unwrap().unwrap(); - // got the correct receipt - assert_eq!(receipt.transaction_hash, tx_hash); -} - -#[tokio::test] -#[cfg(not(feature = "celo"))] -async fn typed_txs() { - let provider = GOERLI.provider(); - - let chain_id = provider.get_chainid().await.unwrap(); - let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); - let address = wallet.address(); - // our wallet - let provider = SignerMiddleware::new(provider, wallet); - - // Uncomment the below and run this test to re-fund the wallets if they get drained. - // Would be ideal if we'd have a way to do this automatically, but this should be - // happening rarely enough that it doesn't matter. - // WALLETS.fund(provider.provider(), 10u32).await; - - async fn check_tx( - pending_tx: ethers_providers::PendingTransaction<'_, P>, - expected: u64, - ) { - let provider = pending_tx.provider(); - let receipt = pending_tx.await.unwrap().unwrap(); - let tx = provider.get_transaction(receipt.transaction_hash).await.unwrap().unwrap(); - assert_eq!(receipt.transaction_type, Some(expected.into())); - assert_eq!(tx.transaction_type, Some(expected.into())); - } - - let nonce = provider.get_transaction_count(address, None).await.unwrap(); - let bn = Some(BlockNumber::Pending.into()); - let gas_price = provider.get_gas_price().await.unwrap() * 125 / 100; - - let tx = TransactionRequest::new().from(address).to(address).nonce(nonce).gas_price(gas_price); - let tx1 = provider.send_transaction(tx.clone(), bn).await.unwrap(); - - let tx = tx.clone().from(address).to(address).nonce(nonce + 1).with_access_list(vec![]); - let tx2 = provider.send_transaction(tx, bn).await.unwrap(); - - let tx = Eip1559TransactionRequest::new() - .from(address) - .to(address) - .nonce(nonce + 2) - .max_fee_per_gas(gas_price) - .max_priority_fee_per_gas(gas_price); - let tx3 = provider.send_transaction(tx, bn).await.unwrap(); - - futures_util::join!(check_tx(tx1, 0), check_tx(tx2, 1), check_tx(tx3, 2),); -} +// #[tokio::test] +// #[cfg(not(feature = "celo"))] +// async fn pending_txs_with_confirmations_testnet() { +// let provider = GOERLI.provider().interval(Duration::from_millis(3000)); +// let chain_id = provider.get_chainid().await.unwrap(); +// let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); +// let address = wallet.address(); +// let provider = SignerMiddleware::new(provider, wallet); +// generic_pending_txs_test(provider, address).await; +// } +// +// // different keys to avoid nonce errors +// #[tokio::test] +// #[cfg(not(feature = "celo"))] +// async fn websocket_pending_txs_with_confirmations_testnet() { +// let provider = GOERLI.ws().await.interval(Duration::from_millis(3000)); +// let chain_id = provider.get_chainid().await.unwrap(); +// let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); +// let address = wallet.address(); +// let provider = SignerMiddleware::new(provider, wallet); +// generic_pending_txs_test(provider, address).await; +// } + +// #[cfg(not(feature = "celo"))] +// async fn generic_pending_txs_test(provider: M, who: Address) { +// let tx = TransactionRequest::new().to(who).from(who); +// let pending_tx = provider.send_transaction(tx, None).await.unwrap(); +// let tx_hash = *pending_tx; +// let receipt = pending_tx.confirmations(1).await.unwrap().unwrap(); +// // got the correct receipt +// assert_eq!(receipt.transaction_hash, tx_hash); +// } +// +// #[tokio::test] +// #[cfg(not(feature = "celo"))] +// async fn typed_txs() { +// let provider = GOERLI.provider(); +// +// let chain_id = provider.get_chainid().await.unwrap(); +// let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); +// let address = wallet.address(); +// +// dbg!(&wallet, &address); +// // our wallet +// let provider = SignerMiddleware::new(provider, wallet); +// +// // Uncomment the below and run this test to re-fund the wallets if they get drained. +// // Would be ideal if we'd have a way to do this automatically, but this should be +// // happening rarely enough that it doesn't matter. +// // WALLETS.fund(provider.provider(), 10u32).await; +// +// async fn check_tx( +// pending_tx: ethers_providers::PendingTransaction<'_, P>, +// expected: u64, +// ) { +// let provider = pending_tx.provider(); +// let receipt = pending_tx.await.unwrap().unwrap(); +// let tx = provider.get_transaction(receipt.transaction_hash).await.unwrap().unwrap(); +// assert_eq!(receipt.transaction_type, Some(expected.into())); +// assert_eq!(tx.transaction_type, Some(expected.into())); +// } +// +// let nonce = provider.get_transaction_count(address, None).await.unwrap(); +// let bn = Some(BlockNumber::Pending.into()); +// let gas_price = provider.get_gas_price().await.unwrap() * 125 / 100; +// +// let tx = +// TransactionRequest::new().from(address).to(address).nonce(nonce).gas_price(gas_price); +// let tx1 = provider.send_transaction(tx.clone(), bn).await.unwrap(); +// +// let tx = tx.clone().from(address).to(address).nonce(nonce + 1).with_access_list(vec![]); +// let tx2 = provider.send_transaction(tx, bn).await.unwrap(); +// +// let tx = Eip1559TransactionRequest::new() +// .from(address) +// .to(address) +// .nonce(nonce + 2) +// .max_fee_per_gas(gas_price) +// .max_priority_fee_per_gas(gas_price); +// let tx3 = provider.send_transaction(tx, bn).await.unwrap(); +// +// futures_util::join!(check_tx(tx1, 0), check_tx(tx2, 1), check_tx(tx3, 2),); +// } #[tokio::test] #[cfg(feature = "celo")]