Skip to content

Commit

Permalink
Merge #1158
Browse files Browse the repository at this point in the history
1158: Fix pallet ibc dependencies build errors. r=KaiserKarel a=Wizdave97

## Issue
*Please replace this line with either a link to the ClickUp issue, or a reference to the GitHub issue.*

## Description
*Please replace this line with info that is not in the ClickUp ticket, eg: "also bumps dependency foo version"*



Co-authored-by: David Salami <[email protected]>
  • Loading branch information
bors[bot] and Wizdave97 authored Jun 17, 2022
2 parents d25bd6e + 9f36f59 commit 3259e2c
Show file tree
Hide file tree
Showing 17 changed files with 409 additions and 331 deletions.
447 changes: 227 additions & 220 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frame/ibc-ping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18", default-features = false }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18", default-features = false }

ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
ibc-primitives = { path = "../ibc/ibc-primitives", default-features = false }
ibc-trait = { path = "../ibc/ibc-trait", default-features = false }

[dev-dependencies]
balances = { package = "pallet-balances", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18" }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", features = [
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", features = [
"mocks",
] }
pallet-ibc = { path = "../ibc" }
Expand Down
23 changes: 12 additions & 11 deletions frame/ibc-ping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ibc::{
},
ics24_host::identifier::{ChannelId, ConnectionId, PortId},
ics26_routing::context::{
Acknowledgement as GenericAcknowledgement, Module, ModuleOutput, OnRecvPacketAck,
Acknowledgement as GenericAcknowledgement, Module, ModuleOutputBuilder, OnRecvPacketAck,
},
},
signer::Signer,
Expand Down Expand Up @@ -176,7 +176,7 @@ impl<T: Config> core::fmt::Debug for IbcHandler<T> {
impl<T: Config + Send + Sync> Module for IbcHandler<T> {
fn on_chan_open_init(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
_order: Order,
_connection_hops: &[ConnectionId],
_port_id: &PortId,
Expand All @@ -190,12 +190,13 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_chan_open_try(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
_order: Order,
_connection_hops: &[ConnectionId],
port_id: &PortId,
channel_id: &ChannelId,
counterparty: &Counterparty,
_version: &Version,
counterparty_version: &Version,
) -> Result<Version, Ics04Error> {
log::info!("Channel initialised {:?}, {:?}, {:?}", channel_id, port_id, counterparty);
Expand All @@ -204,7 +205,7 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_chan_open_ack(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
port_id: &PortId,
channel_id: &ChannelId,
counterparty_version: &Version,
Expand All @@ -220,7 +221,7 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_chan_open_confirm(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
port_id: &PortId,
channel_id: &ChannelId,
) -> Result<(), Ics04Error> {
Expand All @@ -230,7 +231,7 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_chan_close_init(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
port_id: &PortId,
channel_id: &ChannelId,
) -> Result<(), Ics04Error> {
Expand All @@ -240,7 +241,7 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_chan_close_confirm(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
port_id: &PortId,
channel_id: &ChannelId,
) -> Result<(), Ics04Error> {
Expand All @@ -250,18 +251,18 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_recv_packet(
&self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
packet: &Packet,
_relayer: &Signer,
) -> OnRecvPacketAck {
let success = "ping-success".as_bytes().to_vec();
log::info!("Received Packet {:?}", packet);
OnRecvPacketAck::Successful(Box::new(PingAcknowledgement(success)), Box::new(|_| {}))
OnRecvPacketAck::Successful(Box::new(PingAcknowledgement(success)), Box::new(|_| Ok(())))
}

fn on_acknowledgement_packet(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
packet: &Packet,
acknowledgement: &Acknowledgement,
_relayer: &Signer,
Expand All @@ -272,7 +273,7 @@ impl<T: Config + Send + Sync> Module for IbcHandler<T> {

fn on_timeout_packet(
&mut self,
_output: &mut ModuleOutput,
_output: &mut ModuleOutputBuilder,
packet: &Packet,
_relayer: &Signer,
) -> Result<(), Ics04Error> {
Expand Down
29 changes: 18 additions & 11 deletions frame/ibc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "polk
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22", default-features = false, optional = true }
parachain-info = { git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.22" }
prost = { version = "0.10", default-features = false, optional = true }
simple-iavl = { git = "https://github.com/Wizdave97/simple-avl", default-features = false, optional = true }
simple-iavl = { git = "https://github.com/ComposableFi/simple-avl", rev = "7f68d854e82b3e422565df7100dedd79e8ffa346", default-features = false, optional = true }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22", default-features = false }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22", default-features = false }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22", default-features = false }
Expand All @@ -33,32 +33,36 @@ sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22", default-features = false }

hex-literal = { version = "0.3.4", optional = true }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ibc-proto = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ics23 = { version = "=0.8.0-alpha", default-features = false, optional = true }
tendermint = { version = "0.23.7", optional = true, default-features = false }
tendermint-proto = { version = "0.23.7", default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
ibc-proto = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
ics23 = { git = "https://github.com/composablefi/ics23", branch = "seun-v0.8.0-alpha", default-features = false, optional = true }
tendermint = { git = "https://github.com/composableFi/tendermint-rs", branch = "seun-0.23.7", default-features = false, optional = true }
tendermint-proto = { git = "https://github.com/composableFi/tendermint-rs", branch = "seun-0.23.7", default-features = false }

# local deps
ibc-primitives = { path = "ibc-primitives", default-features = false }
ibc-trait = { path = "ibc-trait", default-features = false }
pallet-ibc-ping = { path = "../ibc-ping", default-features = false }

# To be removed in refactor here https://github.com/ComposableFi/composable/pull/1122
sha2 = { version = "0.10.2", default-features = false }
sha3 = { version = "0.10.1", default-features = false }
ripemd = { version = "0.1.1", default-features = false }

[dev-dependencies]
chrono = "0.4.19"
hex = '0.4.0'
hex-literal = { version = "0.3.4" }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", features = [
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", features = [
"mocks",
] }
ics23 = { version = "=0.8.0-alpha" }
ics23 = { git = "https://github.com/composablefi/ics23", branch = "seun-v0.8.0-alpha" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
prost = { version = "0.10" }
serde = { version = "1.0" }
sha2 = '0.9.3'
simple-iavl = { git = "https://github.com/Wizdave97/simple-avl" }
simple-iavl = { git = "https://github.com/ComposableFi/simple-avl", rev = "7f68d854e82b3e422565df7100dedd79e8ffa346" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
tendermint = { version = "0.23.7" }
tendermint = { git = "https://github.com/composableFi/tendermint-rs", branch = "seun-0.23.7" }

[features]
default = ['std']
Expand All @@ -81,6 +85,9 @@ std = [
"ibc-trait/std",
"parachain-info/std",
"sp-runtime-interface/std",
"sha3/std",
"sha2/std",
"ripemd/std"
]

runtime-benchmarks = [
Expand Down
2 changes: 1 addition & 1 deletion frame/ibc/ibc-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0", features = [
"derive",
], default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
scale-info = { version = '2.1.1', default-features = false }
serde = { version = "1.0.136", features = ["derive"], optional = true }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions frame/ibc/ibc-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jsonrpsee = { version = "0.13.0", features = ["server", "macros"] }
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.45"

ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ibc-proto = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
ibc-proto = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
ibc-runtime-api = { path = "../ibc-runtime-api" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
Expand All @@ -30,4 +30,4 @@ sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "pol
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.22" }
tendermint-proto = "0.23.7"
tendermint-proto = {git = "https://github.com/composableFi/tendermint-rs", branch = "seun-0.23.7" }
2 changes: 1 addition & 1 deletion frame/ibc/ibc-trait/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
"derive",
] }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.18", default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "198440a62d4ccc88555cfef6253d6595319b88bf", default-features = false }
ibc = { git = "https://github.com/ComposableFi/ibc-rs", rev = "c7c73ab423445f501ceae3d1d5d74815b502744a", default-features = false }
ibc-primitives = { path = "../ibc-primitives", default-features = false }
scale-info = { version = "2.1.1", default-features = false, features = [
"derive",
Expand Down
10 changes: 5 additions & 5 deletions frame/ibc/src/benchmarks/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ benchmarks! {
let msg = MsgCreateAnyClient::new(
AnyClientState::Tendermint(mock_client_state),
Some(AnyConsensusState::Tendermint(mock_cs_state)),
Signer::new("relayer"),
Signer::from_str(MODULE_ID).unwrap(),
)
.unwrap()
.encode_vec()
Expand Down Expand Up @@ -136,7 +136,7 @@ benchmarks! {
counterparty,
version: None,
delay_period,
signer: Signer::new("relayer")
signer: Signer::from_str(MODULE_ID).unwrap()
}.encode_vec().unwrap();

let msg = Any { type_url: conn_open_init::TYPE_URL.as_bytes().to_vec(), value };
Expand Down Expand Up @@ -307,7 +307,7 @@ benchmarks! {
let value = MsgChannelOpenInit {
port_id: port_id.clone(),
channel: channel_end,
signer: Signer::new("relayer")
signer: Signer::from_str(MODULE_ID).unwrap()
}.encode_vec().unwrap();

let caller: T::AccountId = whitelisted_caller();
Expand Down Expand Up @@ -361,7 +361,7 @@ benchmarks! {
let value = MsgChannelOpenInit {
port_id,
channel: channel_end,
signer: Signer::new("relayer")
signer: Signer::from_str(MODULE_ID).unwrap()
}.encode_vec().unwrap();

let msg = ibc_proto::google::protobuf::Any { type_url: CHAN_OPEN_TYPE_URL.to_string(), value };
Expand Down Expand Up @@ -424,7 +424,7 @@ benchmarks! {
let value = MsgChannelOpenInit {
port_id,
channel: channel_end,
signer: Signer::new("relayer")
signer: Signer::from_str(MODULE_ID).unwrap()
}.encode_vec().unwrap();

let msg = ibc_proto::google::protobuf::Any { type_url: CHAN_OPEN_TYPE_URL.to_string(), value };
Expand Down
30 changes: 17 additions & 13 deletions frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{routing::Context, Config};
use crate::{routing::Context, Config, MODULE_ID};
use core::{str::FromStr, time::Duration};
use frame_support::traits::Get;
use ibc::{
Expand Down Expand Up @@ -146,7 +146,7 @@ pub fn create_client_update() -> MsgUpdateAnyClient {
MsgUpdateAnyClient {
client_id: ClientId::new(ClientType::Tendermint, 0).unwrap(),
header: AnyHeader::Tendermint(create_tendermint_header()),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
}
}
// Proof generation process for all tendermint benchmarks
Expand Down Expand Up @@ -263,7 +263,7 @@ pub fn create_conn_open_try<T: Config>() -> (ConsensusState, MsgConnectionOpenTr
)
.unwrap(),
delay_period,
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -366,7 +366,7 @@ pub fn create_conn_open_ack<T: Config>() -> (ConsensusState, MsgConnectionOpenAc
)
.unwrap(),
version: ConnVersion::default(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -454,7 +454,7 @@ pub fn create_conn_open_confirm<T: Config>() -> (ConsensusState, MsgConnectionOp
Height::new(0, 2),
)
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -517,7 +517,7 @@ pub fn create_chan_open_try() -> (ConsensusState, MsgChannelOpenTry) {
counterparty_version: ChannelVersion::default(),
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -573,7 +573,7 @@ pub fn create_chan_open_ack() -> (ConsensusState, MsgChannelOpenAck) {
counterparty_version: ChannelVersion::default(),
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -627,14 +627,18 @@ pub fn create_chan_open_confirm() -> (ConsensusState, MsgChannelOpenConfirm) {
channel_id: ChannelId::new(0),
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}

pub fn create_chan_close_init() -> MsgChannelCloseInit {
let port_id = PortId::from_str(pallet_ibc_ping::PORT_ID).unwrap();
MsgChannelCloseInit { port_id, channel_id: ChannelId::new(0), signer: Signer::new("relayer") }
MsgChannelCloseInit {
port_id,
channel_id: ChannelId::new(0),
signer: Signer::from_str(MODULE_ID).unwrap(),
}
}

pub fn create_chan_close_confirm() -> (ConsensusState, MsgChannelCloseConfirm) {
Expand Down Expand Up @@ -686,7 +690,7 @@ pub fn create_chan_close_confirm() -> (ConsensusState, MsgChannelCloseConfirm) {
channel_id: Default::default(),
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -751,7 +755,7 @@ where
packet,
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -821,7 +825,7 @@ where
acknowledgement: ack.into(),
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Expand Down Expand Up @@ -886,7 +890,7 @@ where
next_sequence_recv: Default::default(),
proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2))
.unwrap(),
signer: Signer::new("relayer"),
signer: Signer::from_str(MODULE_ID).unwrap(),
},
)
}
Loading

0 comments on commit 3259e2c

Please sign in to comment.