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

ICA Client testing #486

Draft
wants to merge 51 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
38d7965
Cherry Pick
Kayanski Sep 18, 2024
e434b5f
new
Kayanski Sep 18, 2024
b627a91
added patch
Kayanski Sep 23, 2024
8e840d3
With new interchain version
Kayanski Sep 23, 2024
9bd87bb
Nit collection and module update
Kayanski Sep 24, 2024
15f490a
Merge remote-tracking branch 'origin/develop/v2' into nicolas/abs-534…
CyberHoward Sep 27, 2024
0771cca
Updated cw-orch
Kayanski Oct 4, 2024
f5682f4
Moved ica-client
Kayanski Oct 4, 2024
d922020
Fix clippy
Kayanski Oct 7, 2024
04c0bbf
Merge branch 'develop/v2' into nicolas/abs-534-review-interchain-abst…
Kayanski Oct 7, 2024
89182bb
Integration test start
Kayanski Oct 7, 2024
421021c
Fix and update
Kayanski Oct 8, 2024
743af86
Update cw-orch cw-orch-interchain, polytone
Kayanski Oct 8, 2024
340ab11
formatting [skip ci]
Kayanski Oct 8, 2024
279e7b1
Merge branch 'develop/v2' into nicolas/abs-534-review-interchain-abst…
Kayanski Oct 8, 2024
00d6584
Re-added cw-orch-proto dependent tests
Kayanski Oct 8, 2024
452add9
Merge branch 'nicolas/abs-534-review-interchain-abstract-testing-setu…
Kayanski Oct 8, 2024
42b837b
Merge remote-tracking branch 'origin/nicolas/abs-534-review-interchai…
Kayanski Oct 8, 2024
ba0fd34
small-wasm
Buckram123 Oct 8, 2024
b7e9d8c
compiling wasm
Kayanski Oct 9, 2024
1f41822
remove ibc client message
Buckram123 Oct 9, 2024
b253c0a
Avoid usage of instantiate msg for sub account creation
Buckram123 Oct 9, 2024
836f3b4
Final ica client test
Kayanski Oct 9, 2024
317c71e
Merge remote-tracking branch 'origin/v2/small-wasm' into ica-client/t…
Kayanski Oct 9, 2024
52214cd
Removed local patch
Kayanski Oct 9, 2024
a2a1a7e
Working full script with ica client
Kayanski Oct 10, 2024
a230f20
Merge remote-tracking branch 'origin/develop/v2' into nicolas/abs-534…
Kayanski Oct 11, 2024
10e3e30
helper for interchain client mock
Buckram123 Oct 11, 2024
1116360
add admin assertion
Buckram123 Oct 11, 2024
72a628a
Added call as to interface and client
Kayanski Oct 11, 2024
dcd2071
Merge branch 'nicolas/abs-534-review-interchain-abstract-testing-setu…
Kayanski Oct 11, 2024
4e62a5d
Fix interchain clippyé
Kayanski Oct 14, 2024
ee82171
Funds in test
Kayanski Oct 14, 2024
ddf335e
Moved send back logic
Kayanski Oct 14, 2024
b67edb4
Merge remote-tracking branch 'origin/develop/v2' into nicolas/abs-534…
Kayanski Oct 14, 2024
3f6ee36
Merge remote-tracking branch 'origin/nicolas/abs-534-review-interchai…
Kayanski Oct 14, 2024
104741b
Fix
Kayanski Oct 14, 2024
8f92c2d
More helpers in remote crate
Kayanski Oct 15, 2024
eccad1f
Merge remote-tracking branch 'origin/develop/v2' into ica-client/test…
Kayanski Oct 15, 2024
bb21968
Restore union deployment
Kayanski Oct 15, 2024
29e5a79
Fixes and state
Kayanski Oct 15, 2024
c6d7ad5
Update state
Kayanski Oct 16, 2024
2c43df7
Merge remote-tracking branch 'origin/main' into ica-client/tests-move
Kayanski Oct 22, 2024
ed3e161
Less diff
Kayanski Oct 22, 2024
23209a5
Less diff and fixes
Kayanski Oct 22, 2024
3ab47a5
Merge remote-tracking branch 'origin/main' into ica-client/tests-move
Kayanski Oct 22, 2024
20b0558
Take comments into account
Kayanski Oct 22, 2024
d7fee18
formatting [skip ci]
Kayanski Oct 22, 2024
39c1d69
Merge remote-tracking branch 'origin/main' into ica-client/tests-move
Kayanski Oct 25, 2024
819a724
Merge remote-tracking branch 'origin/main' into ica-client/tests-move
Kayanski Nov 6, 2024
1d4f0a8
Started adding docs
Kayanski Nov 25, 2024
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
1,750 changes: 1,649 additions & 101 deletions framework/Cargo.lock

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ polytone = { package = "abstract-polytone", version = "2.0.0" }
polytone-note = { package = "abstract-polytone-note", version = "4.0.1" }
cw-orch-polytone = { package = "abstract-cw-orch-polytone", version = "5.0.0" }

