Repository: gakonst/ethers-rs
Pull request #2292 (2023-03-21 19:51:11)

ci: rm celo integration test, install missing solc version
As title, smol followup to https://github.com/gakonst/ethers-rs/pull/2291. The Celo test is not really useful as it tests very high level functionality we already cover in ethers-providers and is only causing races.


Patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9e45e770..e63f25d2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -63,11 +63,11 @@ jobs:
             - uses: Swatinem/rust-cache@v2
             - name: test ${{ matrix.flags.flags }}
               shell: bash
-              # skip `ethers_etherscan::it` and `ethers::live`
+              # skip `ethers_etherscan::it`
               run: |
                   cargo nextest run \
                   ${{ matrix.flags.flags }} \
-                  -E "!binary(~live) & !(deps(ethers-etherscan) & kind(test))"
+                  -E "!(deps(ethers-etherscan) & kind(test))"
 
     etherscan-tests:
         name: etherscan tests


Test patch:
diff --git a/ethers/tests/celo.rs b/ethers/tests/celo.rs
deleted file mode 100644
index 0931decf..00000000
--- a/ethers/tests/celo.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-use ethers::prelude::*;
-use std::{sync::Arc, time::Duration};
-
-ethers::contract::abigen!(SimpleStorage, "../testdata/SimpleStorage.json");
-
-static CELO_TESTNET_URL: &str = "https://alfajores-forno.celo-testnet.org";
-
-#[tokio::test]
-async fn test_send_transaction() {
-    // Celo testnet
-    let provider =
-        Provider::<Http>::try_from(CELO_TESTNET_URL).unwrap().interval(Duration::from_secs(3));
-    let chain_id = provider.get_chainid().await.unwrap().as_u64();
-
-    // Funded with https://celo.org/developers/faucet
-    // Please do not drain this account :)
-    let wallet = "d652abb81e8c686edba621a895531b1f291289b63b5ef09a94f686a5ecdd5db1"
-        .parse::<LocalWallet>()
-        .unwrap()
-        .with_chain_id(chain_id);
-    let client = SignerMiddleware::new(provider, wallet);
-
-    let balance_before = client.get_balance(client.address(), None).await.unwrap();
-    let tx = TransactionRequest::pay(client.address(), 100);
-    let _receipt = client.send_transaction(tx, None).await.unwrap().confirmations(3).await.unwrap();
-    let balance_after = client.get_balance(client.address(), None).await.unwrap();
-    assert!(balance_before > balance_after);
-}
-
-#[tokio::test]
-async fn deploy_and_call_contract() {
-    // Celo testnet
-    let provider =
-        Provider::<Http>::try_from(CELO_TESTNET_URL).unwrap().interval(Duration::from_secs(3));
-    let chain_id = provider.get_chainid().await.unwrap().as_u64();
-
-    // Funded with https://celo.org/developers/faucet
-    let wallet = "58ea5643a78c36926ad5128a6b0d8dfcc7fc705788a993b1c724be3469bc9697"
-        .parse::<LocalWallet>()
-        .unwrap()
-        .with_chain_id(chain_id);
-    let client = provider.with_signer(wallet);
-    let client = Arc::new(client);
-
-    let deploy_tx = SimpleStorage::deploy(client, ()).unwrap();
-    let contract = deploy_tx.send().await.unwrap();
-
-    let value: U256 = contract.value().call().await.unwrap();
-    assert_eq!(value, 0.into());
-
-    // make a state mutating transaction
-    // gas estimation costs are sometimes under-reported on celo,
-    // so we manually set it to avoid failures
-    let call = contract.set_value(1.into()).gas(100000);
-    let pending_tx = call.send().await.unwrap();
-    let _receipt = pending_tx.await.unwrap();
-
-    let value: U256 = contract.method("value", ()).unwrap().call().await.unwrap();
-    assert_eq!(value, 1.into());
-}
diff --git a/ethers/tests/eip712.rs b/ethers/tests/eip712.rs
index f23d8295..7843a317 100644
--- a/ethers/tests/eip712.rs
+++ b/ethers/tests/eip712.rs
@@ -40,6 +40,7 @@ async fn test_derive_eip712() {
 
     // get ABI and bytecode for the DeriveEip712Test contract
     let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests");
+    Solc::find_or_install_svm_version("0.6.0").unwrap(); // install solc
     let result = Solc::default().compile_source(path).unwrap();
     let (abi, bytecode, _) = result
         .find("DeriveEip712Test")
diff --git a/ethers/tests/main.rs b/ethers/tests/main.rs
index 7d10133c..d4845162 100644
--- a/ethers/tests/main.rs
+++ b/ethers/tests/main.rs
@@ -1,7 +1,4 @@
 //! Ethers integration tests.
 #![cfg(not(target_arch = "wasm32"))]
 
-#[cfg(feature = "celo")]
-mod celo;
-
 mod eip712;