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

feat: schema generation (wip) #52

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
66c39c6
some scripts (#50)
byeongsu-hong Oct 20, 2023
f4027eb
fix: coverage ci (#49)
byeongsu-hong Oct 20, 2023
9cf9ae9
Revert "revert: aggregate"
byeongsu-hong Oct 20, 2023
b7995ad
test(cw20): cw20 init
byeongsu-hong Oct 20, 2023
ee6edd9
test(warp): unit test for cw20
byeongsu-hong Oct 20, 2023
8f2a4f6
test(warp): add query test for cw20
byeongsu-hong Oct 21, 2023
6007674
test(warp): remove existing tests for native
byeongsu-hong Oct 21, 2023
8e158db
feat(warp): add ownable message
byeongsu-hong Oct 21, 2023
ba17746
wip
byeongsu-hong Oct 21, 2023
a37ab9a
test(warp): unit test for native denom
byeongsu-hong Oct 22, 2023
a9a1e8f
test: use u32 directly
byeongsu-hong Oct 22, 2023
e5d60f0
fix!(ism): use parsed u32 merkle index
byeongsu-hong Oct 22, 2023
0a7e408
test: modularize
byeongsu-hong Oct 22, 2023
817c7d7
test: add empty warp
byeongsu-hong Oct 22, 2023
e005671
test: runnable mailbox
byeongsu-hong Oct 22, 2023
f5feba2
test: warp placeholder
byeongsu-hong Oct 22, 2023
8bac2ac
test: deployable
byeongsu-hong Oct 22, 2023
2777239
fix(warp): inject minter to cw20
byeongsu-hong Oct 22, 2023
41a442c
fix(warp): use consistant event name
byeongsu-hong Oct 22, 2023
2e6b36e
test: warp cw20 / native denom creation
byeongsu-hong Oct 22, 2023
aaed6f9
chore: prune
byeongsu-hong Oct 22, 2023
70d8d7c
feat: aggregation
byeongsu-hong Oct 23, 2023
e7c515b
schema
byeongsu-hong Oct 23, 2023
a23afda
fix: evm equivalence
byeongsu-hong Oct 23, 2023
6ea8a39
fix(hook): pass entire metadata
byeongsu-hong Oct 23, 2023
ecaaed5
fix: aggregate works
byeongsu-hong Oct 23, 2023
4432355
chore: remove debugger
byeongsu-hong Oct 23, 2023
1232151
fix: tests
byeongsu-hong Oct 23, 2023
374f958
clippy
byeongsu-hong Oct 23, 2023
40dd0ee
use aggregate ism on integration test
byeongsu-hong Oct 23, 2023
24b2b2e
feat: schema generation - not working
byeongsu-hong Oct 17, 2023
865fccf
feat: add aggregate hook / ism schema
byeongsu-hong Oct 23, 2023
aac5dda
aggregations
byeongsu-hong Oct 23, 2023
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
Prev Previous commit
Next Next commit
test: warp placeholder
  • Loading branch information
byeongsu-hong committed Oct 22, 2023
commit f5feba268e3ae07d1180187677e7b26e44fb0cf8
2 changes: 2 additions & 0 deletions integration-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -39,6 +39,8 @@ ripemd.workspace = true
hex-literal.workspace = true
ibcx-test-utils.workspace = true

rstest.workspace = true

hpl-ownable.workspace = true
hpl-ism-multisig.workspace = true
hpl-interface.workspace = true
63 changes: 41 additions & 22 deletions integration-test/tests/contracts/cw/deploy.rs
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ use cosmwasm_std::HexBinary;
use hpl_interface::{
core::mailbox,
router::{DomainRouteSet, RouterMsg},
warp::{self, cw20::Cw20ModeBridged},
warp::{self, cw20::Cw20ModeBridged, native::NativeModeBriged},
};
use test_tube::{Account, Runner, SigningAccount, Wasm};

@@ -126,29 +126,48 @@ pub fn deploy_warp_route_bridged<'a, R: Runner<'a>>(
hrp: &str,
codes: &Codes,
denom: String,
token_type: warp::TokenType,
) -> eyre::Result<String> {
instantiate(
wasm,
codes.warp_cw20,
deployer,
"warp-cw20",
&warp::cw20::InstantiateMsg {
token: warp::TokenModeMsg::Bridged(Cw20ModeBridged {
code_id: codes.cw20_base,
init_msg: Box::new(warp::cw20::Cw20InitMsg {
name: denom.clone(),
symbol: denom,
decimals: 6,
initial_balances: vec![],
mint: None,
marketing: None,
match token_type {
warp::TokenType::Native(_) => instantiate(
wasm,
codes.warp_native,
deployer,
"warp-native",
&warp::native::InstantiateMsg {
token: warp::TokenModeMsg::Bridged(NativeModeBriged {
denom,
metadata: None,
}),
}),
hrp: hrp.to_string(),
owner: owner.address(),
mailbox: mailbox.to_string(),
},
)
hrp: hrp.to_string(),
owner: owner.address(),
mailbox: mailbox.to_string(),
},
),
warp::TokenType::CW20 { .. } => instantiate(
wasm,
codes.warp_cw20,
deployer,
"warp-cw20",
&warp::cw20::InstantiateMsg {
token: warp::TokenModeMsg::Bridged(Cw20ModeBridged {
code_id: codes.cw20_base,
init_msg: Box::new(warp::cw20::Cw20InitMsg {
name: denom.clone(),
symbol: denom,
decimals: 6,
initial_balances: vec![],
mint: None,
marketing: None,
}),
}),
hrp: hrp.to_string(),
owner: owner.address(),
mailbox: mailbox.to_string(),
},
),
warp::TokenType::CW721 { .. } => todo!(),
}
}

#[allow(dead_code)]
2 changes: 1 addition & 1 deletion integration-test/tests/contracts/cw/mod.rs
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ mod setup;
mod store;
mod types;

pub use deploy::deploy_core;
pub use deploy::*;
pub use hook::{prepare_routing_hook, Hook};
pub use ism::{prepare_routing_ism, Ism};
pub use setup::{setup_env, Env};
9 changes: 7 additions & 2 deletions integration-test/tests/contracts/cw/setup.rs
Original file line number Diff line number Diff line change
@@ -7,8 +7,11 @@ use test_tube::{Account, Module, Runner, SigningAccount, Wasm};
use crate::validator::TestValidators;

use super::{
deploy_core, igp::Igp, prepare_routing_hook, prepare_routing_ism, store_code,
types::CoreDeployments, Hook,
deploy_core,
igp::Igp,
prepare_routing_hook, prepare_routing_ism, store_code,
types::{Codes, CoreDeployments},
Hook,
};

const DEFAULT_GAS: u128 = 300_000;
@@ -18,6 +21,7 @@ pub struct Env<'a, R: Runner<'a>> {

pub app: &'a R,
pub core: CoreDeployments,
pub codes: Codes,
pub domain: u32,

acc_gen: Box<dyn Fn(&'a R, &'a [Coin]) -> SigningAccount>,
@@ -86,6 +90,7 @@ pub fn setup_env<'a, R: Runner<'a>>(

app,
core,
codes,
domain,

acc_gen: Box::new(acc_gen),
156 changes: 156 additions & 0 deletions integration-test/tests/warp.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#[allow(dead_code)]
mod constants;
mod contracts;
mod event;
mod validator;

use cosmwasm_std::Uint128;
use hpl_interface::{igp::oracle::RemoteGasDataConfig, warp};
use osmosis_test_tube::OsmosisTestApp;
use rstest::rstest;
use test_tube::{Module, Wasm};

use crate::{
constants::*,
contracts::{cw, eth},
validator::TestValidators,
};

#[tokio::test]
async fn test_cw20_colleteral() -> eyre::Result<()> {
let osmo_app = OsmosisTestApp::new();
let osmo = cw::setup_env(
&osmo_app,
|app, coins| app.init_account(coins).unwrap(),
None::<&str>,
"osmo",
DOMAIN_OSMO,
&[TestValidators::new(DOMAIN_EVM, 5, 3)],
&[RemoteGasDataConfig {
remote_domain: DOMAIN_EVM,
token_exchange_rate: Uint128::from(10u128.pow(4)),
gas_price: Uint128::from(10u128.pow(9)),
}],
)?;

let wasm = Wasm::new(&osmo_app);

let warp = cw::deploy_warp_route_collateral(
&wasm,
&osmo.acc_owner,
&osmo.acc_deployer,
&osmo.core.mailbox,
"osmo",
&osmo.codes,
"osmo122ryl7pez7yjprtvjckltu2uvjxrq3kqt4nvclax2la7maj6757qg054ga".into(),
)?;

Ok(())
}

#[rstest]
#[tokio::test]
async fn test_cw20_bridged() -> eyre::Result<()> {
let osmo_app = OsmosisTestApp::new();
let osmo = cw::setup_env(
&osmo_app,
|app, coins| app.init_account(coins).unwrap(),
None::<&str>,
"osmo",
DOMAIN_OSMO,
&[TestValidators::new(DOMAIN_EVM, 5, 3)],
&[RemoteGasDataConfig {
remote_domain: DOMAIN_EVM,
token_exchange_rate: Uint128::from(10u128.pow(4)),
gas_price: Uint128::from(10u128.pow(9)),
}],
)?;

let wasm = Wasm::new(&osmo_app);

let warp = cw::deploy_warp_route_bridged(
&wasm,
&osmo.acc_owner,
&osmo.acc_deployer,
&osmo.core.mailbox,
"osmo",
&osmo.codes,
"cw20-denom".into(),
warp::TokenType::CW20 {
contract: "".into(),
},
)?;

Ok(())
}

#[rstest]
#[case("ibc/B5CB286F69D48B2C4F6F8D8CF59011C40590DCF8A91617A5FBA9FF0A7B21307F")]
#[case("uosmo")]
#[tokio::test]
async fn test_native_collateral(#[case] denom: &str) -> eyre::Result<()> {
let osmo_app = OsmosisTestApp::new();
let osmo = cw::setup_env(
&osmo_app,
|app, coins| app.init_account(coins).unwrap(),
None::<&str>,
"osmo",
DOMAIN_OSMO,
&[TestValidators::new(DOMAIN_EVM, 5, 3)],
&[RemoteGasDataConfig {
remote_domain: DOMAIN_EVM,
token_exchange_rate: Uint128::from(10u128.pow(4)),
gas_price: Uint128::from(10u128.pow(9)),
}],
)?;

let wasm = Wasm::new(&osmo_app);

let warp = cw::deploy_warp_route_collateral(
&wasm,
&osmo.acc_owner,
&osmo.acc_deployer,
&osmo.core.mailbox,
"osmo",
&osmo.codes,
denom.into(),
)?;

Ok(())
}

#[rstest]
#[case("ibc/B5CB286F69D48B2C4F6F8D8CF59011C40590DCF8A91617A5FBA9FF0A7B21307F")]
#[case("uosmo")]
#[tokio::test]
async fn test_native_bridged(#[case] denom: &str) -> eyre::Result<()> {
let osmo_app = OsmosisTestApp::new();
let osmo = cw::setup_env(
&osmo_app,
|app, coins| app.init_account(coins).unwrap(),
None::<&str>,
"osmo",
DOMAIN_OSMO,
&[TestValidators::new(DOMAIN_EVM, 5, 3)],
&[RemoteGasDataConfig {
remote_domain: DOMAIN_EVM,
token_exchange_rate: Uint128::from(10u128.pow(4)),
gas_price: Uint128::from(10u128.pow(9)),
}],
)?;

let wasm = Wasm::new(&osmo_app);

let warp = cw::deploy_warp_route_bridged(
&wasm,
&osmo.acc_owner,
&osmo.acc_deployer,
&osmo.core.mailbox,
"osmo",
&osmo.codes,
denom.into(),
warp::TokenType::Native(warp::TokenTypeNative::Fungible { denom: "".into() }),
)?;

Ok(())
}