## evm
evm-note = { version = "0.3.0", features = ["library"] }
polytone-evm = { version = "0.3.0" }
# polytone-evm = { git = "https://github.com/abstractsdk/evm-ibc", branch = "development/create-union-bundle" }
# evm-note = { git = "https://github.com/abstractsdk/evm-ibc", branch = "development/create-union-bundle", features = [
# "library",
# ] }

Kayanski marked this conversation as resolved.
Show resolved Hide resolved

## crates in order of publishing ## see docs/Publishing.md

Expand All @@ -69,6 +77,8 @@ abstract-standalone = { path = "packages/abstract-standalone" }

# Keep these as path, creates cirular dependency otherwise
# Only need to re-publish all contracts if a re-publish of abstract-interface is required

abstract-client = { version = "0.24.1-beta.1", path = "packages/abstract-client" }
abstract-interface = { version = "0.24.1-beta.1", path = "packages/abstract-interface" }
module-factory = { package = "abstract-module-factory", path = "contracts/native/module-factory" }
Kayanski marked this conversation as resolved.
Show resolved Hide resolved
ans-host = { package = "abstract-ans-host", path = "contracts/native/ans-host" }
Expand All @@ -80,7 +90,6 @@ ibc-host = { package = "abstract-ibc-host", path = "contracts/native/ibc-host" }

abstract-account = { path = "contracts/account", default-features = false }

abstract-ica = { version = "0.24.1-beta.2", path = "packages/abstract-ica" }
abstract-sdk = { version = "0.24.1-beta.2", path = "packages/abstract-sdk" }
abstract-testing = { version = "0.24.1-beta.2", path = "packages/abstract-testing" }
abstract-std = { version = "0.24.1-beta.2", path = "packages/abstract-std" }
Expand Down Expand Up @@ -109,6 +118,7 @@ opt-level = 3

# Backup release profile, will result in warnings during optimization
[profile.release]

rpath = false
lto = true
overflow-checks = true
Expand Down
2 changes: 0 additions & 2 deletions framework/contracts/account/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ abstract-std = { workspace = true }
semver = { workspace = true }
abstract-macros = { workspace = true }

abstract-ica = { workspace = true }

abstract-xion = { version = "0.24.1-beta.2", path = "../../packages/abstract-xion", default-features = false, optional = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions framework/contracts/account/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn ica_action(mut deps: DepsMut, msg_info: MessageInfo, action_query: Binary
))
})?;

