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

update #15

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "8c345709b5335e0636d171a6f506a9c76ace2d6d" }
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
4 changes: 2 additions & 2 deletions tests/src/lib/common.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use onomy_test_lib::dockerfiles::onomy_std_cosmos_daemon_with_arbitrary;
use onomy_test_lib::dockerfiles::{onomy_std_cosmos_daemon_with_arbitrary, ONOMYD_VERSION};

pub const PROVIDER_VERSION: &str = "v1.1.2";
pub const PROVIDER_VERSION: &str = ONOMYD_VERSION;
pub const CONSUMER_ID: &str = "appname";
pub const CONSUMER_VERSION: &str = "v0.1.0";
pub const PROVIDER_ACCOUNT_PREFIX: &str = "onomy";
Expand Down
Loading