Skip to content

Commit

Permalink
feat: whole packet workflow works when cw is source chain (#5)
Browse files Browse the repository at this point in the history
* fix: ack

* imp: test passing more

* imp: e2e working
  • Loading branch information
srdtrk authored Jun 28, 2024
1 parent 16727a8 commit 271ca4e
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 115 deletions.
72 changes: 35 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ serde = { version = "1.0.197", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.58" }
# TODO: Remove this once cw-ownable is published with cw-plus-plus
cw-ownable = { git = "https://github.com/CyberHoward/cw-plus-plus", branch = "bump/cosmwasm-2.0" }
ibc-core-host = { git = "https://github.com/cosmos/ibc-rs", rev = "1ca03717ab074da605ace9ad75247dfa8fb03f86", default-features = false, features = ["schema"] }
ibc-client-cw = { git = "https://github.com/cosmos/ibc-rs", rev = "1ca03717ab074da605ace9ad75247dfa8fb03f86", default-features = false }
ibc-client-tendermint = { git = "https://github.com/cosmos/ibc-rs", rev = "1ca03717ab074da605ace9ad75247dfa8fb03f86", default-features = false, features = ["schema"] }
ibc-core-host = { git = "https://github.com/srdtrk/ibc-rs", branch = "serdar/xxx-allow-ibc-lite-paths", default-features = false, features = ["schema"] }
ibc-client-cw = { git = "https://github.com/srdtrk/ibc-rs", branch = "serdar/xxx-allow-ibc-lite-paths", default-features = false }
ibc-client-tendermint = { git = "https://github.com/srdtrk/ibc-rs", branch = "serdar/xxx-allow-ibc-lite-paths", default-features = false, features = ["schema"] }
cw-ibc-lite-shared = { version = "0.1.0", path = "./packages/shared/" }
cw-ibc-lite-derive = { version = "0.1.0", path = "./packages/derive/" }
cw-ibc-lite-ics02-client = { version = "0.1.0", path = "./contracts/ics02-client/", default-features = false }
cw-ibc-lite-ics26-router = { version = "0.1.0", path = "./contracts/ics26-router/", default-features = false }
sha2 = "0.10.8"
ibc-proto = { version = "0.45.0", default-features = false }
derive_more = { version = "0.99.17", default-features = false, features = [ "from", "into", "display", "try_into" ] }
ibc-proto = { version = "0.46.0", default-features = false }
derive_more = { version = "0.99.18", default-features = false, features = [ "from", "into", "display", "try_into" ] }
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["derive"] }
2 changes: 0 additions & 2 deletions contracts/ics07-tendermint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export = []
[dependencies]
cosmwasm-schema = { workspace = true }
cosmwasm-std = { workspace = true }
cw-storage-plus = { workspace = true }
cw2 = { workspace = true }
schemars = { workspace = true }
ibc-client-cw = { workspace = true }
ibc-client-tendermint = { workspace = true }
Expand Down
15 changes: 3 additions & 12 deletions contracts/ics07-tendermint/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Response};
use cw_ibc_lite_shared::types::error::ContractError;

use crate::types::{
keys,
msg::{ExecuteMsg, InstantiateMsg, QueryMsg},
state,
};
Expand All @@ -21,11 +20,10 @@ pub type TendermintContext<'a> = ibc_client_cw::context::Context<'a, state::Tend
pub fn instantiate(
deps: DepsMut,
env: Env,
info: MessageInfo,
_info: MessageInfo,
msg: InstantiateMsg,
) -> Result<Response, ContractError> {
cw2::set_contract_version(deps.storage, keys::CONTRACT_NAME, keys::CONTRACT_VERSION)?;
state::owner::set(deps.storage, info.sender.as_str());
// cw2::set_contract_version(deps.storage, keys::CONTRACT_NAME, keys::CONTRACT_VERSION)?;

let mut ctx = TendermintContext::new_mut(deps, env)?;
let data = ctx.instantiate(msg.into())?;
Expand Down Expand Up @@ -76,7 +74,6 @@ pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> Result<Binary, ContractErro
QueryMsg::VerifyMembership(_) | QueryMsg::VerifyNonMembership(_) => {
query::sudo_query(deps, env, msg.try_into()?)
}
QueryMsg::Owner {} => query::owner(deps),
}
}

Expand All @@ -87,7 +84,7 @@ mod query {

use ibc_client_cw::types::{QueryMsg as TendermintQueryMsg, QueryResponse};

use super::{state, Binary, ContractError, Deps, Env, TendermintContext};
use super::{Binary, ContractError, Deps, Env, TendermintContext};

pub fn status(deps: Deps, env: Env, msg: TendermintQueryMsg) -> Result<Binary, ContractError> {
tendermint_query(deps, env, msg)
Expand Down Expand Up @@ -156,10 +153,4 @@ mod query {

ctx.sudo(msg).map_err(ContractError::from)
}

#[allow(clippy::needless_pass_by_value)]
pub fn owner(deps: Deps) -> Result<Binary, ContractError> {
let owner: String = state::owner::get(deps.storage)?;
Ok(cosmwasm_std::to_json_binary(&owner)?)
}
}
9 changes: 0 additions & 9 deletions contracts/ics07-tendermint/src/types/keys.rs

This file was deleted.

1 change: 0 additions & 1 deletion contracts/ics07-tendermint/src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! This module contains the types used by the contract's execution and state logic.
pub mod keys;
#[allow(clippy::module_name_repetitions)]
pub mod msg;
pub mod state;
Loading

0 comments on commit 271ca4e

Please sign in to comment.