diff --git a/Cargo.lock b/Cargo.lock index 7822296c5..465349d20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,38 +166,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" -[[package]] -name = "axum" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" -dependencies = [ - "async-trait", - "axum-core 0.3.4", - "bitflags 1.3.2", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.31", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "rustversion", - "serde", - "serde_json", - "serde_path_to_error", - "serde_urlencoded", - "sync_wrapper 0.1.2", - "tokio", - "tower 0.4.13", - "tower-layer", - "tower-service", -] - [[package]] name = "axum" version = "0.7.9" @@ -205,7 +173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", - "axum-core 0.4.5", + "axum-core", "bytes", "futures-util", "http 1.1.0", @@ -225,23 +193,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "axum-core" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" -dependencies = [ - "async-trait", - "bytes", - "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "mime", - "rustversion", - "tower-layer", - "tower-service", -] - [[package]] name = "axum-core" version = "0.4.5" @@ -321,11 +272,10 @@ checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" dependencies = [ "bech32 0.10.0-beta", "bitcoin-internals", - "bitcoin_hashes 0.13.0", + "bitcoin_hashes", "hex-conservative", "hex_lit", - "secp256k1 0.28.2", - "serde", + "secp256k1", ] [[package]] @@ -333,24 +283,6 @@ name = "bitcoin-internals" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" -dependencies = [ - "serde", -] - -[[package]] -name = "bitcoin-private" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73290177011694f38ec25e165d0387ab7ea749a4b81cd4c80dae5988229f7a57" - -[[package]] -name = "bitcoin_hashes" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d7066118b13d4b20b23645932dfb3a81ce7e29f95726c2036fa33cd7b092501" -dependencies = [ - "bitcoin-private", -] [[package]] name = "bitcoin_hashes" @@ -360,7 +292,6 @@ checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" dependencies = [ "bitcoin-internals", "hex-conservative", - "serde", ] [[package]] @@ -450,15 +381,6 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -471,16 +393,6 @@ version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" -[[package]] -name = "byte-unit" -version = "4.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da78b32057b8fdfc352504708feeba7216dcd65a2c9ab02978cbd288d1279b6c" -dependencies = [ - "serde", - "utf8-width", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -715,7 +627,7 @@ version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.87", @@ -885,33 +797,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "curve25519-dalek" -version = "4.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest 0.10.7", - "fiat-crypto", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "curve25519-dalek-ng" version = "4.1.1" @@ -935,19 +820,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "dashmap" -version = "5.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "data-encoding" version = "2.6.0" @@ -973,12 +845,6 @@ dependencies = [ "powerfmt", ] -[[package]] -name = "derivation-path" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" - [[package]] name = "derive_more" version = "0.99.18" @@ -1091,7 +957,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" dependencies = [ "pkcs8", - "serde", "signature", ] @@ -1108,33 +973,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ed25519-dalek" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand_core", - "serde", - "sha2 0.10.8", - "subtle", - "zeroize", -] - -[[package]] -name = "ed25519-dalek-bip32" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b49a684b133c4980d7ee783936af771516011c8cd15f429dbda77245e282f03" -dependencies = [ - "derivation-path", - "ed25519-dalek", - "hmac", - "sha2 0.10.8", -] - [[package]] name = "either" version = "1.13.0" @@ -1232,12 +1070,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - [[package]] name = "fixed-hash" version = "0.8.0" @@ -1304,7 +1136,6 @@ checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", - "futures-executor", "futures-io", "futures-sink", "futures-task", @@ -1373,7 +1204,6 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -1476,12 +1306,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "hashbrown" version = "0.15.1" @@ -1497,12 +1321,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1557,7 +1375,6 @@ dependencies = [ "hermes-runtime-components", "hermes-test-components", "ibc", - "ibc-relayer", "prost", "serde_json", "sha2 0.10.8", @@ -1627,7 +1444,6 @@ dependencies = [ "http 1.1.0", "humantime", "ibc", - "ibc-relayer", "oneline-eyre", "prost", "serde", @@ -1700,9 +1516,14 @@ name = "hermes-cosmos-chain-components" version = "0.1.0" dependencies = [ "bech32 0.9.1", + "bitcoin", "cgp", + "digest 0.10.7", + "dirs-next", "eyre", "futures", + "generic-array", + "hdpath", "hermes-chain-type-components", "hermes-comet-light-client-components", "hermes-comet-light-client-context", @@ -1716,14 +1537,19 @@ dependencies = [ "ibc", "ibc-client-tendermint", "ibc-proto", - "ibc-relayer", "ics23", "itertools 0.13.0", + "num-bigint", + "num-rational", "prost", "prost-types", "reqwest 0.12.9", + "ripemd", + "secp256k1", "serde", + "serde_derive", "serde_json", + "sha2 0.10.8", "subtle-encoding", "tendermint", "tendermint-light-client", @@ -1731,6 +1557,7 @@ dependencies = [ "tendermint-proto", "tendermint-rpc", "time", + "tiny-bip39", "tokio", "tonic", "tracing", @@ -1771,7 +1598,6 @@ dependencies = [ "hermes-wasm-test-components", "ibc", "ibc-proto", - "ibc-relayer", "prost", "serde_json", "stable-eyre", @@ -1811,15 +1637,13 @@ dependencies = [ "http 1.1.0", "ibc", "ibc-proto", - "ibc-relayer", - "ibc-telemetry", "itertools 0.13.0", "moka", - "opentelemetry 0.17.0", + "opentelemetry", "prost", "prost-types", "reqwest 0.12.9", - "secp256k1 0.27.0", + "secp256k1", "serde", "serde_derive", "serde_json", @@ -1846,9 +1670,9 @@ dependencies = [ "http 1.1.0", "ibc", "ibc-proto", - "ibc-relayer", "itertools 0.13.0", "prost", + "secp256k1", "serde", "serde_json", "sha2 0.10.8", @@ -1888,11 +1712,9 @@ dependencies = [ "http 1.1.0", "ibc", "ibc-proto", - "ibc-relayer", - "ibc-telemetry", "itertools 0.13.0", "moka", - "opentelemetry 0.17.0", + "opentelemetry", "prost", "prost-types", "rand", @@ -2072,12 +1894,10 @@ dependencies = [ "hermes-runtime-components", "ibc", "ibc-proto", - "ibc-relayer", - "ibc-telemetry", "itertools 0.13.0", "prost", "prost-types", - "secp256k1 0.27.0", + "secp256k1", "serde", "serde_derive", "sha2 0.10.8", @@ -2107,11 +1927,9 @@ dependencies = [ "hermes-solomachine-chain-components", "ibc", "ibc-proto", - "ibc-relayer", - "ibc-telemetry", "itertools 0.13.0", "prost", - "secp256k1 0.27.0", + "secp256k1", "serde", "serde_derive", "sha2 0.10.8", @@ -2317,16 +2135,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" -[[package]] -name = "humantime-serde" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c" -dependencies = [ - "humantime", - "serde", -] - [[package]] name = "hyper" version = "0.14.31" @@ -2521,11 +2329,11 @@ dependencies = [ "ibc-core", "ibc-proto", "parity-scale-codec", - "primitive-types 0.13.1", + "primitive-types", "scale-info", "schemars", "serde", - "uint 0.10.0", + "uint", ] [[package]] @@ -2954,119 +2762,6 @@ dependencies = [ "tonic", ] -[[package]] -name = "ibc-relayer" -version = "0.29.3" -source = "git+https://github.com/informalsystems/hermes.git#282b943dab7d6142719f8a9dd0f4e40f45131721" -dependencies = [ - "anyhow", - "async-stream", - "bech32 0.9.1", - "bitcoin", - "bs58", - "byte-unit", - "bytes", - "crossbeam-channel", - "digest 0.10.7", - "dirs-next", - "ed25519", - "ed25519-dalek", - "ed25519-dalek-bip32", - "flex-error", - "futures", - "generic-array", - "hdpath", - "hex 0.4.3", - "http 1.1.0", - "humantime", - "humantime-serde", - "ibc-proto", - "ibc-relayer-types", - "ibc-telemetry", - "itertools 0.13.0", - "moka", - "num-bigint", - "num-rational", - "once_cell", - "prost", - "regex", - "reqwest 0.11.27", - "retry", - "ripemd", - "secp256k1 0.28.2", - "semver", - "serde", - "serde_derive", - "serde_json", - "sha2 0.10.8", - "signature", - "strum", - "subtle-encoding", - "tendermint", - "tendermint-light-client", - "tendermint-light-client-detector", - "tendermint-light-client-verifier", - "tendermint-proto", - "tendermint-rpc", - "thiserror", - "tiny-bip39", - "tiny-keccak", - "tokio", - "tokio-stream", - "toml", - "tonic", - "tracing", - "tracing-subscriber", - "uuid", -] - -[[package]] -name = "ibc-relayer-types" -version = "0.29.3" -source = "git+https://github.com/informalsystems/hermes.git#282b943dab7d6142719f8a9dd0f4e40f45131721" -dependencies = [ - "bytes", - "derive_more 0.99.18", - "flex-error", - "ibc-proto", - "ics23", - "itertools 0.13.0", - "num-rational", - "primitive-types 0.12.2", - "prost", - "regex", - "serde", - "serde_derive", - "serde_json", - "subtle-encoding", - "tendermint", - "tendermint-light-client-verifier", - "tendermint-proto", - "time", - "tracing", - "uint 0.9.5", -] - -[[package]] -name = "ibc-telemetry" -version = "0.29.3" -source = "git+https://github.com/informalsystems/hermes.git#282b943dab7d6142719f8a9dd0f4e40f45131721" -dependencies = [ - "axum 0.6.20", - "dashmap 5.5.3", - "ibc-relayer-types", - "moka", - "once_cell", - "opentelemetry 0.19.0", - "opentelemetry-prometheus", - "prometheus", - "serde", - "serde_json", - "tendermint", - "tokio", - "tracing", -] - [[package]] name = "ics23" version = "0.12.0" @@ -3234,15 +2929,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - [[package]] name = "impl-serde" version = "0.5.0" @@ -3522,7 +3208,6 @@ checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", - "serde", ] [[package]] @@ -3549,7 +3234,6 @@ dependencies = [ "num-bigint", "num-integer", "num-traits", - "serde", ] [[package]] @@ -3653,7 +3337,7 @@ checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" dependencies = [ "async-trait", "crossbeam-channel", - "dashmap 4.0.2", + "dashmap", "fnv", "futures-channel", "futures-executor", @@ -3666,63 +3350,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "opentelemetry" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4b8347cc26099d3aeee044065ecc3ae11469796b4d65d065a23a584ed92a6f" -dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk", -] - -[[package]] -name = "opentelemetry-prometheus" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9f186f6293ebb693caddd0595e66b74a6068fa51048e26e0bf9c95478c639c" -dependencies = [ - "opentelemetry 0.19.0", - "prometheus", - "protobuf", -] - -[[package]] -name = "opentelemetry_api" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed41783a5bf567688eb38372f2b7a8530f5a607a4b49d38dd7573236c23ca7e2" -dependencies = [ - "fnv", - "futures-channel", - "futures-util", - "indexmap 1.9.3", - "once_cell", - "pin-project-lite", - "thiserror", - "urlencoding", -] - -[[package]] -name = "opentelemetry_sdk" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b3a2a91fdbfdd4d212c0dcc2ab540de2c2bcbbd90be17de7a7daf8822d010c1" -dependencies = [ - "async-trait", - "crossbeam-channel", - "dashmap 5.5.3", - "fnv", - "futures-channel", - "futures-executor", - "futures-util", - "once_cell", - "opentelemetry_api", - "percent-encoding", - "rand", - "thiserror", -] - [[package]] name = "overload" version = "0.1.1" @@ -3906,17 +3533,6 @@ dependencies = [ "syn 2.0.87", ] -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-serde 0.4.0", - "uint 0.9.5", -] - [[package]] name = "primitive-types" version = "0.13.1" @@ -3925,8 +3541,8 @@ checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", "impl-codec", - "impl-serde 0.5.0", - "uint 0.10.0", + "impl-serde", + "uint", ] [[package]] @@ -3947,21 +3563,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "prometheus" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" -dependencies = [ - "cfg-if", - "fnv", - "lazy_static", - "memchr", - "parking_lot", - "protobuf", - "thiserror", -] - [[package]] name = "prost" version = "0.13.3" @@ -3994,12 +3595,6 @@ dependencies = [ "prost", ] -[[package]] -name = "protobuf" -version = "2.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" - [[package]] name = "quanta" version = "0.12.3" @@ -4217,12 +3812,6 @@ dependencies = [ "windows-registry", ] -[[package]] -name = "retry" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9166d72162de3575f950507683fac47e30f6f2c3836b71b7fbc61aa517c9c5f4" - [[package]] name = "rfc6979" version = "0.4.0" @@ -4529,38 +4118,18 @@ dependencies = [ "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" -dependencies = [ - "bitcoin_hashes 0.12.0", - "rand", - "secp256k1-sys 0.8.1", -] - [[package]] name = "secp256k1" version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" dependencies = [ - "bitcoin_hashes 0.13.0", + "bitcoin_hashes", "rand", - "secp256k1-sys 0.9.2", + "secp256k1-sys", "serde", ] -[[package]] -name = "secp256k1-sys" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" -dependencies = [ - "cc", -] - [[package]] name = "secp256k1-sys" version = "0.9.2" @@ -4671,16 +4240,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_path_to_error" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" -dependencies = [ - "itoa", - "serde", -] - [[package]] name = "serde_repr" version = "0.1.19" @@ -4862,28 +4421,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.87", -] - [[package]] name = "subtle" version = "2.6.1" @@ -5089,29 +4626,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "tendermint-light-client-detector" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48a431ea923182c37ca9f3cc8333490ac6746a64520d1c4a3dd18c08b0806ac" -dependencies = [ - "crossbeam-channel", - "derive_more 0.99.18", - "flex-error", - "futures", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "static_assertions", - "tendermint", - "tendermint-light-client", - "tendermint-proto", - "tendermint-rpc", - "time", - "tracing", -] - [[package]] name = "tendermint-light-client-verifier" version = "0.40.0" @@ -5257,15 +4771,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinystr" version = "0.7.6" @@ -5428,7 +4933,7 @@ checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" dependencies = [ "async-stream", "async-trait", - "axum 0.7.9", + "axum", "base64 0.22.1", "bytes", "h2 0.4.6", @@ -5505,7 +5010,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -5613,18 +5117,6 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex 0.4.3", - "static_assertions", -] - [[package]] name = "uint" version = "0.10.0" @@ -5675,12 +5167,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" - [[package]] name = "utf-8" version = "0.7.6" @@ -5693,12 +5179,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" -[[package]] -name = "utf8-width" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" - [[package]] name = "utf8_iter" version = "1.0.4" diff --git a/Cargo.toml b/Cargo.toml index 1436b0ee6..137dc612e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,8 +77,6 @@ async-trait = { version = "0.1.83" } ibc = { version = "0.56.0", default-features = false } ibc-client-tendermint = { version = "0.56.0", default-features = false } ibc-proto = { version = "0.51.1", default-features = false } -ibc-relayer = { version = "0.29.3" } -ibc-telemetry = { version = "0.29.3" } tendermint = { version = "0.40" } tendermint-proto = { version = "0.40" } tendermint-rpc = { version = "0.40" } @@ -86,27 +84,34 @@ tendermint-testgen = { version = "0.40" } tendermint-light-client-verifier = { version = "0.40" } tendermint-light-client = { version = "0.40" } basecoin = { version = "0.2.0" } +bitcoin = { version = "0.31.2" } cgp = { version = "0.2.0", default-features = false } clap = { version = "4.5.20" } dirs-next = { version = "2.0.0" } +num-bigint = { version = "0.4" } +num-rational = { version = "0.4.1" } oneline-eyre = { version = "0.1.0" } prost = { version = "0.13.3" } prost-types = { version = "0.13.3" } reqwest = { version = "0.12.9", features = ["json"] } -serde = { version = "1.0.210" } -serde_derive = { version = "1.0" } +ripemd = { version = "0.1.3" } +serde = { version = "1.0.214" } +serde_derive = { version = "1.0.104" } serde_json = { version = "1.0" } subtle-encoding = { version = "0.5.1" } +tiny-bip39 = { version = "1.0.0" } tokio = { version = "1.40" } tracing = { version = "0.1.40" } tracing-subscriber = { version = "0.3.18" } time = { version = "0.3.36" } tonic = { version = "0.12" } toml = { version = "0.8.15" } +digest = { version = "0.10.6" } futures = { version = "0.3.30", default-features = false } futures-core = { version = "0.3.30", default-features = false } futures-util = { version = "0.3.30", default-features = false } futures-channel = { version = "0.3.31", default-features = false } +generic-array = { version = "0.14.7" } eyre = { version = "0.6.12" } itertools = { version = "0.13" } http = { version = "1.0.0" } @@ -116,7 +121,7 @@ hdpath = { version = "0.6.3" } rand = { version = "0.8.5" } bech32 = { version = "0.9.1" } sha2 = { version = "0.10.8" } -secp256k1 = { version = "0.27.0", features = ["rand", "bitcoin_hashes"] } +secp256k1 = { version = "0.28.2" } ics23 = { version = "0.12" } hermes-runtime-components = { version = "0.1.0" } @@ -188,9 +193,6 @@ hermes-ibc-mock-chain = { version = "0.1.0" } # cgp-run = { git = "https://github.com/contextgeneric/cgp.git" } # cgp-inner = { git = "https://github.com/contextgeneric/cgp.git" } -ibc-relayer = { git = "https://github.com/informalsystems/hermes.git" } -ibc-telemetry = { git = "https://github.com/informalsystems/hermes.git" } - hermes-chain-components = { path = "./crates/chain/chain-components" } hermes-chain-type-components = { path = "./crates/chain/chain-type-components" } diff --git a/crates/any/any-counterparty/src/impls/types/client_state.rs b/crates/any/any-counterparty/src/impls/types/client_state.rs index bca363c1c..8e56f129b 100644 --- a/crates/any/any-counterparty/src/impls/types/client_state.rs +++ b/crates/any/any-counterparty/src/impls/types/client_state.rs @@ -43,4 +43,10 @@ where AnyClientState::Tendermint(cs) => cs.trusting_period < elapsed, } } + + fn client_state_chain_id(client_state: &AnyClientState) -> ChainId { + match client_state { + AnyClientState::Tendermint(cs) => cs.chain_id.clone(), + } + } } diff --git a/crates/celestia/celestia-integration-tests/Cargo.toml b/crates/celestia/celestia-integration-tests/Cargo.toml index 0237afff7..27cdff91f 100644 --- a/crates/celestia/celestia-integration-tests/Cargo.toml +++ b/crates/celestia/celestia-integration-tests/Cargo.toml @@ -28,7 +28,6 @@ hermes-cosmos-integration-tests = { workspace = true } hermes-celestia-test-components = { workspace = true } ibc = { workspace = true } -ibc-relayer = { workspace = true } eyre = { workspace = true } tokio = { workspace = true } diff --git a/crates/chain/chain-components/src/traits/types/client_state.rs b/crates/chain/chain-components/src/traits/types/client_state.rs index 2aab1fc2e..6cd1c46f1 100644 --- a/crates/chain/chain-components/src/traits/types/client_state.rs +++ b/crates/chain/chain-components/src/traits/types/client_state.rs @@ -2,6 +2,7 @@ use core::time::Duration; use cgp::core::component::UseDelegate; use cgp::prelude::*; +use hermes_chain_type_components::traits::types::chain_id::HasChainIdType; pub use hermes_chain_type_components::traits::types::ibc::client_state::*; use crate::traits::types::height::HasHeightType; @@ -21,7 +22,7 @@ pub trait HasRawClientStateType: Async { context: Chain, }] pub trait HasClientStateFields: - HasHeightType + HasClientStateType + HasHeightType + HasChainIdType + HasClientStateType { /// The latest height of the client fn client_state_latest_height(client_state: &Self::ClientState) -> Self::Height; @@ -32,12 +33,14 @@ pub trait HasClientStateFields: /// Check if the client state will expired when `elapsed` time has passed /// since the latest consensus state fn client_state_has_expired(client_state: &Self::ClientState, elapsed: Duration) -> bool; + + fn client_state_chain_id(client_state: &Self::ClientState) -> Self::ChainId; } impl ClientStateFieldsGetter for UseDelegate where - Chain: HasHeightType + HasClientStateType, + Chain: HasHeightType + HasChainIdType + HasClientStateType, Components: DelegateComponent, Delegate: ClientStateFieldsGetter, { @@ -52,4 +55,8 @@ where fn client_state_has_expired(client_state: &Chain::ClientState, elapsed: Duration) -> bool { Delegate::client_state_has_expired(client_state, elapsed) } + + fn client_state_chain_id(client_state: &Chain::ClientState) -> Chain::ChainId { + Delegate::client_state_chain_id(client_state) + } } diff --git a/crates/cli/cli/Cargo.toml b/crates/cli/cli/Cargo.toml index fb3e3251d..99d29301f 100644 --- a/crates/cli/cli/Cargo.toml +++ b/crates/cli/cli/Cargo.toml @@ -35,7 +35,6 @@ hermes-encoding-components = { workspace = true } hermes-protobuf-encoding-components = { workspace = true } ibc = { workspace = true } -ibc-relayer = { workspace = true } clap = { workspace = true, features = ["derive"] } dirs-next = { workspace = true } diff --git a/crates/cli/cli/src/commands/keys/add.rs b/crates/cli/cli/src/commands/keys/add.rs index 297467b41..7428db07e 100644 --- a/crates/cli/cli/src/commands/keys/add.rs +++ b/crates/cli/cli/src/commands/keys/add.rs @@ -7,10 +7,9 @@ use hermes_cli_components::traits::build::CanLoadBuilder; use hermes_cli_framework::command::CommandRunner; use hermes_cli_framework::output::Output; use hermes_cosmos_chain_components::impls::types::config::CosmosChainConfig; +use hermes_cosmos_chain_components::types::key_types::keyring::KeyRing; +use hermes_cosmos_chain_components::types::key_types::secp256k1::Secp256k1KeyPair; use ibc::core::host::types::identifiers::ChainId; -use ibc_relayer::keyring::{ - AnySigningKeyPair, KeyRing, Secp256k1KeyPair, SigningKeyPair, SigningKeyPairSized, Store, -}; use oneline_eyre::eyre; use oneline_eyre::eyre::{eyre, WrapErr}; use tracing::warn; @@ -124,22 +123,24 @@ pub fn add_key( file: &Path, hd_path: &StandardHDPath, overwrite: bool, -) -> eyre::Result { - let mut keyring = KeyRing::new_secp256k1( - Store::Test, +) -> eyre::Result { + let keyring = KeyRing::new_secp256k1( &config.account_prefix, - &ChainId::new(&config.id)?.to_string().into(), + &ChainId::new(&config.id)?, &config.key_store_folder, - )?; + ); check_key_exists(&keyring, key_name, overwrite); let key_contents = fs::read_to_string(file).wrap_err("error reading the key file")?; - let key_pair = Secp256k1KeyPair::from_seed_file(&key_contents, hd_path)?; + let key_pair = + Secp256k1KeyPair::from_seed_file(&key_contents, hd_path).map_err(|e| eyre!("{e}"))?; - keyring.add_key(key_name, key_pair.clone())?; + keyring + .add_key(key_name, key_pair.clone()) + .map_err(|e| eyre!("{e}"))?; - Ok(key_pair.into()) + Ok(key_pair) } pub fn restore_key( @@ -148,35 +149,33 @@ pub fn restore_key( hdpath: &StandardHDPath, config: &CosmosChainConfig, overwrite: bool, -) -> eyre::Result { +) -> eyre::Result { let mnemonic_content = fs::read_to_string(mnemonic).wrap_err("error reading the mnemonic file")?; - let mut keyring = KeyRing::new_secp256k1( - Store::Test, + let keyring = KeyRing::new_secp256k1( &config.account_prefix, - &ChainId::new(&config.id)?.to_string().into(), + &ChainId::new(&config.id)?, &config.key_store_folder, - )?; + ); check_key_exists(&keyring, key_name, overwrite); - let key_pair = Secp256k1KeyPair::from_mnemonic( - &mnemonic_content, - hdpath, - &ibc_relayer::config::AddressType::Cosmos, - keyring.account_prefix(), - )?; + let key_pair = + Secp256k1KeyPair::from_mnemonic(&mnemonic_content, hdpath, keyring.account_prefix()) + .map_err(|e| eyre!("{e}"))?; - keyring.add_key(key_name, key_pair.clone())?; + keyring + .add_key(key_name, key_pair.clone()) + .map_err(|e| eyre!("{e}"))?; - Ok(key_pair.into()) + Ok(key_pair) } /// Check if the key with the given key name already exists. /// If it already exists and overwrite is false, abort the command with an error. /// If overwrite is true, output a warning message informing the key will be overwritten. -fn check_key_exists(keyring: &KeyRing, key_name: &str, overwrite: bool) { +fn check_key_exists(keyring: &KeyRing, key_name: &str, overwrite: bool) { if keyring.get_key(key_name).is_ok() { if overwrite { warn!("key {} will be overwritten", key_name); diff --git a/crates/cli/cli/src/commands/keys/delete.rs b/crates/cli/cli/src/commands/keys/delete.rs index 7ee01338d..42a6932c0 100644 --- a/crates/cli/cli/src/commands/keys/delete.rs +++ b/crates/cli/cli/src/commands/keys/delete.rs @@ -2,9 +2,9 @@ use hermes_cli_components::traits::build::CanLoadBuilder; use hermes_cli_framework::command::CommandRunner; use hermes_cli_framework::output::Output; use hermes_cosmos_chain_components::impls::types::config::CosmosChainConfig; +use hermes_cosmos_chain_components::types::key_types::keyring::KeyRing; use ibc::core::host::types::identifiers::ChainId; -use ibc_relayer::keyring::{KeyRing, Store}; -use oneline_eyre::eyre::{eyre, Context}; +use oneline_eyre::eyre::eyre; use tracing::warn; use crate::contexts::app::HermesApp; @@ -120,28 +120,24 @@ impl CommandRunner for KeysDeleteCmd { fn delete_key(config: &CosmosChainConfig, key_name: &str) -> eyre::Result<()> { let mut keyring = KeyRing::new_secp256k1( - Store::Test, &config.account_prefix, - &ChainId::new(&config.id)?.to_string().into(), + &ChainId::new(&config.id)?, &config.key_store_folder, - )?; + ); - keyring.remove_key(key_name)?; + keyring.remove_key(key_name).map_err(|e| eyre!("{e}"))?; Ok(()) } fn delete_all_keys(config: &CosmosChainConfig) -> eyre::Result<()> { let mut keyring = KeyRing::new_secp256k1( - Store::Test, &config.account_prefix, - &ChainId::new(&config.id)?.to_string().into(), + &ChainId::new(&config.id)?, &config.key_store_folder, - )?; + ); - let keys = keyring - .keys() - .wrap_err("failed to fetch keys from keyring")?; + let keys = keyring.keys().map_err(|e| eyre!("{e}"))?; for (key_name, _) in keys { if let Err(e) = keyring.remove_key(&key_name) { diff --git a/crates/cli/cli/src/commands/keys/list.rs b/crates/cli/cli/src/commands/keys/list.rs index 6bcb349c6..b837ef914 100644 --- a/crates/cli/cli/src/commands/keys/list.rs +++ b/crates/cli/cli/src/commands/keys/list.rs @@ -4,8 +4,8 @@ use std::collections::BTreeMap; use hermes_cli_components::traits::build::CanLoadBuilder; use hermes_cli_framework::command::CommandRunner; use hermes_cli_framework::output::{json, Output}; +use hermes_cosmos_chain_components::types::key_types::keyring::KeyRing; use ibc::core::host::types::identifiers::ChainId; -use ibc_relayer::keyring::{KeyRing, SigningKeyPair, Store}; use oneline_eyre::eyre::eyre; use crate::contexts::app::HermesApp; @@ -32,18 +32,21 @@ impl CommandRunner for KeysListCmd { .ok_or_else(|| eyre!("chain `{}` not found in configuration file", self.chain_id))?; let keyring = KeyRing::new_secp256k1( - Store::Test, &chain_config.account_prefix, - &ChainId::new(&chain_config.id)?.to_string().into(), + &ChainId::new(&chain_config.id)?, &chain_config.key_store_folder, - )?; + ); if json() { - let keys = keyring.keys()?.into_iter().collect::>(); + let keys = keyring + .keys() + .map_err(|e| eyre!("{e}"))? + .into_iter() + .collect::>(); Output::success(keys).exit() } else { let mut msg = String::new(); - for (name, key) in keyring.keys()? { + for (name, key) in keyring.keys().map_err(|e| eyre!("{e}"))? { let _ = write!(msg, "\n- {} ({})", name, key.account()); } Output::success_msg(msg).exit() diff --git a/crates/cli/cli/src/commands/query/channel/ends.rs b/crates/cli/cli/src/commands/query/channel/ends.rs index 92d678d45..5268cd570 100644 --- a/crates/cli/cli/src/commands/query/channel/ends.rs +++ b/crates/cli/cli/src/commands/query/channel/ends.rs @@ -94,7 +94,7 @@ impl CommandRunner for QueryChannelEnds { // channel end query path let channel_end_path = format!("channelEnds/ports/{port_id}/channels/{channel_id}"); - let channel_end_bytes = chain + let channel_end_bytes: Vec = chain .query_abci(IBC_QUERY_PATH, channel_end_path.as_bytes(), &query_height) .await?; diff --git a/crates/cli/cli/src/config/mod.rs b/crates/cli/cli/src/config/mod.rs index 93cb0c65e..1a4f99d84 100644 --- a/crates/cli/cli/src/config/mod.rs +++ b/crates/cli/cli/src/config/mod.rs @@ -1,7 +1,10 @@ +use std::fs::File; +use std::io::Read; use std::ops::Deref; +use std::path::Path; use hermes_cli_framework::config::Config; -use ibc_relayer::config::{load as load_config, Config as RelayerConfig}; +use hermes_cosmos_chain_components::impls::types::config::RelayerConfig; pub struct HermesConfig { pub config: RelayerConfig, @@ -19,7 +22,30 @@ impl Config for HermesConfig { fn load_from_path( path: impl AsRef, ) -> Result> { - let config = load_config(path)?; + let config = load_config(&path)?; Ok(Self { config }) } } + +fn load_config(path: &impl AsRef) -> Result { + let canonical_path = path + .as_ref() + .canonicalize() + .map_err(|e| format!("failed to canonicalize config path. Cause: {e}"))?; + load_toml_file(canonical_path.as_path()) +} + +fn load_toml_file(path: &Path) -> Result { + let mut file = + File::open(path).map_err(|e| format!("failed to open config file. Cause: {e}"))?; + + let mut toml_string = String::new(); + file.read_to_string(&mut toml_string) + .map_err(|e| format!("failed to read toml file from string. Cause: {e}"))?; + load_toml(toml_string) +} + +fn load_toml(toml_string: String) -> Result { + toml::from_str(toml_string.as_ref()) + .map_err(|e| format!("failed to convert String to toml. Cause: {e}")) +} diff --git a/crates/cli/cli/src/contexts/app.rs b/crates/cli/cli/src/contexts/app.rs index 865690643..ba2128e96 100644 --- a/crates/cli/cli/src/contexts/app.rs +++ b/crates/cli/cli/src/contexts/app.rs @@ -49,6 +49,7 @@ use hermes_cli_components::traits::output::{ use hermes_cli_components::traits::parse::ArgParserComponent; use hermes_cli_components::traits::types::config::ConfigTypeComponent; use hermes_cli_framework::output::Output; +use hermes_cosmos_chain_components::impls::types::config::RelayerConfig; use hermes_cosmos_chain_components::types::payloads::client::CosmosCreateClientOptions; use hermes_cosmos_integration_tests::contexts::bootstrap::CosmosBootstrap; use hermes_cosmos_relayer::contexts::build::CosmosBuilder; @@ -65,7 +66,6 @@ use hermes_runtime::types::runtime::HermesRuntime; use hermes_runtime_components::traits::runtime::{RuntimeGetterComponent, RuntimeTypeComponent}; use ibc::core::client::types::Height; use ibc::core::host::types::identifiers::{ChainId, ClientId, ConnectionId}; -use ibc_relayer::config::Config; use serde::Serialize; use crate::commands::bootstrap::chain::{BootstrapChainArgs, LoadCosmosBootstrap}; @@ -107,7 +107,7 @@ delegate_components! { ]: ProvideHermesLogger, ConfigTypeComponent: - WithType, + WithType, BootstrapTypeComponent: WithType, BuilderTypeComponent: diff --git a/crates/cli/cli/src/impls/build.rs b/crates/cli/cli/src/impls/build.rs index 072bf65da..2e1426cfe 100644 --- a/crates/cli/cli/src/impls/build.rs +++ b/crates/cli/cli/src/impls/build.rs @@ -1,17 +1,17 @@ use hermes_cli_components::traits::build::{BuilderLoader, HasBuilderType}; use hermes_cli_components::traits::config::load_config::CanLoadConfig; use hermes_cli_components::traits::types::config::HasConfigType; +use hermes_cosmos_chain_components::impls::types::config::RelayerConfig; use hermes_cosmos_relayer::contexts::build::CosmosBuilder; use hermes_runtime::types::runtime::HermesRuntime; use hermes_runtime_components::traits::runtime::HasRuntime; -use ibc_relayer::config::{ChainConfig, Config}; pub struct LoadCosmosBuilder; impl BuilderLoader for LoadCosmosBuilder where App: HasBuilderType - + HasConfigType + + HasConfigType + HasRuntime + CanLoadConfig, { @@ -19,17 +19,8 @@ where let runtime = app.runtime().clone(); let config = app.load_config().await?; - let chain_configs = config - .chains - .into_iter() - .map(|config| { - let ChainConfig::CosmosSdk(config) = config; - config.into() - }) - .collect(); - let builder = CosmosBuilder::new( - chain_configs, + config.chains, runtime, Default::default(), Default::default(), diff --git a/crates/cosmos/cosmos-chain-components/Cargo.toml b/crates/cosmos/cosmos-chain-components/Cargo.toml index c188d3e38..b9d43a4b2 100644 --- a/crates/cosmos/cosmos-chain-components/Cargo.toml +++ b/crates/cosmos/cosmos-chain-components/Cargo.toml @@ -24,29 +24,39 @@ hermes-comet-light-client-components = { workspace = true } hermes-comet-light-client-context = { workspace = true } ibc = { workspace = true } -ibc-proto = { workspace = true } +ibc-proto = { workspace = true, features = ["client", "transport"] } ibc-client-tendermint = { workspace = true } -ibc-relayer = { workspace = true } tendermint = { workspace = true, features = ["secp256k1"] } tendermint-proto = { workspace = true } tendermint-light-client = { workspace = true } tendermint-light-client-verifier = { workspace = true } tendermint-rpc = { workspace = true, features = ["http-client", "websocket-client"] } +bitcoin = { workspace = true } +bech32 = { workspace = true } +eyre = { workspace = true } +digest = { workspace = true } +dirs-next = { workspace = true } +futures = { workspace = true, features = ["alloc"] } +generic-array = { workspace = true } +hdpath = { workspace = true } +http = { workspace = true } ics23 = { workspace = true } +itertools = { workspace = true } +num-bigint = { workspace = true } +num-rational = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } -eyre = { workspace = true } -tokio = { workspace = true } -itertools = { workspace = true } -futures = { workspace = true } -tracing = { workspace = true } -http = { workspace = true } -bech32 = { workspace = true } reqwest = { workspace = true } -time = { workspace = true } +ripemd = { workspace = true } +sha2 = { workspace = true } +secp256k1 = { workspace = true, features = ["serde"] } serde = { workspace = true } +serde_derive = { workspace = true } serde_json = { workspace = true } +subtle-encoding = { workspace = true } +time = { workspace = true } +tiny-bip39 = { workspace = true } +tokio = { workspace = true } tonic = { workspace = true, features = ["tls", "tls-roots"] } - -subtle-encoding = { workspace = true } +tracing = { workspace = true } diff --git a/crates/cosmos/cosmos-chain-components/src/impls/queries/chain_id.rs b/crates/cosmos/cosmos-chain-components/src/impls/queries/chain_id.rs index 0bb9a7567..b86e4b933 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/queries/chain_id.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/queries/chain_id.rs @@ -1,16 +1,19 @@ +use core::marker::PhantomData; + use cgp::core::error::CanRaiseError; use hermes_relayer_components::chain::traits::queries::chain_status::CanQueryChainHeight; +use hermes_relayer_components::chain::traits::queries::client_state::CanQueryClientState; use hermes_relayer_components::chain::traits::queries::counterparty_chain_id::CounterpartyChainIdQuerier; use hermes_relayer_components::chain::traits::types::chain_id::HasChainIdType; +use hermes_relayer_components::chain::traits::types::client_state::HasClientStateFields; use hermes_relayer_components::chain::traits::types::ibc::HasIbcChainTypes; use ibc::core::channel::types::channel::{ChannelEnd, State}; use ibc::core::channel::types::error::ChannelError; use ibc::core::connection::types::ConnectionEnd; use ibc::core::host::types::error::IdentifierError; -use ibc::core::host::types::identifiers::{ChainId, ChannelId, PortId}; +use ibc::core::host::types::identifiers::{ChainId, ChannelId, ClientId, PortId}; use ibc::cosmos_host::IBC_QUERY_PATH; use ibc_proto::Protobuf; -use ibc_relayer::client_state::AnyClientState; use tendermint_proto::Error as TendermintProtoError; use crate::traits::abci_query::CanQueryAbci; @@ -19,20 +22,21 @@ pub struct QueryChainIdFromAbci; impl CounterpartyChainIdQuerier for QueryChainIdFromAbci where - Chain: HasIbcChainTypes + Chain: HasIbcChainTypes + CanQueryChainHeight + CanQueryAbci + + CanQueryClientState + CanRaiseError + CanRaiseError + CanRaiseError + CanRaiseError, - Counterparty: HasChainIdType, + Counterparty: HasChainIdType + HasClientStateFields, { async fn query_counterparty_chain_id_from_channel_id( chain: &Chain, channel_id: &ChannelId, port_id: &PortId, - ) -> Result { + ) -> Result { let port_id = port_id.clone(); let channel_id = channel_id.clone(); @@ -73,16 +77,10 @@ where let client_id = connection_end.client_id(); - // client state query path - let client_state_path = format!("clients/{client_id}/clientState"); - - let client_state_bytes = chain - .query_abci(IBC_QUERY_PATH, client_state_path.as_bytes(), &latest_height) + let client_state = chain + .query_client_state(PhantomData, client_id, &latest_height) .await?; - let client_state = - AnyClientState::decode_vec(&client_state_bytes).map_err(Chain::raise_error)?; - - ChainId::new(client_state.chain_id().as_str()).map_err(Chain::raise_error) + Ok(Counterparty::client_state_chain_id(&client_state)) } } diff --git a/crates/cosmos/cosmos-chain-components/src/impls/queries/client_state.rs b/crates/cosmos/cosmos-chain-components/src/impls/queries/client_state.rs index a6197e761..cbd0f8632 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/queries/client_state.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/queries/client_state.rs @@ -12,11 +12,11 @@ use ibc::core::client::types::Height; use ibc::core::host::types::error::IdentifierError; use ibc::core::host::types::identifiers::ClientId; use ibc::cosmos_host::IBC_QUERY_PATH; +use ibc_proto::cosmos::base::query::v1beta1::PageRequest; use ibc_proto::ibc::core::client::v1::{ IdentifiedClientState, QueryClientStatesRequest as ProtoQueryClientStatesRequest, QueryClientStatesResponse, }; -use ibc_relayer::chain::requests::{PageRequest, QueryClientStatesRequest}; use prost::{DecodeError, Message}; use prost_types::Any; @@ -89,12 +89,12 @@ where chain: &Chain, height: &Height, ) -> Result, Chain::Error> { - let request = ProtoQueryClientStatesRequest::from(QueryClientStatesRequest { + let request = ProtoQueryClientStatesRequest { pagination: Some(PageRequest { limit: u32::MAX as u64, ..Default::default() }), - }); + }; let data = prost::Message::encode_to_vec(&request); diff --git a/crates/cosmos/cosmos-chain-components/src/impls/transaction/convert_gas_to_fee.rs b/crates/cosmos/cosmos-chain-components/src/impls/transaction/convert_gas_to_fee.rs index 2ea57ac67..ea3abe83a 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/transaction/convert_gas_to_fee.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/transaction/convert_gas_to_fee.rs @@ -4,7 +4,8 @@ use cgp::prelude::HasErrorType; use hermes_relayer_components::transaction::traits::types::fee::HasFeeType; use ibc_proto::cosmos::base::v1beta1::Coin; use ibc_proto::cosmos::tx::v1beta1::Fee; -use ibc_relayer::chain::cosmos::gas::{mul_ceil, mul_floor}; +use num_bigint::BigInt; +use num_rational::BigRational; use crate::traits::convert_gas_to_fee::GasToFeeConverter; use crate::traits::eip::eip_query::CanQueryEipBaseFee; @@ -113,3 +114,21 @@ fn adjust_estimated_gas(gas_multiplier: f64, max_gas: u64, gas_amount: u64) -> u // Bound the gas estimate by the max_gas option min(gas, max_gas) } + +/// Multiply `a` with `f` and round the result up to the nearest integer. +pub fn mul_ceil(a: u64, f: f64) -> BigInt { + assert!(f.is_finite()); + + let a = BigInt::from(a); + let f = BigRational::from_float(f).expect("f is finite"); + (f * a).ceil().to_integer() +} + +/// Multiply `a` with `f` and round the result down to the nearest integer. +pub fn mul_floor(a: u64, f: f64) -> BigInt { + assert!(f.is_finite()); + + let a = BigInt::from(a); + let f = BigRational::from_float(f).expect("f is finite"); + (f * a).floor().to_integer() +} diff --git a/crates/cosmos/cosmos-chain-components/src/impls/transaction/encode_tx.rs b/crates/cosmos/cosmos-chain-components/src/impls/transaction/encode_tx.rs index a558caaa1..186e567d4 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/transaction/encode_tx.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/transaction/encode_tx.rs @@ -13,15 +13,14 @@ use ibc::primitives::Signer; use ibc_proto::cosmos::tx::v1beta1::mode_info::{Single, Sum}; use ibc_proto::cosmos::tx::v1beta1::{AuthInfo, Fee, ModeInfo, SignDoc, SignerInfo, TxBody}; use ibc_proto::google::protobuf::Any; -use ibc_relayer::chain::cosmos::types::account::{Account, AccountNumber, AccountSequence}; -use ibc_relayer::chain::cosmos::types::tx::SignedTx; -use ibc_relayer::config::types::Memo; -use ibc_relayer::keyring::errors::Error as KeyringError; -use ibc_relayer::keyring::{Secp256k1KeyPair, SigningKeyPair}; use prost::{EncodeError, Message}; use crate::traits::message::CosmosMessage; use crate::traits::tx_extension_options::HasTxExtensionOptions; +use crate::types::key_types::secp256k1::Secp256k1KeyPair; +use crate::types::transaction::account::Account; +use crate::types::transaction::memo::Memo; +use crate::types::transaction::signed_tx::SignedTx; pub struct EncodeCosmosTx; @@ -35,7 +34,7 @@ where + HasTxExtensionOptions + HasChainId + CanRaiseError - + CanRaiseError, + + CanRaiseError, { async fn encode_tx( chain: &Chain, @@ -55,7 +54,7 @@ where let chain_id = chain.chain_id(); let extension_options = chain.tx_extension_options(); - let signed_tx = sign_tx( + let signed_tx = sign_tx::( chain_id, key_pair, account, @@ -63,14 +62,13 @@ where &raw_messages, fee, extension_options, - ) - .map_err(Chain::raise_error)?; + )?; Ok(signed_tx) } } -pub fn sign_tx( +pub fn sign_tx( chain_id: &ChainId, key_pair: &Secp256k1KeyPair, account: &Account, @@ -78,7 +76,10 @@ pub fn sign_tx( messages: &[Any], fee: &Fee, extension_options: &Vec, -) -> Result { +) -> Result +where + Chain: CanRaiseError, +{ let key_bytes = Message::encode_to_vec(&key_pair.public_key.serialize().to_vec()); let signer = encode_signer_info(account.sequence, key_bytes); @@ -87,7 +88,7 @@ pub fn sign_tx( let (auth_info, auth_info_bytes) = auth_info_and_bytes(signer, fee.clone()); - let signed_doc = encode_sign_doc( + let signed_doc = encode_sign_doc::( chain_id, key_pair, account.number, @@ -104,28 +105,31 @@ pub fn sign_tx( }) } -pub fn encode_sign_doc( +pub fn encode_sign_doc( chain_id: &ChainId, key_pair: &Secp256k1KeyPair, - account_number: AccountNumber, + account_number: u64, auth_info_bytes: Vec, body_bytes: Vec, -) -> Result, KeyringError> { +) -> Result, Chain::Error> +where + Chain: CanRaiseError, +{ let sign_doc = SignDoc { body_bytes, auth_info_bytes, chain_id: chain_id.to_string(), - account_number: account_number.to_u64(), + account_number, }; let signdoc_buf = Message::encode_to_vec(&sign_doc); - let signed = key_pair.sign(&signdoc_buf)?; + let signed = key_pair.sign(&signdoc_buf).map_err(Chain::raise_error)?; Ok(signed) } -pub fn encode_signer_info(sequence: AccountSequence, key_bytes: Vec) -> SignerInfo { +pub fn encode_signer_info(sequence: u64, key_bytes: Vec) -> SignerInfo { let pk_any = Any { type_url: "/cosmos.crypto.secp256k1.PubKey".to_string(), value: key_bytes, @@ -138,7 +142,7 @@ pub fn encode_signer_info(sequence: AccountSequence, key_bytes: Vec) -> Sign SignerInfo { public_key: Some(pk_any), mode_info: mode, - sequence: sequence.to_u64(), + sequence, } } diff --git a/crates/cosmos/cosmos-chain-components/src/impls/transaction/estimate_fee.rs b/crates/cosmos/cosmos-chain-components/src/impls/transaction/estimate_fee.rs index df2c1fa02..efaf707b6 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/transaction/estimate_fee.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/transaction/estimate_fee.rs @@ -7,10 +7,7 @@ use http::uri::InvalidUri; use ibc::core::host::types::identifiers::ChainId; use ibc_proto::cosmos::tx::v1beta1::service_client::ServiceClient; use ibc_proto::cosmos::tx::v1beta1::{Fee, SimulateRequest, SimulateResponse, Tx}; -use ibc_relayer::chain::cosmos::types::tx::SignedTx; -use ibc_relayer::config::default::max_grpc_decoding_size; -use ibc_relayer::error::Error as RelayerError; -use prost::Message; +use prost::{EncodeError, Message}; use tonic::codegen::http::Uri; use tonic::transport::Error as TransportError; use tonic::Status; @@ -19,6 +16,7 @@ use crate::traits::convert_gas_to_fee::CanConvertGasToFee; use crate::traits::gas_config::HasGasConfig; use crate::traits::grpc_address::HasGrpcAddress; use crate::traits::rpc_client::HasRpcClient; +use crate::types::transaction::signed_tx::SignedTx; pub struct EstimateCosmosTxFee; @@ -55,7 +53,7 @@ where ) .await .map_err(Chain::raise_error)? - .max_decoding_message_size(max_grpc_decoding_size().get_bytes() as usize); + .max_decoding_message_size(33554432); let response = client .simulate(request) @@ -73,13 +71,15 @@ where } } -pub async fn send_tx_simulate( +pub async fn send_tx_simulate( grpc_address: &Uri, tx: Tx, -) -> Result { +) -> Result +where + Chain: CanRaiseError + CanRaiseError + CanRaiseError, +{ let mut tx_bytes = vec![]; - prost::Message::encode(&tx, &mut tx_bytes) - .map_err(|e| RelayerError::protobuf_encode(String::from("Transaction"), e))?; + prost::Message::encode(&tx, &mut tx_bytes).map_err(Chain::raise_error)?; let req = SimulateRequest { tx_bytes, @@ -88,15 +88,14 @@ pub async fn send_tx_simulate( let mut client = ServiceClient::connect(grpc_address.clone()) .await - .map_err(RelayerError::grpc_transport)?; - - client = client.max_decoding_message_size(max_grpc_decoding_size().get_bytes() as usize); + .map_err(Chain::raise_error)? + .max_decoding_message_size(33554432); let request = tonic::Request::new(req); let response = client .simulate(request) .await - .map_err(|e| RelayerError::grpc_status(e, "send_tx_simulate".to_owned()))? + .map_err(Chain::raise_error)? .into_inner(); Ok(response) diff --git a/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_nonce.rs b/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_nonce.rs index 8f0c2ccef..158ed7d63 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_nonce.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_nonce.rs @@ -3,13 +3,13 @@ use hermes_relayer_components::transaction::traits::nonce::query_nonce::NonceQue use hermes_relayer_components::transaction::traits::types::nonce::HasNonceType; use hermes_relayer_components::transaction::traits::types::signer::HasSignerType; use http::uri::InvalidUri; -use http::Uri; -use ibc_relayer::chain::cosmos::query::account::query_account; -use ibc_relayer::chain::cosmos::types::account::Account; -use ibc_relayer::error::Error as RelayerError; -use ibc_relayer::keyring::{Secp256k1KeyPair, SigningKeyPair}; +use prost::DecodeError; +use tonic::transport::Error as TransportError; +use tonic::Status; use crate::traits::grpc_address::HasGrpcAddress; +use crate::types::key_types::secp256k1::Secp256k1KeyPair; +use crate::types::transaction::account::{query_account, Account}; pub struct QueryCosmosAccount; @@ -18,8 +18,11 @@ where Chain: HasSignerType + HasNonceType + HasGrpcAddress + + CanRaiseError + + CanRaiseError + CanRaiseError - + CanRaiseError, + + CanRaiseError + + CanRaiseError, { async fn query_nonce( chain: &Chain, @@ -27,13 +30,6 @@ where ) -> Result { let address = key_pair.account(); - let account = query_account( - &Uri::try_from(&chain.grpc_address().to_string()).map_err(Chain::raise_error)?, - &address, - ) - .await - .map_err(Chain::raise_error)?; - - Ok(account.into()) + query_account(chain, address.to_string()).await } } diff --git a/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_tx_response.rs b/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_tx_response.rs index 2ab9a7152..d487673be 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_tx_response.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/transaction/query_tx_response.rs @@ -2,10 +2,10 @@ use cgp::core::error::CanRaiseError; use hermes_relayer_components::transaction::traits::query_tx_response::TxResponseQuerier; use hermes_relayer_components::transaction::traits::types::tx_hash::HasTransactionHashType; use hermes_relayer_components::transaction::traits::types::tx_response::HasTxResponseType; -use ibc_relayer::chain::cosmos::query::tx::query_tx_response; -use ibc_relayer::error::Error as RelayerError; use tendermint::Hash as TxHash; use tendermint_rpc::endpoint::tx::Response as TxResponse; +use tendermint_rpc::query::Query; +use tendermint_rpc::{Client, Error as TendermintRpcError, Order}; use crate::traits::rpc_client::HasRpcClient; @@ -16,16 +16,26 @@ where Chain: HasTransactionHashType + HasTxResponseType + HasRpcClient - + CanRaiseError, + + CanRaiseError, { async fn query_tx_response( chain: &Chain, tx_hash: &TxHash, ) -> Result, Chain::Error> { - let response = query_tx_response(chain.rpc_client(), chain.rpc_address(), tx_hash) + let query = Query::eq("tx.hash", tx_hash.to_string()); + + let response = chain + .rpc_client() + .tx_search( + query, + false, + 1, + 1, // get only the first Tx matching the query + Order::Ascending, + ) .await .map_err(Chain::raise_error)?; - Ok(response) + Ok(response.txs.into_iter().next()) } } diff --git a/crates/cosmos/cosmos-chain-components/src/impls/transaction/submit_tx.rs b/crates/cosmos/cosmos-chain-components/src/impls/transaction/submit_tx.rs index 125a045e1..dc3b250e0 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/transaction/submit_tx.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/transaction/submit_tx.rs @@ -5,13 +5,13 @@ use hermes_relayer_components::transaction::traits::submit_tx::TxSubmitter; use hermes_relayer_components::transaction::traits::types::transaction::HasTransactionType; use hermes_relayer_components::transaction::traits::types::tx_hash::HasTransactionHashType; use ibc_proto::cosmos::tx::v1beta1::TxRaw; -use ibc_relayer::chain::cosmos::types::tx::SignedTx; use prost::Message; use tendermint::Hash as TxHash; use tendermint_rpc::endpoint::broadcast::tx_sync::Response; use tendermint_rpc::{Client, Error as RpcError}; use crate::traits::rpc_client::HasRpcClient; +use crate::types::transaction::signed_tx::SignedTx; pub struct BroadcastCosmosTx; diff --git a/crates/cosmos/cosmos-chain-components/src/impls/types/client_state.rs b/crates/cosmos/cosmos-chain-components/src/impls/types/client_state.rs index f028df9f5..7b0ac3ee0 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/types/client_state.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/types/client_state.rs @@ -49,4 +49,8 @@ where fn client_state_has_expired(client_state: &TendermintClientState, elapsed: Duration) -> bool { elapsed > client_state.trusting_period } + + fn client_state_chain_id(client_state: &TendermintClientState) -> ChainId { + client_state.chain_id.clone() + } } diff --git a/crates/cosmos/cosmos-chain-components/src/impls/types/config.rs b/crates/cosmos/cosmos-chain-components/src/impls/types/config.rs index 54686638c..dbb4ee428 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/types/config.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/types/config.rs @@ -1,16 +1,18 @@ use core::time::Duration; use std::path::PathBuf; -use ibc_proto::cosmos::base::v1beta1::Coin; -use ibc_proto::cosmos::tx::v1beta1::Fee; use ibc_proto::google::protobuf::Any; -use ibc_relayer::chain::cosmos::config::CosmosSdkConfig; use serde::{Deserialize, Serialize}; use tendermint_rpc::Url; -use crate::types::config::gas::dynamic_gas_config::DynamicGasConfig; use crate::types::config::gas::gas_config::GasConfig; +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct RelayerConfig { + #[serde(default = "Vec::new", skip_serializing_if = "Vec::is_empty")] + pub chains: Vec, +} + #[derive(Clone, Debug, Serialize, Deserialize)] pub struct CosmosChainConfig { pub id: String, @@ -46,78 +48,3 @@ pub enum EventSourceMode { #[serde(alias = "poll")] Pull, } - -impl From for CosmosChainConfig { - fn from(value: CosmosSdkConfig) -> Self { - let event_source = match value.event_source { - ibc_relayer::config::EventSourceMode::Push { - url, - batch_delay: _, - } => EventSourceMode::Push { - url: url.to_string(), - }, - ibc_relayer::config::EventSourceMode::Pull { - interval: _, - max_retries: _, - } => EventSourceMode::Pull, - }; - let gas_multiplier = value.gas_multiplier.unwrap_or_default().to_f64(); - let fee_granter = value.fee_granter.unwrap_or("".to_owned()); - let max_gas = value.max_gas.unwrap_or(400_000); - let max_amount = (max_gas as f64 * gas_multiplier) * value.gas_price.price; - let max_gas_fee_in_coin = Coin { - denom: value.gas_price.denom.clone(), - amount: max_amount.to_string(), - }; - - let max_fee = Fee { - amount: vec![max_gas_fee_in_coin], - gas_limit: max_gas, - payer: "".to_string(), - granter: fee_granter.clone(), - }; - - let dynamic_gas = if value.dynamic_gas_price.enabled { - Some(DynamicGasConfig { - multiplier: value.dynamic_gas_price.multiplier, - max: value.dynamic_gas_price.max, - eip_query_type: Default::default(), - denom: value.gas_price.denom.clone(), - }) - } else { - None - }; - let gas_config = GasConfig { - default_gas: value.default_gas.unwrap_or(400_000), - max_gas, - gas_multiplier: value.gas_multiplier.unwrap_or_default().to_f64(), - gas_price: value.gas_price, - max_fee, - fee_granter, - dynamic_gas_config: dynamic_gas, - }; - let mut extension_options = vec![]; - for extension_option in value.extension_options.into_iter() { - extension_options.push(extension_option.to_any().unwrap()); - } - Self { - id: value.id.to_string(), - grpc_addr: value.grpc_addr, - account_prefix: value.account_prefix, - key_store_folder: value.key_store_folder, - key_name: value.key_name, - store_prefix: value.store_prefix, - event_source, - rpc_addr: value.rpc_addr, - rpc_timeout: value.rpc_timeout, - address_type: value.address_type.to_string(), - max_msg_num: value.max_msg_num.to_usize(), - max_tx_size: value.max_tx_size.to_usize(), - gas_config, - compat_mode: value.compat_mode.map(|compat_mode| compat_mode.to_string()), - extension_options, - clock_drift: value.clock_drift, - max_block_time: value.max_block_time, - } - } -} diff --git a/crates/cosmos/cosmos-chain-components/src/impls/types/transaction.rs b/crates/cosmos/cosmos-chain-components/src/impls/types/transaction.rs index 2c96b8143..53bc33878 100644 --- a/crates/cosmos/cosmos-chain-components/src/impls/types/transaction.rs +++ b/crates/cosmos/cosmos-chain-components/src/impls/types/transaction.rs @@ -9,14 +9,14 @@ use hermes_relayer_components::transaction::traits::types::transaction::ProvideT use hermes_relayer_components::transaction::traits::types::tx_hash::ProvideTransactionHashType; use hermes_relayer_components::transaction::traits::types::tx_response::ProvideTxResponseType; use ibc_proto::cosmos::tx::v1beta1::{Fee, TxRaw}; -use ibc_relayer::chain::cosmos::types::account::Account; -use ibc_relayer::chain::cosmos::types::tx::SignedTx; -use ibc_relayer::keyring::Secp256k1KeyPair; use prost::Message as _; use tendermint::hash::Hash; use tendermint_rpc::endpoint::tx::Response as TxResponse; +use crate::types::key_types::secp256k1::Secp256k1KeyPair; use crate::types::nonce_guard::NonceGuard; +use crate::types::transaction::account::Account; +use crate::types::transaction::signed_tx::SignedTx; pub struct ProvideCosmosTransactionTypes; diff --git a/crates/cosmos/cosmos-chain-components/src/types/config/gas/gas_config.rs b/crates/cosmos/cosmos-chain-components/src/types/config/gas/gas_config.rs index d543658c3..130ec1dae 100644 --- a/crates/cosmos/cosmos-chain-components/src/types/config/gas/gas_config.rs +++ b/crates/cosmos/cosmos-chain-components/src/types/config/gas/gas_config.rs @@ -1,9 +1,20 @@ use ibc_proto::cosmos::tx::v1beta1::Fee; -use ibc_relayer::config::GasPrice; use serde::{Deserialize, Serialize}; use crate::types::config::gas::dynamic_gas_config::DynamicGasConfig; +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct GasPrice { + pub price: f64, + pub denom: String, +} + +impl GasPrice { + pub fn new(price: f64, denom: String) -> Self { + Self { price, denom } + } +} + #[derive(Clone, Debug, Serialize, Deserialize)] pub struct GasConfig { pub default_gas: u64, diff --git a/crates/cosmos/cosmos-chain-components/src/types/key_types/keyring.rs b/crates/cosmos/cosmos-chain-components/src/types/key_types/keyring.rs new file mode 100644 index 000000000..267e4dc0e --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/key_types/keyring.rs @@ -0,0 +1,145 @@ +use std::ffi::OsStr; +use std::fs::{self, File}; +use std::path::PathBuf; + +use ibc::core::host::types::identifiers::ChainId; + +use super::secp256k1::{Secp256k1KeyPair, KEYSTORE_FILE_EXTENSION}; +use crate::types::key_types::secp256k1::{KEYSTORE_DEFAULT_FOLDER, KEYSTORE_DISK_BACKEND}; + +#[derive(Clone, Debug)] +pub enum KeyRing { + Test(Test), +} + +#[derive(Clone, Debug)] +pub struct Test { + account_prefix: String, + store: PathBuf, +} + +impl Test { + pub fn new(account_prefix: String, store: PathBuf) -> Self { + Self { + account_prefix, + store, + } + } + + pub fn add_key(&self, key_name: &str, key_pair: Secp256k1KeyPair) -> Result<(), String> { + let mut filename = self.store.join(key_name); + filename.set_extension(KEYSTORE_FILE_EXTENSION); + + let file = File::create(filename.clone()) + .map_err(|e| format!("failed to create file {}. Cause {e}", filename.display()))?; + + serde_json::to_writer_pretty(file, &key_pair) + .map_err(|e| format!("failed to encore key to file. Cause: {e}"))?; + + Ok(()) + } + + pub fn remove_key(&mut self, key_name: &str) -> Result<(), String> { + let mut filename = self.store.join(key_name); + filename.set_extension(KEYSTORE_FILE_EXTENSION); + + fs::remove_file(filename.clone()) + .map_err(|e| format!("failed to remove file {}. Cause {e}", filename.display()))?; + + Ok(()) + } + + fn get_key(&self, key_name: &str) -> Result { + let mut key_file = self.store.join(key_name); + key_file.set_extension(KEYSTORE_FILE_EXTENSION); + + if !key_file.as_path().exists() { + return Err(format!("key file not found {}", key_file.display())); + } + + let file = File::open(&key_file) + .map_err(|e| format!("failed to open key file {}. Cause: {e}", key_file.display()))?; + + let key_entry = serde_json::from_reader(file).map_err(|e| { + format!( + "failed to decode key file {}. Cause: {e}", + key_file.display() + ) + })?; + + Ok(key_entry) + } +} + +impl KeyRing { + pub fn new_secp256k1( + account_prefix: &str, + chain_id: &ChainId, + ks_folder: &Option, + ) -> Self { + let ks_folder = match ks_folder { + Some(folder) => folder.to_owned(), + None => { + let home = dirs_next::home_dir().unwrap(); + home.join(KEYSTORE_DEFAULT_FOLDER) + } + }; + + let folder = ks_folder + .join(chain_id.as_str()) + .join(KEYSTORE_DISK_BACKEND); + + // Create keys folder if it does not exist + fs::create_dir_all(&folder).unwrap(); + + Self::Test(Test::new(account_prefix.to_string(), folder)) + } + + pub fn account_prefix(&self) -> &str { + match self { + Self::Test(keyring) => &keyring.account_prefix, + } + } + + pub fn add_key(&self, key_name: &str, key_pair: Secp256k1KeyPair) -> Result<(), String> { + match self { + Self::Test(keyring) => keyring.add_key(key_name, key_pair), + } + } + + pub fn remove_key(&mut self, key_name: &str) -> Result<(), String> { + match self { + Self::Test(keyring) => keyring.remove_key(key_name), + } + } + + pub fn get_key(&self, name: &str) -> Result { + match self { + Self::Test(keyring) => keyring.get_key(name), + } + } + + pub fn keys(&self) -> Result, String> { + match self { + Self::Test(keyring) => { + let dir = fs::read_dir(&keyring.store).map_err(|e| { + format!( + "failed to read directory {}. Cause {e}", + keyring.store.as_path().display() + ) + })?; + + let ext = OsStr::new(KEYSTORE_FILE_EXTENSION); + + dir.into_iter() + .flatten() + .map(|entry| entry.path()) + .filter(|path| path.extension() == Some(ext)) + .flat_map(|path| path.file_stem().map(OsStr::to_owned)) + .flat_map(|stem| stem.to_str().map(ToString::to_string)) + .map(|name| self.get_key(&name).map(|key| (name, key))) + .collect() + } + } + } +} diff --git a/crates/cosmos/cosmos-chain-components/src/types/key_types/mod.rs b/crates/cosmos/cosmos-chain-components/src/types/key_types/mod.rs new file mode 100644 index 000000000..0a7a2de35 --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/key_types/mod.rs @@ -0,0 +1,2 @@ +pub mod keyring; +pub mod secp256k1; diff --git a/crates/cosmos/cosmos-chain-components/src/types/key_types/secp256k1.rs b/crates/cosmos/cosmos-chain-components/src/types/key_types/secp256k1.rs new file mode 100644 index 000000000..9e1d7278c --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/key_types/secp256k1.rs @@ -0,0 +1,216 @@ +use core::str::FromStr; + +use bech32::{FromBase32, ToBase32}; +use bip39::{Language, Mnemonic, Seed}; +use bitcoin::bip32::{ChildNumber, DerivationPath, Xpriv, Xpub}; +use bitcoin::network::Network; +use digest::Digest; +use generic_array::typenum::U32; +use generic_array::GenericArray; +use hdpath::StandardHDPath; +use ripemd::Ripemd160; +use secp256k1::{Message, PublicKey, Secp256k1, SecretKey}; +use serde::{Deserialize, Deserializer, Serialize}; +use sha2::Sha256; +use subtle_encoding::base64; + +pub const KEYSTORE_DEFAULT_FOLDER: &str = ".hermes/keys/"; +pub const KEYSTORE_DISK_BACKEND: &str = "keyring-test"; +pub const KEYSTORE_FILE_EXTENSION: &str = "json"; + +/// JSON key seed file +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct KeyFile { + name: String, + r#type: String, + address: String, + pubkey: String, + mnemonic: String, +} + +#[derive(Debug)] +pub enum EncodedPubKey { + Bech32(Vec), + Proto(ProtoAny), +} + +impl FromStr for EncodedPubKey { + type Err = String; + + fn from_str(s: &str) -> Result { + // Try to deserialize into a JSON Value. + let maybe_json: Result = serde_json::from_str(s); + + match maybe_json { + Ok(proto) => { + if proto.tpe != "/cosmos.crypto.secp256k1.PubKey" + && !proto.tpe.ends_with(".ethsecp256k1.PubKey") + { + Err(format!("unsupported public key: {}. only secp256k1 pub keys are currently supported", proto.tpe)) + } else { + Ok(Self::Proto(proto)) + } + } + Err(e) if e.classify() == serde_json::error::Category::Syntax => { + // Input is not syntactically-correct JSON. + // Attempt to decode via Bech32, for backwards compatibility with the old format. + let (_, data, _) = bech32::decode(s) + .map_err(|e| format!("cannot generate bech32 account. Cause: {}", e))?; + let bech32_bytes = Vec::from_base32(&data) + .map_err(|e| format!("cannot generate bech32 account. Cause: {}", e))?; + Ok(Self::Bech32(bech32_bytes)) + } + Err(e) => Err(format!( + "cannot deserialize the encoded public key {}. Cause: {}", + s, e + )), + } + } +} + +/// A variant of [`EncodedPubKey`]. +/// A Protobuf `Any`, having support for deserialization from +/// JSON + base64 (see `deserialize_key`). +#[derive(Debug, Deserialize)] +pub struct ProtoAny { + #[serde(alias = "@type")] + tpe: String, + + #[serde(deserialize_with = "deserialize_key")] + _key: Vec, +} + +/// This method is the workhorse for deserializing +/// the `key` field from a public key. +fn deserialize_key<'de, D>(deser: D) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + // The key is a byte array that is base64-encoded + // and then marshalled into a JSON String. + let based64_encoded: Result = Deserialize::deserialize(deser); + let value = base64::decode(based64_encoded?) + .map_err(|e| serde::de::Error::custom(format!("error in decoding: {e}")))?; + + Ok(value) +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Secp256k1KeyPair { + private_key: SecretKey, + pub public_key: PublicKey, + //address: [u8; 20], + account: String, +} + +impl Secp256k1KeyPair { + pub fn sign(&self, message: &[u8]) -> Result, String> { + let hashed_message: GenericArray = Sha256::digest(message); + + assert!(hashed_message.len() == 32); + + // SAFETY: hashed_message is 32 bytes, as expected in `Message::from_slice`. + let message = Message::from_digest_slice(&hashed_message).map_err(|e| { + format!("failed to create digest Message from hashed messaage. Cause: {e}") + })?; + + Ok(Secp256k1::signing_only() + .sign_ecdsa(&message, &self.private_key) + .serialize_compact() + .to_vec()) + } + + pub fn account(&self) -> String { + self.account.to_string() + } + + pub fn from_key_file(key_file: KeyFile, hd_path: &StandardHDPath) -> Result { + let mnemonic = Mnemonic::from_phrase(&key_file.mnemonic, Language::English) + .map_err(|e| format!("invalid mnemonic. Cause: {e}"))?; + + let seed = Seed::new(&mnemonic, ""); + + let base_key = Xpriv::new_master(Network::Bitcoin, seed.as_bytes()).map_err(|e| { + format!("cannot generate secp256k1 private key from BIP-32 seed. Cause: {e}") + })?; + + let child_numbers = vec![ + ChildNumber::from_hardened_idx(hd_path.purpose().as_value().as_number()) + .expect("Purpose is not Hardened"), + ChildNumber::from_hardened_idx(hd_path.coin_type()).expect("Coin Type is not Hardened"), + ChildNumber::from_hardened_idx(hd_path.account()).expect("Account is not Hardened"), + ChildNumber::from_normal_idx(hd_path.change()).expect("Change is Hardened"), + ChildNumber::from_normal_idx(hd_path.index()).expect("Index is Hardened"), + ]; + + let path = DerivationPath::from(child_numbers); + let private_key = base_key + .derive_priv(&Secp256k1::new(), &path) + .map_err(|e| { + format!("cannot generate secp256k1 private key from BIP-32 seed. Cause: {e}") + })?; + + let derived_pubkey = Xpub::from_priv(&Secp256k1::signing_only(), &private_key); + + Ok(Self { + private_key: private_key.private_key, + public_key: derived_pubkey.public_key, + account: key_file.address, + }) + } + + pub fn from_seed_file(contents: &str, hd_path: &StandardHDPath) -> Result { + let key_file = + serde_json::from_str(contents).map_err(|e| format!("error encoding key. Cause {e}"))?; + Self::from_key_file(key_file, hd_path) + } + + pub fn from_mnemonic( + mnemonic: &str, + hd_path: &StandardHDPath, + account_prefix: &str, + ) -> Result { + let private_key = Self::private_key_from_mnemonic(mnemonic, hd_path)?; + let public_key = Xpub::from_priv(&Secp256k1::signing_only(), &private_key); + let address: [u8; 20] = + Ripemd160::digest(Sha256::digest(public_key.public_key.serialize())).into(); + let account = bech32::encode(account_prefix, address.to_base32(), bech32::Variant::Bech32) + .map_err(|e| format!("error encoding address to base 32. Cause {e}"))?; + + Ok(Self { + private_key: private_key.private_key, + public_key: public_key.public_key, + account, + }) + } + + fn private_key_from_mnemonic( + mnemonic_words: &str, + hd_path: &StandardHDPath, + ) -> Result { + let mnemonic = Mnemonic::from_phrase(mnemonic_words, Language::English) + .map_err(|e| format!("invalid mnemonics. Cause: {e}"))?; + + let seed = Seed::new(&mnemonic, ""); + + let base_key = Xpriv::new_master(Network::Bitcoin, seed.as_bytes()) + .map_err(|e| format!("failed to create new master key from seed. Cause: {e}"))?; + let child_numbers = vec![ + ChildNumber::from_hardened_idx(hd_path.purpose().as_value().as_number()) + .expect("Purpose is not Hardened"), + ChildNumber::from_hardened_idx(hd_path.coin_type()).expect("Coin Type is not Hardened"), + ChildNumber::from_hardened_idx(hd_path.account()).expect("Account is not Hardened"), + ChildNumber::from_normal_idx(hd_path.change()).expect("Change is Hardened"), + ChildNumber::from_normal_idx(hd_path.index()).expect("Index is Hardened"), + ]; + + let path = DerivationPath::from(child_numbers); + let private_key = base_key + .derive_priv(&Secp256k1::new(), &path) + .map_err(|e| { + format!("failed to derive an extended private key from a path. Cause: {e}") + })?; + + Ok(private_key) + } +} diff --git a/crates/cosmos/cosmos-chain-components/src/types/mod.rs b/crates/cosmos/cosmos-chain-components/src/types/mod.rs index 724fff47d..328d4f781 100644 --- a/crates/cosmos/cosmos-chain-components/src/types/mod.rs +++ b/crates/cosmos/cosmos-chain-components/src/types/mod.rs @@ -4,8 +4,10 @@ pub mod config; pub mod connection; pub mod event; pub mod events; +pub mod key_types; pub mod messages; pub mod nonce_guard; pub mod payloads; pub mod status; pub mod tendermint; +pub mod transaction; diff --git a/crates/cosmos/cosmos-chain-components/src/types/nonce_guard.rs b/crates/cosmos/cosmos-chain-components/src/types/nonce_guard.rs index 79a9df76a..40f0bfd6b 100644 --- a/crates/cosmos/cosmos-chain-components/src/types/nonce_guard.rs +++ b/crates/cosmos/cosmos-chain-components/src/types/nonce_guard.rs @@ -1,7 +1,8 @@ use core::ops::Deref; use futures::lock::MutexGuard; -use ibc_relayer::chain::cosmos::types::account::Account; + +use crate::types::transaction::account::Account; pub struct NonceGuard<'a> { pub mutex_guard: MutexGuard<'a, ()>, diff --git a/crates/cosmos/cosmos-chain-components/src/types/transaction/account.rs b/crates/cosmos/cosmos-chain-components/src/types/transaction/account.rs new file mode 100644 index 000000000..b8d4d9ab0 --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/transaction/account.rs @@ -0,0 +1,67 @@ +use cgp::prelude::*; +use http::uri::InvalidUri; +use http::Uri; +use ibc_proto::cosmos::auth::v1beta1::query_client::QueryClient; +use ibc_proto::cosmos::auth::v1beta1::{BaseAccount, QueryAccountRequest}; +use prost::{DecodeError, Message}; +use tonic::transport::Error as TransportError; +use tonic::Status; + +use crate::traits::grpc_address::HasGrpcAddress; + +/// TODO: Move this to a HasAccount component +/// and create a CanQueryAccount trait + +#[derive(Clone, Debug)] +pub struct Account { + pub address: String, + pub number: u64, + pub sequence: u64, +} + +pub async fn query_account( + chain: &Chain, + account_address: String, +) -> Result +where + Chain: HasGrpcAddress + + CanRaiseError + + CanRaiseError + + CanRaiseError + + CanRaiseError + + CanRaiseError, +{ + let mut client = QueryClient::connect( + Uri::try_from(&chain.grpc_address().to_string()).map_err(Chain::raise_error)?, + ) + .await + .map_err(Chain::raise_error)?; + + let request = tonic::Request::new(QueryAccountRequest { + address: account_address.clone(), + }); + + let response = client.account(request).await.map_err(Chain::raise_error)?; + + // Querying for an account might fail, i.e. if the account doesn't actually exist + let resp_account = response + .into_inner() + .account + .ok_or_else(|| format!("empty account for address `{}`", account_address)) + .map_err(Chain::raise_error)?; + + let base_account = if resp_account.type_url == "/cosmos.auth.v1beta1.BaseAccount" { + BaseAccount::decode(resp_account.value.as_slice()).map_err(Chain::raise_error)? + } else { + return Err(Chain::raise_error(format!( + "unknown account with type_url `{}`", + resp_account.type_url + ))); + }; + + Ok(Account { + address: base_account.address, + number: base_account.account_number, + sequence: base_account.sequence, + }) +} diff --git a/crates/cosmos/cosmos-chain-components/src/types/transaction/memo.rs b/crates/cosmos/cosmos-chain-components/src/types/transaction/memo.rs new file mode 100644 index 000000000..968d030df --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/transaction/memo.rs @@ -0,0 +1,10 @@ +use core::fmt::{Display, Error as FmtError, Formatter}; + +#[derive(Default)] +pub struct Memo(String); + +impl Display for Memo { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { + write!(f, "{}", self.0) + } +} diff --git a/crates/cosmos/cosmos-chain-components/src/types/transaction/mod.rs b/crates/cosmos/cosmos-chain-components/src/types/transaction/mod.rs new file mode 100644 index 000000000..54d53611f --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/transaction/mod.rs @@ -0,0 +1,3 @@ +pub mod account; +pub mod memo; +pub mod signed_tx; diff --git a/crates/cosmos/cosmos-chain-components/src/types/transaction/signed_tx.rs b/crates/cosmos/cosmos-chain-components/src/types/transaction/signed_tx.rs new file mode 100644 index 000000000..bef10ceee --- /dev/null +++ b/crates/cosmos/cosmos-chain-components/src/types/transaction/signed_tx.rs @@ -0,0 +1,9 @@ +use ibc_proto::cosmos::tx::v1beta1::{AuthInfo, TxBody}; + +pub struct SignedTx { + pub body: TxBody, + pub body_bytes: Vec, + pub auth_info: AuthInfo, + pub auth_info_bytes: Vec, + pub signatures: Vec>, +} diff --git a/crates/cosmos/cosmos-integration-tests/Cargo.toml b/crates/cosmos/cosmos-integration-tests/Cargo.toml index 490eb00d9..8042766c2 100644 --- a/crates/cosmos/cosmos-integration-tests/Cargo.toml +++ b/crates/cosmos/cosmos-integration-tests/Cargo.toml @@ -30,7 +30,6 @@ hermes-logging-components = { workspace = true } ibc = { workspace = true } ibc-proto = { workspace = true } -ibc-relayer = { workspace = true } tendermint-rpc = { workspace = true } eyre = { workspace = true } @@ -39,6 +38,6 @@ toml = { workspace = true } serde_json = { workspace = true } prost = { workspace = true } tracing = { workspace = true } -tracing-subscriber = { workspace = true } +tracing-subscriber = { workspace = true, features = ["env-filter"] } stable-eyre = { version = "0.2.2" } diff --git a/crates/cosmos/cosmos-integration-tests/src/contexts/bootstrap_legacy.rs b/crates/cosmos/cosmos-integration-tests/src/contexts/bootstrap_legacy.rs index 72865085d..3f5c84393 100644 --- a/crates/cosmos/cosmos-integration-tests/src/contexts/bootstrap_legacy.rs +++ b/crates/cosmos/cosmos-integration-tests/src/contexts/bootstrap_legacy.rs @@ -31,7 +31,7 @@ use hermes_runtime::types::runtime::HermesRuntime; use hermes_runtime_components::traits::runtime::{RuntimeGetterComponent, RuntimeTypeComponent}; use hermes_test_components::chain_driver::traits::types::chain::ChainTypeComponent; use hermes_test_components::driver::traits::types::chain_driver::ChainDriverTypeComponent; -use ibc_relayer::config::compat_mode::CompatMode; +use tendermint_rpc::client::CompatMode; use crate::impls::bootstrap::build_cosmos_chain::BuildCosmosChainWithNodeConfig; use crate::impls::bootstrap::build_cosmos_chain_driver::BuildCosmosChainDriver; diff --git a/crates/cosmos/cosmos-integration-tests/src/contexts/chain_driver.rs b/crates/cosmos/cosmos-integration-tests/src/contexts/chain_driver.rs index cf3bf97d3..46570eeb6 100644 --- a/crates/cosmos/cosmos-integration-tests/src/contexts/chain_driver.rs +++ b/crates/cosmos/cosmos-integration-tests/src/contexts/chain_driver.rs @@ -4,6 +4,7 @@ use std::path::PathBuf; use cgp::core::error::{ErrorRaiserComponent, ErrorTypeComponent}; use cgp::prelude::*; +use hermes_cosmos_chain_components::impls::types::config::RelayerConfig; use hermes_cosmos_relayer::contexts::chain::CosmosChain; use hermes_cosmos_test_components::bootstrap::traits::fields::chain_command_path::ChainCommandPathGetter; use hermes_cosmos_test_components::bootstrap::types::chain_node_config::CosmosChainNodeConfig; @@ -36,7 +37,6 @@ use hermes_test_components::chain_driver::traits::types::chain::{ChainGetter, Pr use hermes_test_components::chain_driver::traits::wait::{ CanWaitChainStartup, ChainStartupWaiterComponent, }; -use ibc_relayer::config::Config; use tokio::process::Child; use toml::to_string_pretty; @@ -190,10 +190,10 @@ impl ChainProcessTaker for CosmosChainDriverComponents { } } -impl ConfigUpdater for CosmosChainDriverComponents { +impl ConfigUpdater for CosmosChainDriverComponents { fn update_config( chain_driver: &CosmosChainDriver, - _config: &mut Config, + _config: &mut RelayerConfig, ) -> Result { let chain_config_str = to_string_pretty(&chain_driver.chain.chain_config)?; diff --git a/crates/cosmos/cosmos-integration-tests/src/impls/bootstrap/relayer_chain_config.rs b/crates/cosmos/cosmos-integration-tests/src/impls/bootstrap/relayer_chain_config.rs index 6c1a7c3f4..7ab9dc0c3 100644 --- a/crates/cosmos/cosmos-integration-tests/src/impls/bootstrap/relayer_chain_config.rs +++ b/crates/cosmos/cosmos-integration-tests/src/impls/bootstrap/relayer_chain_config.rs @@ -3,7 +3,7 @@ use core::time::Duration; use cgp::core::error::CanRaiseError; use hermes_cosmos_chain_components::impls::types::config::{CosmosChainConfig, EventSourceMode}; -use hermes_cosmos_chain_components::types::config::gas::gas_config::GasConfig; +use hermes_cosmos_chain_components::types::config::gas::gas_config::{GasConfig, GasPrice}; use hermes_cosmos_test_components::bootstrap::traits::fields::account_prefix::HasAccountPrefix; use hermes_cosmos_test_components::bootstrap::traits::fields::dynamic_gas_fee::HasDynamicGas; use hermes_cosmos_test_components::bootstrap::traits::types::chain_node_config::HasChainNodeConfigType; @@ -15,7 +15,6 @@ use hermes_test_components::chain::traits::types::wallet::HasWalletType; use hermes_test_components::chain_driver::traits::types::chain::HasChainType; use ibc_proto::cosmos::base::v1beta1::Coin; use ibc_proto::cosmos::tx::v1beta1::Fee; -use ibc_relayer::config::{self, AddressType}; use tendermint_rpc::{Error as TendermintRpcError, Url}; use crate::traits::bootstrap::compat_mode::HasCompatMode; @@ -61,7 +60,7 @@ where default_gas: 400_000, max_gas, gas_multiplier, - gas_price: config::GasPrice::new(1.0, chain_genesis_config.staking_denom.to_string()), + gas_price: GasPrice::new(1.0, chain_genesis_config.staking_denom.to_string()), max_fee, fee_granter, dynamic_gas_config: bootstrap.dynamic_gas().clone(), @@ -76,7 +75,7 @@ where event_source: EventSourceMode::Push { url: format!("ws://localhost:{}/websocket", chain_node_config.rpc_port), }, - rpc_timeout: config::default::rpc_timeout(), + rpc_timeout: Duration::from_secs(10), account_prefix: bootstrap.account_prefix().into(), key_name: relayer_wallet.id.clone(), key_store_folder: Some(chain_node_config.chain_home_dir.join("hermes_keyring")), @@ -86,7 +85,7 @@ where max_block_time: Duration::from_secs(30), clock_drift: Duration::from_secs(5), gas_config, - address_type: AddressType::Cosmos.to_string(), + address_type: "cosmos".to_string(), extension_options: Default::default(), compat_mode: bootstrap .compat_mode() diff --git a/crates/cosmos/cosmos-integration-tests/src/traits/bootstrap/compat_mode.rs b/crates/cosmos/cosmos-integration-tests/src/traits/bootstrap/compat_mode.rs index d87af8ed8..f103b744a 100644 --- a/crates/cosmos/cosmos-integration-tests/src/traits/bootstrap/compat_mode.rs +++ b/crates/cosmos/cosmos-integration-tests/src/traits/bootstrap/compat_mode.rs @@ -2,7 +2,7 @@ use core::marker::PhantomData; use cgp::core::component::UseContext; use cgp::prelude::*; -use ibc_relayer::config::compat_mode::CompatMode; +use tendermint_rpc::client::CompatMode; #[cgp_component { provider: CompatModeGetter, diff --git a/crates/cosmos/cosmos-relayer/Cargo.toml b/crates/cosmos/cosmos-relayer/Cargo.toml index 3bdaaf8bf..1053e7a37 100644 --- a/crates/cosmos/cosmos-relayer/Cargo.toml +++ b/crates/cosmos/cosmos-relayer/Cargo.toml @@ -37,8 +37,6 @@ hermes-wasm-test-components = { workspace = true } ibc = { workspace = true } ibc-proto = { workspace = true } -ibc-relayer = { workspace = true } -ibc-telemetry = { workspace = true } tendermint = { workspace = true, features = ["secp256k1"] } tendermint-proto = { workspace = true } tendermint-rpc = { workspace = true, features = ["http-client", "websocket-client"] } diff --git a/crates/cosmos/cosmos-relayer/src/contexts/build.rs b/crates/cosmos/cosmos-relayer/src/contexts/build.rs index 0677ba32d..dd247d0ae 100644 --- a/crates/cosmos/cosmos-relayer/src/contexts/build.rs +++ b/crates/cosmos/cosmos-relayer/src/contexts/build.rs @@ -13,6 +13,9 @@ use cgp::prelude::*; use eyre::{eyre, Report}; use futures::lock::Mutex; use hermes_cosmos_chain_components::impls::types::config::CosmosChainConfig; +use hermes_cosmos_chain_components::types::key_types::secp256k1::{ + Secp256k1KeyPair, KEYSTORE_DEFAULT_FOLDER, KEYSTORE_FILE_EXTENSION, +}; use hermes_cosmos_chain_components::types::messages::packet::packet_filter::PacketFilterConfig; use hermes_error::types::Error; use hermes_relayer_components::build::traits::builders::birelay_from_relay_builder::BiRelayFromRelayBuilder; @@ -35,9 +38,6 @@ use hermes_relayer_components_extra::components::extra::build::*; use hermes_runtime::types::runtime::HermesRuntime; use hermes_runtime_components::traits::runtime::{RuntimeGetterComponent, RuntimeTypeComponent}; use ibc::core::host::types::identifiers::{ChainId, ClientId}; -use ibc_relayer::keyring::{ - AnySigningKeyPair, Secp256k1KeyPair, KEYSTORE_DEFAULT_FOLDER, KEYSTORE_FILE_EXTENSION, -}; use tendermint_rpc::client::CompatMode; use tendermint_rpc::{Client, HttpClient}; @@ -263,7 +263,7 @@ pub fn get_keypair( let file = File::create(filename.clone())?; if let Some(keypair) = m_keypair { - serde_json::to_writer_pretty(file, &AnySigningKeyPair::Secp256k1(keypair.clone()))?; + serde_json::to_writer_pretty(file, &keypair)?; } let file = File::open(&filename)?; diff --git a/crates/cosmos/cosmos-relayer/src/contexts/chain.rs b/crates/cosmos/cosmos-relayer/src/contexts/chain.rs index fb2408f95..74e93dd7a 100644 --- a/crates/cosmos/cosmos-relayer/src/contexts/chain.rs +++ b/crates/cosmos/cosmos-relayer/src/contexts/chain.rs @@ -25,12 +25,14 @@ use hermes_cosmos_chain_components::traits::tx_extension_options::TxExtensionOpt use hermes_cosmos_chain_components::traits::unbonding_period::CanQueryUnbondingPeriod; use hermes_cosmos_chain_components::types::commitment_proof::CosmosCommitmentProof; use hermes_cosmos_chain_components::types::config::gas::gas_config::GasConfig; +use hermes_cosmos_chain_components::types::key_types::secp256k1::Secp256k1KeyPair; use hermes_cosmos_chain_components::types::messages::packet::packet_filter::PacketFilterConfig; use hermes_cosmos_chain_components::types::nonce_guard::NonceGuard; use hermes_cosmos_chain_components::types::payloads::client::{ CosmosCreateClientOptions, CosmosCreateClientPayload, CosmosUpdateClientPayload, }; use hermes_cosmos_chain_components::types::tendermint::TendermintClientState; +use hermes_cosmos_chain_components::types::transaction::account::Account; use hermes_encoding_components::traits::has_encoding::{ DefaultEncodingGetterComponent, EncodingGetterComponent, EncodingTypeComponent, }; @@ -66,6 +68,7 @@ use hermes_relayer_components::chain::traits::types::channel::HasChannelEndType; use hermes_relayer_components::chain::traits::types::client_state::{ HasClientStateType, HasRawClientStateType, }; +use hermes_relayer_components::chain::traits::types::consensus_state::HasConsensusStateType; use hermes_relayer_components::chain::traits::types::create_client::{ HasCreateClientPayloadOptionsType, HasCreateClientPayloadType, }; @@ -101,12 +104,10 @@ use ibc::core::channel::types::channel::ChannelEnd; use ibc::core::client::types::Height; use ibc::core::host::types::identifiers::ChainId; use ibc_proto::cosmos::tx::v1beta1::Fee; -use ibc_relayer::chain::cosmos::types::account::Account; -use ibc_relayer::event::source::queries::all as all_queries; -use ibc_relayer::keyring::Secp256k1KeyPair; use prost_types::Any; use tendermint::abci::Event as AbciEvent; use tendermint_rpc::client::CompatMode; +use tendermint_rpc::query::{EventType, Query}; use tendermint_rpc::{HttpClient, Url, WebSocketClientUrl}; use crate::contexts::encoding::ProvideCosmosEncoding; @@ -260,7 +261,13 @@ impl CosmosChain { chain_version, WebSocketClientUrl::from_str(&url).unwrap(), compat_mode, - all_queries(), + vec![ + Query::from(EventType::NewBlock), + Query::eq("message.module", "ibc_client"), + Query::eq("message.module", "ibc_connection"), + Query::eq("message.module", "ibc_channel"), + Query::eq("message.module", "interchainquery"), + ], ), EventSourceMode::Pull { .. } => { // TODO: implement pull-based event source @@ -374,6 +381,11 @@ pub trait CanUseCosmosChain: + CanBuildCreateClientPayload + CanFilterIncomingPacket + CanFilterOutgoingPacket +where + CosmosChain: HasClientStateType + + HasConsensusStateType + + HasCreateClientPayloadType + + HasUpdateClientPayloadType, { } diff --git a/crates/cosmos/cosmos-relayer/src/impls/error.rs b/crates/cosmos/cosmos-relayer/src/impls/error.rs index 5aaf9c10a..7e73d56ac 100644 --- a/crates/cosmos/cosmos-relayer/src/impls/error.rs +++ b/crates/cosmos/cosmos-relayer/src/impls/error.rs @@ -59,9 +59,6 @@ use ibc::core::client::types::error::ClientError; use ibc::core::commitment_types::error::CommitmentError; use ibc::core::host::types::error::{DecodingError, IdentifierError}; use ibc::primitives::TimestampError; -use ibc_relayer::error::Error as RelayerError; -use ibc_relayer::keyring::errors::Error as KeyringError; -use ibc_relayer::supervisor::Error as SupervisorError; use prost::{DecodeError, EncodeError}; use tendermint::Error as TendermintError; use tendermint_proto::Error as TendermintProtoError; @@ -113,9 +110,6 @@ delegate_components! { [ Report, TokioRuntimeError, - RelayerError, - KeyringError, - SupervisorError, TendermintError, TendermintClientError, TendermintProtoError, diff --git a/crates/cosmos/cosmos-test-components/Cargo.toml b/crates/cosmos/cosmos-test-components/Cargo.toml index 133e93c45..bf235c819 100644 --- a/crates/cosmos/cosmos-test-components/Cargo.toml +++ b/crates/cosmos/cosmos-test-components/Cargo.toml @@ -20,16 +20,16 @@ hermes-runtime-components = { workspace = true } hermes-cosmos-chain-components = { workspace = true } ibc = { workspace = true } -ibc-relayer = { workspace = true } ibc-proto = { workspace = true } http = { workspace = true } itertools = { workspace = true } +prost = { workspace = true } +secp256k1 = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -toml = { workspace = true } -prost = { workspace = true } time = { workspace = true } +toml = { workspace = true } tonic = { workspace = true } hdpath = { version = "0.6.3" } diff --git a/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk.rs b/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk.rs index b55207cb3..e336c4c39 100644 --- a/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk.rs +++ b/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk.rs @@ -23,7 +23,6 @@ use hermes_test_components::chain::traits::types::wallet::HasWalletType; use hermes_test_components::chain_driver::traits::types::chain::{HasChainType, ProvideChainType}; use hermes_test_components::driver::traits::types::chain_driver::ProvideChainDriverType; use ibc::core::host::types::identifiers::ChainId; -use ibc_relayer::keyring::errors::Error as KeyringError; use crate::bootstrap::impls::chain::bootstrap_chain::BootstrapCosmosChain; use crate::bootstrap::impls::chain::start_chain::StartCosmosChain; @@ -115,8 +114,8 @@ where Bootstrap: HasComponents + HasRuntime + CanRaiseError + + CanRaiseError + CanRaiseError<&'static str> - + CanRaiseError + CanRaiseError + CanRaiseError + CanRaiseError diff --git a/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk_legacy.rs b/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk_legacy.rs index 55a18b0cc..d702a98d4 100644 --- a/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk_legacy.rs +++ b/crates/cosmos/cosmos-test-components/src/bootstrap/components/cosmos_sdk_legacy.rs @@ -23,7 +23,6 @@ use hermes_test_components::chain::traits::types::wallet::HasWalletType; use hermes_test_components::chain_driver::traits::types::chain::{HasChainType, ProvideChainType}; use hermes_test_components::driver::traits::types::chain_driver::ProvideChainDriverType; use ibc::core::host::types::identifiers::ChainId; -use ibc_relayer::keyring::errors::Error as KeyringError; use crate::bootstrap::components::cosmos_sdk::{CosmosSdkBootstrapComponents, *}; use crate::bootstrap::impls::genesis_legacy::add_genesis_account::LegacyAddCosmosGenesisAccount; @@ -100,9 +99,9 @@ impl UseLegacyCosmosSdkChain where Bootstrap: HasComponents + HasRuntime + + CanRaiseError + CanRaiseError + CanRaiseError<&'static str> - + CanRaiseError + CanRaiseError + CanRaiseError + CanRaiseError diff --git a/crates/cosmos/cosmos-test-components/src/bootstrap/impls/initializers/init_wallet.rs b/crates/cosmos/cosmos-test-components/src/bootstrap/impls/initializers/init_wallet.rs index 1ad5388aa..88a4a3f93 100644 --- a/crates/cosmos/cosmos-test-components/src/bootstrap/impls/initializers/init_wallet.rs +++ b/crates/cosmos/cosmos-test-components/src/bootstrap/impls/initializers/init_wallet.rs @@ -1,14 +1,13 @@ use core::marker::PhantomData; use cgp::prelude::{Async, CanRaiseError}; +use hermes_cosmos_chain_components::types::key_types::secp256k1::Secp256k1KeyPair; use hermes_runtime_components::traits::fs::file_path::HasFilePathType; use hermes_runtime_components::traits::fs::write_file::CanWriteStringToFile; use hermes_runtime_components::traits::os::exec_command::{CanExecCommand, ExecOutput}; use hermes_runtime_components::traits::runtime::HasRuntime; use hermes_test_components::chain::traits::types::wallet::HasWalletType; use hermes_test_components::chain_driver::traits::types::chain::HasChainType; -use ibc_relayer::keyring::errors::Error as KeyringError; -use ibc_relayer::keyring::{Secp256k1KeyPair, SigningKeyPair}; use serde_json as json; use crate::bootstrap::traits::fields::chain_command_path::HasChainCommandPath; @@ -49,10 +48,10 @@ where + HasChainType + HasWalletHdPath + HasChainCommandPath + + CanRaiseError + CanRaiseError + CanRaiseError<&'static str> - + CanRaiseError - + CanRaiseError, + + CanRaiseError, Runtime: HasFilePathType + CanExecCommand + CanWriteStringToFile, Chain: HasWalletType, OutputGetter: ExecOutputGetter, diff --git a/crates/cosmos/cosmos-test-components/src/chain/impls/queries/balance.rs b/crates/cosmos/cosmos-test-components/src/chain/impls/queries/balance.rs index 59085a1d2..8c5be6b69 100644 --- a/crates/cosmos/cosmos-test-components/src/chain/impls/queries/balance.rs +++ b/crates/cosmos/cosmos-test-components/src/chain/impls/queries/balance.rs @@ -7,8 +7,10 @@ use hermes_test_components::chain::traits::types::address::HasAddressType; use hermes_test_components::chain::traits::types::amount::HasAmountType; use http::uri::InvalidUri; use http::Uri; -use ibc_relayer::chain::cosmos::query::balance::query_balance; -use ibc_relayer::error::Error as RelayerError; +use ibc_proto::cosmos::bank::v1beta1::query_client::QueryClient; +use ibc_proto::cosmos::bank::v1beta1::QueryBalanceRequest; +use tonic::transport::Error as TransportError; +use tonic::Status; use crate::chain::types::amount::Amount; use crate::chain::types::denom::Denom; @@ -20,26 +22,44 @@ where Chain: HasAddressType + HasAmountType + HasGrpcAddress + + CanRaiseError + + CanRaiseError + CanRaiseError + CanRaiseError - + CanRaiseError, + + CanRaiseError + + CanRaiseError, { async fn query_balance( chain: &Chain, address: &Chain::Address, denom: &Denom, ) -> Result { - let denom_str = denom.to_string(); - - let balance = query_balance( - &Uri::try_from(&chain.grpc_address().to_string()).map_err(Chain::raise_error)?, - &address.to_string(), - &denom_str, + let mut client = QueryClient::connect( + Uri::try_from(&chain.grpc_address().to_string()).map_err(Chain::raise_error)?, ) .await - .map_err(Chain::raise_error)?; + .map_err(Chain::raise_error)? + .max_decoding_message_size(33554432); + + let request = tonic::Request::new(QueryBalanceRequest { + address: address.to_string(), + denom: denom.to_string(), + }); + + let response = client + .balance(request) + .await + .map(|r| r.into_inner()) + .map_err(Chain::raise_error)?; + + // Querying for a balance might fail, i.e. if the account doesn't actually exist + let raw_balance = response.balance.ok_or_else(|| { + Chain::raise_error(format!( + "queried balance is empty for address {address} and denom {denom}" + )) + })?; - let quantity = balance.amount.parse().map_err(Chain::raise_error)?; + let quantity = raw_balance.amount.parse().map_err(Chain::raise_error)?; Ok(Amount { quantity, diff --git a/crates/cosmos/cosmos-test-components/src/chain/impls/types/wallet.rs b/crates/cosmos/cosmos-test-components/src/chain/impls/types/wallet.rs index 668215607..80ee30f7a 100644 --- a/crates/cosmos/cosmos-test-components/src/chain/impls/types/wallet.rs +++ b/crates/cosmos/cosmos-test-components/src/chain/impls/types/wallet.rs @@ -1,9 +1,9 @@ +use hermes_cosmos_chain_components::types::key_types::secp256k1::Secp256k1KeyPair; use hermes_relayer_components::transaction::traits::types::signer::HasSignerType; use hermes_test_components::chain::traits::types::address::HasAddressType; use hermes_test_components::chain::traits::types::wallet::{ HasWalletType, ProvideWalletType, WalletSignerProvider, }; -use ibc_relayer::keyring::Secp256k1KeyPair; use crate::chain::types::wallet::CosmosTestWallet; diff --git a/crates/cosmos/cosmos-test-components/src/chain/types/wallet.rs b/crates/cosmos/cosmos-test-components/src/chain/types/wallet.rs index 909b08462..cf33fa984 100644 --- a/crates/cosmos/cosmos-test-components/src/chain/types/wallet.rs +++ b/crates/cosmos/cosmos-test-components/src/chain/types/wallet.rs @@ -1,4 +1,4 @@ -use ibc_relayer::keyring::Secp256k1KeyPair; +use hermes_cosmos_chain_components::types::key_types::secp256k1::Secp256k1KeyPair; #[derive(Clone)] pub struct CosmosTestWallet { diff --git a/crates/cosmos/cosmos-wasm-relayer/Cargo.toml b/crates/cosmos/cosmos-wasm-relayer/Cargo.toml index 78d02efc3..72b917a4b 100644 --- a/crates/cosmos/cosmos-wasm-relayer/Cargo.toml +++ b/crates/cosmos/cosmos-wasm-relayer/Cargo.toml @@ -39,8 +39,6 @@ hermes-wasm-test-components = { workspace = true } ibc = { workspace = true } ibc-proto = { workspace = true } -ibc-relayer = { workspace = true } -ibc-telemetry = { workspace = true } tendermint = { workspace = true, features = ["secp256k1"] } tendermint-proto = { workspace = true } tendermint-rpc = { workspace = true, features = ["http-client", "websocket-client"] } diff --git a/crates/cosmos/cosmos-wasm-relayer/src/context/chain.rs b/crates/cosmos/cosmos-wasm-relayer/src/context/chain.rs index 4d0417649..10f7ace3b 100644 --- a/crates/cosmos/cosmos-wasm-relayer/src/context/chain.rs +++ b/crates/cosmos/cosmos-wasm-relayer/src/context/chain.rs @@ -16,6 +16,7 @@ use hermes_cosmos_chain_components::traits::rpc_client::RpcClientGetter; use hermes_cosmos_chain_components::traits::tx_extension_options::TxExtensionOptionsGetter; use hermes_cosmos_chain_components::traits::unbonding_period::CanQueryUnbondingPeriod; use hermes_cosmos_chain_components::types::config::gas::gas_config::GasConfig; +use hermes_cosmos_chain_components::types::key_types::secp256k1::Secp256k1KeyPair; use hermes_cosmos_chain_components::types::nonce_guard::NonceGuard; use hermes_cosmos_chain_components::types::payloads::client::{ CosmosCreateClientPayload, CosmosUpdateClientPayload, @@ -23,6 +24,7 @@ use hermes_cosmos_chain_components::types::payloads::client::{ use hermes_cosmos_chain_components::types::tendermint::{ TendermintClientState, TendermintConsensusState, }; +use hermes_cosmos_chain_components::types::transaction::account::Account; use hermes_cosmos_relayer::contexts::chain::CosmosChain; use hermes_cosmos_relayer::impls::error::HandleCosmosError; use hermes_cosmos_relayer::types::telemetry::CosmosTelemetry; @@ -111,8 +113,6 @@ use ibc::core::channel::types::channel::ChannelEnd; use ibc::core::client::types::Height; use ibc::core::host::types::identifiers::ChainId; use ibc_proto::cosmos::tx::v1beta1::Fee; -use ibc_relayer::chain::cosmos::types::account::Account; -use ibc_relayer::keyring::Secp256k1KeyPair; use prost_types::Any; use tendermint::abci::Event as AbciEvent; use tendermint_rpc::{HttpClient, Url}; diff --git a/crates/cosmos/cosmos-wasm-relayer/src/impls/client_state.rs b/crates/cosmos/cosmos-wasm-relayer/src/impls/client_state.rs index 20e252499..859dfcc1d 100644 --- a/crates/cosmos/cosmos-wasm-relayer/src/impls/client_state.rs +++ b/crates/cosmos/cosmos-wasm-relayer/src/impls/client_state.rs @@ -1,11 +1,13 @@ use core::time::Duration; use cgp::core::Async; +use hermes_relayer_components::chain::traits::types::chain_id::HasChainIdType; use hermes_relayer_components::chain::traits::types::client_state::{ ClientStateFieldsGetter, HasClientStateType, ProvideClientStateType, }; use hermes_relayer_components::chain::traits::types::height::HasHeightType; use ibc::core::client::types::Height; +use ibc::core::host::types::identifiers::ChainId; use crate::types::client_state::WasmTendermintClientState; @@ -23,7 +25,8 @@ impl ClientStateFieldsGetter for ProvideWrappedTendermintClientState where Chain: HasClientStateType - + HasHeightType, + + HasHeightType + + HasChainIdType, { fn client_state_latest_height(client_state: &WasmTendermintClientState) -> Height { client_state.tendermint_client_state.latest_height @@ -39,4 +42,8 @@ where ) -> bool { elapsed > client_state.tendermint_client_state.trusting_period } + + fn client_state_chain_id(client_state: &WasmTendermintClientState) -> ChainId { + client_state.tendermint_client_state.chain_id.clone() + } } diff --git a/crates/solomachine/solomachine-chain-components/Cargo.toml b/crates/solomachine/solomachine-chain-components/Cargo.toml index 9ad6aaf2c..5e980bfbc 100644 --- a/crates/solomachine/solomachine-chain-components/Cargo.toml +++ b/crates/solomachine/solomachine-chain-components/Cargo.toml @@ -24,8 +24,6 @@ hermes-protobuf-encoding-components = { workspace = true } ibc = { workspace = true } ibc-proto = { workspace = true } -ibc-relayer = { workspace = true } -ibc-telemetry = { workspace = true } tendermint = { workspace = true, features = ["secp256k1"] } serde = { workspace = true } @@ -38,7 +36,7 @@ itertools = { workspace = true } futures = { workspace = true } tracing = { workspace = true } -secp256k1 = { version = "0.27.0", features = ["rand", "bitcoin_hashes"] } +secp256k1 = { workspace = true } sha2 = "0.10.7" crypto-hash = "0.3.4" bytes = { version = "1.8.0" } diff --git a/crates/solomachine/solomachine-chain-components/src/impls/solomachine/client_state.rs b/crates/solomachine/solomachine-chain-components/src/impls/solomachine/client_state.rs index 7ea452a55..a18c45d06 100644 --- a/crates/solomachine/solomachine-chain-components/src/impls/solomachine/client_state.rs +++ b/crates/solomachine/solomachine-chain-components/src/impls/solomachine/client_state.rs @@ -1,6 +1,7 @@ use core::time::Duration; use cgp::core::Async; +use hermes_chain_type_components::traits::types::chain_id::HasChainIdType; use hermes_relayer_components::chain::traits::types::client_state::{ ClientStateFieldsGetter, HasClientStateType, ProvideClientStateType, }; @@ -24,7 +25,8 @@ impl ClientStateFieldsGetter for ProvideSolomachineClientState where Chain: HasClientStateType - + HasHeightType, + + HasHeightType + + HasChainIdType, { fn client_state_latest_height(client_state: &SolomachineClientState) -> Height { Height::new(0, client_state.sequence).unwrap() @@ -40,4 +42,9 @@ where ) -> bool { false } + + fn client_state_chain_id(_client_state: &SolomachineClientState) -> Chain::ChainId { + // Solomachine client state doesn't contain Chain ID + unimplemented!() + } } diff --git a/crates/solomachine/solomachine-chain-components/src/impls/solomachine/query_consensus_state.rs b/crates/solomachine/solomachine-chain-components/src/impls/solomachine/query_consensus_state.rs index 0b33dbd9e..91aff319f 100644 --- a/crates/solomachine/solomachine-chain-components/src/impls/solomachine/query_consensus_state.rs +++ b/crates/solomachine/solomachine-chain-components/src/impls/solomachine/query_consensus_state.rs @@ -3,8 +3,6 @@ use hermes_relayer_components::chain::traits::queries::consensus_state::Consensu use hermes_relayer_components::chain::traits::types::consensus_state::HasConsensusStateType; use hermes_relayer_components::chain::traits::types::height::HasHeightType; use hermes_relayer_components::chain::traits::types::ibc::HasIbcChainTypes; -use ibc_relayer_types::core::ics24_host::identifier::ClientId; -use ibc_relayer_types::Height; use crate::traits::solomachine::Solomachine; diff --git a/crates/solomachine/solomachine-relayer/Cargo.toml b/crates/solomachine/solomachine-relayer/Cargo.toml index 69cf40b1f..83c4fe1f1 100644 --- a/crates/solomachine/solomachine-relayer/Cargo.toml +++ b/crates/solomachine/solomachine-relayer/Cargo.toml @@ -24,8 +24,6 @@ hermes-protobuf-encoding-components = { workspace = true } ibc = { workspace = true } ibc-proto = { workspace = true } -ibc-relayer = { workspace = true } -ibc-telemetry = { workspace = true } tendermint = { workspace = true, features = ["secp256k1"] } serde = { workspace = true } @@ -36,7 +34,7 @@ tokio = { workspace = true } itertools = { workspace = true } futures = { workspace = true } tracing = { workspace = true } -secp256k1 = { workspace = true } +secp256k1 = { workspace = true, features = ["rand"] } sha2 = "0.10.7" crypto-hash = "0.3.4"