let res: abstract_ica::msg::IcaActionResult = deps.querier.query(
let res: abstract_std::ica_client::IcaActionResult = deps.querier.query(
&WasmQuery::Smart {
contract_addr: ica_client_address.into(),
msg: action_query,
Expand Down Expand Up @@ -395,7 +395,7 @@ mod test {
}

mod ica_action {
use abstract_ica::msg::IcaActionResult;
use abstract_std::ica_client::IcaActionResult;
use abstract_std::ICA_CLIENT;
use cosmwasm_std::{Binary, Empty};

Expand Down
5 changes: 2 additions & 3 deletions framework/contracts/native/ica-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ thiserror = { workspace = true }
abstract-std = { workspace = true }
abstract-sdk = { workspace = true }
semver = { workspace = true }
abstract-ica = { workspace = true }
abstract-macros = { workspace = true }

evm-note = { version = "0.1.0", features = ["library"] }
polytone-evm = "0.1.0"
evm-note = { workspace = true }
polytone-evm = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
workspace-hack = { version = "0.1", path = "../../../workspace-hack" }
Expand Down
10 changes: 6 additions & 4 deletions framework/contracts/native/ica-client/src/chain_types/evm.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use abstract_ica::EVM_NOTE_ID;
use abstract_sdk::{
feature_objects::{AnsHost, RegistryContract},
Resolve,
};
use abstract_std::ica_client::EVM_NOTE_ID;
use abstract_std::objects::{module::ModuleInfo, ChannelEntry, ContractEntry, TruncatedChainId};
use cosmwasm_std::{
wasm_execute, Addr, Binary, Coin, CosmosMsg, Deps, Env, HexBinary, QuerierWrapper, WasmMsg,
Expand Down Expand Up @@ -94,16 +94,18 @@ pub fn send_funds(
}

fn evm_note_addr(vc: &RegistryContract, querier: &QuerierWrapper) -> IcaClientResult<Addr> {
let evm_note_entry =
ModuleInfo::from_id(EVM_NOTE_ID, abstract_ica::POLYTONE_EVM_VERSION.parse()?)?;
let evm_note_entry = ModuleInfo::from_id(
EVM_NOTE_ID,
abstract_std::ica_client::POLYTONE_EVM_VERSION.parse()?,
)?;

vc.query_module(evm_note_entry, querier)?
.reference
.unwrap_native()
.map_err(Into::into)
}

pub(crate) mod types {
pub mod types {
use super::*;

pub const UCS01_PROTOCOL: &str = "ucs01";
Expand Down
5 changes: 1 addition & 4 deletions framework/contracts/native/ica-client/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ mod tests {
let mut deps = mock_dependencies();
let env = mock_env_validated(deps.api);
let abstr = AbstractMockAddrs::new(deps.api);
let msg = InstantiateMsg {
ans_host_address: abstr.ans_host.to_string(),
registry_address: abstr.registry.to_string(),
};
let msg = InstantiateMsg {};
let info = message_info(&abstr.owner, &[]);
let res = instantiate(deps.as_mut(), env.clone(), info, msg).unwrap();
assert!(res.messages.is_empty());
Expand Down
9 changes: 3 additions & 6 deletions framework/contracts/native/ica-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pub mod contract;
pub mod error;
pub use abstract_ica::msg;
mod chain_types;
pub use abstract_std::ica_client as msg;
pub mod chain_types;
mod queries;

#[cfg(test)]
Expand All @@ -19,10 +19,7 @@ mod test_common {

pub fn mock_init(deps: &mut OwnedDeps<MockStorage, MockApi, MockQuerier>) -> IcaClientResult {
let abstr = AbstractMockAddrs::new(deps.api);
let msg = InstantiateMsg {
ans_host_address: abstr.ans_host.to_string(),
registry_address: abstr.registry.to_string(),
};
let msg = InstantiateMsg {};
let info = message_info(&abstr.owner, &[]);
let env = mock_env_validated(deps.api);

Expand Down
66 changes: 37 additions & 29 deletions framework/contracts/native/ica-client/src/queries.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use abstract_ica::{msg::ConfigResponse, ChainType, IcaAction, IcaActionResponse};
use abstract_sdk::feature_objects::{AnsHost, RegistryContract};
use abstract_std::ica_client::{ChainType, ConfigResponse, IcaAction, IcaActionResponse};
use abstract_std::objects::TruncatedChainId;
use cosmwasm_std::{ensure_eq, CosmosMsg, Deps, Env};

Expand All @@ -10,8 +10,8 @@ pub const PACKET_LIFETIME: u64 = 60 * 60;

pub fn config(deps: Deps, env: &Env) -> IcaClientResult<ConfigResponse> {
Ok(ConfigResponse {
ans_host: AnsHost::new(deps.api, env)?.address,
registry_address: RegistryContract::new(deps.api, env)?.address,
ans_host_address: AnsHost::new(deps.api, env)?.address.to_string(),
registry_address: RegistryContract::new(deps.api, env)?.address.to_string(),
})
}

Kayanski marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -23,15 +23,15 @@ pub(crate) fn ica_action(
actions: Vec<IcaAction>,
) -> IcaClientResult<IcaActionResponse> {
// match chain-id with cosmos or EVM
use abstract_ica::CastChainType;
use abstract_std::ica_client::CastChainType;
let chain_type = chain.chain_type().ok_or(IcaClientError::NoChainType {
chain: chain.to_string(),
})?;

let process_action = |action: IcaAction| -> IcaClientResult<Vec<CosmosMsg>> {
match action {
IcaAction::Execute(ica_exec) => match ica_exec {
abstract_ica::IcaExecute::Evm { msgs, callback } => {
abstract_std::ica_client::IcaExecute::Evm { msgs, callback } => {
ensure_eq!(
chain_type,
ChainType::Evm,
Expand Down Expand Up @@ -145,7 +145,9 @@ mod tests {
infos[0],
ModuleInfo::from_id(
EVM_NOTE_ID,
abstract_ica::POLYTONE_EVM_VERSION.parse().unwrap()
abstract_std::ica_client::POLYTONE_EVM_VERSION
.parse()
.unwrap()
)
.unwrap()
);
Expand All @@ -155,7 +157,9 @@ mod tests {
module: Module {
info: ModuleInfo::from_id(
EVM_NOTE_ID,
abstract_ica::POLYTONE_EVM_VERSION.parse().unwrap(),
abstract_std::ica_client::POLYTONE_EVM_VERSION
.parse()
.unwrap(),
)
.unwrap(),
reference: ModuleReference::Native(env_note_addr(api)),
Expand All @@ -175,7 +179,7 @@ mod tests {
use super::*;
use std::str::FromStr;

use abstract_ica::msg::QueryMsg;
use abstract_std::ica_client::QueryMsg;
use abstract_std::objects::TruncatedChainId;

use abstract_testing::mock_env_validated;
Expand All @@ -199,8 +203,8 @@ mod tests {
assert_eq!(
res,
ConfigResponse {
ans_host: abstr.ans_host,
registry_address: abstr.registry
ans_host_address: abstr.ans_host.to_string(),
registry_address: abstr.registry.to_string()
}
);
Ok(())
Expand All @@ -220,15 +224,17 @@ mod tests {
let msg = QueryMsg::IcaAction {
account_address: abstr.account.addr().to_string(),
chain: chain_name,
actions: vec![IcaAction::Execute(abstract_ica::IcaExecute::Evm {
msgs: vec![EvmMsg::Call {
to: "to".to_string(),
data: vec![0x01].into(),
value: None,
allow_failure: None,
}],
callback: None,
})],
actions: vec![IcaAction::Execute(
abstract_std::ica_client::IcaExecute::Evm {
msgs: vec![EvmMsg::Call {
to: "to".to_string(),
data: vec![0x01].into(),
allow_failure: None,
value: None,
}],
callback: None,
},
)],
};

let res = query(deps.as_ref(), env, msg)?;
Expand All @@ -244,8 +250,8 @@ mod tests {
msgs: vec![EvmMsg::Call {
to: "to".to_string(),
data: vec![0x01].into(),
value: None,
allow_failure: None,
value: None,
}],
timeout_seconds: PACKET_LIFETIME.into(),
},
Expand Down Expand Up @@ -361,15 +367,17 @@ mod tests {
let msg = QueryMsg::IcaAction {
account_address: abstr.account.addr().to_string(),
chain: chain_name.clone(),
actions: vec![IcaAction::Execute(abstract_ica::IcaExecute::Evm {
msgs: vec![EvmMsg::Call {
to: "to".to_string(),
data: vec![0x01].into(),
value: None,
allow_failure: None,
}],
callback: None,
})],
actions: vec![IcaAction::Execute(
abstract_std::ica_client::IcaExecute::Evm {
msgs: vec![EvmMsg::Call {
to: "to".to_string(),
data: vec![0x01].into(),
allow_failure: None,
value: None,
}],
callback: None,
},
)],
};

let err = query(deps.as_ref(), mock_env_validated(deps.api), msg).unwrap_err();
Expand Down
9 changes: 8 additions & 1 deletion framework/packages/abstract-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! ```

use abstract_interface::{
Abstract, AccountI, AnsHost, IbcClient, ModuleFactory, RegisteredModule, Registry,
Abstract, AccountI, AnsHost, IbcClient, IcaClient, ModuleFactory, RegisteredModule, Registry,
};
use abstract_std::objects::{
module::{ModuleInfo, ModuleStatus, ModuleVersion},
Expand Down Expand Up @@ -138,6 +138,13 @@ impl<Chain: CwEnv> AbstractClient<Chain> {
&self.abstr.ibc.client
}

/// Abstract Ica Client contract API
///
/// The Abstract Ica Client contract allows users to query messages to send messages across chains (EVM)
pub fn ica_client(&self) -> &IcaClient<Chain> {
&self.abstr.ibc.ica_client
}

/// Service contract API
pub fn service<M: RegisteredModule + From<Contract<Chain>>>(
&self,
Expand Down
4 changes: 4 additions & 0 deletions framework/packages/abstract-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use abstract_interface::AbstractInterfaceError;
use abstract_std::{objects::validation::ValidationError, AbstractError};
use cosmwasm_std::StdError;
use thiserror::Error;

#[derive(Error, Debug)]
Expand All @@ -17,6 +18,9 @@ pub enum AbstractClientError {
#[error("{0}")]
CwOrch(#[from] cw_orch::prelude::CwOrchError),

#[error("{0}")]
StdError(#[from] StdError),

#[error("{0}")]
Semver(#[from] semver::Error),

Expand Down
41 changes: 0 additions & 41 deletions framework/packages/abstract-ica/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions framework/packages/abstract-ica/README.md

This file was deleted.

Loading
Loading