Skip to content

Commit

Permalink
Bump/cw2 (#8)
Browse files Browse the repository at this point in the history
* cosmwasm2 bump polytone

* enable daemon by default

* Update contracts/main/voice/src/ibc.rs

Co-authored-by: Simon Warta <[email protected]>

* Bump cw-orch-interchain version

* update cw-orch deps and state

* bump from yanked version

* bump rest contracts from yanked version

* Updated polytone to use new cw-orch patch

* Fix state from state file (#10)

* Fix state from state file

* Remove match

* Fix/load state from state file (#11)

* Fix state from state file

* Remove match

* Updated state for hackmos

* Rmoved comment

* Trait missing

* cw-orch-interchain fixed

* Added new polytone connections and deploy scripts

* Moved components to be able to write state properly

* Fix state

* Updated published version

---------

Co-authored-by: Buckram <[email protected]>
Co-authored-by: Mykhailo Donchenko <[email protected]>
Co-authored-by: Simon Warta <[email protected]>
  • Loading branch information
4 people authored Dec 17, 2024
1 parent 4aff48d commit 11aec33
Show file tree
Hide file tree
Showing 20 changed files with 3,215 additions and 1,352 deletions.
3,758 changes: 2,691 additions & 1,067 deletions Cargo.lock

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2021"
license = "BSD-3-Clause"
repository = "https://github.com/DA0-DA0/polytone"
rust-version = "1.67"
version = "1.0.2"
version = "2.0.0"

[profile.release]
codegen-units = 1
Expand All @@ -25,17 +25,17 @@ panic = 'abort'
rpath = false

[workspace.dependencies]
polytone = { package = "abstract-polytone", path = "packages/polytone", version = "1.0.0" }
polytone-proxy = { package = "abstract-polytone-proxy", path = "contracts/main/proxy", version = "3.0.0" }
polytone-note = { package = "abstract-polytone-note", path = "contracts/main/note", version = "3.0.0" }
polytone-voice = { package = "abstract-polytone-voice", path = "contracts/main/voice", version = "3.0.0" }
cw-orch-polytone = { package = "abstract-cw-orch-polytone", path = "packages/cw-orch-polytone", version = "4.0.1" }

cosmwasm-schema = "1.2.1"
cosmwasm-std = { version = "1.5.0", features = ["ibc3"] }
cw-storage-plus = "1.0.1"
cw-utils = "1.0.1"
cw2 = "1.0.1"
polytone = { package = "abstract-polytone", path = "packages/polytone", version = "2.0.0" }
polytone-proxy = { package = "abstract-polytone-proxy", path = "contracts/main/proxy", version = "5.0.0" }
polytone-note = { package = "abstract-polytone-note", path = "contracts/main/note", version = "5.0.0" }
polytone-voice = { package = "abstract-polytone-voice", path = "contracts/main/voice", version = "5.0.0" }
cw-orch-polytone = { package = "abstract-cw-orch-polytone", path = "packages/cw-orch-polytone", version = "6.0.0" }

cosmwasm-schema = "2.0.0"
cosmwasm-std = { version = "2.0.0", features = ["stargate"] }
cw-storage-plus = "2.0.0"
cw-utils = "2.0.0"
cw2 = "2.0.0"

serde = { version = "1.0.145", default-features = false, features = ["derive"] }
thiserror = "1.0.31"
Expand All @@ -47,8 +47,8 @@ sha2 = "0.10.6"

# dev-dependencies

cw-orch = { version = "0.24.0" }
cw-orch-interchain = { version = "0.3.0" }
cw-orch = { version = "0.27.0" }
cw-orch-interchain = { version = "0.8.1" }

cw-multi-test = "0.16.2"
cw-multi-test = "2.0.0"
anyhow = { version = "1.0.51" }
2 changes: 0 additions & 2 deletions contracts/accessories/listener/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ version = { workspace = true }
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# disables #[entry_point] (i.e. instantiate/execute/query) export
library = []

Expand Down
2 changes: 0 additions & 2 deletions contracts/accessories/polytone-tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ version = { workspace = true }
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# disables #[entry_point] (i.e. instantiate/execute/query) export
library = []

Expand Down
4 changes: 1 addition & 3 deletions contracts/main/note/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ edition = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
repository = { workspace = true }
version = "3.0.0"
version = "5.0.0"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# disables #[entry_point] (i.e. instantiate/execute/query) export
library = []

Expand Down
4 changes: 1 addition & 3 deletions contracts/main/proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ edition = { workspace = true }
license = { workspace = true }
repository = { workspace = true }
rust-version = { workspace = true }
version = "3.0.0"
version = "5.0.0"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# disables #[entry_point] (i.e. instantiate/execute/query) export
library = []

Expand Down
4 changes: 1 addition & 3 deletions contracts/main/voice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ edition = { workspace = true }
license = { workspace = true }
rust-version = { workspace = true }
repository = { workspace = true }
version = "3.0.0"
version = "5.0.0"

[lib]
crate-type = ["cdylib", "rlib"]

[features]
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
# disables #[entry_point] (i.e. instantiate/execute/query) export
library = []

Expand Down
4 changes: 3 additions & 1 deletion contracts/main/voice/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ pub fn execute(
deps.querier.query_wasm_code_info(code_id)?;
let salt = salt(&connection_id, &counterparty_port, &sender);
let proxy = deps.api.addr_humanize(&instantiate2_address(
&checksum, &contract, &salt,
checksum.as_slice(),
&contract,
&salt,
)?)?;
SENDER_TO_PROXY.save(
deps.storage,
Expand Down
33 changes: 23 additions & 10 deletions contracts/main/voice/src/ibc.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
from_json, to_json_binary, DepsMut, Env, IbcBasicResponse, IbcChannelCloseMsg,
from_json, to_json_binary, Binary, DepsMut, Env, IbcBasicResponse, IbcChannelCloseMsg,
IbcChannelConnectMsg, IbcChannelOpenMsg, IbcChannelOpenResponse, IbcPacketAckMsg,
IbcPacketReceiveMsg, IbcPacketTimeoutMsg, IbcReceiveResponse, Never, Reply, Response, SubMsg,
SubMsgResult, WasmMsg,
};

use cw_utils::{parse_reply_execute_data, MsgExecuteContractResponse};
use cw_utils::{parse_execute_response_data, MsgExecuteContractResponse};
use polytone::{
ack::{ack_execute_fail, ack_fail},
callbacks::Callback,
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn ibc_packet_receive(
let connection_id = CHANNEL_TO_CONNECTION
.load(deps.storage, msg.packet.dest.channel_id.clone())
.expect("handshake sets mapping");
Ok(IbcReceiveResponse::default()
Ok(IbcReceiveResponse::new(b"")
.add_attribute("method", "ibc_packet_receive")
.add_attribute("connection_id", connection_id.as_str())
.add_attribute("channel_id", msg.packet.dest.channel_id.as_str())
Expand All @@ -110,6 +110,7 @@ pub fn ibc_packet_receive(
- ACK_GAS_NEEDED,
),
reply_on: cosmwasm_std::ReplyOn::Always,
payload: Binary::default(),
}))
}

Expand All @@ -120,11 +121,17 @@ pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, Contract
SubMsgResult::Err(e) => Response::default()
.add_attribute("ack_error", &e)
.set_data(ack_fail(e)),
SubMsgResult::Ok(_) => {
let data = parse_reply_execute_data(msg.clone())
.expect("execution succeeded")
.data
.expect("reply_forward_data sets data");
SubMsgResult::Ok(response) => {
let data = parse_execute_response_data(
#[allow(deprecated)]
response
.data
.expect("reply_forward_data sets data")
.as_slice(),
)
.expect("execution succeeded")
.data
.expect("reply_forward_data sets data");
match from_json::<Callback>(&data) {
Ok(_) => Response::default().set_data(data),
Err(e) => Response::default()
Expand All @@ -139,8 +146,14 @@ pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result<Response, Contract
// percolate the data up so we do so ourselves. Because we
// don't reply on instantiation, the data here is the
// result of executing messages on the proxy.
SubMsgResult::Ok(_) => {
let MsgExecuteContractResponse { data } = parse_reply_execute_data(msg)?;
SubMsgResult::Ok(response) => {
let MsgExecuteContractResponse { data } = parse_execute_response_data(
#[allow(deprecated)]
response
.data
.expect("proxy will always set data")
.as_slice(),
)?;
let response =
Response::default().add_attribute("method", "reply_forward_data_success");
Ok(match data {
Expand Down
Loading

0 comments on commit 11aec33

Please sign in to comment.