diff --git a/Cargo.lock b/Cargo.lock index c82489a..6616e48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "ahash" version = "0.7.8" @@ -31,12 +46,105 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "autocfg" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "backtrace" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -67,6 +175,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "blake2" version = "0.10.6" @@ -332,6 +446,7 @@ dependencies = [ "cw-ibc-lite-shared", "cw-storage-plus", "cw2", + "ibc-client-cw", "ibc-core-host", "schemars", "serde", @@ -347,6 +462,7 @@ dependencies = [ "cw-ownable", "ibc-client-cw", "ibc-core-host", + "ibc-proto", "schemars", "serde", "sha2 0.10.8", @@ -543,7 +659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek", - "hashbrown", + "hashbrown 0.12.3", "hex", "rand_core 0.6.4", "serde", @@ -576,6 +692,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "ff" version = "0.13.0" @@ -595,6 +717,12 @@ dependencies = [ "paste", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "forward_ref" version = "1.0.0" @@ -684,6 +812,12 @@ dependencies = [ "wasi", ] +[[package]] +name = "gimli" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" + [[package]] name = "group" version = "0.13.0" @@ -695,6 +829,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -704,6 +857,12 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + [[package]] name = "hex" version = "0.4.3" @@ -719,6 +878,76 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "ibc-client-cw" version = "0.53.0" @@ -1083,6 +1312,7 @@ dependencies = [ "serde", "subtle-encoding", "tendermint-proto", + "tonic", ] [[package]] @@ -1104,6 +1334,26 @@ dependencies = [ "sha3", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", +] + [[package]] name = "informalsystems-pbjson" version = "0.7.0" @@ -1158,6 +1408,44 @@ version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -1173,6 +1461,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -1191,6 +1488,32 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -1219,6 +1542,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "proc-macro2" version = "1.0.84" @@ -1269,6 +1598,27 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -1303,6 +1653,18 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustversion" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" + [[package]] name = "ryu" version = "1.0.18" @@ -1468,6 +1830,25 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spki" version = "0.7.3" @@ -1527,6 +1908,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "tendermint" version = "0.36.0" @@ -1635,6 +2022,151 @@ dependencies = [ "time-core", ] +[[package]] +name = "tokio" +version = "1.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64 0.21.7", + "bytes", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.66", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -1653,12 +2185,160 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index 49eb39b..1c59dcc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,3 +46,4 @@ ibc-client-tendermint = { version = "0.53.0", default-features = false, features cw-ibc-lite-shared = { version = "0.1.0", path = "./packages/shared/" } cw-ibc-lite-ics02-client = { version = "0.1.0", path = "./contracts/ics02-client/", default-features = false } sha2 = "0.10.8" +ibc-proto = "0.44.0" diff --git a/contracts/ics26-router/Cargo.toml b/contracts/ics26-router/Cargo.toml index 24c7c07..5b651c4 100644 --- a/contracts/ics26-router/Cargo.toml +++ b/contracts/ics26-router/Cargo.toml @@ -27,3 +27,4 @@ thiserror = { workspace = true } ibc-core-host = { workspace = true } cw-ibc-lite-shared = { workspace = true } cw-ibc-lite-ics02-client = { workspace = true } +ibc-client-cw = { workspace = true } diff --git a/contracts/ics26-router/src/contract.rs b/contracts/ics26-router/src/contract.rs index c352dd0..7d9b1b6 100644 --- a/contracts/ics26-router/src/contract.rs +++ b/contracts/ics26-router/src/contract.rs @@ -1,6 +1,6 @@ //! This module handles the execution logic of the contract. -use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Response}; +use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Reply, Response}; use cw_ibc_lite_ics02_client as ics02_client; @@ -112,6 +112,19 @@ pub fn execute( } } +/// Handles the replies to the submessages. +/// +/// # Errors +/// Will return an error if the handler returns an error. +#[cosmwasm_std::entry_point] +#[allow(clippy::needless_pass_by_value)] +pub fn reply(_deps: DepsMut, _env: Env, msg: Reply) -> Result { + match msg.id { + keys::reply::ON_RECV_PACKET => todo!(), + _ => Err(ContractError::UnknownReplyId(msg.id)), + } +} + /// Handles the query messages by routing them to the respective handlers. /// /// # Errors @@ -129,9 +142,9 @@ mod execute { use super::{keys, state, ContractError, DepsMut, Env, MessageInfo, Response}; - use cosmwasm_std::{Binary, IbcTimeout}; + use cosmwasm_std::{Binary, IbcTimeout, SubMsg}; - use cw_ibc_lite_ics02_client as client; + use cw_ibc_lite_ics02_client as ics02_client; use cw_ibc_lite_shared::{ types::{ apps, @@ -140,6 +153,8 @@ mod execute { utils, }; + use ibc_client_cw::types::VerifyMembershipMsgRaw; + #[allow(clippy::too_many_arguments, clippy::needless_pass_by_value)] pub fn send_packet( deps: DepsMut, @@ -153,7 +168,7 @@ mod execute { timeout: IbcTimeout, ) -> Result { let ics02_address = state::ICS02_CLIENT_ADDRESS.load(deps.storage)?; - let ics02_contract = client::helpers::Ics02ClientContract::new(ics02_address); + let ics02_contract = ics02_client::helpers::Ics02ClientContract::new(ics02_address); let ibc_app_address = state::IBC_APPS.load(deps.storage, &source_port)?; let ibc_app_contract = apps::helpers::IbcApplicationContract::new(ibc_app_address); @@ -161,7 +176,8 @@ mod execute { // Ensure the counterparty is the destination channel. let counterparty_id = ics02_contract .query(&deps.querier) - .counterparty(&source_channel)?; + .counterparty(&source_channel)? + .client_id; if counterparty_id != dest_channel { return Err(ContractError::invalid_counterparty( counterparty_id, @@ -204,14 +220,63 @@ mod execute { #[allow(clippy::needless_pass_by_value)] pub fn recv_packet( - _deps: DepsMut, + deps: DepsMut, _env: Env, - _info: MessageInfo, - _packet: Packet, - _proof_commitment: Binary, - _proof_height: Height, + info: MessageInfo, + packet: Packet, + proof_commitment: Binary, + proof_height: Height, ) -> Result { - todo!() + let ics02_address = state::ICS02_CLIENT_ADDRESS.load(deps.storage)?; + let ics02_contract = ics02_client::helpers::Ics02ClientContract::new(ics02_address); + + let ibc_app_address = state::IBC_APPS.load(deps.storage, &packet.destination_port)?; + let ibc_app_contract = apps::helpers::IbcApplicationContract::new(ibc_app_address); + + // Verify the + let counterparty = ics02_contract + .query(&deps.querier) + .counterparty(&packet.destination_channel)?; + if counterparty.client_id != packet.source_channel { + return Err(ContractError::invalid_counterparty( + counterparty.client_id, + packet.source_channel, + )); + } + + // NOTE: Verify the packet commitment. + let counterparty_commitment_path = state::packet_commitment_item::new( + &packet.source_port, + &packet.source_channel, + packet.sequence, + ) + .try_into()?; + let verify_membership_msg = VerifyMembershipMsgRaw { + proof: proof_commitment.into(), + path: counterparty_commitment_path, + value: packet.to_commitment_bytes(), + height: proof_height.into(), + delay_time_period: 0, + delay_block_period: 0, + }; + let _ = ics02_contract + .query(&deps.querier) + .client_querier(&packet.destination_channel)? + .verify_membership(verify_membership_msg)?; + + state::helpers::set_packet_receipt(deps.storage, &packet)?; + + // NOTE: We must retreive a reply from the IBC app to set the acknowledgement. + let callback_msg = apps::callbacks::IbcAppCallbackMsg::OnRecvPacket { + packet, + relayer: info.sender.into(), + }; + let recv_packet_callback = SubMsg::reply_on_success( + ibc_app_contract.call(callback_msg)?, + keys::reply::ON_RECV_PACKET, + ); + + Ok(Response::new().add_submessage(recv_packet_callback)) } #[allow(clippy::needless_pass_by_value)] @@ -251,6 +316,7 @@ mod execute { let contract_address = deps.api.addr_validate(&contract_address)?; let port_id = if let Some(port_id) = port_id { // NOTE: Only the admin can register an IBC app with a custom port ID. + // TODO: Add restrictions to the custom port ID. Such as not using `/`. state::admin::assert_admin(&env, &deps.querier, &info.sender)?; port_id } else { diff --git a/contracts/ics26-router/src/types/keys.rs b/contracts/ics26-router/src/types/keys.rs index 54ff8b3..4841020 100644 --- a/contracts/ics26-router/src/types/keys.rs +++ b/contracts/ics26-router/src/types/keys.rs @@ -16,6 +16,6 @@ pub const ICS02_CLIENT_SALT: &str = "ics02_client"; /// Contains the reply ids for various `SubMsg` replies pub mod reply { - /// `ON_SEND_PACKET` is the reply id for the `OnSendPacket` callback reply - pub const ON_SEND_PACKET: u64 = 1; + /// `ON_RECV_PACKET` is the reply id for the `on_recv_packet` reply + pub const ON_RECV_PACKET: u64 = 1; } diff --git a/contracts/ics26-router/src/types/state.rs b/contracts/ics26-router/src/types/state.rs index 96e84ce..2ac9802 100644 --- a/contracts/ics26-router/src/types/state.rs +++ b/contracts/ics26-router/src/types/state.rs @@ -161,4 +161,29 @@ pub mod helpers { item.save(storage, &packet.to_commitment_bytes()); Ok(()) } + + /// Sets the packet receipt in the provable packet receipt store. + /// This is used to prevent replay. + /// + /// # Errors + /// Returns an error if the receipt has already been committed. + pub fn set_packet_receipt( + storage: &mut dyn Storage, + packet: &Packet, + ) -> Result<(), ContractError> { + let item = super::packet_receipt_item::new( + &packet.destination_port, + &packet.destination_channel, + packet.sequence, + ); + + if item.exists(storage) { + return Err(ContractError::packet_already_commited( + item.as_slice().to_vec(), + )); + } + + item.save(storage, &[1]); + Ok(()) + } } diff --git a/packages/shared/Cargo.toml b/packages/shared/Cargo.toml index 75fbc9d..0d41def 100644 --- a/packages/shared/Cargo.toml +++ b/packages/shared/Cargo.toml @@ -17,3 +17,4 @@ ibc-core-host = { workspace = true } ibc-client-cw = { workspace = true } cw-ownable = { workspace = true } sha2 = { workspace = true } +ibc-proto = { workspace = true } diff --git a/packages/shared/src/types/error.rs b/packages/shared/src/types/error.rs index b34726c..d3366f4 100644 --- a/packages/shared/src/types/error.rs +++ b/packages/shared/src/types/error.rs @@ -12,6 +12,10 @@ pub enum ContractError { Std(#[from] StdError), #[error("{0}")] OwnershipError(#[from] cw_ownable::OwnershipError), + #[error("{0}")] + FromUTF8Error(#[from] std::string::FromUtf8Error), + #[error("{0}")] + UTF8Error(#[from] std::str::Utf8Error), #[error("unauthorized")] Unauthorized, @@ -23,6 +27,8 @@ pub enum ContractError { source_type: String, target_type: String, }, + #[error("unknown reply id: {0}")] + UnknownReplyId(u64), #[error("counterparty already provided")] CounterpartyAlreadyProvided, diff --git a/packages/shared/src/types/ibc.rs b/packages/shared/src/types/ibc.rs index d9dba39..da9c8b9 100644 --- a/packages/shared/src/types/ibc.rs +++ b/packages/shared/src/types/ibc.rs @@ -43,6 +43,13 @@ pub struct Height { pub revision_height: u64, } +// /// `MerklePath` is the path used to verify commitment proofs, which can be an +// /// arbitrary structured object (defined by a commitment type). +// /// `MerklePath` is represented from root-to-leaf +// pub struct MerklePath { +// pub key_path: Vec, +// } + impl Packet { /// `to_commitment_bytes` serializes the packet to commitment bytes as per [ibc-lite go implementation](https://github.com/cosmos/ibc-go/blob/2b40562bcd59ce820ddd7d6732940728487cf94e/modules/core/04-channel/types/packet.go#L38) /// @@ -68,3 +75,12 @@ impl Packet { sha2::Sha256::digest(&buf).to_vec() } } + +impl From for ibc_proto::ibc::core::client::v1::Height { + fn from(height: Height) -> Self { + Self { + revision_number: height.revision_number, + revision_height: height.revision_height, + } + } +} diff --git a/packages/shared/src/types/storage.rs b/packages/shared/src/types/storage.rs index a522f13..1c48161 100644 --- a/packages/shared/src/types/storage.rs +++ b/packages/shared/src/types/storage.rs @@ -1,6 +1,7 @@ //! This module defines the `CosmWasm` storage helper types. use cosmwasm_std::{Addr, CustomQuery, QuerierWrapper, StdResult, Storage}; +use ibc_client_cw::types::MerklePath; use super::error::ContractError; @@ -56,7 +57,7 @@ impl PureItem { } /// If you import [`PureItem`] from the remote contract, this will let you read the data - /// from a remote contract using [`WasmQuery::Raw`]. Returns `Ok(None)` if no data is set. + /// from a remote contract using [`cosmwasm_std::WasmQuery::Raw`]. Returns `Ok(None)` if no data is set. /// /// # Errors /// It only returns error on some runtime issue, not on any data cases. @@ -67,6 +68,47 @@ impl PureItem { ) -> StdResult>> { querier.query_wasm_raw(remote_contract, self.as_slice()) } + + /// This will convert the [`PureItem`] into a [`MerklePath`]. + /// This is useful when you want to use the key for remote proofs. + /// + /// # Errors + /// It returns an error if the key is not valid UTF-8. + pub fn into_merkle_path_with_prefix( + self, + merkle_prefix: Option, + ) -> Result { + if let Some(mut prefix) = merkle_prefix { + let last_mut = prefix.key_path.last_mut(); + if let Some(last) = last_mut { + let key = String::from_utf8(self.storage_key)?; + last.push_str(&key); + Ok(prefix) + } else { + self.try_into() + } + } else { + self.try_into() + } + } +} + +impl TryFrom for MerklePath { + type Error = ContractError; + + fn try_from(item: PureItem) -> Result { + Ok(Self { + key_path: vec![item.try_into()?], + }) + } +} + +impl TryFrom for String { + type Error = ContractError; + + fn try_from(item: PureItem) -> Result { + Ok(Self::from_utf8(item.storage_key)?) + } } /// Includes the helpers for constructing a [`cosmwasm_std::DepsMut`] from an [`cosmwasm_std::Deps`].