test: disable signer integration tests temporarily

This commit is contained in:
Georgios Konstantopoulos 2023-02-27 13:08:39 -07:00
parent bb63cf1ac3
commit 9d4b9b5be5
1 changed files with 82 additions and 79 deletions

View File

@ -90,86 +90,89 @@ async fn send_with_chain_id_anvil() {
let _err = res.unwrap_err(); let _err = res.unwrap_err();
} }
#[tokio::test] // #[tokio::test]
#[cfg(not(feature = "celo"))] // #[cfg(not(feature = "celo"))]
async fn pending_txs_with_confirmations_testnet() { // async fn pending_txs_with_confirmations_testnet() {
let provider = GOERLI.provider().interval(Duration::from_millis(3000)); // let provider = GOERLI.provider().interval(Duration::from_millis(3000));
let chain_id = provider.get_chainid().await.unwrap(); // let chain_id = provider.get_chainid().await.unwrap();
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); // let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
let address = wallet.address(); // let address = wallet.address();
let provider = SignerMiddleware::new(provider, wallet); // let provider = SignerMiddleware::new(provider, wallet);
generic_pending_txs_test(provider, address).await; // 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;
// }
// different keys to avoid nonce errors // #[cfg(not(feature = "celo"))]
#[tokio::test] // async fn generic_pending_txs_test<M: Middleware>(provider: M, who: Address) {
#[cfg(not(feature = "celo"))] // let tx = TransactionRequest::new().to(who).from(who);
async fn websocket_pending_txs_with_confirmations_testnet() { // let pending_tx = provider.send_transaction(tx, None).await.unwrap();
let provider = GOERLI.ws().await.interval(Duration::from_millis(3000)); // let tx_hash = *pending_tx;
let chain_id = provider.get_chainid().await.unwrap(); // let receipt = pending_tx.confirmations(1).await.unwrap().unwrap();
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); // // got the correct receipt
let address = wallet.address(); // assert_eq!(receipt.transaction_hash, tx_hash);
let provider = SignerMiddleware::new(provider, wallet); // }
generic_pending_txs_test(provider, address).await; //
} // #[tokio::test]
// #[cfg(not(feature = "celo"))]
#[cfg(not(feature = "celo"))] // async fn typed_txs() {
async fn generic_pending_txs_test<M: Middleware>(provider: M, who: Address) { // let provider = GOERLI.provider();
let tx = TransactionRequest::new().to(who).from(who); //
let pending_tx = provider.send_transaction(tx, None).await.unwrap(); // let chain_id = provider.get_chainid().await.unwrap();
let tx_hash = *pending_tx; // let wallet = WALLETS.next().with_chain_id(chain_id.as_u64());
let receipt = pending_tx.confirmations(1).await.unwrap().unwrap(); // let address = wallet.address();
// got the correct receipt //
assert_eq!(receipt.transaction_hash, tx_hash); // dbg!(&wallet, &address);
} // // our wallet
// let provider = SignerMiddleware::new(provider, wallet);
#[tokio::test] //
#[cfg(not(feature = "celo"))] // // Uncomment the below and run this test to re-fund the wallets if they get drained.
async fn typed_txs() { // // Would be ideal if we'd have a way to do this automatically, but this should be
let provider = GOERLI.provider(); // // happening rarely enough that it doesn't matter.
// // WALLETS.fund(provider.provider(), 10u32).await;
let chain_id = provider.get_chainid().await.unwrap(); //
let wallet = WALLETS.next().with_chain_id(chain_id.as_u64()); // async fn check_tx<P: JsonRpcClient + Clone>(
let address = wallet.address(); // pending_tx: ethers_providers::PendingTransaction<'_, P>,
// our wallet // expected: u64,
let provider = SignerMiddleware::new(provider, wallet); // ) {
// let provider = pending_tx.provider();
// Uncomment the below and run this test to re-fund the wallets if they get drained. // let receipt = pending_tx.await.unwrap().unwrap();
// Would be ideal if we'd have a way to do this automatically, but this should be // let tx = provider.get_transaction(receipt.transaction_hash).await.unwrap().unwrap();
// happening rarely enough that it doesn't matter. // assert_eq!(receipt.transaction_type, Some(expected.into()));
// WALLETS.fund(provider.provider(), 10u32).await; // assert_eq!(tx.transaction_type, Some(expected.into()));
// }
async fn check_tx<P: JsonRpcClient + Clone>( //
pending_tx: ethers_providers::PendingTransaction<'_, P>, // let nonce = provider.get_transaction_count(address, None).await.unwrap();
expected: u64, // let bn = Some(BlockNumber::Pending.into());
) { // let gas_price = provider.get_gas_price().await.unwrap() * 125 / 100;
let provider = pending_tx.provider(); //
let receipt = pending_tx.await.unwrap().unwrap(); // let tx =
let tx = provider.get_transaction(receipt.transaction_hash).await.unwrap().unwrap(); // TransactionRequest::new().from(address).to(address).nonce(nonce).gas_price(gas_price);
assert_eq!(receipt.transaction_type, Some(expected.into())); // let tx1 = provider.send_transaction(tx.clone(), bn).await.unwrap();
assert_eq!(tx.transaction_type, Some(expected.into())); //
} // 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 nonce = provider.get_transaction_count(address, None).await.unwrap(); //
let bn = Some(BlockNumber::Pending.into()); // let tx = Eip1559TransactionRequest::new()
let gas_price = provider.get_gas_price().await.unwrap() * 125 / 100; // .from(address)
// .to(address)
let tx = TransactionRequest::new().from(address).to(address).nonce(nonce).gas_price(gas_price); // .nonce(nonce + 2)
let tx1 = provider.send_transaction(tx.clone(), bn).await.unwrap(); // .max_fee_per_gas(gas_price)
// .max_priority_fee_per_gas(gas_price);
let tx = tx.clone().from(address).to(address).nonce(nonce + 1).with_access_list(vec![]); // let tx3 = provider.send_transaction(tx, bn).await.unwrap();
let tx2 = provider.send_transaction(tx, bn).await.unwrap(); //
// futures_util::join!(check_tx(tx1, 0), check_tx(tx2, 1), check_tx(tx3, 2),);
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] #[tokio::test]
#[cfg(feature = "celo")] #[cfg(feature = "celo")]