Skip to content

Commit

Permalink
Upgrade to ICS23 0.10 (#13)
Browse files Browse the repository at this point in the history
* WIP upgrade to ICS23 0.10

* update tendermint

* update tendermint 2

* temporarily disable no_std checking

* update crate versions

* update crate versions 2
  • Loading branch information
hdevalence authored Apr 28, 2023
1 parent c9ba790 commit b56deb3
Show file tree
Hide file tree
Showing 26 changed files with 120 additions and 122 deletions.
90 changes: 45 additions & 45 deletions .github/workflows/no-std.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
name: no_std check
on:
pull_request:
paths:
- .github/workflows/no-std.yml
- Cargo.toml
- Cargo.lock
- ci/**
- crates/**
push:
branches: main
paths:
- .github/workflows/no-std.yml
- Cargo.toml
- Cargo.lock
- ci/**
- crates/**

jobs:
check-no-std-panic-conflict:
name: Check no_std panic conflict
runs-on: buildjet-16vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: |
cd ci/no-std-check
make check-panic-conflict
check-substrate:
name: Check no_std substrate support
runs-on: buildjet-16vcpu-ubuntu-2004
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-unknown-unknown
override: true
- run: |
cd ci/no-std-check
make check-substrate
# name: no_std check
# on:
# pull_request:
# paths:
# - .github/workflows/no-std.yml
# - Cargo.toml
# - Cargo.lock
# - ci/**
# - crates/**
# push:
# branches: main
# paths:
# - .github/workflows/no-std.yml
# - Cargo.toml
# - Cargo.lock
# - ci/**
# - crates/**
#
# jobs:
# check-no-std-panic-conflict:
# name: Check no_std panic conflict
# runs-on: buildjet-16vcpu-ubuntu-2004
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# override: true
# - run: |
# cd ci/no-std-check
# make check-panic-conflict
#
# check-substrate:
# name: Check no_std substrate support
# runs-on: buildjet-16vcpu-ubuntu-2004
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# target: wasm32-unknown-unknown
# override: true
# - run: |
# cd ci/no-std-check
# make check-substrate
10 changes: 5 additions & 5 deletions ci/no-std-check/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "no-std-check"
version = "0.1.0"
version = "0.2.0"
edition = "2021"
resolver = "2"

Expand All @@ -9,13 +9,13 @@ ibc-types = { path = "../../crates/ibc-types", default-features = false, feature
"serde",
"mocks-no-std",
] }
ibc-proto = { version = "0.26.0", default-features = false, features = [
ibc-proto = { git = "https://github.com/penumbra-zone/ibc-proto-rs", branch = "penumbra", version = "0.30.0", default-features = false, features = [
"parity-scale-codec",
"borsh",
] }
tendermint = { version = "0.29.0", default-features = false }
tendermint-proto = { version = "0.29.0", default-features = false }
tendermint-light-client-verifier = { version = "0.29.0", default-features = false, features = ["rust-crypto"] }
tendermint = { version = "0.31.1", default-features = false }
tendermint-proto = { version = "0.31.1", default-features = false }
tendermint-light-client-verifier = { version = "0.31.1", default-features = false, features = ["rust-crypto"] }

sp-core = { version = "17.0.0", default-features = false, optional = true }
sp-io = { version = "18.0.0", default-features = false, optional = true }
Expand Down
10 changes: 5 additions & 5 deletions crates/ibc-types-core-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibc-types-core-client"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
license = "Apache-2.0"
readme = "../../README.md"
Expand Down Expand Up @@ -53,11 +53,11 @@ mocks = ["tendermint-testgen", "tendermint/clock", "cfg-if", "parking_lot"]
mocks-no-std = ["cfg-if"]

[dependencies]
ibc-types-timestamp = { version = "0.1.1", path = "../ibc-types-timestamp", default-features = false }
ibc-types-domain-type = { version = "0.1.1", path = "../ibc-types-domain-type", default-features = false }
ibc-types-timestamp = { version = "0.2.0", path = "../ibc-types-timestamp", default-features = false }
ibc-types-domain-type = { version = "0.2.0", path = "../ibc-types-domain-type", default-features = false }
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.26.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.9.0", default-features = false, features = ["host-functions"] }
ibc-proto = { git = "https://github.com/penumbra-zone/ibc-proto-rs", branch = "penumbra",version = "0.30.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.10.1", default-features = false, features = ["host-functions"] }
time = { version = ">=0.3.0, <0.3.20", default-features = false }
serde_derive = { version = "1.0.104", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }
Expand Down
3 changes: 1 addition & 2 deletions crates/ibc-types-core-client/src/mock/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ impl From<MockClientState> for Any {
fn from(client_state: MockClientState) -> Self {
Any {
type_url: MOCK_CLIENT_STATE_TYPE_URL.to_string(),
value: Protobuf::<RawMockClientState>::encode_vec(&client_state)
.expect("encoding to `Any` from `MockClientState`"),
value: Protobuf::<RawMockClientState>::encode_vec(&client_state),
}
}
}
3 changes: 1 addition & 2 deletions crates/ibc-types-core-client/src/mock/consensus_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ impl From<MockConsensusState> for Any {
fn from(consensus_state: MockConsensusState) -> Self {
Any {
type_url: MOCK_CONSENSUS_STATE_TYPE_URL.to_string(),
value: Protobuf::<RawMockConsensusState>::encode_vec(&consensus_state)
.expect("encoding to `Any` from `MockConsensusState`"),
value: Protobuf::<RawMockConsensusState>::encode_vec(&consensus_state),
}
}
}
5 changes: 2 additions & 3 deletions crates/ibc-types-core-client/src/mock/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ impl From<MockHeader> for Any {
fn from(header: MockHeader) -> Self {
Any {
type_url: MOCK_HEADER_TYPE_URL.to_string(),
value: Protobuf::<RawMockHeader>::encode_vec(&header)
.expect("encoding to `Any` from `TmHeader`"),
value: Protobuf::<RawMockHeader>::encode_vec(&header),
}
}
}
Expand All @@ -120,7 +119,7 @@ mod tests {
#[test]
fn encode_any() {
let header = MockHeader::new(Height::new(1, 10).unwrap()).with_timestamp(Timestamp::none());
let bytes = <MockHeader as Protobuf<Any>>::encode_vec(&header).unwrap();
let bytes = <MockHeader as Protobuf<Any>>::encode_vec(&header);

assert_eq!(
&bytes,
Expand Down
3 changes: 1 addition & 2 deletions crates/ibc-types-core-client/src/mock/misbehaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ impl From<Misbehaviour> for Any {
fn from(misbehaviour: Misbehaviour) -> Self {
Any {
type_url: MOCK_MISBEHAVIOUR_TYPE_URL.to_string(),
value: Protobuf::<RawMisbehaviour>::encode_vec(&misbehaviour)
.expect("encoding to `Any` from `TmMisbehaviour`"),
value: Protobuf::<RawMisbehaviour>::encode_vec(&misbehaviour),
}
}
}
2 changes: 1 addition & 1 deletion crates/ibc-types-domain-type/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibc-types-domain-type"
version = "0.1.1"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
10 changes: 5 additions & 5 deletions crates/ibc-types-lightclients-tendermint/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibc-types-lightclients-tendermint"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
license = "Apache-2.0"
readme = "../../README.md"
Expand Down Expand Up @@ -53,8 +53,8 @@ mocks-no-std = ["cfg-if"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.26.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.9.0", default-features = false, features = ["host-functions"] }
ibc-proto = { git = "https://github.com/penumbra-zone/ibc-proto-rs", branch = "penumbra", version = "0.30.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.10.1", default-features = false, features = ["host-functions"] }
time = { version = ">=0.3.0, <0.3.20", default-features = false }
serde_derive = { version = "1.0.104", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }
Expand Down Expand Up @@ -103,8 +103,8 @@ env_logger = "0.10.0"
rstest = "0.16.0"
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
test-log = { version = "0.2.10", features = ["trace"] }
tendermint-rpc = { version = "0.29", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.29" } # Needed for generating (synthetic) light blocks.
tendermint-rpc = { version = "0.31.1", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.31.1" } # Needed for generating (synthetic) light blocks.
parking_lot = { version = "0.12.1" }
cfg-if = { version = "1.0.0" }

10 changes: 5 additions & 5 deletions crates/ibc-types-timestamp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibc-types-timestamp"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
license = "Apache-2.0"
readme = "../../README.md"
Expand Down Expand Up @@ -48,8 +48,8 @@ mocks-no-std = ["cfg-if"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.26.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.9.0", default-features = false, features = ["host-functions"] }
ibc-proto = { git = "https://github.com/penumbra-zone/ibc-proto-rs", branch = "penumbra",version = "0.30.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.10.1", default-features = false, features = ["host-functions"] }
time = { version = ">=0.3.0, <0.3.20", default-features = false }
serde_derive = { version = "1.0.104", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }
Expand Down Expand Up @@ -98,8 +98,8 @@ env_logger = "0.10.0"
rstest = "0.16.0"
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
test-log = { version = "0.2.10", features = ["trace"] }
tendermint-rpc = { version = "0.29", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.29" } # Needed for generating (synthetic) light blocks.
tendermint-rpc = { version = "0.31.1", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.31.1" } # Needed for generating (synthetic) light blocks.
parking_lot = { version = "0.12.1" }
cfg-if = { version = "1.0.0" }

18 changes: 9 additions & 9 deletions crates/ibc-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibc-types"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
license = "Apache-2.0"
readme = "../../README.md"
Expand Down Expand Up @@ -53,8 +53,8 @@ mocks-no-std = ["cfg-if"]

[dependencies]
# Proto definitions for all IBC-related interfaces, e.g., connections or channels.
ibc-proto = { version = "0.26.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.9.0", default-features = false, features = ["host-functions"] }
ibc-proto = { git = "https://github.com/penumbra-zone/ibc-proto-rs", branch = "penumbra", version = "0.30.0", default-features = false, features = ["parity-scale-codec", "borsh"] }
ics23 = { version = "0.10.1", default-features = false, features = ["host-functions"] }
time = { version = ">=0.3.0, <0.3.20", default-features = false }
serde_derive = { version = "1.0.104", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }
Expand All @@ -81,20 +81,20 @@ parking_lot = { version = "0.12.1", default-features = false, optional = true }
cfg-if = { version = "1.0.0", optional = true }

[dependencies.tendermint]
version = "0.29"
version = "0.31.1"
default-features = false

[dependencies.tendermint-proto]
version = "0.29"
version = "0.31.1"
default-features = false

[dependencies.tendermint-light-client-verifier]
version = "0.29"
version = "0.31.1"
default-features = false
features = ["rust-crypto"]

[dependencies.tendermint-testgen]
version = "0.29"
version = "0.31.1"
optional = true
default-features = false

Expand All @@ -103,7 +103,7 @@ env_logger = "0.10.0"
rstest = "0.16.0"
tracing-subscriber = { version = "0.3.14", features = ["fmt", "env-filter", "json"]}
test-log = { version = "0.2.10", features = ["trace"] }
tendermint-rpc = { version = "0.29", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.29" } # Needed for generating (synthetic) light blocks.
tendermint-rpc = { version = "0.31.1", features = ["http-client", "websocket-client"] }
tendermint-testgen = { version = "0.31.1" } # Needed for generating (synthetic) light blocks.
parking_lot = { version = "0.12.1" }
cfg-if = { version = "1.0.0" }
8 changes: 7 additions & 1 deletion crates/ibc-types/src/applications/transfer/msgs/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct MsgTransfer<C = Coin> {
/// Timeout timestamp relative to the current block timestamp.
/// The timeout is disabled when set to 0.
pub timeout_timestamp_on_b: Timestamp,
pub memo: String,
}

impl Msg for MsgTransfer {
Expand Down Expand Up @@ -68,6 +69,7 @@ impl TryFrom<RawMsgTransfer> for MsgTransfer {
})?;

Ok(MsgTransfer {
memo: raw_msg.memo,
port_on_a: raw_msg.source_port.parse().map_err(|e| {
TokenTransferError::InvalidPortId {
context: raw_msg.source_port.clone(),
Expand Down Expand Up @@ -95,6 +97,7 @@ impl TryFrom<RawMsgTransfer> for MsgTransfer {
impl From<MsgTransfer> for RawMsgTransfer {
fn from(domain_msg: MsgTransfer) -> Self {
RawMsgTransfer {
memo: domain_msg.memo,
source_port: domain_msg.port_on_a.to_string(),
source_channel: domain_msg.chan_on_a.to_string(),
token: Some(domain_msg.token),
Expand Down Expand Up @@ -125,11 +128,12 @@ impl TryFrom<Any> for MsgTransfer {

#[cfg(test)]
pub mod test_util {
use super::*;

use core::ops::Add;
use core::time::Duration;
use primitive_types::U256;

use super::MsgTransfer;
use crate::applications::transfer::packet::PacketData;
use crate::applications::transfer::Coin;
use crate::core::ics04_channel::packet::{Packet, Sequence};
Expand All @@ -150,6 +154,7 @@ pub mod test_util {
) -> MsgTransfer<PrefixedCoin> {
let address: Signer = get_dummy_bech32_account().as_str().parse().unwrap();
MsgTransfer {
memo: String::new(),
port_on_a: PortId::default(),
chan_on_a: ChannelId::default(),
token: BaseCoin {
Expand All @@ -173,6 +178,7 @@ pub mod test_util {

let data = {
let data = PacketData {
memo: String::new(),
token: coin,
sender: msg.sender.clone(),
receiver: msg.receiver.clone(),
Expand Down
4 changes: 4 additions & 0 deletions crates/ibc-types/src/applications/transfer/packet.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloc::string::String;
use alloc::string::ToString;
use core::convert::TryFrom;
use core::str::FromStr;
Expand All @@ -18,6 +19,7 @@ pub struct PacketData {
pub token: PrefixedCoin,
pub sender: Signer,
pub receiver: Signer,
pub memo: String,
}

impl TryFrom<RawPacketData> for PacketData {
Expand All @@ -28,6 +30,7 @@ impl TryFrom<RawPacketData> for PacketData {
let denom = PrefixedDenom::from_str(&raw_pkt_data.denom)?;
let amount = Amount::from_str(&raw_pkt_data.amount)?;
Ok(Self {
memo: raw_pkt_data.memo,
token: PrefixedCoin { denom, amount },
sender: raw_pkt_data
.sender
Expand All @@ -48,6 +51,7 @@ impl From<PacketData> for RawPacketData {
amount: pkt_data.token.amount.to_string(),
sender: pkt_data.sender.to_string(),
receiver: pkt_data.receiver.to_string(),
memo: pkt_data.memo,
}
}
}
Loading

0 comments on commit b56deb3

Please sign in to comment.