forked from crypto-org-chain/cronos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: no integration tests for ibc bridge with main chain (wip cry…
…pto-org-chain#2) Update integration_tests/network.py thanks~ Co-authored-by: yihuang <huang@crypto.com> use binary directly runing together enable ibc tidy up tidy up hermes working run cronos, chainmain hermes working hermes working ibc working ibc test working tidy up genesis tested Problem: no integration tests for ibc bridge with main chain (wip crypto-org-chain#2) Update integration_tests/network.py thanks~ Co-authored-by: yihuang <huang@crypto.com> use binary directly runing together enable ibc tidy up tidy up hermes working run cronos, chainmain hermes working hermes working ibc working ibc test working tidy up metamask working evm works tidy up fix rebase use hermes 0.7.1 Update integration_tests/network.py thanks Co-authored-by: yihuang <huang@crypto.com> change chainmain version to current use chain-main v2.1.2 update hermes to 0.7.3 remove ibc setup in genesis
- Loading branch information
1 parent
39849e4
commit 00bccb8
Showing
14 changed files
with
424 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import pytest | ||
import time | ||
import os | ||
import json | ||
from .conftest import setup_cronos2, setup_chainmain, setup_hermes | ||
from web3 import Web3 | ||
import json | ||
import sys | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def cronos(tmp_path_factory): | ||
print(f'cronos tmp folder= {tmp_path_factory}') | ||
yield from setup_cronos2(tmp_path_factory.mktemp("cronos"), 26700) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def chainmain(tmp_path_factory): | ||
print(f'chainmain tmp folder= {tmp_path_factory}') | ||
# "start-cronos" | ||
yield from setup_chainmain(tmp_path_factory.mktemp("chainmain"), 26800) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def hermes(tmp_path_factory): | ||
print("hermes waiting for chains booting up") | ||
time.sleep(20) | ||
print(f'hermes tmp folder= {tmp_path_factory}') | ||
yield from setup_hermes(tmp_path_factory.mktemp("hermes"), 26900) | ||
|
||
|
||
def getBalance(chain, addr, denom): | ||
output = chain.cosmos_cli(0).raw( | ||
"query", | ||
"bank", | ||
"balances", | ||
addr, | ||
node=chain.node_rpc(0), | ||
output="json", | ||
) | ||
c = json.loads(output.decode()) | ||
d = json.dumps(c, indent=4) | ||
print(d) | ||
coins = c["balances"] | ||
for coin in coins: | ||
if coin["denom"] == denom: | ||
value = int(coin["amount"]) | ||
return value | ||
return 0 | ||
|
||
|
||
def test_ibc(cronos, chainmain): | ||
print("test ibc") | ||
time.sleep(2000000000) | ||
assert True | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{pkgs ? import ./default.nix {} }: | ||
let | ||
released = (import (builtins.fetchTarball "https://github.com/crypto-org-chain/chain-main/archive/v2.1.2.tar.gz") { }).chain-maind; | ||
in | ||
pkgs.symlinkJoin { | ||
name = "chainmain"; | ||
paths = [ released ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{pkgs ? import ./default.nix {} }: | ||
pkgs.stdenv.mkDerivation { | ||
name="hermes"; | ||
version="v0.7.3"; | ||
src= pkgs.fetchurl { | ||
url="https://github.com/informalsystems/ibc-rs/releases/download/v0.7.3/hermes-v0.7.3-x86_64-unknown-linux-gnu.tar.gz"; | ||
sha256 = "sha256:17k9017y41zbjqywrgni0i7s1qn6v0pjc5af7xqaqa9qcsi3l9jr"; | ||
}; | ||
sourceRoot = "."; | ||
installPhase = '' | ||
echo "hermes" | ||
echo $out | ||
install -m755 -D hermes $out/bin/hermes | ||
''; | ||
|
||
meta = with pkgs.lib; { | ||
platforms = platforms.linux; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,34 @@ | ||
{ pkgs | ||
, config | ||
, cronos ? (import ../. { inherit pkgs; }) | ||
, chainmain ? (import ../nix/chainmain.nix { inherit pkgs; }) | ||
, hermes ? (import ../nix/hermes.nix { inherit pkgs; }) | ||
|
||
}: | ||
rec { | ||
start-chainmain = pkgs.writeShellScriptBin "start-chainmain" '' | ||
export PATH=${pkgs.pystarport}/bin:${chainmain}/bin:$PATH | ||
${../scripts/start-chainmain} ${config.chainmain-config} $@ | ||
''; | ||
start-cronos = pkgs.writeShellScriptBin "start-cronos" '' | ||
# rely on environment to provide cronosd | ||
export PATH=${pkgs.pystarport}/bin:$PATH | ||
${../scripts/start-cronos} ${config.cronos-config} $@ | ||
''; | ||
start-cronos2 = pkgs.writeShellScriptBin "start-cronos" '' | ||
export PATH=${pkgs.pystarport}/bin:${cronos}/bin:$PATH | ||
${../scripts/start-cronos} ${config.cronos2-config} $@ | ||
''; | ||
start-geth = pkgs.writeShellScriptBin "start-geth" '' | ||
export PATH=${pkgs.go-ethereum}/bin:$PATH | ||
${../scripts/start-geth} ${config.geth-genesis} $@ | ||
''; | ||
start-hermes = pkgs.writeShellScriptBin "start-hermes" '' | ||
export PATH=${hermes}/bin:$PATH | ||
${../scripts/start-hermes} ${config.hermes-config} $@ | ||
''; | ||
start-scripts = pkgs.symlinkJoin { | ||
name = "start-scripts"; | ||
paths = [ start-cronos start-geth ]; | ||
paths = [ start-cronos2 start-cronos start-geth start-chainmain start-hermes]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
chainmain-1: | ||
cmd: chain-maind | ||
start-flags: "--trace" | ||
validators: | ||
- coins: 2234240000000000000cro | ||
staked: 10000000000000cro | ||
mnemonic: visit craft resemble online window solution west chuckle music diesel vital settle comic tribe project blame bulb armed flower region sausage mercy arrive release | ||
- coins: 987870000000000000cro | ||
staked: 20000000000000cro | ||
mnemonic: direct travel shrug hand twice agent sail sell jump phone velvet pilot mango charge usual multiply orient garment bleak virtual action mention panda vast | ||
# min_self_delegation: 10000000 # 0.1cro | ||
accounts: | ||
- name: community | ||
coins: 10000000000000cro | ||
mnemonic: notable error gospel wave pair ugly measure elite toddler cost various fly make eye ketchup despair slab throw tribe swarm word fruit into inmate | ||
- name: signer1 | ||
coins: 10000000000000cro | ||
mnemonic: shed crumble dismiss loyal latin million oblige gesture shrug still oxygen custom remove ribbon disorder palace addict again blanket sad flock consider obey popular | ||
- name: signer2 | ||
coins: 20000000000000cro | ||
mnemonic: night renew tonight dinner shaft scheme domain oppose echo summer broccoli agent face guitar surface belt veteran siren poem alcohol menu custom crunch index | ||
genesis: | ||
app_state: | ||
staking: | ||
params: | ||
unbonding_time: "1814400s" | ||
gov: | ||
voting_params: | ||
voting_period: "1814400s" | ||
deposit_params: | ||
max_deposit_period: "1814400s" | ||
min_deposit: | ||
- denom: "basecro" | ||
amount: "10000000" | ||
transfer: | ||
params: | ||
receive_enabled: true | ||
send_enabled: true | ||
capability: | ||
index: '3' | ||
owners: | ||
- index: '1' | ||
index_owners: | ||
owners: | ||
- module: ibc | ||
name: ports/transfer | ||
- module: transfer | ||
name: ports/transfer | ||
- index: '2' | ||
index_owners: | ||
owners: | ||
- module: ibc | ||
name: capabilities/ports/transfer/channels/channel-0 | ||
- module: transfer | ||
name: capabilities/ports/transfer/channels/channel-0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.