Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test against the new geth image #11

Merged
merged 13 commits into from
Apr 6, 2021
10 changes: 4 additions & 6 deletions .github/workflows/main.yml → .github/workflows/geth.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Ethane Rust
name: Ethane Rust runs against Geth 1.9.25

# you can save compilation hours on Github if you only run this on pull
# requests or when directly pushing to main branch
on:
on:
push:
branches: [main]
pull_request:
Expand Down Expand Up @@ -31,11 +31,9 @@ jobs:
runs-on: ubuntu-latest
services:
ganache:
image: pumpkinseed/ganache-fix
image: zgen/geth:v0.3.2
ports:
- 8545:8545
env:
WEB3_FORK_URL: ${{ secrets.INFURA_LINK }}
steps:
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -52,4 +50,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: test

7 changes: 0 additions & 7 deletions ethane/test-helper/infrastructure/README.md

This file was deleted.

16 changes: 0 additions & 16 deletions ethane/test-helper/infrastructure/docker-compose.yml

This file was deleted.

20 changes: 0 additions & 20 deletions ethane/test-helper/infrastructure/ganache-cli/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion ethane/test-helper/src/fixtures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pub const TEST_CONTRACT_PATH: &str = "./test-helper/src/fixtures/TestContract.so
pub const TEST_CONTRACT_NAME: &str = "TestContract";
pub const TEST_ERC20_PATH: &str = "./test-helper/src/fixtures/TestERC20.sol";
pub const TEST_ERC20_NAME: &str = "ERC20";
pub const ACCOUNTS_PASSWORD: &str = "12345678";
pub const ACCOUNTS_PASSWORD: &str = "";
pub const FIX_SECRET: &str = "fdc861959d1768d936bf17eec56260d4de3a7473e58c349e31beba539e5fc88d";
pub const FIX_ADDRESS: &str = "0xDc677f7C5060B0b441d30F361D0c8529Ac04E099";
pub const KECCAK_HASH_OF_EMPTY_STRING: &str =
Expand Down
19 changes: 9 additions & 10 deletions ethane/test-helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod spin_up;
pub use spin_up::{ConnectorNodeBundle, ConnectorWrapper, NodeProcess};

mod fixtures;
use ethane::ConnectorError;
pub use fixtures::*;

pub fn wait_for_transaction(client: &mut ConnectorWrapper, tx_hash: H256) {
Expand Down Expand Up @@ -41,13 +42,11 @@ pub fn create_secret() -> H256 {
H256::from_str(&secret).unwrap()
}

pub fn import_account(client: &mut ConnectorWrapper, secret: H256) -> H160 {
client
.call(rpc::personal_import_raw_key(
PrivateKey::ZeroXPrefixed(secret),
String::from(ACCOUNTS_PASSWORD),
))
.unwrap()
pub fn import_account(client: &mut ConnectorWrapper, secret: H256) -> Result<H160, ConnectorError> {
client.call(rpc::personal_import_raw_key(
PrivateKey::NonPrefixed(secret),
String::from(ACCOUNTS_PASSWORD),
))
}

pub fn unlock_account(client: &mut ConnectorWrapper, address: H160) -> bool {
Expand Down Expand Up @@ -75,7 +74,7 @@ pub fn prefund_account(client: &mut ConnectorWrapper, address: H160) -> H256 {

pub fn create_account(client: &mut ConnectorWrapper) -> (H256, H160) {
let secret = create_secret();
let address = import_account(client, secret);
let address = import_account(client, secret).unwrap();
unlock_account(client, address);
prefund_account(client, address);
(secret, address)
Expand Down Expand Up @@ -106,7 +105,7 @@ pub fn deploy_contract(
let transaction = TransactionRequest {
from: address,
data: Some(contract_bytes),
gas: Some(U256::from(10000000 as u64)),
gas: Some(U256::from(1000000 as u64)),
..Default::default()
};
let transaction_hash = client.call(rpc::eth_send_transaction(transaction)).unwrap();
Expand All @@ -127,7 +126,7 @@ pub fn simulate_transaction(
value: U256,
) -> H256 {
let transaction = TransactionRequest {
from: from,
from,
to: Some(to.parse().unwrap()),
value: Some(value),
..Default::default()
Expand Down
Loading