diff --git a/.vscode/settings.json b/.vscode/settings.json index d610dec8..0f291d3b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,8 @@ { "rust-analyzer.linkedProjects": [ + "./clients/sov-celestia-cw/Cargo.toml", "./ci/risc0-check/methods/guest/Cargo.toml", - "./ci/risc0-check/host/Cargo.toml" + "./ci/risc0-check/host/Cargo.toml", ], "cSpell.words": [ "jsonrpsee", diff --git a/Cargo.lock b/Cargo.lock index a5231780..1236990e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -402,7 +402,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basecoin-app" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ccbea55#ccbea55541e903b3c654c7c394ed2ce3933696e7" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=4de5278#4de5278cf8bec4399d0104130f9cbee27bd27a67" dependencies = [ "base64 0.21.7", "basecoin-store", @@ -420,7 +420,7 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.10.8", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", "tendermint 0.34.0", "tendermint-proto 0.34.0", "tendermint-rpc", @@ -437,7 +437,7 @@ dependencies = [ [[package]] name = "basecoin-store" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ccbea55#ccbea55541e903b3c654c7c394ed2ce3933696e7" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=4de5278#4de5278cf8bec4399d0104130f9cbee27bd27a67" dependencies = [ "displaydoc", "ics23", @@ -1292,9 +1292,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" +checksum = "c376d08ea6aa96aafe61237c7200d1241cb177b7d3a542d791f2d118e9cbb955" dependencies = [ "darling_core", "darling_macro", @@ -1302,9 +1302,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" +checksum = "33043dcd19068b8192064c704b3f83eb464f91f1ff527b44a4e2b08d9cdb8855" dependencies = [ "fnv", "ident_case", @@ -1315,9 +1315,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.5" +version = "0.20.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" +checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" dependencies = [ "darling_core", "quote", @@ -2171,7 +2171,7 @@ dependencies = [ [[package]] name = "ibc" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-apps", "ibc-clients", @@ -2184,7 +2184,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-app-nft-transfer-types", "ibc-core", @@ -2194,7 +2194,7 @@ dependencies = [ [[package]] name = "ibc-app-nft-transfer-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "base64 0.21.7", "borsh", @@ -2214,7 +2214,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-app-transfer-types", "ibc-core", @@ -2224,7 +2224,7 @@ dependencies = [ [[package]] name = "ibc-app-transfer-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2240,7 +2240,7 @@ dependencies = [ [[package]] name = "ibc-apps" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-app-nft-transfer", "ibc-app-transfer", @@ -2249,7 +2249,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-client-tendermint-types", "ibc-core-client", @@ -2265,7 +2265,7 @@ dependencies = [ [[package]] name = "ibc-client-tendermint-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "displaydoc", "ibc-core-client-types", @@ -2282,7 +2282,7 @@ dependencies = [ [[package]] name = "ibc-client-wasm-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "base64 0.21.7", "cosmwasm-schema", @@ -2297,7 +2297,7 @@ dependencies = [ [[package]] name = "ibc-clients" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-client-tendermint", "ibc-client-wasm-types", @@ -2306,7 +2306,7 @@ dependencies = [ [[package]] name = "ibc-core" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -2322,7 +2322,7 @@ dependencies = [ [[package]] name = "ibc-core-channel" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-core-channel-types", "ibc-core-client", @@ -2337,7 +2337,7 @@ dependencies = [ [[package]] name = "ibc-core-channel-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2360,7 +2360,7 @@ dependencies = [ [[package]] name = "ibc-core-client" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-core-client-context", "ibc-core-client-types", @@ -2373,7 +2373,7 @@ dependencies = [ [[package]] name = "ibc-core-client-context" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "derive_more", "displaydoc", @@ -2389,7 +2389,7 @@ dependencies = [ [[package]] name = "ibc-core-client-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2409,7 +2409,7 @@ dependencies = [ [[package]] name = "ibc-core-commitment-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2427,7 +2427,7 @@ dependencies = [ [[package]] name = "ibc-core-connection" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-core-client", "ibc-core-connection-types", @@ -2439,7 +2439,7 @@ dependencies = [ [[package]] name = "ibc-core-connection-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2460,7 +2460,7 @@ dependencies = [ [[package]] name = "ibc-core-handler" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "ibc-core-channel", "ibc-core-client", @@ -2475,7 +2475,7 @@ dependencies = [ [[package]] name = "ibc-core-handler-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2499,7 +2499,7 @@ dependencies = [ [[package]] name = "ibc-core-host" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "derive_more", "displaydoc", @@ -2517,7 +2517,7 @@ dependencies = [ [[package]] name = "ibc-core-host-cosmos" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "derive_more", "displaydoc", @@ -2540,7 +2540,7 @@ dependencies = [ [[package]] name = "ibc-core-host-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2555,7 +2555,7 @@ dependencies = [ [[package]] name = "ibc-core-router" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "derive_more", "displaydoc", @@ -2569,7 +2569,7 @@ dependencies = [ [[package]] name = "ibc-core-router-types" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2588,7 +2588,7 @@ dependencies = [ [[package]] name = "ibc-derive" version = "0.6.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "proc-macro2", "quote", @@ -2598,7 +2598,7 @@ dependencies = [ [[package]] name = "ibc-primitives" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "borsh", "derive_more", @@ -2637,7 +2637,7 @@ dependencies = [ [[package]] name = "ibc-query" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "displaydoc", "ibc", @@ -2648,7 +2648,7 @@ dependencies = [ [[package]] name = "ibc-testkit" version = "0.50.0" -source = "git+https://github.com/cosmos/ibc-rs.git?rev=b25d7d8868#b25d7d88687599e7b457471c55965b73d8cbe177" +source = "git+https://github.com/cosmos/ibc-rs.git?rev=74c316c36c#74c316c36c8dae87a44f04627e0fb223c3805e3d" dependencies = [ "derive_more", "displaydoc", @@ -4693,7 +4693,7 @@ dependencies = [ [[package]] name = "sov-celestia-client" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf#6b1eedfdd26651cc80c8b98965dd20a14883f9e7" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee#01ed4ee9928d7119c24284a6694916924d332c1d" dependencies = [ "derive_more", "ibc-client-tendermint", @@ -4701,7 +4701,7 @@ dependencies = [ "ics23", "prost", "serde", - "sov-celestia-client-types 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", + "sov-celestia-client-types 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", "tendermint 0.34.0", "tendermint-light-client-verifier", "tendermint-proto 0.34.0", @@ -4752,7 +4752,7 @@ dependencies = [ [[package]] name = "sov-celestia-client-types" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf#6b1eedfdd26651cc80c8b98965dd20a14883f9e7" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee#01ed4ee9928d7119c24284a6694916924d332c1d" dependencies = [ "base64 0.21.7", "bytes", @@ -4835,8 +4835,9 @@ dependencies = [ [[package]] name = "sov-ibc" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf#6b1eedfdd26651cc80c8b98965dd20a14883f9e7" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee#01ed4ee9928d7119c24284a6694916924d332c1d" dependencies = [ + "ahash 0.8.6", "anyhow", "borsh", "derive_more", @@ -4849,9 +4850,9 @@ dependencies = [ "schemars", "serde", "serde_json", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", "sov-chain-state", - "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", + "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", "sov-modules-api", "sov-rollup-interface", "sov-state", @@ -4884,10 +4885,10 @@ dependencies = [ "sha2 0.10.8", "sov-bank", "sov-celestia-adapter", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", "sov-chain-state", - "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", - "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf)", + "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", + "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee)", "sov-mock-da", "sov-modules-api", "sov-modules-stf-blueprint", @@ -4932,7 +4933,7 @@ dependencies = [ [[package]] name = "sov-ibc-transfer" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=6b1eedf#6b1eedfdd26651cc80c8b98965dd20a14883f9e7" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=01ed4ee#01ed4ee9928d7119c24284a6694916924d332c1d" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/Cargo.toml b/Cargo.toml index 0cd699f7..ba773b1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,15 +40,15 @@ tempfile = "3.5" thiserror = "1.0.38" # ibc depedenencies -ibc-core = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false, features = ["borsh","schema","serde"] } -ibc-core-client = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-core-host-cosmos = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-client-tendermint = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-client-wasm-types = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-app-transfer = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-primitives = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-query = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } -ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } +ibc-core = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false, features = ["borsh","schema","serde"] } +ibc-core-client = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-core-host-cosmos = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-client-tendermint = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-client-wasm-types = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-app-transfer = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-primitives = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-query = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } +ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } ibc-proto = { git = "https://github.com/cosmos/ibc-proto-rs.git", rev = "d1daaab", default-features = false } # cosmos dependencies diff --git a/clients/sov-celestia-cw/src/contexts/client_ctx.rs b/clients/sov-celestia-cw/src/contexts/client_ctx.rs index 8eec9d29..6f8e0ef6 100644 --- a/clients/sov-celestia-cw/src/contexts/client_ctx.rs +++ b/clients/sov-celestia-cw/src/contexts/client_ctx.rs @@ -3,14 +3,16 @@ use ibc_core::client::types::error::ClientError; use ibc_core::client::types::Height; use ibc_core::handler::types::error::ContextError; use ibc_core::host::types::identifiers::ClientId; -use ibc_core::host::types::path::{ClientConsensusStatePath, ClientStatePath}; +use ibc_core::host::types::path::{ + iteration_key, ClientConsensusStatePath, ClientStatePath, ClientUpdateHeightPath, + ClientUpdateTimePath, +}; use ibc_core::host::ValidationContext; -use ibc_core::primitives::proto::Any; use ibc_core::primitives::Timestamp; +use sov_celestia_client::client_state::ClientState; -use super::definition::StorageMut; -use super::{Context, StorageRef}; -use crate::types::{AnyClientState, AnyConsensusState, ProcessedStates, ReadonlyProcessedStates}; +use super::Context; +use crate::types::AnyConsensusState; impl ClientValidationContext for Context<'_> { fn update_meta( @@ -18,8 +20,46 @@ impl ClientValidationContext for Context<'_> { client_id: &ClientId, height: &Height, ) -> Result<(Timestamp, Height), ContextError> { - let timestamp = client_update_time(self, client_id, height)?; - let height = client_update_height(self, client_id, height)?; + let client_update_time_path = ClientUpdateTimePath::new( + client_id.clone(), + height.revision_number(), + height.revision_height(), + ); + + let path_vec = client_update_time_path.leaf().into_bytes(); + + let timestamp = self + .retrieve(path_vec) + .map(|timestamp| u64::from_be_bytes(timestamp.try_into().expect("invalid timestamp"))); + + let timestamp = match timestamp { + Some(time) => { + Timestamp::from_nanoseconds(time).map_err(ClientError::InvalidPacketTimestamp)? + } + None => Err(ClientError::Other { + description: "problem getting processed time".to_string(), + })?, + }; + + let client_update_height_path = ClientUpdateHeightPath::new( + client_id.clone(), + height.revision_number(), + height.revision_height(), + ); + + let path_vec = client_update_height_path.leaf().into_bytes(); + + let revision_height = self + .retrieve(path_vec) + .map(|height| u64::from_be_bytes(height.try_into().expect("invalid height"))); + + let height = match revision_height { + Some(h) => Height::new(0, h)?, + None => Err(ClientError::Other { + description: "problem getting processed time".to_string(), + })?, + }; + Ok((timestamp, height)) } } @@ -31,10 +71,16 @@ impl ClientExecutionContext for Context<'_> { fn store_client_state( &mut self, - client_state_path: ClientStatePath, - client_state: AnyClientState, + _client_state_path: ClientStatePath, + client_state: ClientState, ) -> Result<(), ContextError> { - store_client_state(self, client_state_path, client_state) + let key = ClientStatePath::leaf().into_bytes(); + + let encoded_client_state = self.encode_client_state(client_state)?; + + self.insert(key, encoded_client_state); + + Ok(()) } fn store_consensus_state( @@ -42,7 +88,13 @@ impl ClientExecutionContext for Context<'_> { consensus_state_path: ClientConsensusStatePath, consensus_state: AnyConsensusState, ) -> Result<(), ContextError> { - store_consensus_state(self, consensus_state_path, consensus_state) + let key = consensus_state_path.leaf().into_bytes(); + + let encoded_consensus_state = consensus_state.encode(); + + self.insert(key, encoded_consensus_state); + + Ok(()) } fn delete_consensus_state( @@ -59,8 +111,37 @@ impl ClientExecutionContext for Context<'_> { host_timestamp: Timestamp, host_height: Height, ) -> Result<(), ContextError> { - store_update_time(self, client_id.clone(), height, host_timestamp)?; - store_update_height(self, client_id, height, host_height) + let client_update_time_path = ClientUpdateTimePath::new( + client_id.clone(), + height.revision_number(), + height.revision_height(), + ); + + let path_vec = client_update_time_path.leaf().into_bytes(); + + let time_vec: [u8; 8] = host_timestamp.nanoseconds().to_be_bytes(); + + self.insert(path_vec, time_vec); + + let client_update_height_path = ClientUpdateHeightPath::new( + client_id, + height.revision_number(), + height.revision_height(), + ); + + let path_vec = client_update_height_path.leaf().into_bytes(); + + let revision_height_vec: [u8; 8] = host_height.revision_height().to_be_bytes(); + + self.insert(path_vec, revision_height_vec); + + let iteration_key = iteration_key(height.revision_number(), height.revision_height()); + + let height_vec = height.to_string().into_bytes(); + + self.insert(iteration_key, height_vec); + + Ok(()) } fn delete_update_meta( @@ -71,110 +152,3 @@ impl ClientExecutionContext for Context<'_> { todo!() } } - -fn client_update_time( - ctx: &Ctx, - _client_id: &ClientId, - height: &Height, -) -> Result -where - Ctx: ClientValidationContext + StorageRef, -{ - let processed_state = ReadonlyProcessedStates::new(ctx.storage_ref()); - let timestamp = match processed_state.get_processed_time(*height, &mut Vec::new()) { - Some(time) => { - Timestamp::from_nanoseconds(time).map_err(ClientError::InvalidPacketTimestamp)? - } - None => Err(ClientError::Other { - description: "problem getting processed time".to_string(), - })?, - }; - - Ok(timestamp) -} - -fn client_update_height( - ctx: &Ctx, - _client_id: &ClientId, - height: &Height, -) -> Result -where - Ctx: ClientValidationContext + StorageRef, -{ - let processed_state = ReadonlyProcessedStates::new(ctx.storage_ref()); - - let height = match processed_state.get_processed_height(*height, &mut Vec::new()) { - Some(h) => Height::new(0, h)?, - None => Err(ClientError::Other { - description: "problem getting processed time".to_string(), - })?, - }; - - Ok(height) -} - -fn store_client_state( - ctx: &mut Ctx, - client_state_path: ClientStatePath, - client_state: AnyClientState, -) -> Result<(), ContextError> -where - Ctx: ClientExecutionContext + StorageMut, -{ - let client_state_value = Any::from(client_state).value; - - ctx.storage_mut().set( - client_state_path.to_string().as_bytes(), - client_state_value.as_slice(), - ); - - Ok(()) -} - -fn store_consensus_state( - ctx: &mut Ctx, - consensus_state_path: ClientConsensusStatePath, - consensus_state: AnyConsensusState, -) -> Result<(), ContextError> -where - Ctx: ClientExecutionContext + StorageMut, -{ - let consensus_state_value = Any::from(consensus_state).value; - - ctx.storage_mut().set( - consensus_state_path.to_string().as_bytes(), - consensus_state_value.as_slice(), - ); - - Ok(()) -} - -fn store_update_time( - ctx: &mut Ctx, - _client_id: ClientId, - height: Height, - timestamp: Timestamp, -) -> Result<(), ContextError> -where - Ctx: ClientExecutionContext + StorageMut, -{ - let mut processed_state = ProcessedStates::new(ctx.storage_mut()); - processed_state.set_processed_time(height, timestamp.nanoseconds(), &mut Vec::new()); - - Ok(()) -} - -fn store_update_height( - ctx: &mut Ctx, - _client_id: ClientId, - height: Height, - host_height: Height, -) -> Result<(), ContextError> -where - Ctx: ClientExecutionContext + StorageMut, -{ - let mut processed_state = ProcessedStates::new(ctx.storage_mut()); - processed_state.set_processed_height(height, host_height.revision_height(), &mut Vec::new()); - processed_state.set_iteration_key(height, &mut Vec::new()); - Ok(()) -} diff --git a/clients/sov-celestia-cw/src/contexts/core_ctx.rs b/clients/sov-celestia-cw/src/contexts/core_ctx.rs index 7aac91f7..adaabba3 100644 --- a/clients/sov-celestia-cw/src/contexts/core_ctx.rs +++ b/clients/sov-celestia-cw/src/contexts/core_ctx.rs @@ -17,19 +17,20 @@ use ibc_core::host::types::path::{ use ibc_core::host::{ExecutionContext, ValidationContext}; use ibc_core::primitives::proto::{Any, Protobuf}; use ibc_core::primitives::{Signer, Timestamp}; +use sov_celestia_client::client_state::ClientState; use sov_celestia_client::types::client_state::SOV_TENDERMINT_CLIENT_STATE_TYPE_URL; use sov_celestia_client::types::proto::v1::{ ClientState as RawClientState, ConsensusState as RawConsensusState, }; use super::{Context, StorageRef}; -use crate::types::{AnyClientState, AnyConsensusState}; +use crate::types::AnyConsensusState; impl ValidationContext for Context<'_> { type V = Self; type E = Self; type AnyConsensusState = AnyConsensusState; - type AnyClientState = AnyClientState; + type AnyClientState = ClientState; fn get_client_validation_context(&self) -> &Self::V { self @@ -256,11 +257,11 @@ impl ExecutionContext for Context<'_> { } } -pub fn client_state(ctx: &Ctx, client_id: &ClientId) -> Result +pub fn client_state(ctx: &Ctx, client_id: &ClientId) -> Result where Ctx: ValidationContext + StorageRef, { - let client_state_path = ClientStatePath::new(client_id).to_string(); + let client_state_path = ClientStatePath::new(client_id.clone()).to_string(); let client_state_value = ctx.storage_ref() @@ -274,10 +275,10 @@ where description: e.to_string(), })?; - Ok(AnyClientState::Sovereign(sov_client_state)) + Ok(sov_client_state) } -fn decode_client_state(_ctx: &Ctx, client_state: Any) -> Result +fn decode_client_state(_ctx: &Ctx, client_state: Any) -> Result where Ctx: ValidationContext + StorageRef, { @@ -290,7 +291,7 @@ where } })?; - Ok(AnyClientState::Sovereign(sov_client_state)) + Ok(sov_client_state) } _ => Err(ClientError::Other { description: "Client state type not supported".to_string(), diff --git a/clients/sov-celestia-cw/src/contexts/definition.rs b/clients/sov-celestia-cw/src/contexts/definition.rs index 94cd2bf5..39db51a2 100644 --- a/clients/sov-celestia-cw/src/contexts/definition.rs +++ b/clients/sov-celestia-cw/src/contexts/definition.rs @@ -1,10 +1,12 @@ use std::str::FromStr; use cosmwasm_std::{to_json_binary, Binary, Deps, DepsMut, Env, Storage}; +use ibc_client_wasm_types::client_state::ClientState as WasmClientState; use ibc_core::client::context::client_state::{ ClientStateCommon, ClientStateExecution, ClientStateValidation, }; use ibc_core::client::context::consensus_state::ConsensusState as _; +use ibc_core::client::types::error::ClientError; use ibc_core::client::types::UpdateKind; use ibc_core::handler::types::error::ContextError; use ibc_core::host::types::error::IdentifierError; @@ -23,12 +25,15 @@ use crate::types::{ VerifyNonMembershipMsg, VerifyUpgradeAndUpdateStateMsg, }; +pub type Checksum = Vec; + /// Context is a wrapper around the deps and env that gives access to the /// methods of the ibc-rs Validation and Execution traits. pub struct Context<'a> { deps: Option>, deps_mut: Option>, env: Env, + checksum: Option, } impl<'a> Context<'a> { @@ -37,6 +42,7 @@ impl<'a> Context<'a> { deps: Some(deps), deps_mut: None, env, + checksum: None, } } @@ -45,6 +51,7 @@ impl<'a> Context<'a> { deps: None, deps_mut: Some(deps), env, + checksum: None, } } @@ -60,16 +67,40 @@ impl<'a> Context<'a> { ClientId::from_str(self.env.contract.address.as_str()) } - pub fn instantiate(&mut self, msg: InstantiateMsg) -> Result { - let client_id = self.client_id()?; + pub fn set_checksum(&mut self, checksum: Checksum) { + self.checksum = Some(checksum); + } + + pub fn retrieve(&self, key: impl AsRef<[u8]>) -> Option> { + self.storage_ref().get(key.as_ref()) + } + + pub fn insert(&mut self, key: impl AsRef<[u8]>, value: impl AsRef<[u8]>) { + self.storage_mut().set(key.as_ref(), value.as_ref()); + } + + pub fn encode_client_state(&self, client_state: ClientState) -> Result, ClientError> { + let wasm_client_state = WasmClientState { + data: Any::from(client_state.clone()).encode_to_vec(), + checksum: self.checksum.clone().ok_or(ClientError::Other { + description: "checksum not set".to_string(), + })?, + latest_height: client_state.latest_height(), + }; + Ok(Any::from(wasm_client_state).encode_to_vec()) + } + + pub fn instantiate(&mut self, msg: InstantiateMsg) -> Result { let any = Any::decode(&mut msg.client_state.as_slice())?; let client_state = ClientState::try_from(any)?; let any_consensus_state = Any::decode(&mut msg.consensus_state.as_slice())?; - client_state.initialise(self, &client_id, any_consensus_state)?; + self.set_checksum(msg.checksum); + + client_state.initialise(self, &self.client_id()?, any_consensus_state)?; Ok(to_json_binary(&ContractResult::success())?) } diff --git a/clients/sov-celestia-cw/src/types/client_state.rs b/clients/sov-celestia-cw/src/types/client_state.rs deleted file mode 100644 index 6b702ff1..00000000 --- a/clients/sov-celestia-cw/src/types/client_state.rs +++ /dev/null @@ -1,43 +0,0 @@ -use ibc_core::client::types::error::ClientError; -use ibc_core::derive::ClientState as ClientStateDerive; -use ibc_core::primitives::proto::{Any, Protobuf}; -use sov_celestia_client::client_state::ClientState; -use sov_celestia_client::types::client_state::{ - ClientState as ClientStateType, SOV_TENDERMINT_CLIENT_STATE_TYPE_URL, -}; - -use crate::contexts::Context; - -#[derive(ClientStateDerive, Debug, derive_more::From)] -#[validation(Context<'a>)] -#[execution(Context<'a>)] -pub enum AnyClientState { - Sovereign(ClientState), -} - -impl TryFrom for ClientState { - type Error = ClientError; - - fn try_from(value: AnyClientState) -> Result { - match value { - AnyClientState::Sovereign(state) => Ok(state), - } - } -} - -impl From for AnyClientState { - fn from(value: ClientStateType) -> Self { - AnyClientState::Sovereign(ClientState::from(value)) - } -} - -impl From for Any { - fn from(value: AnyClientState) -> Self { - match value { - AnyClientState::Sovereign(cs) => Any { - type_url: SOV_TENDERMINT_CLIENT_STATE_TYPE_URL.to_string(), - value: Protobuf::::encode_vec(cs), - }, - } - } -} diff --git a/clients/sov-celestia-cw/src/types/consensus_state.rs b/clients/sov-celestia-cw/src/types/consensus_state.rs index 17285e18..116967d2 100644 --- a/clients/sov-celestia-cw/src/types/consensus_state.rs +++ b/clients/sov-celestia-cw/src/types/consensus_state.rs @@ -1,6 +1,8 @@ +use ibc_client_wasm_types::consensus_state::ConsensusState as WasmConsensusState; use ibc_core::client::types::error::ClientError; use ibc_core::derive::ConsensusState as ConsensusStateDerive; use ibc_core::primitives::proto::{Any, Protobuf}; +use prost::Message; use sov_celestia_client::consensus_state::ConsensusState; use sov_celestia_client::types::consensus_state::SOV_TENDERMINT_CONSENSUS_STATE_TYPE_URL; @@ -9,6 +11,16 @@ pub enum AnyConsensusState { Sovereign(ConsensusState), } +impl AnyConsensusState { + pub fn encode(self) -> Vec { + let encoded_cs = Any::from(self).encode_to_vec(); + + let wasm_consensus_state = WasmConsensusState::new(encoded_cs); + + Any::from(wasm_consensus_state).encode_to_vec() + } +} + impl TryFrom for ConsensusState { type Error = ClientError; diff --git a/clients/sov-celestia-cw/src/types/mod.rs b/clients/sov-celestia-cw/src/types/mod.rs index eec974b7..bc8d32af 100644 --- a/clients/sov-celestia-cw/src/types/mod.rs +++ b/clients/sov-celestia-cw/src/types/mod.rs @@ -1,11 +1,9 @@ -mod client_state; mod consensus_state; mod error; mod msgs; mod processed_states; mod response; -pub use client_state::*; pub use consensus_state::*; pub use error::*; pub use msgs::*; diff --git a/clients/sov-celestia/src/client_state.rs b/clients/sov-celestia/src/client_state.rs index 83010c1b..69147816 100644 --- a/clients/sov-celestia/src/client_state.rs +++ b/clients/sov-celestia/src/client_state.rs @@ -226,7 +226,7 @@ where let sov_consensus_state = ConsensusState::try_from(consensus_state)?; - ctx.store_client_state(ClientStatePath::new(client_id), self.clone().into())?; + ctx.store_client_state(ClientStatePath::new(client_id.clone()), self.clone().into())?; ctx.store_consensus_state( ClientConsensusStatePath::new( client_id.clone(), @@ -286,7 +286,7 @@ where ConsensusState::from(new_consensus_state).into(), )?; ctx.store_client_state( - ClientStatePath::new(client_id), + ClientStatePath::new(client_id.clone()), ClientState::from(new_client_state).into(), )?; ctx.store_update_meta( @@ -311,7 +311,7 @@ where let wrapped_frozen_client_state = ClientState::from(frozen_client_state); ctx.store_client_state( - ClientStatePath::new(client_id), + ClientStatePath::new(client_id.clone()), wrapped_frozen_client_state.into(), )?; @@ -367,7 +367,7 @@ where let host_height = CommonContext::host_height(ctx)?; ctx.store_client_state( - ClientStatePath::new(client_id), + ClientStatePath::new(client_id.clone()), ClientState::from(new_client_state).into(), )?; ctx.store_consensus_state( diff --git a/mocks/Cargo.toml b/mocks/Cargo.toml index 70240c47..c0e4673f 100644 --- a/mocks/Cargo.toml +++ b/mocks/Cargo.toml @@ -28,9 +28,9 @@ tracing = "0.1.36" typed-builder = "0.18.0" # internal dependencies -sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "6b1eedf" } -sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "6b1eedf" } -sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "6b1eedf", features = ["test-util"] } +sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "01ed4ee" } +sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "01ed4ee" } +sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "01ed4ee", features = ["test-util"] } # ibc dependencies ibc-core = { workspace = true } @@ -38,11 +38,11 @@ ibc-app-transfer = { workspace = true } ibc-client-tendermint = { workspace = true } ibc-core-host-cosmos = { workspace = true } ibc-query = { workspace = true } -ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git", rev = "b25d7d8868", default-features = false } +ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git", rev = "74c316c36c", default-features = false } # cosmos dependencies -basecoin-app = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "ccbea55" } -basecoin-store = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "ccbea55" } +basecoin-app = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "4de5278" } +basecoin-store = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "4de5278" } tendermint = { workspace = true } tendermint-testgen = { workspace = true } diff --git a/modules/sov-ibc/src/query/context.rs b/modules/sov-ibc/src/query/context.rs index aab69a69..924a510f 100644 --- a/modules/sov-ibc/src/query/context.rs +++ b/modules/sov-ibc/src/query/context.rs @@ -118,7 +118,7 @@ where .ibc .client_connections_map .get( - &ClientConnectionPath::new(client_id), + &ClientConnectionPath::new(client_id.clone()), *self.working_set.borrow_mut(), ) .ok_or(ConnectionError::Other {