From c87276c07e3aa89af819a07497c052ac79a11a21 Mon Sep 17 00:00:00 2001 From: David Salami Date: Thu, 16 Jun 2022 12:43:16 +0100 Subject: [PATCH 1/5] fix ibc-rs build errors --- Cargo.lock | 447 +++++++++--------- frame/ibc-ping/Cargo.toml | 4 +- frame/ibc-ping/src/lib.rs | 23 +- frame/ibc/Cargo.toml | 29 +- frame/ibc/ibc-primitives/Cargo.toml | 2 +- frame/ibc/ibc-rpc/Cargo.toml | 6 +- frame/ibc/ibc-trait/Cargo.toml | 2 +- frame/ibc/src/benchmarks/benchmarking.rs | 10 +- .../benchmarks/tendermint_benchmark_utils.rs | 28 +- frame/ibc/src/channel.rs | 24 +- frame/ibc/src/events.rs | 27 +- frame/ibc/src/host_functions.rs | 62 ++- frame/ibc/src/impls.rs | 21 +- frame/ibc/src/lib.rs | 5 +- frame/ibc/src/port.rs | 16 +- frame/ibc/src/routing.rs | 12 +- frame/ibc/src/tests.rs | 10 +- 17 files changed, 403 insertions(+), 325 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af5500a8ddb..b9b82d43194 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -224,7 +224,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -235,7 +235,7 @@ dependencies = [ "composable-traits", "parity-scale-codec", "sp-api", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -672,7 +672,7 @@ dependencies = [ "sp-io", "sp-mmr-primitives", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -691,7 +691,7 @@ dependencies = [ "sp-application-crypto", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -987,7 +987,7 @@ dependencies = [ "sp-core", "sp-finality-grandpa", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -999,7 +999,7 @@ dependencies = [ "frame-support", "parity-scale-codec", "scale-info", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1016,7 +1016,7 @@ dependencies = [ "scale-info", "serde", "sp-core", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1033,7 +1033,7 @@ dependencies = [ "sp-api", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-version", ] @@ -1050,7 +1050,7 @@ dependencies = [ "smallvec 1.8.0", "sp-api", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-version", ] @@ -1068,7 +1068,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-trie", ] @@ -1084,7 +1084,7 @@ dependencies = [ "sp-application-crypto", "sp-finality-grandpa", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1099,7 +1099,7 @@ dependencies = [ "parity-scale-codec", "sp-api", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1123,7 +1123,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-trie", ] @@ -1527,7 +1527,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-builder", "xcm-executor", @@ -1554,7 +1554,7 @@ dependencies = [ "scale-info", "sp-arithmetic", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1716,7 +1716,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -1742,7 +1742,7 @@ dependencies = [ "sp-arithmetic", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1758,7 +1758,7 @@ dependencies = [ "serde", "sp-arithmetic", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -1777,7 +1777,7 @@ dependencies = [ "serde", "sp-arithmetic", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -2094,7 +2094,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -2413,7 +2413,7 @@ dependencies = [ "sp-application-crypto", "sp-consensus-aura", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -2429,7 +2429,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -2458,7 +2458,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-trie", "sp-version", "xcm", @@ -2486,7 +2486,7 @@ dependencies = [ "pallet-session", "parity-scale-codec", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -2502,7 +2502,7 @@ dependencies = [ "serde", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -2520,7 +2520,7 @@ dependencies = [ "rand_chacha 0.3.1", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -2538,7 +2538,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -2554,7 +2554,7 @@ dependencies = [ "polkadot-primitives", "sp-api", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-trie", ] @@ -2575,7 +2575,7 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-storage", "sp-trie", "tracing", @@ -2590,7 +2590,7 @@ dependencies = [ "futures 0.3.21", "parity-scale-codec", "sp-inherents", - "sp-std 4.0.0", + "sp-std", "sp-timestamp", ] @@ -2606,7 +2606,7 @@ dependencies = [ "polkadot-parachain", "polkadot-primitives", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-trie", "xcm", ] @@ -2700,7 +2700,7 @@ dependencies = [ "polkadot-primitives", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -2837,7 +2837,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -3550,7 +3550,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-runtime-interface", - "sp-std 4.0.0", + "sp-std", "sp-storage", ] @@ -3628,7 +3628,7 @@ dependencies = [ "sp-arithmetic", "sp-npos-elections", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -3643,7 +3643,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-tracing", ] @@ -3684,7 +3684,7 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-tracing", "tt-call", ] @@ -3736,7 +3736,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-version", ] @@ -3752,7 +3752,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -3772,7 +3772,7 @@ dependencies = [ "frame-support", "sp-api", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -4493,8 +4493,8 @@ dependencies = [ [[package]] name = "ibc" -version = "0.14.1" -source = "git+https://github.com/ComposableFi/ibc-rs?rev=198440a62d4ccc88555cfef6253d6595319b88bf#198440a62d4ccc88555cfef6253d6595319b88bf" +version = "0.15.0" +source = "git+https://github.com/ComposableFi/ibc-rs?rev=c7c73ab423445f501ceae3d1d5d74815b502744a#c7c73ab423445f501ceae3d1d5d74815b502744a" dependencies = [ "beefy-generic-client", "beefy-primitives", @@ -4508,24 +4508,27 @@ dependencies = [ "parity-scale-codec", "prost 0.10.4", "prost-types 0.10.1", + "ripemd", "safe-regex", "serde", "serde_derive", "serde_json", "sha2 0.10.2", + "sha3 0.10.1", "sp-core", "sp-io", "sp-mmr-primitives", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-trie", "subtle-encoding", "tendermint", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.23.7 (git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7)", "tendermint-testgen", "time 0.3.9", "tracing", + "uint", ] [[package]] @@ -4536,20 +4539,20 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-std 4.0.0", + "sp-std", ] [[package]] name = "ibc-proto" -version = "0.17.1" -source = "git+https://github.com/ComposableFi/ibc-rs?rev=198440a62d4ccc88555cfef6253d6595319b88bf#198440a62d4ccc88555cfef6253d6595319b88bf" +version = "0.18.0" +source = "git+https://github.com/ComposableFi/ibc-rs?rev=c7c73ab423445f501ceae3d1d5d74815b502744a#c7c73ab423445f501ceae3d1d5d74815b502744a" dependencies = [ "base64 0.13.0", "bytes 1.1.0", "prost 0.10.4", "prost-types 0.10.1", "serde", - "tendermint-proto", + "tendermint-proto 0.23.7 (git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7)", ] [[package]] @@ -4571,7 +4574,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-trie", - "tendermint-proto", + "tendermint-proto 0.23.7 (git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7)", ] [[package]] @@ -4580,7 +4583,7 @@ version = "0.1.0" dependencies = [ "ibc-primitives", "sp-api", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -4592,23 +4595,19 @@ dependencies = [ "ibc-primitives", "parity-scale-codec", "scale-info", - "sp-std 4.0.0", + "sp-std", ] [[package]] name = "ics23" version = "0.8.0-alpha" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a435f2471c1b2ce14771da465d47321c5905fac866d0effa9e0a3eb5d94fcf" +source = "git+https://github.com/composablefi/ics23?branch=seun-v0.8.0-alpha#c79df0901ddfdfb539dae1e451e7beadc01694f4" dependencies = [ "anyhow", "bytes 1.1.0", "hex", "prost 0.10.4", - "ripemd160", - "sha2 0.9.9", - "sha3 0.9.1", - "sp-std 3.0.0", + "sp-std", ] [[package]] @@ -5215,7 +5214,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "static_assertions", @@ -5316,7 +5315,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -6072,7 +6071,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "statemine-runtime", @@ -6920,7 +6919,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -6937,7 +6936,7 @@ dependencies = [ "serde", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -6952,7 +6951,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -6967,7 +6966,7 @@ dependencies = [ "serde", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -6979,7 +6978,7 @@ dependencies = [ "orml-traits", "parity-scale-codec", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -6999,7 +6998,7 @@ dependencies = [ "serde", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -7038,7 +7037,7 @@ dependencies = [ "sp-api", "sp-blockchain", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7049,7 +7048,7 @@ dependencies = [ "composable-traits", "parity-scale-codec", "sp-api", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7066,7 +7065,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7093,7 +7092,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7107,7 +7106,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7127,7 +7126,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -7144,7 +7143,7 @@ dependencies = [ "sp-application-crypto", "sp-consensus-aura", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7160,7 +7159,7 @@ dependencies = [ "sp-application-crypto", "sp-authority-discovery", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7175,7 +7174,7 @@ dependencies = [ "scale-info", "sp-authorship", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7199,7 +7198,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7218,7 +7217,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-tracing", ] @@ -7234,7 +7233,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7250,7 +7249,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7273,7 +7272,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7299,7 +7298,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7317,7 +7316,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7334,7 +7333,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7355,7 +7354,7 @@ dependencies = [ "serde", "sp-finality-grandpa", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-trie", ] @@ -7377,7 +7376,7 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7395,7 +7394,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7414,7 +7413,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7434,7 +7433,7 @@ dependencies = [ "serde", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7451,7 +7450,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7477,7 +7476,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7497,7 +7496,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7520,7 +7519,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7536,7 +7535,7 @@ dependencies = [ "serde", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7562,7 +7561,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7597,7 +7596,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -7619,7 +7618,7 @@ dependencies = [ "sp-io", "sp-npos-elections", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "static_assertions", "strum 0.23.0", ] @@ -7652,7 +7651,7 @@ dependencies = [ "sp-io", "sp-npos-elections", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7667,7 +7666,7 @@ dependencies = [ "scale-info", "sp-arithmetic", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7685,7 +7684,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7708,7 +7707,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7733,19 +7732,21 @@ dependencies = [ "parachain-info", "parity-scale-codec", "prost 0.10.4", + "ripemd", "scale-info", "serde", - "sha2 0.9.9", + "sha2 0.10.2", + "sha3 0.10.1", "simple-iavl", "sp-core", "sp-io", "sp-keyring", "sp-runtime", "sp-runtime-interface", - "sp-std 4.0.0", + "sp-std", "sp-trie", "tendermint", - "tendermint-proto", + "tendermint-proto 0.23.7 (git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7)", ] [[package]] @@ -7766,8 +7767,8 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", - "tendermint-proto", + "sp-std", + "tendermint-proto 0.23.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -7783,7 +7784,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7803,7 +7804,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7820,7 +7821,7 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7862,7 +7863,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -7896,7 +7897,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -7914,7 +7915,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7932,7 +7933,7 @@ dependencies = [ "sp-io", "sp-mmr-primitives", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -7972,7 +7973,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -7988,7 +7989,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8008,7 +8009,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8022,7 +8023,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8037,7 +8038,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8056,7 +8057,7 @@ dependencies = [ "scale-info", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8073,7 +8074,7 @@ dependencies = [ "serde", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8096,7 +8097,7 @@ dependencies = [ "scale-info", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8122,7 +8123,7 @@ dependencies = [ "sp-io", "sp-keystore", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8149,7 +8150,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8164,7 +8165,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -8181,7 +8182,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8199,7 +8200,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8214,7 +8215,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8228,7 +8229,7 @@ dependencies = [ "safe-mix", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8243,7 +8244,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8259,7 +8260,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8279,7 +8280,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "sp-trie", ] @@ -8296,7 +8297,7 @@ dependencies = [ "rand 0.7.3", "sp-runtime", "sp-session", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8310,7 +8311,7 @@ dependencies = [ "rand_chacha 0.2.2", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8333,7 +8334,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8377,7 +8378,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8391,7 +8392,7 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8408,7 +8409,7 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-timestamp", ] @@ -8428,7 +8429,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8445,7 +8446,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8488,7 +8489,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8503,7 +8504,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8519,7 +8520,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8547,7 +8548,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8567,7 +8568,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8582,7 +8583,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -8598,7 +8599,7 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -8615,7 +8616,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -8654,7 +8655,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "substrate-wasm-builder", "xcm", "xcm-executor", @@ -9041,7 +9042,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -9348,7 +9349,7 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -9903,7 +9904,7 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -9946,7 +9947,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", "sp-trie", "sp-version", ] @@ -10059,7 +10060,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "static_assertions", @@ -10111,7 +10112,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "static_assertions", "xcm", ] @@ -10136,7 +10137,7 @@ dependencies = [ "bs58", "parity-scale-codec", "polkadot-primitives", - "sp-std 4.0.0", + "sp-std", "sp-tracing", ] @@ -10177,7 +10178,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "static_assertions", "xcm", "xcm-executor", @@ -10433,7 +10434,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] @@ -11192,14 +11193,12 @@ dependencies = [ ] [[package]] -name = "ripemd160" -version = "0.9.1" +name = "ripemd" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +checksum = "1facec54cb5e0dc08553501fa740091086d0259ad0067e0d4103448e4cb22ed3" dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest 0.10.3", ] [[package]] @@ -11280,7 +11279,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -12508,7 +12507,7 @@ dependencies = [ "serde_json", "sp-core", "sp-io", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -12527,7 +12526,7 @@ dependencies = [ "serde_json", "sp-core", "sp-io", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13178,7 +13177,7 @@ source = "git+https://github.com/polytope-labs/substrate-simnode?rev=920d5d7a032 dependencies = [ "parity-scale-codec", "sp-api", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13222,7 +13221,7 @@ checksum = "cc47a29ce97772ca5c927f75bac34866b16d64e07f330c3248e2d7226623901b" [[package]] name = "simple-iavl" version = "0.1.0" -source = "git+https://github.com/Wizdave97/simple-avl#2e19515bd19a87db4abd9a3b6affc7541dd6e56d" +source = "git+https://github.com/ComposableFi/simple-avl?rev=7f68d854e82b3e422565df7100dedd79e8ffa346#7f68d854e82b3e422565df7100dedd79e8ffa346" dependencies = [ "bytes 1.1.0", "ics23", @@ -13254,7 +13253,7 @@ dependencies = [ "parity-scale-codec", "paste 1.0.7", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13360,7 +13359,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-version", "thiserror", ] @@ -13387,7 +13386,7 @@ dependencies = [ "serde", "sp-core", "sp-io", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13401,7 +13400,7 @@ dependencies = [ "scale-info", "serde", "sp-debug-derive", - "sp-std 4.0.0", + "sp-std", "static_assertions", ] @@ -13415,7 +13414,7 @@ dependencies = [ "sp-api", "sp-application-crypto", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13427,7 +13426,7 @@ dependencies = [ "parity-scale-codec", "sp-inherents", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13439,7 +13438,7 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13474,7 +13473,7 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-version", "thiserror", ] @@ -13493,7 +13492,7 @@ dependencies = [ "sp-consensus-slots", "sp-inherents", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-timestamp", ] @@ -13516,7 +13515,7 @@ dependencies = [ "sp-inherents", "sp-keystore", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-timestamp", ] @@ -13530,7 +13529,7 @@ dependencies = [ "serde", "sp-arithmetic", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-timestamp", ] @@ -13544,7 +13543,7 @@ dependencies = [ "schnorrkel", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13583,7 +13582,7 @@ dependencies = [ "sp-debug-derive", "sp-externalities", "sp-runtime-interface", - "sp-std 4.0.0", + "sp-std", "sp-storage", "ss58-registry", "substrate-bip39", @@ -13603,7 +13602,7 @@ dependencies = [ "digest 0.10.3", "sha2 0.10.2", "sha3 0.10.1", - "sp-std 4.0.0", + "sp-std", "twox-hash", ] @@ -13644,7 +13643,7 @@ source = "git+https://github.com/composableFi/substrate?branch=polkadot-v0.9.22# dependencies = [ "environmental", "parity-scale-codec", - "sp-std 4.0.0", + "sp-std", "sp-storage", ] @@ -13663,7 +13662,7 @@ dependencies = [ "sp-core", "sp-keystore", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13676,7 +13675,7 @@ dependencies = [ "parity-scale-codec", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "thiserror", ] @@ -13697,7 +13696,7 @@ dependencies = [ "sp-keystore", "sp-runtime-interface", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-tracing", "sp-trie", "sp-wasm-interface", @@ -13754,7 +13753,7 @@ dependencies = [ "sp-core", "sp-debug-derive", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13768,7 +13767,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13820,7 +13819,7 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-io", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13833,7 +13832,7 @@ dependencies = [ "primitive-types", "sp-externalities", "sp-runtime-interface-proc-macro", - "sp-std 4.0.0", + "sp-std", "sp-storage", "sp-tracing", "sp-wasm-interface", @@ -13861,7 +13860,7 @@ dependencies = [ "parity-scale-codec", "sp-core", "sp-io", - "sp-std 4.0.0", + "sp-std", "sp-wasm-interface", "wasmi", ] @@ -13886,7 +13885,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-staking", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13897,7 +13896,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13915,19 +13914,13 @@ dependencies = [ "sp-core", "sp-externalities", "sp-panic-handler", - "sp-std 4.0.0", + "sp-std", "sp-trie", "thiserror", "tracing", "trie-root", ] -[[package]] -name = "sp-std" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35391ea974fa5ee869cb094d5b437688fbf3d8127d64d1b9fed5822a1ed39b12" - [[package]] name = "sp-std" version = "4.0.0" @@ -13943,7 +13936,7 @@ dependencies = [ "ref-cast", "serde", "sp-debug-derive", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13956,7 +13949,7 @@ dependencies = [ "sp-externalities", "sp-io", "sp-runtime-interface", - "sp-std 4.0.0", + "sp-std", ] [[package]] @@ -13971,7 +13964,7 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "thiserror", ] @@ -13981,7 +13974,7 @@ version = "5.0.0" source = "git+https://github.com/composableFi/substrate?branch=polkadot-v0.9.22#616d33ea23bab86cafffaf116fc607b6790fb4eb" dependencies = [ "parity-scale-codec", - "sp-std 4.0.0", + "sp-std", "tracing", "tracing-core", "tracing-subscriber", @@ -14008,7 +14001,7 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-trie", ] @@ -14022,7 +14015,7 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-core", - "sp-std 4.0.0", + "sp-std", "thiserror", "trie-db", "trie-root", @@ -14040,7 +14033,7 @@ dependencies = [ "serde", "sp-core-hashing-proc-macro", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "sp-version-proc-macro", "thiserror", ] @@ -14064,7 +14057,7 @@ dependencies = [ "impl-trait-for-tuples", "log 0.4.17", "parity-scale-codec", - "sp-std 4.0.0", + "sp-std", "wasmi", "wasmtime", ] @@ -14163,7 +14156,7 @@ dependencies = [ "sp-offchain", "sp-runtime", "sp-session", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -14471,7 +14464,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-state-machine", - "sp-std 4.0.0", + "sp-std", "sp-trie", "trie-db", ] @@ -14600,8 +14593,7 @@ dependencies = [ [[package]] name = "tendermint" version = "0.23.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ca881fa4dedd2b46334f13be7fbc8cc1549ba4be5a833fe4e73d1a1baaf7949" +source = "git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7#cb79c164e84c3d9176b374f2b227393fe000e691" dependencies = [ "async-trait", "bytes 1.1.0", @@ -14621,7 +14613,7 @@ dependencies = [ "signature", "subtle", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.23.7 (git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7)", "time 0.3.9", "zeroize", ] @@ -14629,8 +14621,7 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" version = "0.23.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ae030a759b89cca84860d497d4d4e491615d8a9243cc04c61cd89335ba9b593" +source = "git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7#cb79c164e84c3d9176b374f2b227393fe000e691" dependencies = [ "derive_more", "flex-error", @@ -14657,11 +14648,27 @@ dependencies = [ "time 0.3.9", ] +[[package]] +name = "tendermint-proto" +version = "0.23.7" +source = "git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7#cb79c164e84c3d9176b374f2b227393fe000e691" +dependencies = [ + "bytes 1.1.0", + "flex-error", + "num-derive", + "num-traits", + "prost 0.10.4", + "prost-types 0.10.1", + "serde", + "serde_bytes", + "subtle-encoding", + "time 0.3.9", +] + [[package]] name = "tendermint-testgen" version = "0.23.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442ede2d01e61466e515fd7f1d0aac7c3c86b3066535479caa86a43afb5e2e17" +source = "git+https://github.com/composableFi/tendermint-rs?branch=seun-0.23.7#cb79c164e84c3d9176b374f2b227393fe000e691" dependencies = [ "ed25519-dalek", "gumdrop", @@ -16177,7 +16184,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std 4.0.0", + "sp-std", "sp-transaction-pool", "sp-version", "substrate-wasm-builder", @@ -16430,7 +16437,7 @@ dependencies = [ "sp-arithmetic", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -16454,7 +16461,7 @@ dependencies = [ "polkadot-primitives", "polkadot-runtime-parachains", "sp-io", - "sp-std 4.0.0", + "sp-std", "xcm", "xcm-executor", ] @@ -16473,7 +16480,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std 4.0.0", + "sp-std", "xcm", ] diff --git a/frame/ibc-ping/Cargo.toml b/frame/ibc-ping/Cargo.toml index fab8718fea8..b38a26f1687 100644 --- a/frame/ibc-ping/Cargo.toml +++ b/frame/ibc-ping/Cargo.toml @@ -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" } diff --git a/frame/ibc-ping/src/lib.rs b/frame/ibc-ping/src/lib.rs index a47a92f26b1..2f326d2569e 100644 --- a/frame/ibc-ping/src/lib.rs +++ b/frame/ibc-ping/src/lib.rs @@ -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, @@ -176,7 +176,7 @@ impl core::fmt::Debug for IbcHandler { impl Module for IbcHandler { fn on_chan_open_init( &mut self, - _output: &mut ModuleOutput, + _output: &mut ModuleOutputBuilder, _order: Order, _connection_hops: &[ConnectionId], _port_id: &PortId, @@ -190,12 +190,13 @@ impl Module for IbcHandler { 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 { log::info!("Channel initialised {:?}, {:?}, {:?}", channel_id, port_id, counterparty); @@ -204,7 +205,7 @@ impl Module for IbcHandler { fn on_chan_open_ack( &mut self, - _output: &mut ModuleOutput, + _output: &mut ModuleOutputBuilder, port_id: &PortId, channel_id: &ChannelId, counterparty_version: &Version, @@ -220,7 +221,7 @@ impl Module for IbcHandler { fn on_chan_open_confirm( &mut self, - _output: &mut ModuleOutput, + _output: &mut ModuleOutputBuilder, port_id: &PortId, channel_id: &ChannelId, ) -> Result<(), Ics04Error> { @@ -230,7 +231,7 @@ impl Module for IbcHandler { fn on_chan_close_init( &mut self, - _output: &mut ModuleOutput, + _output: &mut ModuleOutputBuilder, port_id: &PortId, channel_id: &ChannelId, ) -> Result<(), Ics04Error> { @@ -240,7 +241,7 @@ impl Module for IbcHandler { fn on_chan_close_confirm( &mut self, - _output: &mut ModuleOutput, + _output: &mut ModuleOutputBuilder, port_id: &PortId, channel_id: &ChannelId, ) -> Result<(), Ics04Error> { @@ -250,18 +251,18 @@ impl Module for IbcHandler { 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, @@ -272,7 +273,7 @@ impl Module for IbcHandler { fn on_timeout_packet( &mut self, - _output: &mut ModuleOutput, + _output: &mut ModuleOutputBuilder, packet: &Packet, _relayer: &Signer, ) -> Result<(), Ics04Error> { diff --git a/frame/ibc/Cargo.toml b/frame/ibc/Cargo.toml index 59b910c30d8..53fe4c344d9 100644 --- a/frame/ibc/Cargo.toml +++ b/frame/ibc/Cargo.toml @@ -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 } @@ -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 } +#temporary dependencies +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'] @@ -81,6 +85,9 @@ std = [ "ibc-trait/std", "parachain-info/std", "sp-runtime-interface/std", + "sha3/std", + "sha2/std", + "ripemd/std" ] runtime-benchmarks = [ diff --git a/frame/ibc/ibc-primitives/Cargo.toml b/frame/ibc/ibc-primitives/Cargo.toml index bde77918cac..99cbf73bab1 100644 --- a/frame/ibc/ibc-primitives/Cargo.toml +++ b/frame/ibc/ibc-primitives/Cargo.toml @@ -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 } diff --git a/frame/ibc/ibc-rpc/Cargo.toml b/frame/ibc/ibc-rpc/Cargo.toml index 793100b71d8..e3e93d810cb 100644 --- a/frame/ibc/ibc-rpc/Cargo.toml +++ b/frame/ibc/ibc-rpc/Cargo.toml @@ -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" } @@ -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" } diff --git a/frame/ibc/ibc-trait/Cargo.toml b/frame/ibc/ibc-trait/Cargo.toml index cd06477c2bf..9d2d746a6d4 100644 --- a/frame/ibc/ibc-trait/Cargo.toml +++ b/frame/ibc/ibc-trait/Cargo.toml @@ -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", diff --git a/frame/ibc/src/benchmarks/benchmarking.rs b/frame/ibc/src/benchmarks/benchmarking.rs index 1bf9cc52cf3..e79cfeabc67 100644 --- a/frame/ibc/src/benchmarks/benchmarking.rs +++ b/frame/ibc/src/benchmarks/benchmarking.rs @@ -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("relayer").unwrap(), ) .unwrap() .encode_vec() @@ -136,7 +136,7 @@ benchmarks! { counterparty, version: None, delay_period, - signer: Signer::new("relayer") + signer: Signer::from_str("relayer").unwrap() }.encode_vec().unwrap(); let msg = Any { type_url: conn_open_init::TYPE_URL.as_bytes().to_vec(), value }; @@ -307,7 +307,7 @@ benchmarks! { let value = MsgChannelOpenInit { port_id: port_id.clone(), channel: channel_end, - signer: Signer::new("relayer") + signer: Signer::from_str("relayer").unwrap() }.encode_vec().unwrap(); let caller: T::AccountId = whitelisted_caller(); @@ -361,7 +361,7 @@ benchmarks! { let value = MsgChannelOpenInit { port_id, channel: channel_end, - signer: Signer::new("relayer") + signer: Signer::from_str("relayer").unwrap() }.encode_vec().unwrap(); let msg = ibc_proto::google::protobuf::Any { type_url: CHAN_OPEN_TYPE_URL.to_string(), value }; @@ -424,7 +424,7 @@ benchmarks! { let value = MsgChannelOpenInit { port_id, channel: channel_end, - signer: Signer::new("relayer") + signer: Signer::from_str("relayer").unwrap() }.encode_vec().unwrap(); let msg = ibc_proto::google::protobuf::Any { type_url: CHAN_OPEN_TYPE_URL.to_string(), value }; diff --git a/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs b/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs index e8aef79e9dc..38529371824 100644 --- a/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs +++ b/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs @@ -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("relayer").unwrap(), } } // Proof generation process for all tendermint benchmarks @@ -263,7 +263,7 @@ pub fn create_conn_open_try() -> (ConsensusState, MsgConnectionOpenTr ) .unwrap(), delay_period, - signer: Signer::new("relayer"), + signer: Signer::from_str("relayer").unwrap(), }, ) } @@ -366,7 +366,7 @@ pub fn create_conn_open_ack() -> (ConsensusState, MsgConnectionOpenAc ) .unwrap(), version: ConnVersion::default(), - signer: Signer::new("relayer"), + signer: Signer::from_str("relayer").unwrap(), }, ) } @@ -454,7 +454,7 @@ pub fn create_conn_open_confirm() -> (ConsensusState, MsgConnectionOp Height::new(0, 2), ) .unwrap(), - signer: Signer::new("relayer"), + signer: Signer::from_str("relayer").unwrap(), }, ) } @@ -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("relayer").unwrap(), }, ) } @@ -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("relayer").unwrap(), }, ) } @@ -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("relayer").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("relayer").unwrap(), + } } pub fn create_chan_close_confirm() -> (ConsensusState, MsgChannelCloseConfirm) { @@ -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("relayer").unwrap(), }, ) } @@ -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("relayer").unwrap(), }, ) } @@ -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("relayer").unwrap(), }, ) } @@ -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("relayer").unwrap(), }, ) } diff --git a/frame/ibc/src/channel.rs b/frame/ibc/src/channel.rs index 1037f862067..f9123cca451 100644 --- a/frame/ibc/src/channel.rs +++ b/frame/ibc/src/channel.rs @@ -1,7 +1,8 @@ use super::*; use core::{str::FromStr, time::Duration}; use frame_support::traits::Get; -use scale_info::prelude::string::ToString; +use ibc_primitives::OffchainPacketType; +use scale_info::prelude::{collections::BTreeMap, string::ToString}; use crate::routing::Context; use ibc::{ @@ -18,6 +19,7 @@ use ibc::{ timestamp::Timestamp, Height, }; + use tendermint_proto::Protobuf; impl ChannelReader for Context @@ -285,6 +287,26 @@ where Ok(()) } + fn store_packet( + &mut self, + key: (PortId, ChannelId, Sequence), + packet: ibc::core::ics04_channel::packet::Packet, + ) -> Result<(), ICS04Error> { + // store packet offchain + let channel_id = key.1.to_string().as_bytes().to_vec(); + let port_id = key.0.as_bytes().to_vec(); + let seq = u64::from(key.2); + let key = Pallet::::offchain_key(channel_id, port_id); + let mut offchain_packets: BTreeMap = + sp_io::offchain::local_storage_get(sp_core::offchain::StorageKind::PERSISTENT, &key) + .and_then(|v| codec::Decode::decode(&mut &*v).ok()) + .unwrap_or_default(); + let offchain_packet: OffchainPacketType = packet.into(); + offchain_packets.insert(seq, offchain_packet); + sp_io::offchain_index::set(&key, offchain_packets.encode().as_slice()); + Ok(()) + } + fn delete_packet_commitment( &mut self, key: (PortId, ChannelId, Sequence), diff --git a/frame/ibc/src/events.rs b/frame/ibc/src/events.rs index 321a5433d1c..00fc517898a 100644 --- a/frame/ibc/src/events.rs +++ b/frame/ibc/src/events.rs @@ -29,13 +29,21 @@ pub enum IbcEvent { /// Client misbehaviour ClientMisbehaviour { client_id: Vec, revision_height: u64, revision_number: u64 }, /// Connection open init - OpenInitConnection { revision_height: u64, revision_number: u64, connection_id: Vec }, + OpenInitConnection { + revision_height: u64, + revision_number: u64, + connection_id: Option>, + }, /// Connection open confirm - OpenConfirmConnection { revision_height: u64, revision_number: u64, connection_id: Vec }, + OpenConfirmConnection { + revision_height: u64, + revision_number: u64, + connection_id: Option>, + }, /// Connection try open - OpenTryConnection { revision_height: u64, revision_number: u64, connection_id: Vec }, + OpenTryConnection { revision_height: u64, revision_number: u64, connection_id: Option> }, /// Connection open acknowledge - OpenAckConnection { revision_height: u64, revision_number: u64, connection_id: Vec }, + OpenAckConnection { revision_height: u64, revision_number: u64, connection_id: Option> }, /// Channel open init OpenInitChannel { revision_height: u64, @@ -131,6 +139,8 @@ pub enum IbcEvent { Empty, /// Chain Error ChainError, + /// Module event + AppModule, } impl From for IbcEvent { @@ -165,22 +175,22 @@ impl From for IbcEvent { RawIbcEvent::OpenInitConnection(ev) => IbcEvent::OpenInitConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().unwrap_or_default().as_bytes().to_vec(), + connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenTryConnection(ev) => IbcEvent::OpenTryConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().unwrap_or_default().as_bytes().to_vec(), + connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenAckConnection(ev) => IbcEvent::OpenAckConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().unwrap_or_default().as_bytes().to_vec(), + connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenConfirmConnection(ev) => IbcEvent::OpenConfirmConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().unwrap_or_default().as_bytes().to_vec(), + connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenInitChannel(ev) => IbcEvent::OpenInitChannel { revision_height: ev.height().revision_height, @@ -277,6 +287,7 @@ impl From for IbcEvent { }, RawIbcEvent::Empty(_) => IbcEvent::Empty, RawIbcEvent::ChainError(_) => IbcEvent::ChainError, + RawIbcEvent::AppModule(_) => IbcEvent::AppModule, } } } diff --git a/frame/ibc/src/host_functions.rs b/frame/ibc/src/host_functions.rs index 9175ce9a96f..b890166f7cd 100644 --- a/frame/ibc/src/host_functions.rs +++ b/frame/ibc/src/host_functions.rs @@ -9,7 +9,7 @@ use ibc::{ use sp_core::{storage::StateVersion, H256}; use sp_std::prelude::*; -#[derive(Clone)] +#[derive(Clone, Default)] pub struct HostFunctions; impl HostFunctionsProvider for HostFunctions { @@ -23,10 +23,6 @@ impl HostFunctionsProvider for HostFunctions { .map(|pub_key| pub_key.to_vec()) } - fn ed25519_recover(_signature: &[u8; 64], _value: &[u8; 32]) -> Option> { - unimplemented!() - } - fn verify_membership_trie_proof( root: &H256, proof: &[Vec], @@ -55,4 +51,60 @@ impl HostFunctionsProvider for HostFunctions { fn sha256_digest(data: &[u8]) -> [u8; 32] { sp_io::hashing::sha2_256(data) } + + // These are temporary implementations to fix build errors, will be replaced with + // host functions in https://github.com/ComposableFi/composable/pull/1122 + fn ripemd160(message: &[u8]) -> [u8; 20] { + use ripemd::Digest; + let mut hasher = ripemd::Ripemd160::new(); + hasher.update(message); + let hash = hasher.finalize(); + let mut res = [0u8; 20]; + res.copy_from_slice(&hash); + res + } + + fn ed25519_verify(signature: &[u8; 64], msg: &[u8], pubkey: &[u8]) -> bool { + let signature = sp_core::ed25519::Signature::from_raw(*signature); + let public_key = if let Ok(pub_key) = sp_core::ed25519::Public::try_from(pubkey) { + pub_key + } else { + return false + }; + sp_io::crypto::ed25519_verify(&signature, msg, &public_key) + } + + fn sha2_256(message: &[u8]) -> [u8; 32] { + sp_io::hashing::sha2_256(message) + } + + fn sha2_512(message: &[u8]) -> [u8; 64] { + use sha2::Digest; + let mut hasher = sha2::Sha512::new(); + hasher.update(message); + let hash = hasher.finalize(); + let mut res = [0u8; 64]; + res.copy_from_slice(&hash); + res + } + + fn sha2_512_truncated(message: &[u8]) -> [u8; 32] { + use sha2::Digest; + let mut hasher = sha2::Sha512::new(); + hasher.update(message); + let hash = hasher.finalize(); + let mut res = [0u8; 32]; + res.copy_from_slice(&hash[..32]); + res + } + + fn sha3_512(message: &[u8]) -> [u8; 64] { + use sha3::Digest; + let mut hasher = sha3::Sha3_512::new(); + hasher.update(message); + let hash = hasher.finalize(); + let mut res = [0u8; 64]; + res.copy_from_slice(&hash); + res + } } diff --git a/frame/ibc/src/impls.rs b/frame/ibc/src/impls.rs index 357f407e535..1a6d9876b80 100644 --- a/frame/ibc/src/impls.rs +++ b/frame/ibc/src/impls.rs @@ -661,16 +661,6 @@ where .map_err(|_| IbcHandlerError::SendPacketError)?; ctx.store_packet_result(send_packet_result.result) .map_err(|_| IbcHandlerError::SendPacketError)?; - - // store packet offchain - let key = Pallet::::offchain_key(channel_id, port_id); - let mut offchain_packets: BTreeMap = - sp_io::offchain::local_storage_get(sp_core::offchain::StorageKind::PERSISTENT, &key) - .and_then(|v| codec::Decode::decode(&mut &*v).ok()) - .unwrap_or_default(); - let offchain_packet: OffchainPacketType = packet.into(); - offchain_packets.insert(next_seq_send, offchain_packet); - sp_io::offchain_index::set(&key, offchain_packets.encode().as_slice()); Ok(()) } @@ -683,9 +673,14 @@ where ctx.channel_counter().map_err(|_| IbcHandlerError::ChannelInitError)?; let channel_id = ChannelId::new(channel_counter); // Signer does not matter in this case - let value = MsgChannelOpenInit { port_id, channel: channel_end, signer: Signer::new("") } - .encode_vec() - .map_err(|_| IbcHandlerError::ChannelInitError)?; + let value = MsgChannelOpenInit { + port_id, + channel: channel_end, + signer: Signer::from_str("pallet_ibc") + .map_err(|_| IbcHandlerError::ChannelInitError)?, + } + .encode_vec() + .map_err(|_| IbcHandlerError::ChannelInitError)?; let msg = ibc_proto::google::protobuf::Any { type_url: CHANNEL_OPEN_INIT_TYPE_URL.to_string(), value, diff --git a/frame/ibc/src/lib.rs b/frame/ibc/src/lib.rs index 7dc2519d2cb..bd7814355df 100644 --- a/frame/ibc/src/lib.rs +++ b/frame/ibc/src/lib.rs @@ -127,6 +127,7 @@ pub mod pallet { version::Version, }, ics23_commitment::commitment::CommitmentPrefix, + ics26_routing::handler::MsgReceipt, }, signer::Signer, }; @@ -399,7 +400,7 @@ pub mod pallet { match ibc::core::ics26_routing::handler::deliver::<_, HostFunctions>( &mut ctx, msg, ) { - Ok((temp_events, temp_logs)) => { + Ok(MsgReceipt { events: temp_events, log: temp_logs }) => { events.extend_from_slice(&temp_events); logs.extend_from_slice(&temp_logs); }, @@ -450,7 +451,7 @@ pub mod pallet { counterparty, version: Some(version), delay_period, - signer: Signer::new(""), + signer: Signer::from_str("pallet_ibc").map_err(|_| Error::::DecodingError)?, } .encode_vec() .map_err(|_| Error::::ProcessingError)?; diff --git a/frame/ibc/src/port.rs b/frame/ibc/src/port.rs index 07c1fd896bf..53e874f72d0 100644 --- a/frame/ibc/src/port.rs +++ b/frame/ibc/src/port.rs @@ -2,10 +2,7 @@ use super::*; use crate::routing::Context; use ibc::core::{ - ics05_port::{ - context::{PortKeeper, PortReader}, - error::Error as ICS05Error, - }, + ics05_port::{context::PortReader, error::Error as ICS05Error}, ics24_host::identifier::PortId, ics26_routing::context::ModuleId, }; @@ -19,14 +16,3 @@ impl PortReader for Context { } } } - -impl PortKeeper for Context { - /// Since we are using statically defined ports and module Ids, this is not neccessary. - fn bind_module_to_port( - &mut self, - _module_id: ModuleId, - _port_id: PortId, - ) -> Result<(), ICS05Error> { - Ok(()) - } -} diff --git a/frame/ibc/src/routing.rs b/frame/ibc/src/routing.rs index e64242875b5..eed6ebb4127 100644 --- a/frame/ibc/src/routing.rs +++ b/frame/ibc/src/routing.rs @@ -1,9 +1,6 @@ use super::*; use core::borrow::Borrow; -use ibc::{ - applications::ics20_fungible_token_transfer::context::Ics20Context, - core::ics26_routing::context::{Ics26Context, LightClientContext, Module, ModuleId, Router}, -}; +use ibc::core::ics26_routing::context::{Ics26Context, Module, ModuleId, ReaderContext, Router}; use scale_info::prelude::string::ToString; #[derive(Clone)] @@ -66,12 +63,7 @@ where } } -impl Ics20Context for Context where - u32: From<::BlockNumber> -{ -} - -impl LightClientContext for Context where +impl ReaderContext for Context where u32: From<::BlockNumber> { } diff --git a/frame/ibc/src/tests.rs b/frame/ibc/src/tests.rs index dfe944cc0e3..2eb439143fe 100644 --- a/frame/ibc/src/tests.rs +++ b/frame/ibc/src/tests.rs @@ -35,7 +35,7 @@ fn initialize_connection() { let msg = MsgCreateAnyClient::new( AnyClientState::Mock(mock_client_state), Some(AnyConsensusState::Mock(mock_cs_state)), - Signer::new("relayer"), + Signer::from_str("relayer").unwrap(), ) .unwrap() .encode_vec() @@ -73,7 +73,7 @@ fn should_open_a_channel() { let msg = MsgCreateAnyClient::new( AnyClientState::Mock(mock_client_state), Some(AnyConsensusState::Mock(mock_cs_state)), - Signer::new("relayer"), + Signer::from_str("relayer").unwrap(), ) .unwrap() .encode_vec() @@ -123,7 +123,7 @@ fn should_send_ping_packet() { let msg = MsgCreateAnyClient::new( AnyClientState::Mock(mock_client_state), Some(AnyConsensusState::Mock(mock_cs_state)), - Signer::new("relayer"), + Signer::from_str("relayer").unwrap(), ) .unwrap() .encode_vec() @@ -170,7 +170,7 @@ fn should_send_ping_packet() { ) .unwrap(), version: ConnVersion::default(), - signer: Signer::new("relayer"), + signer: Signer::from_str("relayer").unwrap(), } .encode_vec() .unwrap(); @@ -208,7 +208,7 @@ fn should_send_ping_packet() { Height::new(0, 1), ) .unwrap(), - signer: Signer::new("relayer"), + signer: Signer::from_str("relayer").unwrap(), } .encode_vec() .unwrap(); From bc0d75e829c58eabf12af6590e6da530a77915aa Mon Sep 17 00:00:00 2001 From: David Salami Date: Thu, 16 Jun 2022 12:59:27 +0100 Subject: [PATCH 2/5] clippy fixes --- frame/ibc/src/events.rs | 8 ++++---- frame/ibc/src/impls.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frame/ibc/src/events.rs b/frame/ibc/src/events.rs index 00fc517898a..94ab923d5a8 100644 --- a/frame/ibc/src/events.rs +++ b/frame/ibc/src/events.rs @@ -175,22 +175,22 @@ impl From for IbcEvent { RawIbcEvent::OpenInitConnection(ev) => IbcEvent::OpenInitConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), + connection_id: ev.connection_id().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenTryConnection(ev) => IbcEvent::OpenTryConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), + connection_id: ev.connection_id().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenAckConnection(ev) => IbcEvent::OpenAckConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), + connection_id: ev.connection_id().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenConfirmConnection(ev) => IbcEvent::OpenConfirmConnection { revision_height: ev.height().revision_height, revision_number: ev.height().revision_number, - connection_id: ev.connection_id().clone().map(|val| val.as_bytes().to_vec()), + connection_id: ev.connection_id().map(|val| val.as_bytes().to_vec()), }, RawIbcEvent::OpenInitChannel(ev) => IbcEvent::OpenInitChannel { revision_height: ev.height().revision_height, diff --git a/frame/ibc/src/impls.rs b/frame/ibc/src/impls.rs index 1a6d9876b80..ec37f8a9548 100644 --- a/frame/ibc/src/impls.rs +++ b/frame/ibc/src/impls.rs @@ -636,9 +636,9 @@ where let next_seq_send = NextSequenceSend::::get(port_id.clone(), channel_id.clone()); let sequence = Sequence::from(next_seq_send); let source_port = - port_id_from_bytes(port_id.clone()).map_err(|_| IbcHandlerError::SendPacketError)?; - let source_channel = channel_id_from_bytes(channel_id.clone()) - .map_err(|_| IbcHandlerError::SendPacketError)?; + port_id_from_bytes(port_id).map_err(|_| IbcHandlerError::SendPacketError)?; + let source_channel = + channel_id_from_bytes(channel_id).map_err(|_| IbcHandlerError::SendPacketError)?; let destination_port = port_id_from_bytes(data.dest_port_id).map_err(|_| IbcHandlerError::SendPacketError)?; let destination_channel = channel_id_from_bytes(data.dest_channel_id) @@ -657,7 +657,7 @@ where }; let send_packet_result = - ibc::core::ics04_channel::handler::send_packet::send_packet(&ctx, packet.clone()) + ibc::core::ics04_channel::handler::send_packet::send_packet(&ctx, packet) .map_err(|_| IbcHandlerError::SendPacketError)?; ctx.store_packet_result(send_packet_result.result) .map_err(|_| IbcHandlerError::SendPacketError)?; From 58b336456d8b5d7d2a3469ea9b6a68a562103b88 Mon Sep 17 00:00:00 2001 From: David Salami Date: Fri, 17 Jun 2022 11:29:56 +0100 Subject: [PATCH 3/5] use constant value for deriving Signer in pallet ibc --- frame/ibc/src/benchmarks/benchmarking.rs | 10 +++++----- frame/ibc/src/impls.rs | 3 +-- frame/ibc/src/lib.rs | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frame/ibc/src/benchmarks/benchmarking.rs b/frame/ibc/src/benchmarks/benchmarking.rs index e79cfeabc67..b6f457e8284 100644 --- a/frame/ibc/src/benchmarks/benchmarking.rs +++ b/frame/ibc/src/benchmarks/benchmarking.rs @@ -73,7 +73,7 @@ benchmarks! { let msg = MsgCreateAnyClient::new( AnyClientState::Tendermint(mock_client_state), Some(AnyConsensusState::Tendermint(mock_cs_state)), - Signer::from_str("relayer").unwrap(), + Signer::from_str(MODULE_ID).unwrap(), ) .unwrap() .encode_vec() @@ -136,7 +136,7 @@ benchmarks! { counterparty, version: None, delay_period, - signer: Signer::from_str("relayer").unwrap() + 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 }; @@ -307,7 +307,7 @@ benchmarks! { let value = MsgChannelOpenInit { port_id: port_id.clone(), channel: channel_end, - signer: Signer::from_str("relayer").unwrap() + signer: Signer::from_str(MODULE_ID).unwrap() }.encode_vec().unwrap(); let caller: T::AccountId = whitelisted_caller(); @@ -361,7 +361,7 @@ benchmarks! { let value = MsgChannelOpenInit { port_id, channel: channel_end, - signer: Signer::from_str("relayer").unwrap() + 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 }; @@ -424,7 +424,7 @@ benchmarks! { let value = MsgChannelOpenInit { port_id, channel: channel_end, - signer: Signer::from_str("relayer").unwrap() + 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 }; diff --git a/frame/ibc/src/impls.rs b/frame/ibc/src/impls.rs index ec37f8a9548..6da9fd26e27 100644 --- a/frame/ibc/src/impls.rs +++ b/frame/ibc/src/impls.rs @@ -676,8 +676,7 @@ where let value = MsgChannelOpenInit { port_id, channel: channel_end, - signer: Signer::from_str("pallet_ibc") - .map_err(|_| IbcHandlerError::ChannelInitError)?, + signer: Signer::from_str(MODULE_ID).map_err(|_| IbcHandlerError::ChannelInitError)?, } .encode_vec() .map_err(|_| IbcHandlerError::ChannelInitError)?; diff --git a/frame/ibc/src/lib.rs b/frame/ibc/src/lib.rs index bd7814355df..b13116463c9 100644 --- a/frame/ibc/src/lib.rs +++ b/frame/ibc/src/lib.rs @@ -53,6 +53,7 @@ mod port; pub mod routing; pub const IBC_DIGEST_ID: [u8; 4] = *b"/IBC"; +pub const MODULE_ID: &str = "pallet_ibc"; #[derive(Clone, PartialEq, Eq, Encode, Decode, RuntimeDebug, TypeInfo)] pub struct Any { @@ -451,7 +452,7 @@ pub mod pallet { counterparty, version: Some(version), delay_period, - signer: Signer::from_str("pallet_ibc").map_err(|_| Error::::DecodingError)?, + signer: Signer::from_str(MODULE_ID).map_err(|_| Error::::DecodingError)?, } .encode_vec() .map_err(|_| Error::::ProcessingError)?; From 67477d5c0f558f2a9a605349ce0e22ce462b0839 Mon Sep 17 00:00:00 2001 From: David Salami Date: Fri, 17 Jun 2022 11:37:49 +0100 Subject: [PATCH 4/5] minor fixes --- frame/ibc/Cargo.toml | 2 +- frame/ibc/src/tests.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frame/ibc/Cargo.toml b/frame/ibc/Cargo.toml index 53fe4c344d9..629b759f0a5 100644 --- a/frame/ibc/Cargo.toml +++ b/frame/ibc/Cargo.toml @@ -44,7 +44,7 @@ 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 } -#temporary dependencies +# 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 } diff --git a/frame/ibc/src/tests.rs b/frame/ibc/src/tests.rs index 2eb439143fe..5ac3b1d4139 100644 --- a/frame/ibc/src/tests.rs +++ b/frame/ibc/src/tests.rs @@ -1,4 +1,4 @@ -use crate::{mock::*, Any, ConnectionParams}; +use crate::{mock::*, Any, ConnectionParams, MODULE_ID}; use frame_support::{assert_ok, traits::Get}; use ibc::{ core::{ @@ -35,7 +35,7 @@ fn initialize_connection() { let msg = MsgCreateAnyClient::new( AnyClientState::Mock(mock_client_state), Some(AnyConsensusState::Mock(mock_cs_state)), - Signer::from_str("relayer").unwrap(), + Signer::from_str(MODULE_ID).unwrap(), ) .unwrap() .encode_vec() @@ -73,7 +73,7 @@ fn should_open_a_channel() { let msg = MsgCreateAnyClient::new( AnyClientState::Mock(mock_client_state), Some(AnyConsensusState::Mock(mock_cs_state)), - Signer::from_str("relayer").unwrap(), + Signer::from_str(MODULE_ID).unwrap(), ) .unwrap() .encode_vec() @@ -123,7 +123,7 @@ fn should_send_ping_packet() { let msg = MsgCreateAnyClient::new( AnyClientState::Mock(mock_client_state), Some(AnyConsensusState::Mock(mock_cs_state)), - Signer::from_str("relayer").unwrap(), + Signer::from_str(MODULE_ID).unwrap(), ) .unwrap() .encode_vec() @@ -170,7 +170,7 @@ fn should_send_ping_packet() { ) .unwrap(), version: ConnVersion::default(), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), } .encode_vec() .unwrap(); @@ -208,7 +208,7 @@ fn should_send_ping_packet() { Height::new(0, 1), ) .unwrap(), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), } .encode_vec() .unwrap(); From 9f36f5945b870755b3ae6d17811fd46a31d004b2 Mon Sep 17 00:00:00 2001 From: David Salami Date: Fri, 17 Jun 2022 12:06:18 +0100 Subject: [PATCH 5/5] minor fix --- .../benchmarks/tendermint_benchmark_utils.rs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs b/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs index 38529371824..c30e0eb0361 100644 --- a/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs +++ b/frame/ibc/src/benchmarks/tendermint_benchmark_utils.rs @@ -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::{ @@ -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::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), } } // Proof generation process for all tendermint benchmarks @@ -263,7 +263,7 @@ pub fn create_conn_open_try() -> (ConsensusState, MsgConnectionOpenTr ) .unwrap(), delay_period, - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -366,7 +366,7 @@ pub fn create_conn_open_ack() -> (ConsensusState, MsgConnectionOpenAc ) .unwrap(), version: ConnVersion::default(), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -454,7 +454,7 @@ pub fn create_conn_open_confirm() -> (ConsensusState, MsgConnectionOp Height::new(0, 2), ) .unwrap(), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -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::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -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::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -627,7 +627,7 @@ 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::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -637,7 +637,7 @@ pub fn create_chan_close_init() -> MsgChannelCloseInit { MsgChannelCloseInit { port_id, channel_id: ChannelId::new(0), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), } } @@ -690,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::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -755,7 +755,7 @@ where packet, proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2)) .unwrap(), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -825,7 +825,7 @@ where acknowledgement: ack.into(), proofs: Proofs::new(buf.try_into().unwrap(), None, None, None, Height::new(0, 2)) .unwrap(), - signer: Signer::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) } @@ -890,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::from_str("relayer").unwrap(), + signer: Signer::from_str(MODULE_ID).unwrap(), }, ) }