diff --git a/Cargo.lock b/Cargo.lock index 22f3f08..3317db7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,12 +67,6 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" -[[package]] -name = "bech32" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" - [[package]] name = "blake2" version = "0.10.6" @@ -113,12 +107,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bnum" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d" - [[package]] name = "bnum" version = "0.10.0" @@ -166,9 +154,9 @@ checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "cosmwasm-crypto" -version = "1.5.2" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ed6aa9f904de106fa16443ad14ec2abe75e94ba003bb61c681c0e43d4c58d2a" +checksum = "e6b4c3f9c4616d6413d4b5fc4c270a4cc32a374b9be08671e80e1a019f805d8f" dependencies = [ "digest 0.10.7", "ecdsa", @@ -178,57 +166,22 @@ dependencies = [ "thiserror", ] -[[package]] -name = "cosmwasm-crypto" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd7a367ebd007cb05fe17e9c449beeb3636b15160750f2c6226c7dfd46df37" -dependencies = [ - "digest 0.10.7", - "ed25519-zebra", - "k256", - "rand_core 0.6.4", - "thiserror", -] - -[[package]] -name = "cosmwasm-derive" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5e72e330bd3bdab11c52b5ecbdeb6a8697a004c57964caeb5d876f0b088b3c" -dependencies = [ - "syn 1.0.109", -] - [[package]] name = "cosmwasm-derive" -version = "2.0.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db01ae480b00f133b78830db3211ff63afe08093e78c77ee20e73f7134849a60" +checksum = "c586ced10c3b00e809ee664a895025a024f60d65d34fe4c09daed4a4db68a3f3" dependencies = [ "syn 1.0.109", ] [[package]] name = "cosmwasm-schema" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e3a2136e2a60e8b6582f5dffca5d1a683ed77bf38537d330bc1dfccd69010" -dependencies = [ - "cosmwasm-schema-derive 1.5.3", - "schemars", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "cosmwasm-schema" -version = "2.0.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6e530d13452b4e9d882008193ab165032307a31f197b45d7b4e2aeff7577b5" +checksum = "8467874827d384c131955ff6f4d47d02e72a956a08eb3c0ff24f8c903a5517b4" dependencies = [ - "cosmwasm-schema-derive 2.0.1", + "cosmwasm-schema-derive", "schemars", "serde", "serde_json", @@ -237,20 +190,9 @@ dependencies = [ [[package]] name = "cosmwasm-schema-derive" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d803bea6bd9ed61bd1ee0b4a2eb09ee20dbb539cc6e0b8795614d20952ebb1" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cosmwasm-schema-derive" -version = "2.0.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ef0d7a8ae8807b8e8f5c94333d12aa9a11efc05f7b864f362582a2b167c663" +checksum = "f6db85d98ac80922aef465e564d5b21fa9cfac5058cb62df7f116c3682337393" dependencies = [ "proc-macro2", "quote", @@ -259,43 +201,21 @@ dependencies = [ [[package]] name = "cosmwasm-std" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad011ae7447188e26e4a7dbca2fcd0fc186aa21ae5c86df0503ea44c78f9e469" -dependencies = [ - "base64 0.21.7", - "bech32 0.9.1", - "bnum 0.8.1", - "cosmwasm-crypto 1.5.2", - "cosmwasm-derive 1.5.3", - "derivative", - "forward_ref", - "hex", - "schemars", - "serde", - "serde-json-wasm 0.5.2", - "sha2 0.10.8", - "static_assertions", - "thiserror", -] - -[[package]] -name = "cosmwasm-std" -version = "2.0.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6201969327d8fe5e9596e8c36e376ab595a885bdfcaa6a0bf57748f9ea2be2b" +checksum = "712fe58f39d55c812f7b2c84e097cdede3a39d520f89b6dc3153837e31741927" dependencies = [ "base64 0.21.7", - "bech32 0.9.1", - "bnum 0.10.0", - "cosmwasm-crypto 2.0.1", - "cosmwasm-derive 2.0.1", + "bech32", + "bnum", + "cosmwasm-crypto", + "cosmwasm-derive", "derivative", "forward_ref", "hex", "schemars", "serde", - "serde-json-wasm 1.0.1", + "serde-json-wasm", "sha2 0.10.8", "static_assertions", "thiserror", @@ -358,48 +278,15 @@ dependencies = [ "zeroize", ] -[[package]] -name = "cw-multi-test" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b69c1ba533753a2c90e60f4c803f52ee80cf3ba183c3ca0645fd1796561951" -dependencies = [ - "anyhow", - "bech32 0.11.0", - "cosmwasm-std 2.0.1", - "cw-storage-plus", - "cw-utils", - "derivative", - "itertools", - "prost", - "schemars", - "serde", - "sha2 0.10.8", - "thiserror", -] - [[package]] name = "cw-storage-plus" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f13360e9007f51998d42b1bc6b7fa0141f74feae61ed5fd1e5b0a89eec7b5de1" -dependencies = [ - "cosmwasm-std 2.0.1", - "schemars", - "serde", -] - -[[package]] -name = "cw-utils" -version = "2.0.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07dfee7f12f802431a856984a32bce1cb7da1e6c006b5409e3981035ce562dec" +checksum = "d5ff29294ee99373e2cd5fd21786a3c0ced99a52fec2ca347d565489c61b723c" dependencies = [ - "cosmwasm-schema 2.0.1", - "cosmwasm-std 2.0.1", + "cosmwasm-std", "schemars", "serde", - "thiserror", ] [[package]] @@ -558,16 +445,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "eyre" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" -dependencies = [ - "indenter", - "once_cell", -] - [[package]] name = "ff" version = "0.13.0" @@ -584,7 +461,6 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c606d892c9de11507fa0dcffc116434f94e105d0bbdc4e405b61519464c49d7b" dependencies = [ - "eyre", "paste", ] @@ -714,11 +590,12 @@ dependencies = [ [[package]] name = "ibc-client-cw" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ - "cosmwasm-schema 1.5.3", - "cosmwasm-std 1.5.2", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus", "derive_more", "ibc-client-wasm-types", "ibc-core", @@ -728,8 +605,8 @@ dependencies = [ [[package]] name = "ibc-client-tendermint" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "ibc-client-tendermint-types", @@ -745,8 +622,8 @@ dependencies = [ [[package]] name = "ibc-client-tendermint-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "displaydoc", "ibc-core-client-types", @@ -762,11 +639,11 @@ dependencies = [ [[package]] name = "ibc-client-wasm-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "base64 0.21.7", - "cosmwasm-schema 1.5.3", + "cosmwasm-schema", "displaydoc", "ibc-core-client", "ibc-core-host-types", @@ -777,8 +654,8 @@ dependencies = [ [[package]] name = "ibc-core" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -793,8 +670,8 @@ dependencies = [ [[package]] name = "ibc-core-channel" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "ibc-core-channel-types", "ibc-core-client", @@ -808,8 +685,8 @@ dependencies = [ [[package]] name = "ibc-core-channel-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -828,8 +705,8 @@ dependencies = [ [[package]] name = "ibc-core-client" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "ibc-core-client-context", "ibc-core-client-types", @@ -841,8 +718,8 @@ dependencies = [ [[package]] name = "ibc-core-client-context" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -857,8 +734,8 @@ dependencies = [ [[package]] name = "ibc-core-client-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -874,8 +751,8 @@ dependencies = [ [[package]] name = "ibc-core-commitment-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -889,8 +766,8 @@ dependencies = [ [[package]] name = "ibc-core-connection" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "ibc-core-client", "ibc-core-connection-types", @@ -901,8 +778,8 @@ dependencies = [ [[package]] name = "ibc-core-connection-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -919,8 +796,8 @@ dependencies = [ [[package]] name = "ibc-core-handler" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -934,8 +811,8 @@ dependencies = [ [[package]] name = "ibc-core-handler-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -955,8 +832,8 @@ dependencies = [ [[package]] name = "ibc-core-host" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -973,8 +850,8 @@ dependencies = [ [[package]] name = "ibc-core-host-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -985,8 +862,8 @@ dependencies = [ [[package]] name = "ibc-core-router" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -999,8 +876,8 @@ dependencies = [ [[package]] name = "ibc-core-router-types" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -1015,8 +892,8 @@ dependencies = [ [[package]] name = "ibc-derive" -version = "0.6.1" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.7.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "proc-macro2", "quote", @@ -1025,8 +902,8 @@ dependencies = [ [[package]] name = "ibc-primitives" -version = "0.51.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=80b8084#80b8084c0415a4636e71a0f4520e18ad3c1dae16" +version = "0.52.0" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=4ea4dcb#4ea4dcb863efa12f5628a05588e2207112035e4a" dependencies = [ "derive_more", "displaydoc", @@ -1040,10 +917,10 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.42.2" -source = "git+https://github.com/cosmos/ibc-proto-rs.git?rev=6d57834e03b5a3789c8d32a04c833d8926fad27b#6d57834e03b5a3789c8d32a04c833d8926fad27b" +version = "0.44.0" +source = "git+https://github.com/cosmos/ibc-proto-rs.git?rev=a70f7e9cc896c1a707a907e09ec340771a50c326#a70f7e9cc896c1a707a907e09ec340771a50c326" dependencies = [ - "base64 0.21.7", + "base64 0.22.0", "bytes", "flex-error", "ics23", @@ -1074,12 +951,6 @@ dependencies = [ "sha3", ] -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - [[package]] name = "informalsystems-pbjson" version = "0.7.0" @@ -1107,9 +978,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "k256" -version = "0.13.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" dependencies = [ "cfg-if", "ecdsa", @@ -1140,17 +1011,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "num-traits" version = "0.2.18" @@ -1295,9 +1155,8 @@ name = "rollkit-ibc" version = "0.1.0" dependencies = [ "base64 0.22.0", - "cosmwasm-schema 1.5.3", - "cosmwasm-std 1.5.2", - "cw-multi-test", + "cosmwasm-schema", + "cosmwasm-std", "ibc-client-cw", "ibc-client-tendermint", "ibc-core", @@ -1370,15 +1229,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde-json-wasm" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05da0d153dd4595bdffd5099dc0e9ce425b205ee648eb93437ff7302af8c9a5" -dependencies = [ - "serde", -] - [[package]] name = "serde_bytes" version = "0.11.14" @@ -1537,9 +1387,9 @@ dependencies = [ [[package]] name = "tendermint" -version = "0.34.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15ab8f0a25d0d2ad49ac615da054d6a76aa6603ff95f7d18bafdd34450a1a04b" +checksum = "8b50aae6ec24c3429149ad59b5b8d3374d7804d4c7d6125ceb97cb53907fb68d" dependencies = [ "bytes", "digest 0.10.7", @@ -1566,9 +1416,9 @@ dependencies = [ [[package]] name = "tendermint-light-client-verifier" -version = "0.34.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b8090d0eef9ad57b1b913b5e358e26145c86017e87338136509b94383a4af25" +checksum = "4216e487165e5dbd7af79952eaa0d5f06c5bde861eb76c690acd7f2d2a19395c" dependencies = [ "derive_more", "flex-error", @@ -1579,14 +1429,12 @@ dependencies = [ [[package]] name = "tendermint-proto" -version = "0.34.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b797dd3d2beaaee91d2f065e7bdf239dc8d80bba4a183a288bc1279dd5a69a1e" +checksum = "46f193d04afde6592c20fd70788a10b8cb3823091c07456db70d8a93f5fb99c1" dependencies = [ "bytes", "flex-error", - "num-derive", - "num-traits", "prost", "prost-types", "serde", diff --git a/Cargo.toml b/Cargo.toml index afb5dd6..5a46775 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,19 +37,16 @@ optimize = """docker run --rm -v "$(pwd)":/code \ [dependencies] base64 = "0.22.0" -cosmwasm-schema = "1.5.2" -cosmwasm-std = "1.5.2" -ibc-core = { git = "https://github.com/cosmos/ibc-rs.git", rev = "80b8084", default-features = false, features = ["schema"] } -ibc-core-host = { git = "https://github.com/cosmos/ibc-rs.git", rev = "80b8084", default-features = false, features = ["schema"] } -ibc-client-tendermint = { git = "https://github.com/cosmos/ibc-rs.git", rev = "80b8084", default-features = false, features = ["schema"] } -ibc-client-cw = { git = "https://github.com/cosmos/ibc-rs.git", rev = "80b8084", default-features = false } -ibc-proto = { version = "0.42.2", default-features = false } -prost = "0.12.3" -tendermint = "0.34.1" -tendermint-light-client-verifier = "0.34.1" +cosmwasm-schema = "1.5.4" +cosmwasm-std = "1.5.4" +ibc-core = { git = "https://github.com/cosmos/ibc-rs.git", rev = "4ea4dcb", default-features = false, features = ["schema"] } +ibc-core-host = { git = "https://github.com/cosmos/ibc-rs.git", rev = "4ea4dcb", default-features = false, features = ["schema"] } +ibc-client-tendermint = { git = "https://github.com/cosmos/ibc-rs.git", rev = "4ea4dcb", default-features = false, features = ["schema"] } +ibc-client-cw = { git = "https://github.com/cosmos/ibc-rs.git", rev = "4ea4dcb", default-features = false } +ibc-proto = { version = "0.44.0", default-features = false } +prost = "0.12.4" +tendermint = "0.36.0" +tendermint-light-client-verifier = "0.36.0" [patch.crates-io] -ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "6d57834e03b5a3789c8d32a04c833d8926fad27b", default-features = false } # "0.42.2" - -[dev-dependencies] -cw-multi-test = "2.0.0" +ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "a70f7e9cc896c1a707a907e09ec340771a50c326", default-features = false } # "0.42.2" diff --git a/src/client_state/common.rs b/src/client_state/common.rs index a245d22..9c962c8 100644 --- a/src/client_state/common.rs +++ b/src/client_state/common.rs @@ -14,8 +14,8 @@ use crate::client_state::{rollkit_client_type, ClientState}; impl ClientStateCommon for ClientState { fn verify_consensus_state(&self, consensus_state: Any) -> Result<(), ClientError> { - let tm_consensus_state = ConsensusState::try_from(consensus_state)?; - if tm_consensus_state.root().is_empty() { + let tendermint_consensus_state = ConsensusState::try_from(consensus_state)?; + if tendermint_consensus_state.root().is_empty() { return Err(ClientError::Other { description: "empty commitment root".into(), }); diff --git a/src/client_state/definition.rs b/src/client_state/definition.rs index 16437be..ec12273 100644 --- a/src/client_state/definition.rs +++ b/src/client_state/definition.rs @@ -1,4 +1,6 @@ +use ibc_core::client::types::Height; use ibc_client_tendermint::client_state::ClientState as TendermintClientState; +use ibc_client_tendermint::types::ClientState as TendermintClientStateType; use ibc_core::client::types::error::ClientError; use ibc_proto::ibc::lightclients::rollkit::v1::ClientState as RawClientState; @@ -15,23 +17,30 @@ pub const ROLLKIT_CLIENT_STATE_TYPE_URL: &str = "/ibc.lightclients.rollkit.v1.Cl #[derive(Clone, Debug, PartialEq)] pub struct ClientState { pub tendermint_client_state: TendermintClientState, - pub da_params: DaParams, + pub da_params: Option, } impl ClientState { pub fn new(tendermint_client_state: TendermintClientState, da_params: DaParams) -> Self { Self { tendermint_client_state, - da_params, + da_params: Some(da_params), } } - pub fn da_client_id(&self) -> &ClientId { - &self.da_params.client_id + pub fn da_client_id(&self) -> Option { + self.da_params.as_ref().map(|da_params| da_params.client_id.clone()) } - pub fn da_fraud_period_window(&self) -> u64 { - self.da_params.fraud_period_window + pub fn da_fraud_period_window(&self) -> Option { + self.da_params.as_ref().map(|da_params| da_params.fraud_period_window) + } + + pub fn with_frozen_height(self, h: Height) -> Self { + Self { + tendermint_client_state: self.tendermint_client_state.inner().clone().with_frozen_height(h).into(), + ..self + } } } @@ -59,7 +68,7 @@ impl From for RawClientState { fn from(value: ClientState) -> Self { Self { tendermint_client_state: Some(value.tendermint_client_state.into()), - da_params: Some(value.da_params.into()), + da_params: value.da_params.map(|da_params|da_params.into()), } } } @@ -88,6 +97,23 @@ impl TryFrom for ClientState { } } +impl From for ClientState { + fn from(value: TendermintClientStateType) -> Self { + ClientState { + tendermint_client_state: value.into(), + da_params: Default::default(), + } + } +} + +impl TryFrom for TendermintClientStateType { + type Error = ClientError; + + fn try_from(value: ClientState) -> Result { + Ok(value.tendermint_client_state.inner().clone()) + } +} + impl From for Any { fn from(client_state: ClientState) -> Self { Any { diff --git a/src/client_state/execution.rs b/src/client_state/execution.rs index 70f56e5..78479fe 100644 --- a/src/client_state/execution.rs +++ b/src/client_state/execution.rs @@ -10,12 +10,15 @@ use ibc_core::primitives::proto::Any; use ibc_core_host::types::path::{ClientConsensusStatePath, ClientStatePath}; use crate::client_state::ClientState; +use crate::client_message::Header; impl ClientStateExecution for ClientState where E: ExtClientExecutionContext, E::ClientStateRef: From, - E::ConsensusStateRef: Convertible, + E::ClientStateMut: From, + TendermintConsensusStateType: Convertible, + ClientError: From<>::Error> { fn initialise( &self, @@ -28,20 +31,20 @@ where fn update_state( &self, - _ctx: &mut E, - _client_id: &ClientId, - _header: Any, + ctx: &mut E, + client_id: &ClientId, + header: Any, ) -> Result, ClientError> { - unimplemented!() + update_state(self, ctx, client_id, header) } fn update_state_on_misbehaviour( &self, - _ctx: &mut E, - _client_id: &ClientId, - _client_message: Any, + ctx: &mut E, + client_id: &ClientId, + client_message: Any, ) -> Result<(), ClientError> { - unimplemented!() + update_on_misbehaviour(self, ctx, client_id, client_message) } // Commit the new client state and consensus state to the store @@ -60,6 +63,7 @@ where _ctx: &mut E, _subject_client_id: &ClientId, _substitute_client_state: Any, + _substitute_consensus_state: Any, ) -> Result<(), ClientError> { unimplemented!() } @@ -79,12 +83,16 @@ pub fn initialise( where E: ExtClientExecutionContext, E::ClientStateRef: From, - E::ConsensusStateRef: Convertible, + TendermintConsensusStateType: Convertible, + ClientError: From<>::Error> { let host_timestamp = ExtClientValidationContext::host_timestamp(ctx)?; let host_height = ExtClientValidationContext::host_height(ctx)?; - let tm_consensus_state = TendermintConsensusStateType::try_from(consensus_state)?; + let tendermint_consensus_state: TendermintConsensusStateType = consensus_state + .clone() + .try_into() + .map_err(|_: ClientError| ClientError::UnknownConsensusStateType { consensus_state_type:consensus_state.type_url })?; ctx.store_client_state( ClientStatePath::new(client_id.clone()), @@ -104,7 +112,7 @@ where .latest_height .revision_height(), ), - E::ConsensusStateRef::from(tm_consensus_state), + tendermint_consensus_state.into(), )?; ctx.store_update_meta( @@ -116,3 +124,61 @@ where Ok(()) } + +/// Update the host store with a new client state, pruning old states from the +/// store if need be. +/// +/// Note that this function is typically implemented as part of the +/// [`ClientStateExecution`] trait, but has been made a standalone function +/// in order to make the ClientState APIs more flexible. +pub fn update_state( + client_state: &ClientState, + ctx: &mut E, + client_id: &ClientId, + header: Any, +) -> Result, ClientError> +where + E: ExtClientExecutionContext, + E::ClientStateRef: From, + E::ClientStateMut: From, + TendermintConsensusStateType: Convertible, + ClientError: From<>::Error>, +{ + let header = Header::try_from(header)?; + return client_state.tendermint_client_state.update_state( + ctx, + client_id, + Any::from(header.tendermint_header), + ) +} + +/// Commit a frozen client state, which was frozen as a result of having exhibited +/// misbehaviour, to the store. +/// +/// Note that this function is typically implemented as part of the +/// [`ClientStateExecution`] trait, but has been made a standalone function +/// in order to make the ClientState APIs more flexible. +pub fn update_on_misbehaviour( + client_state: &ClientState, + ctx: &mut E, + client_id: &ClientId, + _client_message: Any, +) -> Result<(), ClientError> +where + E: ExtClientExecutionContext, + E::ClientStateRef: From, +{ + // NOTE: frozen height is set to `Height {revision_height: 0, + // revision_number: 1}` and it is the same for all misbehaviour. This + // aligns with the + // [`ibc-go`](https://github.com/cosmos/ibc-go/blob/0e3f428e66d6fc0fc6b10d2f3c658aaa5000daf7/modules/light-clients/07-tendermint/misbehaviour.go#L18-L19) + // implementation. + let frozen_client_state = client_state.clone().with_frozen_height(Height::min(0)); + + ctx.store_client_state( + ClientStatePath::new(client_id.clone()), + frozen_client_state.into(), + )?; + + Ok(()) +} \ No newline at end of file diff --git a/src/client_state/validation.rs b/src/client_state/validation.rs index 7e00ea9..6cd1c1a 100644 --- a/src/client_state/validation.rs +++ b/src/client_state/validation.rs @@ -15,7 +15,8 @@ use crate::client_state::ClientState; impl ClientStateValidation for ClientState where V: ExtClientValidationContext, - V::ConsensusStateRef: Convertible, + TendermintConsensusStateType: Convertible, + ClientError: From<>::Error> { fn verify_client_message( &self, @@ -34,11 +35,11 @@ where fn check_for_misbehaviour( &self, - _ctx: &V, - _client_id: &ClientId, - _client_message: Any, + ctx: &V, + client_id: &ClientId, + client_message: Any, ) -> Result { - unimplemented!("verify_client_message") + check_for_misbehaviour(self, ctx, client_id, client_message) } fn status(&self, _ctx: &V, _client_id: &ClientId) -> Result { @@ -68,7 +69,8 @@ pub fn verify_client_message( ) -> Result<(), ClientError> where V: ExtClientValidationContext, - V::ConsensusStateRef: Convertible, + TendermintConsensusStateType: Convertible, + ClientError: From<>::Error> { match client_message.type_url.as_str() { ROLLKIT_HEADER_TYPE_URL => { @@ -85,3 +87,50 @@ where _ => Err(ClientError::InvalidUpdateClientMessage), } } + + +/// Check for misbehaviour on the client state as part of the client state +/// validation process. +/// +/// Note that this function is typically implemented as part of the +/// [`ClientStateValidation`] trait, but has been made a standalone function +/// in order to make the ClientState APIs more flexible. +/// +/// This method covers the following cases: +/// +/// 1 - fork: +/// Assumes at least one consensus state before the fork point exists. Let +/// existing consensus states on chain B be: [Sn,.., Sf, Sf-1, S0] with +/// `Sf-1` being the most recent state before fork. Chain A is queried for a +/// header `Hf'` at `Sf.height` and if it is different than the `Hf` in the +/// event for the client update (the one that has generated `Sf` on chain), +/// then the two headers are included in the evidence and submitted. Note +/// that in this case the headers are different but have the same height. +/// +/// 2 - BFT time violation for unavailable header (a.k.a. Future Lunatic +/// Attack or FLA): +/// Some header with a height that is higher than the latest height on A has +/// been accepted and a consensus state was created on B. Note that this +/// implies that the timestamp of this header must be within the +/// `clock_drift` of the client. Assume the client on B has been updated +/// with `h2`(not present on/ produced by chain A) and it has a timestamp of +/// `t2` that is at most `clock_drift` in the future. Then the latest header +/// from A is fetched, let it be `h1`, with a timestamp of `t1`. If `t1 >= +/// t2` then evidence of misbehavior is submitted to A. +/// +/// 3 - BFT time violation for existing headers: +/// Ensure that consensus state times are monotonically increasing with +/// height. +pub fn check_for_misbehaviour( + client_state: &ClientState, + ctx: &V, + client_id: &ClientId, + client_message: Any, +) -> Result +where + V: ExtClientValidationContext, + TendermintConsensusStateType: Convertible, + ClientError: From<>::Error> +{ + return client_state.tendermint_client_state.check_for_misbehaviour(ctx, client_id, client_message) +} \ No newline at end of file diff --git a/src/types/client_type.rs b/src/types/client_type.rs index 13f1e74..4d80f56 100644 --- a/src/types/client_type.rs +++ b/src/types/client_type.rs @@ -1,11 +1,11 @@ use ibc_client_cw::api::ClientType; +use ibc_client_tendermint::consensus_state::ConsensusState as TendermintConsensusState; use crate::client_state::ClientState as RollkitClientState; -use crate::consensus_state::AnyConsensusState; pub struct RollkitClient; impl<'a> ClientType<'a> for RollkitClient { type ClientState = RollkitClientState; - type ConsensusState = AnyConsensusState; + type ConsensusState = TendermintConsensusState; }