Skip to content

Commit

Permalink
Merge branch 'main' into fix/use-upstream-cw20
Browse files Browse the repository at this point in the history
  • Loading branch information
Kayanski authored Sep 30, 2024
2 parents fae20b0 + a58d5af commit 9d20f46
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Adds an `upload_wasm` function to CosmosSender to upload wasm code associated to no Contract structure
- Update syn to 2.0
- Added cw-plus orchestrator interface to the repo. Pacing the way for more integrations inside this repository in the future
- Add easier way to get PublicKey for `cw_orch_daemon::Wallet`

### Breaking

Expand Down
6 changes: 5 additions & 1 deletion cw-orch-daemon/src/senders/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use cosmrs::{
crypto::secp256k1::SigningKey,
proto::{cosmos::authz::v1beta1::MsgExec, traits::Message},
tendermint::chain::Id,
tx::{self, ModeInfo, Msg, Raw, SignDoc, SignMode, SignerInfo},
tx::{self, ModeInfo, Msg, Raw, SignDoc, SignMode, SignerInfo, SignerPublicKey},
AccountId, Any,
};
use cosmwasm_std::{coin, Addr, Coin};
Expand Down Expand Up @@ -124,6 +124,10 @@ impl Wallet {
self.options.clone()
}

pub fn public_key(&self) -> Option<SignerPublicKey> {
self.private_key.get_signer_public_key(&self.secp)
}

/// Replaces the private key that the [CosmosSender] is using with key derived from the provided 24-word mnemonic.
/// If you want more control over the derived private key, use [Self::set_private_key]
pub fn set_mnemonic(&mut self, mnemonic: impl Into<String>) -> Result<(), DaemonError> {
Expand Down
2 changes: 1 addition & 1 deletion packages/cw-orch-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-orch-core"
version = "2.1.0"
version = "2.1.1"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/cw-orch-mock/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-orch-mock"
version = "0.24.1"
version = "0.24.2"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion packages/cw-orch-networks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-orch-networks"
version = "0.24.1"
version = "0.24.2"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/cw-orch-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-orch-traits"
version = "0.24.0"
version = "0.24.1"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/interchain/interchain-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cw-orch-daemon = { workspace = true, optional = true }
futures = "0.3.30"
ibc-relayer-types = { workspace = true }
log = { workspace = true }
polytone = "1.0.0"
# TODO: polytone = "2.0.0"
prost = "0.13.1"
serde_json = { workspace = true }
thiserror = { workspace = true }
Expand Down
58 changes: 57 additions & 1 deletion packages/interchain/interchain-core/src/ack_parser.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::{from_json, Binary};
use cw_orch_core::environment::CwEnv;
use polytone::ack::Callback;
use prost::Message;
// TODO: when polytone updates to cosmwasm v2 use polytone::ack::Callback;
use polytone_callback::Callback;

use crate::{
env::decode_ack_error,
Expand Down Expand Up @@ -147,3 +148,58 @@ pub mod acknowledgement {
}
}
}

mod polytone_callback {
use super::*;

use cosmwasm_std::{SubMsgResponse, Uint64};

#[cw_serde]
pub struct ExecutionResponse {
/// The address on the remote chain that executed the messages.
pub executed_by: String,
/// Index `i` corresponds to the result of executing the `i`th
/// message.
pub result: Vec<SubMsgResponse>,
}

#[cw_serde]
pub struct ErrorResponse {
/// The index of the first message who's execution failed.
pub message_index: Uint64,
/// The error that occured executing the message.
pub error: String,
}

/// Copy of the [polytone::ack::Callback](https://docs.rs/polytone/1.0.0/polytone/ack/index.html#reexport.Callback)
/// But without cosmwasm v1 dependencies
#[cw_serde]
pub enum Callback {
/// Result of executing the requested query, or an error.
///
/// result[i] corresponds to the i'th query and contains the
/// base64 encoded query response.
Query(Result<Vec<Binary>, ErrorResponse>),

/// Result of executing the requested messages, or an error.
///
/// 14/04/23: if a submessage errors the reply handler can see
/// `codespace: wasm, code: 5`, but not the actual error. as a
/// result, we can't return good errors for Execution and this
/// error string will only tell you the error's codespace. for
/// example, an out-of-gas error is code 11 and looks like
/// `codespace: sdk, code: 11`.
Execute(Result<ExecutionResponse, String>),

/// An error occured that could not be recovered from. The only
/// known way that this can occur is message handling running out
/// of gas, in which case the error will be `codespace: sdk, code:
/// 11`.
///
/// This error is not named becuase it could also occur due to a
/// panic or unhandled error during message processing. We don't
/// expect this to happen and have carefully written the code to
/// avoid it.
FatalError(String),
}
}
2 changes: 1 addition & 1 deletion packages/interchain/interchain-core/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ pub trait InterchainEnv<Chain: IbcQueryHandler>: Clone {
/// use counter_contract::CounterContract;
/// let interchain = MockBech32InterchainEnv::new(vec![("osmosis-1","osmo"),("archway-1","arch")]);
///
/// let all_chains: Vec<&MockBeck32> = interchain.chains().collect();
/// let all_chains: Vec<&MockBech32> = interchain.chains().collect();
///
/// ```
fn chains<'a>(&'a self) -> impl Iterator<Item = &'a Chain>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl<C: ChannelCreator> DaemonInterchain<C> {
/// let src_chain = OSMOSIS_1;
///
/// let interchain = DaemonInterchain::new(
/// vec![(src_chain.clone(), None), (dst_chain, None)],
/// vec![src_chain.clone(), dst_chain],
/// &ChannelCreationValidator,
/// ).unwrap();
///
Expand Down
2 changes: 1 addition & 1 deletion packages/macros/cw-orch-contract-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-orch-contract-derive"
version = "0.21.0"
version = "0.21.1"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion packages/macros/cw-orch-fns-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-orch-fns-derive"
version = "0.23.0"
version = "0.23.1"
authors = { workspace = true }
edition = { workspace = true }
license = { workspace = true }
Expand Down

0 comments on commit 9d20f46

Please sign in to comment.