Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronKutch committed Nov 17, 2023
1 parent ad162f4 commit a48fae0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ path = "src/lib/common.rs"
clap = { version = "4", features = ["derive"] }
log = "0.4"
#onomy_test_lib = { path = "./../../onomy_tests/onomy_test_lib" }
onomy_test_lib = { git = "https://github.com/pendulum-labs/onomy_tests", rev = "08143eb6f399470404515f7fd1d4b20b466b540c" }
onomy_test_lib = { git = "https://github.com/pendulum-labs/onomy_tests", rev = "4f67962483864893239c5882ad43f8e383c70c70" }
serde_json = "1.0"
tokio = { version = "1", default-features = false }
43 changes: 24 additions & 19 deletions tests/src/bin/ics_with_onomyd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ use onomy_test_lib::{
HermesChainConfig, IbcPair,
},
onomy_std_init, reprefix_bech32,
setups::{
cosmovisor_add_consumer, marketd_setup, onomyd_setup, test_proposal, CosmosSetupOptions,
},
setups::{cosmovisor_add_consumer, cosmovisor_setup, test_proposal, CosmosSetupOptions},
super_orchestrator::{
docker::{Container, ContainerNetwork, Dockerfile},
net_message::NetMessenger,
Expand Down Expand Up @@ -182,9 +180,10 @@ async fn hermes_runner(args: &Args) -> Result<()> {
// wait for setup
nm_onomyd.recv::<()>().await.stack()?;

let ibc_pair = IbcPair::hermes_setup_ics_pair(CONSUMER_ID, "onomy")
.await
.stack()?;
let ibc_pair =
IbcPair::hermes_setup_ics_pair(CONSUMER_ID, "07-tendermint-0", "onomy", "07-tendermint-0")
.await
.stack()?;
let mut hermes_runner = hermes_start("/logs/hermes_bootstrap_runner.log")
.await
.stack()?;
Expand Down Expand Up @@ -226,11 +225,14 @@ async fn onomyd_runner(args: &Args) -> Result<()> {
.stack()
.stack()?;

let mnemonic = onomyd_setup(CosmosSetupOptions::new(daemon_home))
let cosmores = cosmovisor_setup(CosmosSetupOptions::onomy(daemon_home))
.await
.stack()?;
// send mnemonic to hermes
nm_hermes.send::<String>(&mnemonic).await.stack()?;
nm_hermes
.send::<String>(&cosmores.hermes_mnemonic.stack()?)
.await
.stack()?;

// keep these here for local testing purposes
let addr = &cosmovisor_get_addr("validator").await.stack()?;
Expand Down Expand Up @@ -290,7 +292,7 @@ async fn onomyd_runner(args: &Args) -> Result<()> {
.await
.stack()?;
// it takes time for the relayer to complete relaying
wait_for_num_blocks(5).await.stack()?;
wait_for_num_blocks(4).await.stack()?;
// notify consumer that we have sent NOM
nm_consumer.send::<IbcPair>(&ibc_pair).await.stack()?;

Expand Down Expand Up @@ -334,9 +336,15 @@ async fn consumer(args: &Args) -> Result<()> {
// we need the initial consumer state
let ccvconsumer_state_s: String = nm_onomyd.recv().await.stack()?;

marketd_setup(daemon_home, chain_id, &ccvconsumer_state_s)
.await
.stack()?;
cosmovisor_setup(CosmosSetupOptions::new(
daemon_home,
chain_id,
"anative",
"anative",
Some(&ccvconsumer_state_s),
))
.await
.stack()?;

// get keys
let node_key = nm_onomyd.recv::<String>().await.stack()?;
Expand Down Expand Up @@ -407,16 +415,13 @@ async fn consumer(args: &Args) -> Result<()> {
.stack()?;
info!("sending back to {}", test_addr);

// avoid conflict with hermes relayer
wait_for_num_blocks(5).await.stack()?;

// send some IBC NOM back to origin chain using it as gas
ibc_pair
.a
.cosmovisor_ibc_transfer("validator", test_addr, "5000", ibc_nom)
.await
.stack()?;
wait_for_num_blocks(6).await.stack()?;
wait_for_num_blocks(4).await.stack()?;

let pubkey = sh_cosmovisor(["tendermint show-validator"]).await.stack()?;
let pubkey = pubkey.trim();
Expand All @@ -434,7 +439,7 @@ async fn consumer(args: &Args) -> Result<()> {
"--min-self-delegation",
"1",
"--amount",
&token18(500.0, ONOMY_IBC_NOM),
&token18(500.0, "anative"),
"--fees",
&format!("1000000{ONOMY_IBC_NOM}"),
"--pubkey",
Expand All @@ -455,7 +460,7 @@ async fn consumer(args: &Args) -> Result<()> {
wait_for_num_blocks(1).await.stack()?;

// test a simple text proposal
let test_deposit = token18(500.0, ONOMY_IBC_NOM);
let test_deposit = token18(500.0, "anative");
let proposal = json!({
"title": "Text Proposal",
"description": "a text proposal",
Expand All @@ -475,7 +480,7 @@ async fn consumer(args: &Args) -> Result<()> {

// but first, test governance with IBC NOM as the token
let test_crisis_denom = ONOMY_IBC_NOM;
let test_deposit = token18(500.0, ONOMY_IBC_NOM);
let test_deposit = token18(500.0, "anative");
wait_for_num_blocks(1).await.stack()?;
cosmovisor_gov_file_proposal(
daemon_home,
Expand Down

0 comments on commit a48fae0

Please sign in to comment.