From b5955ab7c3c3c313798338a76993437d87437bb3 Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Wed, 6 Mar 2024 08:20:31 -0800 Subject: [PATCH] imp: cache escrow address + update Sovereign SDK dependencies (#90) * imp: caching escrow addresses + updating Sovereign SDK deps revision * chore: update rpc codebase with latest sovereign changes * chore: update mocks with latest changes in Sovereign SDK * fix: BorrowMutError when accessing working_set for obtaining escrow address * chore: update basecoin rev * fix: clippy no-default-features --- Cargo.lock | 837 ++++++++++++++++++++++-- Cargo.toml | 10 +- mocks/Cargo.toml | 34 +- mocks/src/configs.rs | 34 +- mocks/src/relayer/builder.rs | 34 +- mocks/src/relayer/handle/rollup.rs | 13 +- mocks/src/relayer/mod.rs | 4 +- mocks/src/relayer/msgs/rollup.rs | 4 +- mocks/src/sovereign/manual.rs | 13 +- mocks/src/sovereign/rollup.rs | 76 +-- mocks/src/sovereign/runner.rs | 26 +- mocks/src/sovereign/runtime/config.rs | 26 +- mocks/src/sovereign/runtime/mod.rs | 32 +- mocks/src/tests/transfer.rs | 7 +- modules/sov-ibc-transfer/src/context.rs | 94 +-- modules/sov-ibc-transfer/src/genesis.rs | 6 +- modules/sov-ibc-transfer/src/lib.rs | 32 +- modules/sov-ibc-transfer/src/rpc.rs | 22 +- modules/sov-ibc-transfer/src/utils.rs | 22 + modules/sov-ibc/src/call.rs | 12 +- modules/sov-ibc/src/clients/context.rs | 22 +- modules/sov-ibc/src/clients/mod.rs | 24 +- modules/sov-ibc/src/context.rs | 36 +- modules/sov-ibc/src/genesis.rs | 6 +- modules/sov-ibc/src/lib.rs | 20 +- modules/sov-ibc/src/router.rs | 18 +- modules/sov-ibc/src/rpc/context.rs | 10 +- modules/sov-ibc/src/rpc/methods.rs | 62 +- 28 files changed, 1133 insertions(+), 403 deletions(-) create mode 100644 modules/sov-ibc-transfer/src/utils.rs diff --git a/Cargo.lock b/Cargo.lock index 1277d7da..4f4cc80d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,13 +2,30 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + [[package]] name = "addr2line" version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ + "cpp_demangle", + "fallible-iterator 0.3.0", "gimli 0.28.1", + "memmap2 0.5.10", + "object", + "rustc-demangle", + "smallvec", ] [[package]] @@ -114,6 +131,52 @@ version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2 0.10.8", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -125,7 +188,7 @@ dependencies = [ "ark-serialize 0.3.0", "ark-std 0.3.0", "derivative", - "num-bigint", + "num-bigint 0.4.4", "num-traits", "paste", "rustc_version 0.3.3", @@ -145,7 +208,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools 0.10.5", - "num-bigint", + "num-bigint 0.4.4", "num-traits", "paste", "rustc_version 0.4.0", @@ -178,7 +241,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ - "num-bigint", + "num-bigint 0.4.4", "num-traits", "quote", "syn 1.0.109", @@ -190,13 +253,53 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint", + "num-bigint 0.4.4", "num-traits", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", + "tracing-subscriber 0.2.25", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -213,9 +316,33 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ + "ark-serialize-derive", "ark-std 0.4.0", "digest 0.10.7", - "num-bigint", + "num-bigint 0.4.4", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", ] [[package]] @@ -294,9 +421,9 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", @@ -309,6 +436,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "autotools" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8da1805e028a172334c3b680f93e71126f2327622faef2ec3d893c0a4ad77" +dependencies = [ + "cc", +] + [[package]] name = "axum" version = "0.6.20" @@ -402,7 +538,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basecoin-app" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=8c3e924#8c3e924d4b794a3a61e77aa35ca37230cedf0ae7" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=e668ec4#e668ec44a361f7c752ca12a20c1288ffa91bdd3f" dependencies = [ "base64 0.21.7", "basecoin-store", @@ -420,7 +556,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=c42dac1)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", "tendermint 0.34.0", "tendermint-proto 0.34.0", "tendermint-rpc", @@ -431,13 +567,13 @@ dependencies = [ "tower", "tower-abci", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] name = "basecoin-store" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=8c3e924#8c3e924d4b794a3a61e77aa35ca37230cedf0ae7" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=e668ec4#e668ec44a361f7c752ca12a20c1288ffa91bdd3f" dependencies = [ "displaydoc", "ics23", @@ -590,6 +726,17 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab9008b6bb9fc80b5277f2fe481c09e828743d9151203e804583eb4c9e15b31d" +[[package]] +name = "bonsai-sdk" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f0a6b186dce8b2f945bd3ecc5d35a36280400200ed57878c7c3f2aeb01632e" +dependencies = [ + "reqwest", + "serde", + "thiserror", +] + [[package]] name = "borsh" version = "0.10.3" @@ -679,6 +826,26 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "bytemuck" +version = "1.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -876,7 +1043,7 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const-rollup-config" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" [[package]] name = "const_format" @@ -1073,6 +1240,15 @@ dependencies = [ "wasmer-middlewares", ] +[[package]] +name = "cpp_demangle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" +dependencies = [ + "cfg-if", +] + [[package]] name = "cpufeatures" version = "0.2.12" @@ -1424,6 +1600,27 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + [[package]] name = "displaydoc" version = "0.2.4" @@ -1435,6 +1632,26 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "downcast-rs" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" + +[[package]] +name = "downloader" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05213e96f184578b5f70105d4d0a644a168e99e12d7bea0b200c15d67b5c182" +dependencies = [ + "digest 0.10.7", + "futures", + "rand", + "reqwest", + "thiserror", + "tokio", +] + [[package]] name = "dyn-clone" version = "1.0.16" @@ -1507,15 +1724,16 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek 4.1.2", "ed25519", "rand_core 0.6.4", "serde", "sha2 0.10.8", + "subtle", "zeroize", ] @@ -1540,6 +1758,12 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + [[package]] name = "elliptic-curve" version = "0.13.8" @@ -1627,6 +1851,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "erased-serde" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388979d208a049ffdfb22fa33b9c81942215b940910bccfe258caeb25d125cb3" +dependencies = [ + "serde", +] + [[package]] name = "errno" version = "0.3.8" @@ -1659,6 +1892,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "2.0.1" @@ -1682,10 +1921,29 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ + "bitvec", + "byteorder", + "ff_derive", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "ff_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" +dependencies = [ + "addchain", + "cfg-if", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "fiat-crypto" version = "0.2.6" @@ -1710,6 +1968,16 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "flate2" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flex-error" version = "0.4.4" @@ -1885,7 +2153,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ - "fallible-iterator", + "fallible-iterator 0.2.0", "indexmap 1.9.3", "stable_deref_trait", ] @@ -1895,6 +2163,10 @@ name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator 0.3.0", + "stable_deref_trait", +] [[package]] name = "glob" @@ -2084,9 +2356,9 @@ dependencies = [ [[package]] name = "http" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -2116,6 +2388,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "human-repr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58b778a5761513caf593693f8951c97a5b610841e754788400f32102eefdff1" + [[package]] name = "hyper" version = "0.14.28" @@ -2200,7 +2478,7 @@ dependencies = [ "borsh", "derive_more", "displaydoc", - "http 1.0.0", + "http 1.1.0", "ibc-core", "ibc-proto", "mime", @@ -2774,6 +3052,12 @@ dependencies = [ "web-sys", ] +[[package]] +name = "inventory" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" + [[package]] name = "ipnet" version = "2.9.0" @@ -2817,7 +3101,7 @@ dependencies = [ "ics23", "itertools 0.10.5", "mirai-annotations", - "num-derive", + "num-derive 0.3.3", "num-traits", "serde", "sha2 0.10.8", @@ -3027,6 +3311,29 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "lazy-regex" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.48", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -3067,6 +3374,17 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.2", + "libc", + "redox_syscall", +] + [[package]] name = "librocksdb-sys" version = "0.11.0+8.1.1" @@ -3150,6 +3468,16 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "matrixmultiply" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" +dependencies = [ + "autocfg", + "rawpointer", +] + [[package]] name = "memchr" version = "2.7.1" @@ -3269,6 +3597,20 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +[[package]] +name = "ndarray" +version = "0.15.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32" +dependencies = [ + "matrixmultiply", + "num-complex", + "num-integer", + "num-traits", + "rawpointer", + "rayon", +] + [[package]] name = "nmt-rs" version = "0.1.0" @@ -3300,6 +3642,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -3311,6 +3664,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +dependencies = [ + "num-traits", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -3322,6 +3684,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -3357,7 +3730,9 @@ version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ + "flate2", "memchr", + "ruzstd", ] [[package]] @@ -3378,6 +3753,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "overload" version = "0.1.1" @@ -3480,9 +3861,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.7" +version = "2.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" +checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8" dependencies = [ "memchr", "thiserror", @@ -3726,6 +4107,15 @@ dependencies = [ "prost", ] +[[package]] +name = "protobuf-src" +version = "1.1.0+21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7ac8852baeb3cc6fb83b93646fb93c0ffe5d14bf138c945ceb4b9948ee0e3c1" +dependencies = [ + "autotools", +] + [[package]] name = "ptr_meta" version = "0.1.4" @@ -3806,6 +4196,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + [[package]] name = "rayon" version = "1.8.1" @@ -3835,6 +4231,17 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_users" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + [[package]] name = "regalloc2" version = "0.5.1" @@ -3950,6 +4357,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg", ] @@ -3986,6 +4394,203 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "risc0-binfmt" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d263c6370d7714d2a634b6d88deb3871d0fad1f9486a9da6d48139c1ac85b26" +dependencies = [ + "anyhow", + "elf", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-build-kernel" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fa4cd0e10797e933d0e2056e24e5b15cc0bb324d5dfd44e145048a0029f7af5" +dependencies = [ + "cc", + "directories", + "hex", + "sha2 0.10.8", + "tempfile", +] + +[[package]] +name = "risc0-circuit-recursion" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9835069929a0e7b6b4b34e6a83f08aaa9d34b30023b9ccaf96ddbe20404eba" +dependencies = [ + "anyhow", + "bytemuck", + "downloader", + "hex", + "rand", + "rayon", + "risc0-circuit-recursion-sys", + "risc0-core", + "risc0-zkp", + "sha2 0.10.8", + "tracing", + "zip", +] + +[[package]] +name = "risc0-circuit-recursion-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b12fa422928ccae0ca6d39a3bdb784e417c65813f004b258f2113609095358ba" +dependencies = [ + "glob", + "risc0-build-kernel", + "risc0-core", +] + +[[package]] +name = "risc0-circuit-rv32im" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb1caa759ab74d08779e062fcf98f5bd34397dfde572516a52369f0ec46db650" +dependencies = [ + "anyhow", + "rand", + "rayon", + "risc0-circuit-rv32im-sys", + "risc0-core", + "risc0-zkp", + "risc0-zkvm-platform", + "tracing", +] + +[[package]] +name = "risc0-circuit-rv32im-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81a88e4b25e30eeb49adab83fe014110bec18e69dd63a47a5f36b00ac48fe373" +dependencies = [ + "glob", + "risc0-build-kernel", + "risc0-core", +] + +[[package]] +name = "risc0-core" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be79c89bcd18886b376073e3da22f8b7963247a42dce7b49cf3d09853f51641e" +dependencies = [ + "bytemuck", + "rand_core 0.6.4", +] + +[[package]] +name = "risc0-cycle-utils" +version = "0.3.0" +source = "git+https://github.com/Sovereign-Labs/risc0-cycle-macros.git?rev=98948b8ee0e3edffcee7f3bd95a9d93c5c0941af#98948b8ee0e3edffcee7f3bd95a9d93c5c0941af" +dependencies = [ + "bytes", + "risc0-zkvm", + "risc0-zkvm-platform", +] + +[[package]] +name = "risc0-sys" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c40caeacec542a0187e44203dd90501edcecf194cad648d590f6b2b0e4e4e5b" +dependencies = [ + "cc", + "risc0-build-kernel", +] + +[[package]] +name = "risc0-zkp" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e20a57e04840a5afadebb5d232546245f4fd8bd0e774bd69bf4bf25f8ab90c04" +dependencies = [ + "anyhow", + "blake2", + "bytemuck", + "digest 0.10.7", + "ff", + "hex", + "lazy_static", + "ndarray", + "paste", + "rand", + "rand_core 0.6.4", + "rayon", + "risc0-core", + "risc0-sys", + "risc0-zkvm-platform", + "serde", + "sha2 0.10.8", + "tracing", +] + +[[package]] +name = "risc0-zkvm" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "922588cb4b884b3951316a65581ccdfd1174af93c54093190878366812073329" +dependencies = [ + "addr2line", + "anyhow", + "ark-bn254", + "ark-groth16", + "ark-serialize 0.4.2", + "bincode", + "bonsai-sdk", + "bytemuck", + "bytes", + "cfg-if", + "crypto-bigint", + "elf", + "getrandom", + "hex", + "human-repr", + "lazy-regex", + "num-bigint 0.4.4", + "num-derive 0.4.2", + "num-traits", + "prost", + "prost-build", + "protobuf-src", + "rayon", + "risc0-binfmt", + "risc0-circuit-recursion", + "risc0-circuit-rv32im", + "risc0-core", + "risc0-zkp", + "risc0-zkvm-platform", + "rrs-lib", + "rustc-demangle", + "semver 1.0.21", + "serde", + "sha2 0.10.8", + "tempfile", + "tracing", + "typetag", +] + +[[package]] +name = "risc0-zkvm-platform" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc5819c0c3bfd8f20b1226c9d4ca1f342eb3d8385e71211a9383a879643d1dde" +dependencies = [ + "bytemuck", + "getrandom", + "libm", +] + [[package]] name = "rkyv" version = "0.7.44" @@ -4042,18 +4647,28 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] + [[package]] name = "ruint" -version = "1.11.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608a5726529f2f0ef81b8fde9873c4bb829d6b5b5ca6be4d97345ddf0749c825" +checksum = "49b1d9521f889713d1221270fdd63370feca7e5c71a18745343402fa86e4f04f" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", "fastrlp", - "num-bigint", + "num-bigint 0.4.4", "num-traits", "parity-scale-codec", "primitive-types", @@ -4068,9 +4683,9 @@ dependencies = [ [[package]] name = "ruint-macro" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e666a5496a0b2186dbcd0ff6106e29e093c15591bde62c20d3842007c6978a09" +checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" [[package]] name = "rustc-demangle" @@ -4170,6 +4785,17 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +[[package]] +name = "ruzstd" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c4eb8a81997cf040a091d1f7e1938aeab6749d3a0dfa73af43cdc32393483d" +dependencies = [ + "byteorder", + "derive_more", + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.16" @@ -4608,7 +5234,7 @@ dependencies = [ [[package]] name = "sov-bank" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "borsh", @@ -4625,7 +5251,7 @@ dependencies = [ [[package]] name = "sov-blob-storage" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "bincode", @@ -4646,11 +5272,10 @@ dependencies = [ [[package]] name = "sov-celestia-adapter" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "async-trait", - "base64 0.21.7", "bech32", "borsh", "celestia-proto", @@ -4693,7 +5318,7 @@ dependencies = [ [[package]] name = "sov-celestia-client" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1#c42dac144728911abfe4dae92f72f3ca37276f63" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048#3fe4048d18e653c941fc74b95087e2afd2b15200" dependencies = [ "derive_more", "ibc-client-tendermint", @@ -4701,7 +5326,7 @@ dependencies = [ "ics23", "prost", "serde", - "sov-celestia-client-types 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1)", + "sov-celestia-client-types 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", "tendermint 0.34.0", "tendermint-light-client-verifier", "tendermint-proto 0.34.0", @@ -4724,7 +5349,7 @@ dependencies = [ "tendermint-testgen", "test-log", "thiserror", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] @@ -4752,7 +5377,7 @@ dependencies = [ [[package]] name = "sov-celestia-client-types" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1#c42dac144728911abfe4dae92f72f3ca37276f63" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048#3fe4048d18e653c941fc74b95087e2afd2b15200" dependencies = [ "base64 0.21.7", "bytes", @@ -4774,7 +5399,7 @@ dependencies = [ [[package]] name = "sov-chain-state" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "borsh", @@ -4789,16 +5414,17 @@ dependencies = [ [[package]] name = "sov-db" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "bincode", "borsh", "byteorder", + "hex", "jmt", "rocksdb", "serde", - "serde_json", + "sov-modules-core", "sov-rollup-interface", "sov-schema-db", "tokio", @@ -4836,10 +5462,11 @@ dependencies = [ [[package]] name = "sov-ibc" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1#c42dac144728911abfe4dae92f72f3ca37276f63" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048#3fe4048d18e653c941fc74b95087e2afd2b15200" dependencies = [ "ahash 0.8.6", "anyhow", + "base64 0.21.7", "borsh", "derive_more", "ibc-app-transfer", @@ -4851,13 +5478,13 @@ dependencies = [ "schemars", "serde", "serde_json", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1)", + "sha2 0.10.8", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", "sov-chain-state", - "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1)", + "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", "sov-modules-api", "sov-rollup-interface", "sov-state", - "tendermint 0.34.0", "thiserror", "time", ] @@ -4886,11 +5513,12 @@ 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=c42dac1)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", "sov-chain-state", - "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1)", - "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1)", + "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", + "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048)", "sov-mock-da", + "sov-mock-zkvm", "sov-modules-api", "sov-modules-stf-blueprint", "sov-prover-storage-manager", @@ -4906,7 +5534,7 @@ dependencies = [ "tower", "tower-abci", "tracing", - "tracing-subscriber", + "tracing-subscriber 0.3.18", "typed-builder", ] @@ -4934,7 +5562,7 @@ dependencies = [ [[package]] name = "sov-ibc-transfer" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=c42dac1#c42dac144728911abfe4dae92f72f3ca37276f63" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=3fe4048#3fe4048d18e653c941fc74b95087e2afd2b15200" dependencies = [ "anyhow", "base64 0.21.7", @@ -4956,7 +5584,7 @@ dependencies = [ [[package]] name = "sov-mock-da" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "async-trait", @@ -4968,20 +5596,37 @@ dependencies = [ "sha2 0.10.8", "sov-rollup-interface", "tokio", - "tracing", +] + +[[package]] +name = "sov-mock-zkvm" +version = "0.3.0" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" +dependencies = [ + "anyhow", + "bincode", + "borsh", + "ed25519-dalek", + "hex", + "rand", + "schemars", + "serde", + "sha2 0.10.8", + "sov-modules-api", + "sov-rollup-interface", + "thiserror", ] [[package]] name = "sov-modules-api" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "bech32", "borsh", "clap", "derive_more", - "ed25519-dalek", "hex", "jsonrpsee", "rand", @@ -5000,7 +5645,7 @@ dependencies = [ [[package]] name = "sov-modules-core" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "bech32", @@ -5010,6 +5655,7 @@ dependencies = [ "digest 0.10.7", "hex", "jmt", + "proptest", "schemars", "serde", "sha2 0.10.8", @@ -5020,7 +5666,7 @@ dependencies = [ [[package]] name = "sov-modules-macros" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "borsh", @@ -5029,14 +5675,13 @@ dependencies = [ "quote", "schemars", "serde_json", - "sov-modules-core", "syn 1.0.109", ] [[package]] name = "sov-modules-stf-blueprint" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "borsh", @@ -5056,7 +5701,7 @@ dependencies = [ [[package]] name = "sov-prover-storage-manager" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "sov-db", @@ -5064,13 +5709,12 @@ dependencies = [ "sov-schema-db", "sov-state", "tracing", - "tracing-subscriber", ] [[package]] name = "sov-rollup-interface" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "async-trait", @@ -5079,6 +5723,7 @@ dependencies = [ "digest 0.10.7", "futures", "hex", + "proptest", "serde", "serde_json", "sha2 0.10.8", @@ -5089,7 +5734,7 @@ dependencies = [ [[package]] name = "sov-schema-db" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "byteorder", @@ -5103,12 +5748,13 @@ dependencies = [ [[package]] name = "sov-sequencer-registry" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "borsh", "clap", "jsonrpsee", + "risc0-cycle-utils", "schemars", "serde", "serde_json", @@ -5120,7 +5766,7 @@ dependencies = [ [[package]] name = "sov-state" version = "0.3.0" -source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=a1d9ed8#a1d9ed80af46a0ea6e173204ca708c40ce592d3f" +source = "git+ssh://git@github.com/informalsystems/sovereign-sdk-wip.git?rev=5a144d60#5a144d60eefaf9ce166bbfd66324b959aa4ae82b" dependencies = [ "anyhow", "bcs", @@ -5371,7 +6017,7 @@ source = "git+https://github.com/eigerco/celestia-tendermint-rs.git?rev=ef58b85# dependencies = [ "bytes", "flex-error", - "num-derive", + "num-derive 0.3.3", "num-traits", "prost", "prost-types", @@ -5389,7 +6035,7 @@ checksum = "2cc728a4f9e891d71adf66af6ecaece146f9c7a11312288a3107b3e1d6979aaf" dependencies = [ "bytes", "flex-error", - "num-derive", + "num-derive 0.3.3", "num-traits", "prost", "prost-types", @@ -5464,7 +6110,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6159ab4116165c99fc88cce31f99fa2c9dbe08d3691cb38da02fc3b45f357d2b" dependencies = [ "test-log-macros", - "tracing-subscriber", + "tracing-subscriber 0.3.18", ] [[package]] @@ -5691,7 +6337,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.2", + "winnow 0.6.5", ] [[package]] @@ -5830,6 +6476,15 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "tracing-subscriber" version = "0.3.18" @@ -5854,6 +6509,16 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typed-builder" version = "0.18.1" @@ -5880,6 +6545,30 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "typetag" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "661d18414ec032a49ece2d56eee03636e43c4e8d577047ab334c0ba892e29aaf" +dependencies = [ + "erased-serde", + "inventory", + "once_cell", + "serde", + "typetag-impl", +] + +[[package]] +name = "typetag-impl" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac73887f47b9312552aa90ef477927ff014d63d1920ca8037c6c1951eab64bb1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "ucd-trie" version = "0.1.6" @@ -5992,9 +6681,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -6545,9 +7234,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -6611,6 +7300,18 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "byteorder", + "crc32fast", + "crossbeam-utils", + "flate2", +] + [[package]] name = "zstd-sys" version = "2.0.9+zstd.1.5.5" diff --git a/Cargo.toml b/Cargo.toml index b02364a8..79f35b5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,8 +58,8 @@ tendermint-testgen = { version = "0.34", default-features = false } tendermint-light-client-verifier = { version = "0.34", default-features = false } # sovereign dependencies -sov-bank = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } -sov-chain-state = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } -sov-modules-api = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } -sov-state = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } -sov-rollup-interface = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } +sov-bank = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } +sov-chain-state = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } +sov-modules-api = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } +sov-state = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } +sov-rollup-interface = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } diff --git a/mocks/Cargo.toml b/mocks/Cargo.toml index d1704222..09c30822 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 = "c42dac1" } -sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "c42dac1" } -sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "c42dac1", features = ["test-util"] } +sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "3fe4048" } +sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "3fe4048" } +sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "3fe4048", features = ["test-util"] } # ibc dependencies ibc-core = { workspace = true } @@ -41,8 +41,8 @@ ibc-query = { workspace = true } ibc-testkit = { git = "https://github.com/cosmos/ibc-rs.git", rev = "552863ec93", default-features = false } # cosmos dependencies -basecoin-app = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "8c3e924" } -basecoin-store = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "8c3e924" } +basecoin-app = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "e668ec4" } +basecoin-store = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "e668ec4" } tendermint = { workspace = true } tendermint-testgen = { workspace = true } @@ -54,12 +54,13 @@ sov-modules-api = { workspace = true } sov-rollup-interface = { workspace = true } sov-state = { workspace = true } -sov-celestia-adapter = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8", features = ["native"], optional = true } -sov-mock-da = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8", features = ["native"], optional = true } -sov-modules-stf-blueprint = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } -sov-prover-storage-manager = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8", features = ["test-utils"] } -sov-schema-db = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } -const-rollup-config = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "a1d9ed8" } +sov-celestia-adapter = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60", features = ["native"], optional = true } +sov-mock-da = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60", features = ["native"], optional = true } +sov-mock-zkvm = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60", features = ["native"], optional = true } +sov-modules-stf-blueprint = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60", features = ["native"], optional = true } +sov-prover-storage-manager = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60", features = ["test-utils"] } +sov-schema-db = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } +const-rollup-config = { git = "ssh://git@github.com/informalsystems/sovereign-sdk-wip.git", rev = "5a144d60" } jmt = { git = "https://github.com/penumbra-zone/jmt.git", rev = "1d007e11cb68aa5ca13e9a5af4a12e6439d5f7b6" } [dev-dependencies] @@ -70,13 +71,14 @@ tracing-subscriber = { version = "0.3", default-features = false, features = default = ["native"] native = [ "sov-bank/native", - "sov-celestia-adapter", + "sov-ibc/native", + "sov-ibc-transfer/native", "sov-chain-state/native", "sov-modules-api/native", - "sov-modules-stf-blueprint/native", "sov-state/native", - "sov-mock-da", "sov-rollup-interface/native", - "sov-ibc/native", - "sov-ibc-transfer/native", + "sov-celestia-adapter", + "sov-mock-da", + "sov-mock-zkvm", + "sov-modules-stf-blueprint", ] diff --git a/mocks/src/configs.rs b/mocks/src/configs.rs index b97c2cbf..4a7a4887 100644 --- a/mocks/src/configs.rs +++ b/mocks/src/configs.rs @@ -8,16 +8,18 @@ use serde::de::DeserializeOwned; use sov_bank::{get_token_address, TokenConfig}; use sov_celestia_adapter::CelestiaService; use sov_mock_da::MockDaService; -use sov_modules_api::default_context::DefaultContext; -use sov_modules_api::{Address, Context}; +use sov_modules_api::{Address, Spec}; use sov_modules_stf_blueprint::kernels::basic::BasicKernelGenesisConfig; use sov_rollup_interface::services::da::DaService; use typed_builder::TypedBuilder; +pub(crate) type DefaultSpec = + sov_modules_api::default_spec::DefaultSpec; + use crate::sovereign::{celestia_da_service, mock_da_service, GenesisConfig, RollupGenesisConfig}; #[derive(TypedBuilder, Clone, Debug)] -pub struct TestSetupConfig { +pub struct TestSetupConfig { /// The chain Id of the DA chain. #[builder(default = ChainId::new("mock-celestia-0").unwrap())] pub da_chain_id: ChainId, @@ -28,21 +30,21 @@ pub struct TestSetupConfig { pub rollup_id: ChainId, /// The runtime configuration. #[builder(default = RollupGenesisConfig::default())] - pub rollup_genesis_config: RollupGenesisConfig, + pub rollup_genesis_config: RollupGenesisConfig, /// Sets whether to use manual IBC TAO or not. #[builder(default = false)] pub with_manual_tao: bool, } -impl TestSetupConfig { +impl TestSetupConfig { /// Returns list of tokens in the bank configuration - pub fn get_tokens(&self) -> &Vec> { + pub fn get_tokens(&self) -> &Vec> { &self.rollup_genesis_config.bank_config.tokens } /// Returns the address of the relayer. We use the last address in the list /// as the relayer address - pub fn get_relayer_address(&self) -> C::Address { + pub fn get_relayer_address(&self) -> S::Address { self.rollup_genesis_config.bank_config.tokens[0] .address_and_balances .last() @@ -52,21 +54,21 @@ impl TestSetupConfig { } /// Returns the token address for a given token configuration - pub fn get_token_address(&self, token_cfg: &TokenConfig) -> C::Address { - get_token_address::( + pub fn get_token_address(&self, token_cfg: &TokenConfig) -> S::Address { + get_token_address::( &token_cfg.token_name, - self.get_relayer_address().as_ref(), + &self.get_relayer_address(), token_cfg.salt, ) } - pub fn kernel_genesis_config(&self) -> BasicKernelGenesisConfig { + pub fn kernel_genesis_config(&self) -> BasicKernelGenesisConfig { BasicKernelGenesisConfig { chain_state: self.rollup_genesis_config.chain_state_config.clone(), } } - pub fn runtime_genesis_config(&self) -> GenesisConfig { + pub fn runtime_genesis_config(&self) -> GenesisConfig { GenesisConfig::new( self.rollup_genesis_config.bank_config.clone(), self.rollup_genesis_config.ibc_config.clone(), @@ -75,14 +77,14 @@ impl TestSetupConfig { } } -pub fn default_config_with_mock_da() -> TestSetupConfig { - TestSetupConfig::::builder() +pub fn default_config_with_mock_da() -> TestSetupConfig { + TestSetupConfig::::builder() .da_service(mock_da_service()) .build() } -pub async fn default_config_with_celestia_da() -> TestSetupConfig { - TestSetupConfig::::builder() +pub async fn default_config_with_celestia_da() -> TestSetupConfig { + TestSetupConfig::::builder() .da_service(celestia_da_service().await) .build() } diff --git a/mocks/src/relayer/builder.rs b/mocks/src/relayer/builder.rs index dd68cb0a..dfb87961 100644 --- a/mocks/src/relayer/builder.rs +++ b/mocks/src/relayer/builder.rs @@ -3,30 +3,29 @@ use ibc_core::host::types::identifiers::Sequence; use ibc_core::host::ValidationContext; use sov_celestia_client::types::client_state::sov_client_type; use sov_mock_da::MockDaService; -use sov_modules_api::default_context::DefaultContext; -use sov_modules_api::{Context, WorkingSet}; +use sov_modules_api::{Context, Spec, WorkingSet}; use sov_prover_storage_manager::new_orphan_storage; use sov_rollup_interface::services::da::DaService; use sov_state::{MerkleProofSpec, ProverStorage}; use tracing::info; use super::DefaultRelayer; -use crate::configs::{default_config_with_mock_da, TestSetupConfig}; +use crate::configs::{default_config_with_mock_da, DefaultSpec, TestSetupConfig}; use crate::cosmos::{dummy_signer, CosmosBuilder, MockTendermint}; use crate::relayer::handle::{Handle, QueryReq, QueryResp}; use crate::relayer::relay::MockRelayer; use crate::sovereign::{MockRollup, Runtime, DEFAULT_INIT_HEIGHT}; #[derive(Clone)] -pub struct RelayerBuilder +pub struct RelayerBuilder where - C: Context, + S: Spec, Da: DaService, { - setup_cfg: TestSetupConfig, + setup_cfg: TestSetupConfig, } -impl Default for RelayerBuilder { +impl Default for RelayerBuilder { fn default() -> Self { Self { setup_cfg: default_config_with_mock_da(), @@ -34,17 +33,17 @@ impl Default for RelayerBuilder { } } -impl RelayerBuilder +impl RelayerBuilder where - C: Context, + S: Spec, Da: DaService, { - pub fn new(setup_cfg: TestSetupConfig) -> Self { + pub fn new(setup_cfg: TestSetupConfig) -> Self { Self { setup_cfg } } /// Returns the setup configuration - pub fn setup_cfg(&self) -> &TestSetupConfig { + pub fn setup_cfg(&self) -> &TestSetupConfig { &self.setup_cfg } @@ -55,20 +54,19 @@ where } /// Initializes a mock rollup and a mock Cosmos chain and sets up the relayer between them. - pub async fn setup(self) -> DefaultRelayer + pub async fn setup

(self) -> DefaultRelayer where - C: Context> + Send + Sync, + S: Spec> + Send + Sync, Da: DaService + Clone, - S: MerkleProofSpec + Clone + 'static, - ::Hasher: Send, - MockRollup: Handle, - C::GasUnit: Default, + P: MerkleProofSpec + Clone + 'static, +

::Hasher: Send, + MockRollup: Handle, { let runtime = Runtime::default(); let sender_address = self.setup_cfg.get_relayer_address(); - let rollup_ctx = C::new(sender_address.clone(), sender_address, DEFAULT_INIT_HEIGHT); + let rollup_ctx = Context::new(sender_address.clone(), sender_address, DEFAULT_INIT_HEIGHT); let tmpdir = tempfile::tempdir().unwrap(); diff --git a/mocks/src/relayer/handle/rollup.rs b/mocks/src/relayer/handle/rollup.rs index 4898cda9..df106b13 100644 --- a/mocks/src/relayer/handle/rollup.rs +++ b/mocks/src/relayer/handle/rollup.rs @@ -7,7 +7,7 @@ use ibc_core::handler::types::events::IbcEvent; use ibc_core::host::types::path::{ClientConsensusStatePath, Path}; use ibc_core::host::ValidationContext; use sov_celestia_client::types::client_message::test_util::dummy_sov_header; -use sov_modules_api::{Context, WorkingSet}; +use sov_modules_api::{Spec, WorkingSet}; use sov_rollup_interface::services::da::DaService; use sov_state::{MerkleProofSpec, ProverStorage}; use tracing::info; @@ -17,16 +17,15 @@ use crate::sovereign::{MockRollup, RuntimeCall}; use crate::utils::{wait_for_block, MutexUtil}; #[async_trait] -impl Handle for MockRollup +impl Handle for MockRollup where - C: Context> + Send + Sync, + S: Spec> + Send + Sync, Da: DaService + Clone, ::Spec: Clone, - S: MerkleProofSpec + Clone + 'static, - ::Hasher: Send + Sync, - C::GasUnit: Default, + P: MerkleProofSpec + Clone + 'static, +

::Hasher: Send + Sync, { - type Message = RuntimeCall; + type Message = RuntimeCall; async fn query(&self, request: QueryReq) -> QueryResp { info!("rollup: querying app with {:?}", request); diff --git a/mocks/src/relayer/mod.rs b/mocks/src/relayer/mod.rs index 9aadd31b..d454b048 100644 --- a/mocks/src/relayer/mod.rs +++ b/mocks/src/relayer/mod.rs @@ -22,8 +22,8 @@ mod types { /// Default concrete type for the relayer between the mock rollup and the /// mock Cosmos chain. - pub type DefaultRelayer = - MockRelayer, MockCosmosChain>; + pub type DefaultRelayer = + MockRelayer, MockCosmosChain>; } #[cfg(feature = "native")] diff --git a/mocks/src/relayer/msgs/rollup.rs b/mocks/src/relayer/msgs/rollup.rs index 2b3840d6..d500e4f1 100644 --- a/mocks/src/relayer/msgs/rollup.rs +++ b/mocks/src/relayer/msgs/rollup.rs @@ -20,7 +20,7 @@ use ibc_core::primitives::{Signer, Timestamp, ToProto}; use sov_bank::{CallMessage as BankCallMessage, TokenConfig}; use sov_ibc::call::CallMessage; use sov_ibc::clients::AnyClientState; -use sov_modules_api::Context; +use sov_modules_api::Spec; use crate::configs::TransferTestConfig; use crate::cosmos::dummy_tm_client_state; @@ -193,7 +193,7 @@ where } /// Creates a token with the given configuration - pub fn build_msg_create_token(&self, token: &TokenConfig) -> BankCallMessage { + pub fn build_msg_create_token(&self, token: &TokenConfig) -> BankCallMessage { BankCallMessage::CreateToken { salt: token.salt, token_name: token.token_name.clone(), diff --git a/mocks/src/sovereign/manual.rs b/mocks/src/sovereign/manual.rs index a26924f4..64f1187f 100644 --- a/mocks/src/sovereign/manual.rs +++ b/mocks/src/sovereign/manual.rs @@ -20,26 +20,25 @@ use ibc_core::host::types::path::{ }; use ibc_core::host::{ExecutionContext, ValidationContext}; use sov_ibc::context::IbcContext; -use sov_modules_api::{Context, WorkingSet}; +use sov_modules_api::{Spec, WorkingSet}; use sov_rollup_interface::services::da::DaService; use sov_state::{MerkleProofSpec, ProverStorage}; use super::MockRollup; use crate::cosmos::{dummy_tm_client_state, dummy_tm_consensus_state}; -impl MockRollup +impl MockRollup where - C: Context> + Send + Sync, + S: Spec> + Send + Sync, Da: DaService + Clone, - S: MerkleProofSpec + Clone + 'static, - ::Hasher: Send, - C::GasUnit: Default, + P: MerkleProofSpec + Clone + 'static, +

::Hasher: Send, { /// Establishes a tendermint light client on the ibc module pub async fn setup_client(&mut self, client_chain_id: &ChainId) -> ClientId { let mut working_set = WorkingSet::new(self.prover_storage()); - let mut ibc_ctx: IbcContext<'_, C, ::Spec> = + let mut ibc_ctx: IbcContext<'_, S, ::Spec> = self.ibc_ctx(&mut working_set); let client_counter = ibc_ctx.client_counter().unwrap(); diff --git a/mocks/src/sovereign/rollup.rs b/mocks/src/sovereign/rollup.rs index 772c6ae5..4355a06a 100644 --- a/mocks/src/sovereign/rollup.rs +++ b/mocks/src/sovereign/rollup.rs @@ -13,7 +13,7 @@ use sov_celestia_client::types::consensus_state::{SovTmConsensusState, TmConsens use sov_ibc::call::CallMessage as IbcCallMessage; use sov_ibc::clients::AnyConsensusState; use sov_ibc::context::IbcContext; -use sov_modules_api::{Context, DaSpec, WorkingSet}; +use sov_modules_api::{Context, DaSpec, Spec, WorkingSet}; use sov_modules_stf_blueprint::kernels::basic::BasicKernel; use sov_rollup_interface::services::da::DaService; use sov_state::{MerkleProofSpec, ProverStorage, Storage}; @@ -27,23 +27,23 @@ use crate::utils::MutexUtil; type Mempool = Vec>; #[derive(Clone)] -pub struct MockRollup +pub struct MockRollup where - C: Context, + S: Spec, Da: DaService + Clone, - S: MerkleProofSpec, + P: MerkleProofSpec, { - kernel: BasicKernel, - runtime: Runtime, + kernel: BasicKernel, + runtime: Runtime, da_service: Da, - prover_storage: ProverStorage, + prover_storage: ProverStorage

, pub(crate) da_core: MockTendermint, - pub(crate) rollup_ctx: Arc>, - pub(crate) state_root: Arc as Storage>::Root>>, - pub(crate) mempool: Arc>>, + pub(crate) rollup_ctx: Arc>>, + pub(crate) state_root: Arc as Storage>::Root>>, + pub(crate) mempool: Arc>>, } -impl Clone for RuntimeCall { +impl Clone for RuntimeCall { fn clone(&self) -> Self { match self { RuntimeCall::bank(call) => RuntimeCall::bank(call.clone()), @@ -53,29 +53,29 @@ impl Clone for RuntimeCall { } } -impl From for RuntimeCall { +impl From for RuntimeCall { fn from(call: IbcCallMessage) -> Self { RuntimeCall::ibc(call) } } -impl From> for RuntimeCall { - fn from(call: BankCallMessage) -> Self { +impl From> for RuntimeCall { + fn from(call: BankCallMessage) -> Self { RuntimeCall::bank(call) } } -impl MockRollup +impl MockRollup where - C: Context> + Send + Sync, + S: Spec> + Send + Sync, Da: DaService + Clone, - S: MerkleProofSpec + Clone + 'static, - ::Hasher: Send, + P: MerkleProofSpec + Clone + 'static, +

::Hasher: Send, { pub fn new( - runtime: Runtime, - prover_storage: ProverStorage, - rollup_ctx: C, + runtime: Runtime, + prover_storage: ProverStorage

, + rollup_ctx: Context, da_core: MockTendermint, da_service: Da, ) -> Self { @@ -95,11 +95,11 @@ where self.da_core.chain_id() } - pub fn kernel(&self) -> &BasicKernel { + pub fn kernel(&self) -> &BasicKernel { &self.kernel } - pub fn runtime(&self) -> &Runtime { + pub fn runtime(&self) -> &Runtime { &self.runtime } @@ -107,26 +107,26 @@ where &self.da_service } - pub fn rollup_ctx(&self) -> C { + pub fn rollup_ctx(&self) -> Context { self.rollup_ctx.acquire_mutex().clone() } - pub fn prover_storage(&self) -> ProverStorage { + pub fn prover_storage(&self) -> ProverStorage

{ self.prover_storage.clone() } - pub fn state_root(&self) -> Arc as Storage>::Root>> { + pub fn state_root(&self) -> Arc as Storage>::Root>> { self.state_root.clone() } - pub fn mempool(&self) -> Vec> { + pub fn mempool(&self) -> Vec> { self.mempool.acquire_mutex().clone() } pub fn ibc_ctx<'a>( &'a self, - working_set: &'a mut WorkingSet, - ) -> IbcContext<'a, C, Da::Spec> { + working_set: &'a mut WorkingSet, + ) -> IbcContext<'a, S, Da::Spec> { let shared_working_set = Rc::new(RefCell::new(working_set)); IbcContext::new( @@ -137,8 +137,8 @@ where } /// Returns the balance of a user for a given token - pub fn get_balance_of(&self, user_address: C::Address, token_address: C::Address) -> u64 { - let mut working_set: WorkingSet = WorkingSet::new(self.prover_storage()); + pub fn get_balance_of(&self, user_address: S::Address, token_address: S::Address) -> u64 { + let mut working_set: WorkingSet = WorkingSet::new(self.prover_storage()); self.runtime() .bank @@ -147,7 +147,7 @@ where } /// Returns token address of an IBC denom - pub fn get_minted_token_address(&self, token_denom: String) -> Option { + pub fn get_minted_token_address(&self, token_denom: String) -> Option { let mut working_set = WorkingSet::new(self.prover_storage()); self.runtime() @@ -159,7 +159,7 @@ where /// Searches the transfer module to retrieve the address of the token held /// in escrow, based on its token denom. - pub fn get_escrowed_token_address(&self, token_denom: String) -> Option { + pub fn get_escrowed_token_address(&self, token_denom: String) -> Option { let mut working_set = WorkingSet::new(self.prover_storage()); self.runtime() @@ -169,12 +169,12 @@ where .ok() } - pub(crate) fn set_state_root(&mut self, state_root: as Storage>::Root) { + pub(crate) fn set_state_root(&mut self, state_root: as Storage>::Root) { *self.state_root.acquire_mutex() = state_root; } - pub(crate) fn set_sender(&mut self, sender_address: C::Address) { - *self.rollup_ctx.acquire_mutex() = C::new( + pub(crate) fn set_sender(&mut self, sender_address: S::Address) { + *self.rollup_ctx.acquire_mutex() = Context::new( sender_address.clone(), sender_address, self.rollup_ctx().visible_slot_number(), @@ -184,8 +184,8 @@ where /// Sets the host consensus state when processing each block pub(crate) fn set_host_consensus_state( &mut self, - root_hash: as Storage>::Root, - working_set: &mut WorkingSet, + root_hash: as Storage>::Root, + working_set: &mut WorkingSet, ) { let mut ibc_ctx = self.ibc_ctx(working_set); diff --git a/mocks/src/sovereign/runner.rs b/mocks/src/sovereign/runner.rs index b623ee7d..daccead2 100644 --- a/mocks/src/sovereign/runner.rs +++ b/mocks/src/sovereign/runner.rs @@ -4,7 +4,7 @@ use std::time::Duration; use sov_modules_api::hooks::{FinalizeHook, SlotHooks}; use sov_modules_api::runtime::capabilities::{Kernel, KernelSlotHooks}; use sov_modules_api::{ - Context, DispatchCall, Genesis, KernelWorkingSet, ModuleInfo, SlotData, StateCheckpoint, + DispatchCall, Gas, Genesis, KernelWorkingSet, ModuleInfo, SlotData, Spec, StateCheckpoint, VersionedStateReadWriter, }; use sov_modules_stf_blueprint::kernels::basic::BasicKernelGenesisConfig; @@ -18,20 +18,19 @@ use tracing::{debug, info}; use super::{GenesisConfig, MockRollup, RuntimeCall}; use crate::utils::{wait_for_block, MutexUtil}; -impl MockRollup +impl MockRollup where - C: Context> + Send + Sync, + S: Spec> + Send + Sync, Da: DaService + Clone, - S: MerkleProofSpec + Clone + 'static, - ::Hasher: Send, - C::GasUnit: Default, + P: MerkleProofSpec + Clone + 'static, +

::Hasher: Send, { /// Initializes the chain with the genesis configuration pub async fn init( &mut self, - kernel_genesis_config: &BasicKernelGenesisConfig, - runtime_genesis_config: &GenesisConfig, - ) -> StateCheckpoint { + kernel_genesis_config: &BasicKernelGenesisConfig, + runtime_genesis_config: &GenesisConfig, + ) -> StateCheckpoint { let mut checkpoint = StateCheckpoint::new(self.prover_storage()); let mut kernel_working_set = KernelWorkingSet::uninitialized(&mut checkpoint); @@ -54,7 +53,7 @@ where } /// Begins a block by setting the host consensus state and triggering the slot hook - pub async fn begin_block(&mut self, mut checkpoint: StateCheckpoint) -> StateCheckpoint { + pub async fn begin_block(&mut self, mut checkpoint: StateCheckpoint) -> StateCheckpoint { let current_height = self.rollup_ctx.acquire_mutex().visible_slot_number(); debug!("rollup: processing block at height {current_height}"); @@ -103,7 +102,7 @@ where working_set.checkpoint().0 } - pub async fn execute_msg(&mut self, checkpoint: StateCheckpoint) -> StateCheckpoint { + pub async fn execute_msg(&mut self, checkpoint: StateCheckpoint) -> StateCheckpoint { let mut working_set = checkpoint.to_revertable(Default::default()); let rollup_ctx = self.rollup_ctx(); @@ -131,11 +130,10 @@ where /// Commits a block by triggering the end slot hook, computing the state /// update and committing it to the prover storage - pub async fn commit(&mut self, checkpoint: StateCheckpoint) -> StateCheckpoint { + pub async fn commit(&mut self, checkpoint: StateCheckpoint) -> StateCheckpoint { let mut checkpoint = self.execute_msg(checkpoint).await; - self.kernel() - .end_slot_hook(&Default::default(), &mut checkpoint); + self.kernel().end_slot_hook(&Gas::zero(), &mut checkpoint); self.runtime().end_slot_hook(&mut checkpoint); diff --git a/mocks/src/sovereign/runtime/config.rs b/mocks/src/sovereign/runtime/config.rs index 2cffe2fe..65005570 100644 --- a/mocks/src/sovereign/runtime/config.rs +++ b/mocks/src/sovereign/runtime/config.rs @@ -5,7 +5,7 @@ use sov_chain_state::ChainStateConfig; use sov_ibc::ExampleModuleConfig; use sov_ibc_transfer::TransferConfig; use sov_modules_api::utils::generate_address as gen_address_generic; -use sov_modules_api::{Context, GasUnit}; +use sov_modules_api::{Gas, GasArray, Spec}; use sov_rollup_interface::da::Time; // The default initial slot height. @@ -21,17 +21,17 @@ pub const DEFAULT_ADDRESS_COUNT: u64 = 3; pub const DEFAULT_TOKEN_NAME: &str = "sov-demo-token"; #[derive(Clone, Debug)] -pub struct RollupGenesisConfig { - pub chain_state_config: ChainStateConfig, - pub bank_config: BankConfig, +pub struct RollupGenesisConfig { + pub chain_state_config: ChainStateConfig, + pub bank_config: BankConfig, pub ibc_config: ExampleModuleConfig, pub ibc_transfer_config: TransferConfig, } -impl RollupGenesisConfig { +impl RollupGenesisConfig { pub fn new( - chain_state_config: ChainStateConfig, - bank_config: BankConfig, + chain_state_config: ChainStateConfig, + bank_config: BankConfig, ibc_config: ExampleModuleConfig, ibc_transfer_config: TransferConfig, ) -> Self { @@ -44,7 +44,7 @@ impl RollupGenesisConfig { } } -impl Default for RollupGenesisConfig { +impl Default for RollupGenesisConfig { fn default() -> Self { let chain_state_config = create_chain_state_config(); @@ -64,7 +64,7 @@ impl Default for RollupGenesisConfig { } /// Creates a chain state configuration with the given initial slot height -pub fn create_chain_state_config() -> ChainStateConfig { +pub fn create_chain_state_config() -> ChainStateConfig { let now = SystemTime::now(); let seconds = now @@ -76,17 +76,17 @@ pub fn create_chain_state_config() -> ChainStateConfig { current_time: Time::from_secs(seconds.try_into().unwrap()), gas_price_blocks_depth: 10, gas_price_maximum_elasticity: 1, - initial_gas_price: GasUnit::ZEROED, - minimum_gas_price: GasUnit::ZEROED, + initial_gas_price: <::Gas as Gas>::Price::ZEROED, + minimum_gas_price: <::Gas as Gas>::Price::ZEROED, } } /// Creates a bank configuration with the given number of addresses and initial balance -pub fn create_bank_config(addresses_count: u64, initial_balance: u64) -> BankConfig { +pub fn create_bank_config(addresses_count: u64, initial_balance: u64) -> BankConfig { let address_and_balances: Vec<_> = (0..addresses_count) .map(|i| { let key = format!("key_{}", i); - let addr = gen_address_generic::(&key); + let addr = gen_address_generic::(&key); (addr, initial_balance) }) .collect(); diff --git a/mocks/src/sovereign/runtime/mod.rs b/mocks/src/sovereign/runtime/mod.rs index 5e09dbe5..00ce80c2 100644 --- a/mocks/src/sovereign/runtime/mod.rs +++ b/mocks/src/sovereign/runtime/mod.rs @@ -7,44 +7,44 @@ use sov_ibc_transfer::IbcTransfer; use sov_modules_api::hooks::{FinalizeHook, SlotHooks}; use sov_modules_api::macros::DefaultRuntime; use sov_modules_api::{ - AccessoryStateCheckpoint, Context, DaSpec, DispatchCall, Genesis, MessageCodec, Spec, - StateCheckpoint, VersionedStateReadWriter, + AccessoryStateCheckpoint, DaSpec, DispatchCall, Genesis, MessageCodec, Spec, StateCheckpoint, + VersionedStateReadWriter, }; use sov_state::Storage; #[derive(Genesis, DispatchCall, MessageCodec, DefaultRuntime, Clone)] #[serialization(serde::Serialize, serde::Deserialize)] #[serialization(borsh::BorshDeserialize, borsh::BorshSerialize)] -pub struct Runtime +pub struct Runtime where - C: Context, + S: Spec, Da: DaSpec, { - pub bank: Bank, - pub ibc: Ibc, - pub ibc_transfer: IbcTransfer, + pub bank: Bank, + pub ibc: Ibc, + pub ibc_transfer: IbcTransfer, } -impl SlotHooks for Runtime { - type Context = C; +impl SlotHooks for Runtime { + type Spec = S; fn begin_slot_hook( &self, - _pre_state_root: &<::Storage as Storage>::Root, - _working_set: &mut VersionedStateReadWriter>, + _pre_state_root: &<::Storage as Storage>::Root, + _working_set: &mut VersionedStateReadWriter>, ) { } - fn end_slot_hook(&self, _working_set: &mut StateCheckpoint) {} + fn end_slot_hook(&self, _working_set: &mut StateCheckpoint) {} } -impl FinalizeHook for Runtime { - type Context = C; +impl FinalizeHook for Runtime { + type Spec = S; fn finalize_hook( &self, - _root_hash: &<::Storage as Storage>::Root, - _accesorry_working_set: &mut AccessoryStateCheckpoint, + _root_hash: &<::Storage as Storage>::Root, + _accesorry_working_set: &mut AccessoryStateCheckpoint, ) { } } diff --git a/mocks/src/tests/transfer.rs b/mocks/src/tests/transfer.rs index 9b58faa7..580f9d90 100644 --- a/mocks/src/tests/transfer.rs +++ b/mocks/src/tests/transfer.rs @@ -7,10 +7,9 @@ use ibc_core::primitives::ToProto; use sov_bank::{get_genesis_token_address, TokenConfig}; use sov_ibc::call::CallMessage; use sov_ibc::clients::AnyClientState; -use sov_modules_api::default_context::DefaultContext; use test_log::test; -use crate::configs::TransferTestConfig; +use crate::configs::{DefaultSpec, TransferTestConfig}; use crate::relayer::{Handle, QueryReq, QueryResp, QueryService, RelayerBuilder}; /// Checks if a transfer initiated on the rollup (`send_transfer`) succeeds by @@ -23,8 +22,8 @@ async fn test_escrow_unescrow_on_sov() { let rly = relayer_builder.clone().with_manual_tao().setup().await; // set transfer parameters - let token: TokenConfig = relayer_builder.setup_cfg().get_tokens()[0].clone(); - let token_address = get_genesis_token_address::(&token.token_name, token.salt); + let token: TokenConfig = relayer_builder.setup_cfg().get_tokens()[0].clone(); + let token_address = get_genesis_token_address::(&token.token_name, token.salt); let mut cfg = TransferTestConfig::builder() .sov_denom(token.token_name.clone()) .sov_token_address(Some(token_address)) diff --git a/modules/sov-ibc-transfer/src/context.rs b/modules/sov-ibc-transfer/src/context.rs index a7a5f7cc..d02529e5 100644 --- a/modules/sov-ibc-transfer/src/context.rs +++ b/modules/sov-ibc-transfer/src/context.rs @@ -23,27 +23,27 @@ use ibc_core::primitives::Signer; use ibc_core::router::module::Module; use ibc_core::router::types::module::ModuleExtras; use sov_bank::Coins; -use sov_modules_api::{Context, StateMapAccessor, WorkingSet}; -use sov_rollup_interface::digest::Digest; +use sov_modules_api::{Context, Spec, StateMapAccessor, WorkingSet}; use uint::FromDecStrErr; use super::IbcTransfer; +use crate::utils::compute_escrow_address; /// We need to create a wrapper around the `Transfer` module and `WorkingSet`, /// because we only get the `WorkingSet` at call-time from the Sovereign SDK, /// which must be passed to `TokenTransferValidationContext` methods through /// the `self` argument. -pub struct IbcTransferContext<'ws, C: Context> { - pub ibc_transfer: IbcTransfer, - pub sdk_context: C, - pub working_set: Rc>>, +pub struct IbcTransferContext<'ws, S: Spec> { + pub ibc_transfer: IbcTransfer, + pub sdk_context: Context, + pub working_set: Rc>>, } -impl<'ws, C: Context> IbcTransferContext<'ws, C> { +impl<'ws, S: Spec> IbcTransferContext<'ws, S> { pub fn new( - ibc_transfer: IbcTransfer, - sdk_context: C, - working_set: Rc>>, + ibc_transfer: IbcTransfer, + sdk_context: Context, + working_set: Rc>>, ) -> Self { Self { ibc_transfer, @@ -52,30 +52,32 @@ impl<'ws, C: Context> IbcTransferContext<'ws, C> { } } - // The escrow address follows the format as outlined in ADR 028: - // https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-028-public-key-addresses.md - // except that we don't use a different hash function. - fn get_escrow_account(&self, port_id: &PortId, channel_id: &ChannelId) -> C::Address { - // TODO: Probably cache so we don't need to hash every time - let escrow_account_bytes: [u8; 32] = { - let mut hasher = ::new(); - hasher.update(VERSION); - hasher.update([0]); - hasher.update(format!("{port_id}/{channel_id}")); + /// Obtains the escrow address for a given port and channel pair by looking + /// up the cache. If the cache does not contain the address, it is computed + /// and stored in the cache. + fn obtain_escrow_address(&self, port_id: &PortId, channel_id: &ChannelId) -> S::Address { + let mut working_set = self.working_set.borrow_mut(); - let hash = hasher.finalize(); - *hash.as_ref() - }; - - escrow_account_bytes.into() + self.ibc_transfer + .escrow_address_cache + .get(&(port_id.clone(), channel_id.clone()), *working_set) + .unwrap_or_else(|| { + let escrow_account = compute_escrow_address::(port_id, channel_id); + self.ibc_transfer.escrow_address_cache.set( + &(port_id.clone(), channel_id.clone()), + &escrow_account, + *working_set, + ); + escrow_account + }) } /// Transfers `amount` tokens from `from_account` to `to_account` fn transfer( &self, - token_address: C::Address, - from_account: &C::Address, - to_account: &C::Address, + token_address: S::Address, + from_account: &S::Address, + to_account: &S::Address, amount: &Amount, ) -> Result<(), TokenTransferError> { let amount: sov_bank::Amount = (*amount.as_ref()) @@ -100,9 +102,9 @@ impl<'ws, C: Context> IbcTransferContext<'ws, C> { } } -impl<'ws, C> core::fmt::Debug for IbcTransferContext<'ws, C> +impl<'ws, S> core::fmt::Debug for IbcTransferContext<'ws, S> where - C: Context, + S: Spec, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("TransferContext") @@ -112,16 +114,16 @@ where } /// Extra data to be passed to `TokenTransfer` contexts' escrow methods -pub struct EscrowExtraData { +pub struct EscrowExtraData { /// The address of the token being escrowed - pub token_address: C::Address, + pub token_address: S::Address, } -impl<'ws, C> TokenTransferValidationContext for IbcTransferContext<'ws, C> +impl<'ws, S> TokenTransferValidationContext for IbcTransferContext<'ws, S> where - C: Context, + S: Spec, { - type AccountId = Address; + type AccountId = Address; fn get_port(&self) -> Result { PortId::new(PORT_ID_STR.to_string()).map_err(TokenTransferError::InvalidIdentifier) @@ -159,7 +161,7 @@ where .decode(memo.as_ref()) .map_err(|e| TokenTransferError::Other(format!("Failed to decode memo: {}", e)))?; - let token_address: C::Address = + let token_address: S::Address = BorshDeserialize::deserialize(&mut token_address_buf.as_slice()) .map_err(|e| TokenTransferError::Other(format!("Failed to decode memo: {}", e)))?; @@ -288,7 +290,7 @@ where coin: coin.to_string(), })? }; - let escrow_address = self.get_escrow_account(port_id, channel_id); + let escrow_address = self.obtain_escrow_address(port_id, channel_id); let escrow_balance = self .ibc_transfer @@ -317,7 +319,7 @@ where } } -impl<'ws, C: Context> TokenTransferExecutionContext for IbcTransferContext<'ws, C> { +impl<'ws, S: Spec> TokenTransferExecutionContext for IbcTransferContext<'ws, S> { /// This is called in a `recv_packet()` in the case where we are NOT the /// token source. fn mint_coins_execute( @@ -328,7 +330,7 @@ impl<'ws, C: Context> TokenTransferExecutionContext for IbcTransferContext<'ws, let denom = coin.denom.to_string(); // 1. if token address doesn't exist in `minted_tokens`, then create a new token and store in `minted_tokens` - let token_address: C::Address = { + let token_address: S::Address = { let maybe_token_address = self .ibc_transfer .minted_tokens @@ -453,7 +455,7 @@ impl<'ws, C: Context> TokenTransferExecutionContext for IbcTransferContext<'ws, .decode(memo.as_ref()) .map_err(|e| TokenTransferError::Other(format!("Failed to decode memo: {}", e)))?; - let token_address: C::Address = + let token_address: S::Address = BorshDeserialize::deserialize(&mut token_address_buf.as_slice()) .map_err(|e| TokenTransferError::Other(format!("Failed to decode memo: {}", e)))?; @@ -471,7 +473,7 @@ impl<'ws, C: Context> TokenTransferExecutionContext for IbcTransferContext<'ws, ); // 2. transfer coins to escrow account - let escrow_account = self.get_escrow_account(port_id, channel_id); + let escrow_account = self.obtain_escrow_address(port_id, channel_id); self.transfer( token_address, @@ -503,7 +505,7 @@ impl<'ws, C: Context> TokenTransferExecutionContext for IbcTransferContext<'ws, // transfer coins out of escrow account to `to_account` - let escrow_account = self.get_escrow_account(port_id, channel_id); + let escrow_account = self.obtain_escrow_address(port_id, channel_id); self.transfer( token_address, @@ -518,11 +520,11 @@ impl<'ws, C: Context> TokenTransferExecutionContext for IbcTransferContext<'ws, /// Address type, which wraps C::Address. This is needed to implement /// `TryFrom` (circumventing the orphan rule). -pub struct Address { - pub address: C::Address, +pub struct Address { + pub address: S::Address, } -impl TryFrom for Address { +impl TryFrom for Address { type Error = anyhow::Error; fn try_from(signer: Signer) -> Result { @@ -534,7 +536,7 @@ impl TryFrom for Address { } } -impl<'ws, C: Context> Module for IbcTransferContext<'ws, C> { +impl<'ws, S: Spec> Module for IbcTransferContext<'ws, S> { fn on_chan_open_init_validate( &self, order: Order, diff --git a/modules/sov-ibc-transfer/src/genesis.rs b/modules/sov-ibc-transfer/src/genesis.rs index 319018c8..4a3580df 100644 --- a/modules/sov-ibc-transfer/src/genesis.rs +++ b/modules/sov-ibc-transfer/src/genesis.rs @@ -1,13 +1,13 @@ use anyhow::Result; -use sov_modules_api::{Context, Module, WorkingSet}; +use sov_modules_api::{Module, Spec, WorkingSet}; use super::IbcTransfer; -impl IbcTransfer { +impl IbcTransfer { pub(crate) fn init_module( &self, _config: &::Config, - _working_set: &mut WorkingSet, + _working_set: &mut WorkingSet, ) -> Result<()> { Ok(()) } diff --git a/modules/sov-ibc-transfer/src/lib.rs b/modules/sov-ibc-transfer/src/lib.rs index dd09ac18..b30b23bd 100644 --- a/modules/sov-ibc-transfer/src/lib.rs +++ b/modules/sov-ibc-transfer/src/lib.rs @@ -8,11 +8,13 @@ )] pub mod context; mod genesis; +mod utils; use anyhow::anyhow; use ibc_core::handler::types::events::IbcEvent; +use ibc_core::host::types::identifiers::{ChannelId, PortId}; use serde::{Deserialize, Serialize}; -use sov_modules_api::{Context, Error, Module, ModuleInfo, StateMap, WorkingSet}; +use sov_modules_api::{Context, Error, Module, ModuleInfo, Spec, StateMap, WorkingSet}; #[cfg(feature = "native")] mod rpc; @@ -24,18 +26,18 @@ pub struct TransferConfig {} #[cfg_attr(feature = "native", derive(sov_modules_api::ModuleCallJsonSchema))] #[derive(ModuleInfo, Clone)] -pub struct IbcTransfer { +pub struct IbcTransfer { /// Address of the module. #[address] - address: C::Address, + address: S::Address, /// Reference to the Bank module. #[module] - bank: sov_bank::Bank, + bank: sov_bank::Bank, /// Keeps track of the address of each token we minted by token denom. #[state] - minted_tokens: StateMap, + minted_tokens: StateMap, /// Keeps track of the address of each token we escrowed as a function of /// the token denom. We need this map because we have the token address @@ -48,11 +50,17 @@ pub struct IbcTransfer { /// 1. when tokens are escrowed, save the mapping `denom -> token address` /// 2. when tokens are unescrowed, lookup the token address by `denom` #[state] - escrowed_tokens: StateMap, + escrowed_tokens: StateMap, + + /// Keeps track of escrow addresses associated with a specific port and + /// channel pair, offering an efficient means to access these addresses + /// without the need for recomputation during every packet processing. + #[state] + escrow_address_cache: StateMap<(PortId, ChannelId), S::Address>, } -impl Module for IbcTransfer { - type Context = C; +impl Module for IbcTransfer { + type Spec = S; type Config = TransferConfig; @@ -60,15 +68,15 @@ impl Module for IbcTransfer { type Event = IbcEvent; - fn genesis(&self, config: &Self::Config, working_set: &mut WorkingSet) -> Result<(), Error> { + fn genesis(&self, config: &Self::Config, working_set: &mut WorkingSet) -> Result<(), Error> { Ok(self.init_module(config, working_set)?) } fn call( &self, _msg: Self::CallMessage, - _context: &Self::Context, - _working_set: &mut WorkingSet, + _context: &Context, + _working_set: &mut WorkingSet, ) -> Result { Err(Error::ModuleError(anyhow!( "Cannot call sov-ibc-transfer; use sov-ibc instead" @@ -76,7 +84,7 @@ impl Module for IbcTransfer { } } -impl core::fmt::Debug for IbcTransfer { +impl core::fmt::Debug for IbcTransfer { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { // FIXME: put real values here, or remove `Debug` requirement from router::Module f.debug_struct("Transfer") diff --git a/modules/sov-ibc-transfer/src/rpc.rs b/modules/sov-ibc-transfer/src/rpc.rs index e0e31ca5..223f2be2 100644 --- a/modules/sov-ibc-transfer/src/rpc.rs +++ b/modules/sov-ibc-transfer/src/rpc.rs @@ -2,31 +2,31 @@ use jsonrpsee::core::RpcResult; use jsonrpsee::types::ErrorObjectOwned; use sov_modules_api::macros::rpc_gen; -use sov_modules_api::{Context, StateMapAccessor, WorkingSet}; +use sov_modules_api::{Spec, StateMapAccessor, WorkingSet}; use super::IbcTransfer; #[derive(Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone)] -pub struct EscrowedTokenResponse { - pub address: C::Address, +pub struct EscrowedTokenResponse { + pub address: S::Address, } #[derive(Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, Clone)] -pub struct MintedTokenResponse { - pub address: C::Address, +pub struct MintedTokenResponse { + pub address: S::Address, } #[rpc_gen(client, server, namespace = "transfer")] -impl IbcTransfer +impl IbcTransfer where - C: Context, + S: Spec, { #[rpc_method(name = "escrowedToken")] pub fn escrowed_token( &self, token_denom: String, - working_set: &mut WorkingSet, - ) -> RpcResult> { + working_set: &mut WorkingSet, + ) -> RpcResult> { let token_address = self.escrowed_tokens .get(&token_denom, working_set) @@ -45,8 +45,8 @@ where pub fn minted_token( &self, token_denom: String, - working_set: &mut WorkingSet, - ) -> RpcResult> { + working_set: &mut WorkingSet, + ) -> RpcResult> { let token_address = self.minted_tokens .get(&token_denom, working_set) diff --git a/modules/sov-ibc-transfer/src/utils.rs b/modules/sov-ibc-transfer/src/utils.rs new file mode 100644 index 00000000..d5ad3d51 --- /dev/null +++ b/modules/sov-ibc-transfer/src/utils.rs @@ -0,0 +1,22 @@ +use ibc_app_transfer::types::VERSION; +use ibc_core::host::types::identifiers::{ChannelId, PortId}; +use sov_modules_api::digest::Digest; +use sov_modules_api::{CryptoSpec, Spec}; + +/// The escrow address follows the format as outlined in Cosmos SDK's ADR 028: +/// https://github.com/cosmos/cosmos-sdk/blob/master/docs/architecture/adr-028-public-key-addresses.md +/// except that the `Hasher` function mandated by the `CryptoSpec` trait in the +/// rollup implementation. +pub fn compute_escrow_address(port_id: &PortId, channel_id: &ChannelId) -> S::Address { + let escrow_account_bytes: [u8; 32] = { + let mut hasher = ::Hasher::new(); + hasher.update(VERSION); + hasher.update([0]); + hasher.update(format!("{port_id}/{channel_id}")); + + let hash = hasher.finalize(); + *hash.as_ref() + }; + + escrow_account_bytes.into() +} diff --git a/modules/sov-ibc/src/call.rs b/modules/sov-ibc/src/call.rs index 2347ced3..a95d4b08 100644 --- a/modules/sov-ibc/src/call.rs +++ b/modules/sov-ibc/src/call.rs @@ -9,7 +9,7 @@ use ibc_core::entrypoint::dispatch; use ibc_core::handler::types::msgs::MsgEnvelope; use ibc_core::primitives::proto::Any; use sov_ibc_transfer::context::IbcTransferContext; -use sov_modules_api::{CallResponse, Context, DaSpec, WorkingSet}; +use sov_modules_api::{CallResponse, Context, DaSpec, Spec, WorkingSet}; use thiserror::Error; use crate::context::IbcContext; @@ -33,12 +33,12 @@ pub enum CallMessage { #[derive(Debug, Error)] enum SetValueError {} -impl Ibc { +impl Ibc { pub(crate) fn process_core_message( &self, msg: Any, - context: C, - working_set: &mut WorkingSet, + context: Context, + working_set: &mut WorkingSet, ) -> Result { let shared_working_set = Rc::new(RefCell::new(working_set)); @@ -63,8 +63,8 @@ impl Ibc { pub(crate) fn transfer( &self, msg_transfer: MsgTransfer, - context: C, - working_set: &mut WorkingSet, + context: Context, + working_set: &mut WorkingSet, ) -> Result { let shared_working_set = Rc::new(RefCell::new(working_set)); diff --git a/modules/sov-ibc/src/clients/context.rs b/modules/sov-ibc/src/clients/context.rs index 33f69bd5..51d2e9c2 100644 --- a/modules/sov-ibc/src/clients/context.rs +++ b/modules/sov-ibc/src/clients/context.rs @@ -13,12 +13,12 @@ use ibc_core::primitives::Timestamp; use sov_celestia_client::context::{ CommonContext as SovCommonContext, ValidationContext as SovValidationContext, }; -use sov_modules_api::{Context, DaSpec, StateMapAccessor, StateVecAccessor}; +use sov_modules_api::{DaSpec, Spec, StateMapAccessor, StateVecAccessor}; use super::AnyConsensusState; use crate::context::IbcContext; -impl<'a, C: Context, Da: DaSpec> ClientValidationContext for IbcContext<'a, C, Da> { +impl<'a, S: Spec, Da: DaSpec> ClientValidationContext for IbcContext<'a, S, Da> { fn update_meta( &self, client_id: &ClientId, @@ -40,7 +40,7 @@ impl<'a, C: Context, Da: DaSpec> ClientValidationContext for IbcContext<'a, C, D } } -impl<'a, C: Context, Da: DaSpec> ClientExecutionContext for IbcContext<'a, C, Da> { +impl<'a, S: Spec, Da: DaSpec> ClientExecutionContext for IbcContext<'a, S, Da> { type V = ::V; type AnyClientState = ::AnyClientState; type AnyConsensusState = ::AnyConsensusState; @@ -116,7 +116,7 @@ impl<'a, C: Context, Da: DaSpec> ClientExecutionContext for IbcContext<'a, C, Da } } -impl<'a, C: Context, Da: DaSpec> TmCommonContext for IbcContext<'a, C, Da> { +impl<'a, S: Spec, Da: DaSpec> TmCommonContext for IbcContext<'a, S, Da> { type ConversionError = &'static str; type AnyConsensusState = AnyConsensusState; @@ -145,7 +145,7 @@ impl<'a, C: Context, Da: DaSpec> TmCommonContext for IbcContext<'a, C, Da> { } } -impl<'a, C: Context, Da: DaSpec> TmValidationContext for IbcContext<'a, C, Da> { +impl<'a, S: Spec, Da: DaSpec> TmValidationContext for IbcContext<'a, S, Da> { fn next_consensus_state( &self, client_id: &ClientId, @@ -163,7 +163,7 @@ impl<'a, C: Context, Da: DaSpec> TmValidationContext for IbcContext<'a, C, Da> { } } -impl<'a, C: Context, Da: DaSpec> SovCommonContext for IbcContext<'a, C, Da> { +impl<'a, S: Spec, Da: DaSpec> SovCommonContext for IbcContext<'a, S, Da> { type ConversionError = &'static str; type AnyConsensusState = AnyConsensusState; @@ -192,7 +192,7 @@ impl<'a, C: Context, Da: DaSpec> SovCommonContext for IbcContext<'a, C, Da> { } } -impl<'a, C: Context, Da: DaSpec> SovValidationContext for IbcContext<'a, C, Da> { +impl<'a, S: Spec, Da: DaSpec> SovValidationContext for IbcContext<'a, S, Da> { fn next_consensus_state( &self, client_id: &ClientId, @@ -210,8 +210,8 @@ impl<'a, C: Context, Da: DaSpec> SovValidationContext for IbcContext<'a, C, Da> } } -fn next_consensus_state( - ctx: &IbcContext<'_, C, D>, +fn next_consensus_state( + ctx: &IbcContext<'_, S, D>, client_id: &ClientId, height: &Height, ) -> Result, ContextError> { @@ -269,8 +269,8 @@ fn next_consensus_state( Ok(None) } -fn prev_consensus_state( - ctx: &IbcContext<'_, C, D>, +fn prev_consensus_state( + ctx: &IbcContext<'_, S, D>, client_id: &ClientId, height: &Height, ) -> Result, ContextError> { diff --git a/modules/sov-ibc/src/clients/mod.rs b/modules/sov-ibc/src/clients/mod.rs index 8ed1dd4d..e379fe1e 100644 --- a/modules/sov-ibc/src/clients/mod.rs +++ b/modules/sov-ibc/src/clients/mod.rs @@ -22,7 +22,7 @@ use sov_celestia_client::client_state::ClientState as SovClientState; use sov_celestia_client::consensus_state::ConsensusState as SovConsensusState; use sov_celestia_client::types::client_state::SOV_TENDERMINT_CLIENT_STATE_TYPE_URL; use sov_celestia_client::types::consensus_state::SOV_TENDERMINT_CONSENSUS_STATE_TYPE_URL; -use sov_modules_api::{Context, DaSpec}; +use sov_modules_api::{DaSpec, Spec}; use crate::context::IbcContext; @@ -151,14 +151,14 @@ impl ClientStateCommon for AnyClientState { } } -impl<'a, C, Da> ClientStateExecution> for AnyClientState +impl<'a, S, Da> ClientStateExecution> for AnyClientState where - C: Context, + S: Spec, Da: DaSpec, { fn initialise( &self, - ctx: &mut IbcContext<'a, C, Da>, + ctx: &mut IbcContext<'a, S, Da>, client_id: &ClientId, consensus_state: Any, ) -> Result<(), ClientError> { @@ -170,7 +170,7 @@ where fn update_state( &self, - ctx: &mut IbcContext<'a, C, Da>, + ctx: &mut IbcContext<'a, S, Da>, client_id: &ClientId, header: Any, ) -> Result, ClientError> { @@ -182,7 +182,7 @@ where fn update_state_on_misbehaviour( &self, - ctx: &mut IbcContext<'a, C, Da>, + ctx: &mut IbcContext<'a, S, Da>, client_id: &ClientId, client_message: Any, ) -> Result<(), ClientError> { @@ -198,7 +198,7 @@ where fn update_state_on_upgrade( &self, - ctx: &mut IbcContext<'a, C, Da>, + ctx: &mut IbcContext<'a, S, Da>, client_id: &ClientId, upgraded_client_state: Any, upgraded_consensus_state: Any, @@ -220,14 +220,14 @@ where } } -impl<'a, C, Da> ClientStateValidation> for AnyClientState +impl<'a, S, Da> ClientStateValidation> for AnyClientState where - C: Context, + S: Spec, Da: DaSpec, { fn verify_client_message( &self, - ctx: &IbcContext<'a, C, Da>, + ctx: &IbcContext<'a, S, Da>, client_id: &ClientId, client_message: Any, ) -> Result<(), ClientError> { @@ -243,7 +243,7 @@ where fn check_for_misbehaviour( &self, - ctx: &IbcContext<'a, C, Da>, + ctx: &IbcContext<'a, S, Da>, client_id: &ClientId, client_message: Any, ) -> Result { @@ -259,7 +259,7 @@ where fn status( &self, - ctx: &IbcContext<'a, C, Da>, + ctx: &IbcContext<'a, S, Da>, client_id: &ClientId, ) -> Result { match self { diff --git a/modules/sov-ibc/src/context.rs b/modules/sov-ibc/src/context.rs index c7bb9a3f..9a5e3baa 100644 --- a/modules/sov-ibc/src/context.rs +++ b/modules/sov-ibc/src/context.rs @@ -23,8 +23,8 @@ use ibc_core::host::{ExecutionContext, ValidationContext}; use ibc_core::primitives::proto::Any; use ibc_core::primitives::{Signer, Timestamp}; use sov_modules_api::{ - Context, DaSpec, Module, ModuleInfo, StateMapAccessor, StateValueAccessor, StateVecAccessor, - WorkingSet, + Context, DaSpec, EventEmitter, ModuleInfo, Spec, StateMapAccessor, StateValueAccessor, + StateVecAccessor, WorkingSet, }; use sov_state::Prefix; @@ -36,26 +36,26 @@ use crate::Ibc; pub const HOST_REVISION_NUMBER: u64 = 0; #[derive(Clone)] -pub struct IbcContext<'a, C, Da> +pub struct IbcContext<'a, S, Da> where - C: Context, + S: Spec, Da: DaSpec, { - pub ibc: &'a Ibc, - pub context: Option, - pub working_set: Rc>>, + pub ibc: &'a Ibc, + pub context: Option>, + pub working_set: Rc>>, } -impl<'a, C, Da> IbcContext<'a, C, Da> +impl<'a, S, Da> IbcContext<'a, S, Da> where - C: Context, + S: Spec, Da: DaSpec, { pub fn new( - ibc: &'a Ibc, - context: Option, - working_set: Rc>>, - ) -> IbcContext<'a, C, Da> { + ibc: &'a Ibc, + context: Option>, + working_set: Rc>>, + ) -> IbcContext<'a, S, Da> { IbcContext { ibc, context, @@ -64,9 +64,9 @@ where } } -impl<'a, C, Da> ValidationContext for IbcContext<'a, C, Da> +impl<'a, S, Da> ValidationContext for IbcContext<'a, S, Da> where - C: Context, + S: Spec, Da: DaSpec, { type V = Self; @@ -356,9 +356,9 @@ where } } -impl<'a, C, Da> ExecutionContext for IbcContext<'a, C, Da> +impl<'a, S, Da> ExecutionContext for IbcContext<'a, S, Da> where - C: Context, + S: Spec, Da: DaSpec, { fn get_client_execution_context(&mut self) -> &mut Self::E { @@ -611,7 +611,7 @@ where // TODO: to unblock testing, we implement this method, but the correct way to // track and update the host chain's consensus should be investigated -impl<'ws, C: Context, Da: DaSpec> IbcContext<'ws, C, Da> { +impl<'ws, S: Spec, Da: DaSpec> IbcContext<'ws, S, Da> { pub fn store_host_consensus_state( &mut self, height: Height, diff --git a/modules/sov-ibc/src/genesis.rs b/modules/sov-ibc/src/genesis.rs index 7eadf441..2b12b2c3 100644 --- a/modules/sov-ibc/src/genesis.rs +++ b/modules/sov-ibc/src/genesis.rs @@ -1,13 +1,13 @@ use anyhow::Result; -use sov_modules_api::{Context, DaSpec, Module, StateValueAccessor, WorkingSet}; +use sov_modules_api::{DaSpec, Module, Spec, StateValueAccessor, WorkingSet}; use crate::Ibc; -impl Ibc { +impl Ibc { pub(crate) fn init_module( &self, _config: &::Config, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> Result<()> { self.client_counter.set(&0, working_set); self.connection_counter.set(&0, working_set); diff --git a/modules/sov-ibc/src/lib.rs b/modules/sov-ibc/src/lib.rs index 7e413ea2..4106984a 100644 --- a/modules/sov-ibc/src/lib.rs +++ b/modules/sov-ibc/src/lib.rs @@ -42,7 +42,7 @@ use ibc_core::primitives::Timestamp; use serde::{Deserialize, Serialize}; use sov_ibc_transfer::IbcTransfer; use sov_modules_api::{ - Context, DaSpec, Error, ModuleInfo, StateMap, StateValue, StateVec, WorkingSet, + Context, DaSpec, Error, ModuleInfo, Spec, StateMap, StateValue, StateVec, WorkingSet, }; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] @@ -56,15 +56,15 @@ pub struct ExampleModuleConfig {} /// prefixes by modules are in harmony. #[derive(ModuleInfo, Clone)] #[cfg_attr(feature = "native", derive(sov_modules_api::ModuleCallJsonSchema))] -pub struct Ibc { +pub struct Ibc { #[address] - pub address: C::Address, + pub address: S::Address, #[kernel_module] - chain_state: sov_chain_state::ChainState, + chain_state: sov_chain_state::ChainState, #[module] - transfer: IbcTransfer, + transfer: IbcTransfer, // ----------- IBC core client state maps ------------- #[state] @@ -130,8 +130,8 @@ pub struct Ibc { packet_ack_map: StateMap, } -impl sov_modules_api::Module for Ibc { - type Context = C; +impl sov_modules_api::Module for Ibc { + type Spec = S; type Config = ExampleModuleConfig; @@ -139,15 +139,15 @@ impl sov_modules_api::Module for Ibc { type Event = IbcEvent; - fn genesis(&self, config: &Self::Config, working_set: &mut WorkingSet) -> Result<(), Error> { + fn genesis(&self, config: &Self::Config, working_set: &mut WorkingSet) -> Result<(), Error> { Ok(self.init_module(config, working_set)?) } fn call( &self, msg: Self::CallMessage, - context: &Self::Context, - working_set: &mut WorkingSet, + context: &Context, + working_set: &mut WorkingSet, ) -> Result { match msg { call::CallMessage::Core(msg_envelope) => { diff --git a/modules/sov-ibc/src/router.rs b/modules/sov-ibc/src/router.rs index e199f664..ca645631 100644 --- a/modules/sov-ibc/src/router.rs +++ b/modules/sov-ibc/src/router.rs @@ -8,21 +8,21 @@ use ibc_core::router::module::Module; use ibc_core::router::router::Router; use ibc_core::router::types::module::ModuleId; use sov_ibc_transfer::context::IbcTransferContext; -use sov_modules_api::{Context, DaSpec, WorkingSet}; +use sov_modules_api::{Context, DaSpec, Spec, WorkingSet}; use crate::Ibc; -pub struct IbcRouter<'ws, C: Context, Da: DaSpec> { - pub transfer_ctx: IbcTransferContext<'ws, C>, +pub struct IbcRouter<'ws, S: Spec, Da: DaSpec> { + pub transfer_ctx: IbcTransferContext<'ws, S>, _da: PhantomData, } -impl<'ws, C: Context, Da: DaSpec> IbcRouter<'ws, C, Da> { +impl<'ws, S: Spec, Da: DaSpec> IbcRouter<'ws, S, Da> { pub fn new( - ibc_mod: &Ibc, - sdk_context: C, - working_set: Rc>>, - ) -> IbcRouter<'ws, C, Da> { + ibc_mod: &Ibc, + sdk_context: Context, + working_set: Rc>>, + ) -> IbcRouter<'ws, S, Da> { IbcRouter { transfer_ctx: IbcTransferContext::new( ibc_mod.transfer.clone(), @@ -34,7 +34,7 @@ impl<'ws, C: Context, Da: DaSpec> IbcRouter<'ws, C, Da> { } } -impl<'ws, C: Context, Da: DaSpec> Router for IbcRouter<'ws, C, Da> { +impl<'ws, S: Spec, Da: DaSpec> Router for IbcRouter<'ws, S, Da> { fn get_route(&self, module_id: &ModuleId) -> Option<&dyn Module> { if *module_id == ModuleId::new(MODULE_ID_STR.to_string()) { Some(&self.transfer_ctx) diff --git a/modules/sov-ibc/src/rpc/context.rs b/modules/sov-ibc/src/rpc/context.rs index 924a510f..a7e49dbd 100644 --- a/modules/sov-ibc/src/rpc/context.rs +++ b/modules/sov-ibc/src/rpc/context.rs @@ -13,13 +13,13 @@ use ibc_core::host::types::path::{ }; use ibc_core::host::ValidationContext; use ibc_query::core::context::{ProvableContext, QueryContext}; -use sov_modules_api::{Context, DaSpec, StateMapAccessor, StateValueAccessor, StateVecAccessor}; +use sov_modules_api::{DaSpec, Spec, StateMapAccessor, StateValueAccessor, StateVecAccessor}; use crate::context::IbcContext; -impl<'a, C, Da> ProvableContext for IbcContext<'a, C, Da> +impl<'a, S, Da> ProvableContext for IbcContext<'a, S, Da> where - C: Context, + S: Spec, Da: DaSpec, { /// TODO: Should figure out how can access the proof from the context @@ -28,9 +28,9 @@ where } } -impl<'a, C, Da> QueryContext for IbcContext<'a, C, Da> +impl<'a, S, Da> QueryContext for IbcContext<'a, S, Da> where - C: Context, + S: Spec, Da: DaSpec, { fn client_states( diff --git a/modules/sov-ibc/src/rpc/methods.rs b/modules/sov-ibc/src/rpc/methods.rs index b22fc7d9..cf5e2444 100644 --- a/modules/sov-ibc/src/rpc/methods.rs +++ b/modules/sov-ibc/src/rpc/methods.rs @@ -50,8 +50,8 @@ use ibc_query::core::connection::{ use jsonrpsee::core::RpcResult; use jsonrpsee::types::ErrorObjectOwned; use sov_modules_api::macros::rpc_gen; -use sov_modules_api::{Context, DaSpec, WorkingSet}; -use sov_state::storage::{StateCodec, StateValueCodec, StorageKey}; +use sov_modules_api::{DaSpec, Spec, WorkingSet}; +use sov_state::storage::{SlotKey, StateCodec, StateValueCodec}; use crate::clients::{AnyClientState, AnyConsensusState}; use crate::context::IbcContext; @@ -59,12 +59,12 @@ use crate::Ibc; /// Structure returned by the `client_state` rpc method. #[rpc_gen(client, server, namespace = "ibc")] -impl Ibc { +impl Ibc { #[rpc_method(name = "clientState")] pub fn client_state( &self, request: QueryClientStateRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let prefix = self.client_state_map.prefix(); @@ -73,7 +73,7 @@ impl Ibc { let client_id = ClientId::from_str(request.client_id.as_str()).map_err(to_jsonrpsee_error)?; - let key = StorageKey::new(prefix, &client_id, codec.key_codec()); + let key = SlotKey::new(prefix, &client_id, codec.key_codec()); let value_with_proof = working_set.get_with_proof(key); @@ -109,7 +109,7 @@ impl Ibc { pub fn client_states( &self, request: QueryClientStatesRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -124,7 +124,7 @@ impl Ibc { pub fn consensus_state( &self, request: QueryConsensusStateRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let prefix = self.consensus_state_map.prefix(); @@ -139,7 +139,7 @@ impl Ibc { request.revision_height, ); - let key = StorageKey::new(prefix, &path, codec.key_codec()); + let key = SlotKey::new(prefix, &path, codec.key_codec()); let value_with_proof = working_set.get_with_proof(key); @@ -177,7 +177,7 @@ impl Ibc { pub fn consensus_states( &self, request: QueryConsensusStatesRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -192,7 +192,7 @@ impl Ibc { pub fn consensus_state_heights( &self, request: QueryConsensusStateHeightsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -207,7 +207,7 @@ impl Ibc { pub fn client_status( &self, request: QueryClientStatusRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -222,7 +222,7 @@ impl Ibc { pub fn connection( &self, request: QueryConnectionRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -237,7 +237,7 @@ impl Ibc { pub fn connections( &self, request: QueryConnectionsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -252,7 +252,7 @@ impl Ibc { pub fn client_connections( &self, request: QueryClientConnectionsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -267,7 +267,7 @@ impl Ibc { pub fn connection_client_state( &self, request: QueryConnectionClientStateRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -282,7 +282,7 @@ impl Ibc { pub fn connection_consensus_state( &self, request: QueryConnectionConsensusStateRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -297,7 +297,7 @@ impl Ibc { pub fn connection_params( &self, request: QueryConnectionParamsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -312,7 +312,7 @@ impl Ibc { pub fn channel( &self, request: QueryChannelRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -327,7 +327,7 @@ impl Ibc { pub fn channels( &self, request: QueryChannelsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -342,7 +342,7 @@ impl Ibc { pub fn connection_channels( &self, request: QueryConnectionChannelsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -357,7 +357,7 @@ impl Ibc { pub fn channel_client_state( &self, request: QueryChannelClientStateRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -372,7 +372,7 @@ impl Ibc { pub fn channel_consensus_state( &self, request: QueryChannelConsensusStateRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -387,7 +387,7 @@ impl Ibc { pub fn packet_commitment( &self, request: QueryPacketCommitmentRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let prefix = self.packet_commitment_map.prefix(); @@ -399,7 +399,7 @@ impl Ibc { request.sequence.into(), ); - let key = StorageKey::new(prefix, &commitment_path, codec.key_codec()); + let key = SlotKey::new(prefix, &commitment_path, codec.key_codec()); let value_with_proof = working_set.get_with_proof(key); @@ -433,7 +433,7 @@ impl Ibc { pub fn packet_commitments( &self, request: QueryPacketCommitmentsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -448,7 +448,7 @@ impl Ibc { pub fn packet_receipt( &self, request: QueryPacketReceiptRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -463,7 +463,7 @@ impl Ibc { pub fn packet_acknowledgement( &self, request: QueryPacketAcknowledgementRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -478,7 +478,7 @@ impl Ibc { pub fn packet_acknowledgements( &self, request: QueryPacketAcknowledgementsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -493,7 +493,7 @@ impl Ibc { pub fn unreceived_packets( &self, request: QueryUnreceivedPacketsRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -508,7 +508,7 @@ impl Ibc { pub fn unreceived_acks( &self, request: QueryUnreceivedAcksRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self, @@ -523,7 +523,7 @@ impl Ibc { pub fn next_sequence_receive( &self, request: QueryNextSequenceReceiveRequest, - working_set: &mut WorkingSet, + working_set: &mut WorkingSet, ) -> RpcResult { let ibc_ctx = IbcContext { ibc: self,