From d94185ab94ec58d27d569afe6268fcc5ee71b5d0 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Thu, 10 Aug 2023 14:00:22 +0100 Subject: [PATCH 1/2] update nix dependency proper way --- code/Cargo.lock | 36 +++++++++---------- code/Cargo.toml | 10 +++--- .../frame/composable-traits/src/centauri.rs | 2 +- flake.lock | 8 ++--- flake.nix | 2 +- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/code/Cargo.lock b/code/Cargo.lock index 61ee26a2fb8..6d466268c58 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -895,7 +895,7 @@ dependencies = [ [[package]] name = "beefy-light-client" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "beefy-light-client-primitives", "ckb-merkle-mountain-range 0.3.2", @@ -918,7 +918,7 @@ dependencies = [ [[package]] name = "beefy-light-client-primitives" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "ckb-merkle-mountain-range 0.3.2", "derive_more 0.99.17", @@ -5078,7 +5078,7 @@ dependencies = [ [[package]] name = "grandpa-light-client-primitives" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "anyhow", "derive_more 0.99.17", @@ -5100,7 +5100,7 @@ dependencies = [ [[package]] name = "grandpa-light-client-verifier" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "anyhow", "finality-grandpa", @@ -5538,7 +5538,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.15.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "derive_more 0.99.17", "flex-error", @@ -5598,7 +5598,7 @@ dependencies = [ [[package]] name = "ibc-derive" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "convert_case 0.6.0", "proc-macro-crate 1.3.1", @@ -5622,7 +5622,7 @@ dependencies = [ [[package]] name = "ibc-primitives" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "base58", "blake2", @@ -5646,7 +5646,7 @@ dependencies = [ [[package]] name = "ibc-proto" version = "0.18.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "base64 0.13.1", "bytes 1.4.0", @@ -5675,7 +5675,7 @@ dependencies = [ [[package]] name = "ibc-rpc" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "frame-system", "hex-literal", @@ -5702,7 +5702,7 @@ dependencies = [ [[package]] name = "ibc-runtime-api" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "ibc-primitives", "pallet-ibc", @@ -5714,7 +5714,7 @@ dependencies = [ [[package]] name = "ics07-tendermint" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "bytes 1.4.0", "flex-error", @@ -5736,7 +5736,7 @@ dependencies = [ [[package]] name = "ics08-wasm" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "hex", "ibc 0.15.0", @@ -5748,7 +5748,7 @@ dependencies = [ [[package]] name = "ics10-grandpa" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "anyhow", "derive_more 0.99.17", @@ -5774,7 +5774,7 @@ dependencies = [ [[package]] name = "ics11-beefy" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "anyhow", "beefy-light-client", @@ -7226,7 +7226,7 @@ dependencies = [ [[package]] name = "light-client-common" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "anyhow", "async-trait", @@ -9206,7 +9206,7 @@ dependencies = [ [[package]] name = "pallet-ibc" version = "0.0.1" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "beefy-light-client-primitives", "cumulus-primitives-core", @@ -9259,7 +9259,7 @@ dependencies = [ [[package]] name = "pallet-ibc-ping" version = "0.0.1" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "frame-support", "frame-system", @@ -15113,7 +15113,7 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "simple-iavl" version = "0.1.0" -source = "git+https://github.com/ComposableFi/centauri?rev=1687de03194ba073b14ea7344efe35f0a95017b8#1687de03194ba073b14ea7344efe35f0a95017b8" +source = "git+https://github.com/ComposableFi/centauri?rev=664429d7b929266549067a14a21cd74c27e3848b#664429d7b929266549067a14a21cd74c27e3848b" dependencies = [ "bytes 1.4.0", "ics23 0.10.0", diff --git a/code/Cargo.toml b/code/Cargo.toml index a5c08d0ee0f..0e124082eba 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -114,11 +114,11 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "a0751540591c88ccc2d4029464de887933727183", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "a0751540591c88ccc2d4029464de887933727183", default-features = false } -ibc = { git = "https://github.com/ComposableFi/centauri", rev = "1687de03194ba073b14ea7344efe35f0a95017b8", default-features = false } -ibc-rpc = { git = "https://github.com/ComposableFi/centauri", rev = "1687de03194ba073b14ea7344efe35f0a95017b8", default-features = false } -ibc-primitives = { git = "https://github.com/ComposableFi/centauri", rev = "1687de03194ba073b14ea7344efe35f0a95017b8", default-features = false } -ibc-runtime-api = { git = "https://github.com/ComposableFi/centauri", rev = "1687de03194ba073b14ea7344efe35f0a95017b8", default-features = false } -pallet-ibc = { git = "https://github.com/ComposableFi/centauri", rev = "1687de03194ba073b14ea7344efe35f0a95017b8", default-features = false } +ibc = { git = "https://github.com/ComposableFi/centauri", rev = "664429d7b929266549067a14a21cd74c27e3848b", default-features = false } +ibc-rpc = { git = "https://github.com/ComposableFi/centauri", rev = "664429d7b929266549067a14a21cd74c27e3848b", default-features = false } +ibc-primitives = { git = "https://github.com/ComposableFi/centauri", rev = "664429d7b929266549067a14a21cd74c27e3848b", default-features = false } +ibc-runtime-api = { git = "https://github.com/ComposableFi/centauri", rev = "664429d7b929266549067a14a21cd74c27e3848b", default-features = false } +pallet-ibc = { git = "https://github.com/ComposableFi/centauri", rev = "664429d7b929266549067a14a21cd74c27e3848b", default-features = false } xcm-builder = { git = "https://github.com/paritytech/polkadot", rev = "c22e1c4173bf6966f5d1980f4299f7abe836f0c1", default-features = false } polkadot-primitives = { git = "https://github.com/paritytech/polkadot", rev = "c22e1c4173bf6966f5d1980f4299f7abe836f0c1", default-features = false } diff --git a/code/parachain/frame/composable-traits/src/centauri.rs b/code/parachain/frame/composable-traits/src/centauri.rs index dab577d8982..33a244a8054 100644 --- a/code/parachain/frame/composable-traits/src/centauri.rs +++ b/code/parachain/frame/composable-traits/src/centauri.rs @@ -13,7 +13,7 @@ impl Map { receiver: value.receiver, port: value.port.map(|x| x.to_string()), channel: value.channel.map(|x| x.to_string()), - timeout: value.timeout, + timeout: value.timeout.and_then(|x| x.parse().ok()), retries: value.retries.map(Into::into), para_id: value.substrate.and_then(|x| x.para_id), substrate: Some(value.substrate.is_some()), diff --git a/flake.lock b/flake.lock index ad3e2c2c184..e670c5b1a4d 100644 --- a/flake.lock +++ b/flake.lock @@ -104,17 +104,17 @@ "centauri-src": { "flake": false, "locked": { - "lastModified": 1691413830, - "narHash": "sha256-BmZ6GhVdLjBXx7ZTLUI/i2lriJAtrz4OvKy9Y/f6xCU=", + "lastModified": 1691619411, + "narHash": "sha256-re9ickVyDTB1c+ZQdYTT6y3/vCqKJhvp90NLnjeO4V0=", "owner": "ComposableFi", "repo": "centauri", - "rev": "1687de03194ba073b14ea7344efe35f0a95017b8", + "rev": "664429d7b929266549067a14a21cd74c27e3848b", "type": "github" }, "original": { "owner": "ComposableFi", "repo": "centauri", - "rev": "1687de03194ba073b14ea7344efe35f0a95017b8", + "rev": "664429d7b929266549067a14a21cd74c27e3848b", "type": "github" } }, diff --git a/flake.nix b/flake.nix index dd660bf0274..9925638570e 100644 --- a/flake.nix +++ b/flake.nix @@ -57,7 +57,7 @@ centauri-src = { flake = false; url = - "github:ComposableFi/centauri/1687de03194ba073b14ea7344efe35f0a95017b8"; + "github:ComposableFi/centauri/664429d7b929266549067a14a21cd74c27e3848b"; }; }; From 73f3cad2e2af5991356a7129a94ff320153b7e5d Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Thu, 10 Aug 2023 21:34:29 +0100 Subject: [PATCH 2/2] add logs and use u64 for timeout instead of string --- .../frame/composable-traits/src/centauri.rs | 2 +- .../frame/pallet-multihop-xcm-ibc/src/lib.rs | 23 +++++++++++++++---- .../lib/core/src/transport/ibc/ics20/pfm.rs | 4 ++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/code/parachain/frame/composable-traits/src/centauri.rs b/code/parachain/frame/composable-traits/src/centauri.rs index 33a244a8054..dab577d8982 100644 --- a/code/parachain/frame/composable-traits/src/centauri.rs +++ b/code/parachain/frame/composable-traits/src/centauri.rs @@ -13,7 +13,7 @@ impl Map { receiver: value.receiver, port: value.port.map(|x| x.to_string()), channel: value.channel.map(|x| x.to_string()), - timeout: value.timeout.and_then(|x| x.parse().ok()), + timeout: value.timeout, retries: value.retries.map(Into::into), para_id: value.substrate.and_then(|x| x.para_id), substrate: Some(value.substrate.is_some()), diff --git a/code/parachain/frame/pallet-multihop-xcm-ibc/src/lib.rs b/code/parachain/frame/pallet-multihop-xcm-ibc/src/lib.rs index d18389e6fa7..8fe0e06a5ed 100644 --- a/code/parachain/frame/pallet-multihop-xcm-ibc/src/lib.rs +++ b/code/parachain/frame/pallet-multihop-xcm-ibc/src/lib.rs @@ -58,7 +58,7 @@ pub mod pallet { }; use xcm::latest::prelude::*; - use composable_traits::{prelude::ToString, xcm::memo::ChainInfo}; + use composable_traits::xcm::memo::ChainInfo; use sp_std::boxed::Box; use frame_support::BoundedVec; @@ -303,7 +303,7 @@ pub mod pallet { } } - impl Pallet { + impl Pallet { /// Create memo from the route configuration using chain info, name and address /// /// This function is called from deposit_asset XCM callback function in @@ -356,16 +356,31 @@ pub mod pallet { .into_iter() .map(|byte| { u5::try_from_u8(byte).map_err(|_| { + //write to log + frame_support::log::error!( + "Failed to convert u8 into u5: {:?}", + byte + ); DispatchError::Other("Failed to convert u8 into u5") }) }) .collect::>()?; - let name = String::from_utf8(name).map_err(|_| { + let name = String::from_utf8(name.clone()).map_err(|_| { + //write to log + frame_support::log::error!( + "Failed to convert chain name from utf8: {:?}", + name + ); DispatchError::Other("Failed to convert chain name from utf8") })?; bech32_no_std::encode(&name, data.clone(), bech32_no_std::Variant::Bech32) .map_err(|_| { + //write to log + frame_support::log::error!( + "Failed to convert chain name and address into bech32: {:?}", + data + ); DispatchError::Other( "Failed to convert chain name and address into bech32", ) @@ -376,7 +391,7 @@ pub mod pallet { memo_receiver, PortId::transfer(), ChannelId::new(i.channel_id), - i.timeout.ok_or(DispatchError::Other("Timeout is none"))?.to_string(), + i.timeout.ok_or(DispatchError::Other("Timeout is none"))?, i.retries.ok_or(DispatchError::Other("Retries is none"))?, ) }; diff --git a/code/xcvm/lib/core/src/transport/ibc/ics20/pfm.rs b/code/xcvm/lib/core/src/transport/ibc/ics20/pfm.rs index c4075350fbb..c7e6143403e 100644 --- a/code/xcvm/lib/core/src/transport/ibc/ics20/pfm.rs +++ b/code/xcvm/lib/core/src/transport/ibc/ics20/pfm.rs @@ -15,7 +15,7 @@ pub struct ForwardingMemo { #[serde(skip_serializing_if = "Option::is_none")] pub channel: Option, #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, + pub timeout: Option, #[serde(skip_serializing_if = "Option::is_none")] pub retries: Option, @@ -60,7 +60,7 @@ impl ForwardingMemo { receiver: String, port: PortId, channel: ChannelId, - timeout: String, + timeout: u64, retries: u8, ) -> Self { Self {