From b53e17d9276c9bf4d0ad242d7d0e66f1f3f8d64a Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Mon, 23 Aug 2021 22:24:27 +0200 Subject: [PATCH] Release Hermes v0.7.0 (#1296) * Bump all 0.6.2 crates to 0.7.0 * Bump `ibc-proto` to v0.10.0 * Bump version in guide * Add `ibc-relayer-rest` crate to README table * fixup version * Update Cargo.lock * Update dependencies * Update supported Cosmos SDK version range, cf. #1266 * Improve structure of JSON sent back by the REST server * Remove prefix from info message in start command * Document the REST server API * Include error source in `ConnectionError::Relayer` * Add .changelog entry for #1278 * Fix ibc-relayer-rest integration tests * Release changelog for 0.7.0 * Reformat the changelog --- .../bug-fixes/1261-gm-req-detect.md | 0 .../bug-fixes/1285-fix-typeok-bug.md | 0 .../ibc/1257-set-capability-index.md | 0 .../features/1065-keys-delete.md | 0 .../features/1175-update-ci.md | 0 .../features/1287-upgrade-legacy.md | 0 .../features/843-rest-api.md | 0 .../901-conditionally-spawn-worker.md | 0 .../948-upgrade-to-cosmos-sdk-v0.43.md | 0 .../1132-query-channels-filter.md | 0 .../improvements/1191-ica-compat.md | 0 .../improvements/1249-update-modelator.md | 0 .../1265-async-tx-confirmation.md | 5 + .../ibc/1297-impl-consensus-state.md | 0 .changelog/v0.7.0/summary.md | 3 + CHANGELOG.md | 61 +++++- Cargo.lock | 61 +++--- README.md | 5 + guide/README.md | 2 +- guide/src/SUMMARY.md | 3 +- guide/src/commands/global.md | 2 +- guide/src/config.md | 27 ++- guide/src/features.md | 2 +- guide/src/help.md | 4 +- guide/src/index.md | 2 +- guide/src/installation.md | 14 +- guide/src/rest-api.md | 178 ++++++++++++++++++ guide/src/tutorials/local-chains/start.md | 2 +- modules/Cargo.toml | 4 +- proto/Cargo.toml | 2 +- relayer-cli/Cargo.toml | 10 +- relayer-cli/src/commands/start.rs | 2 +- relayer-rest/Cargo.toml | 16 +- relayer-rest/src/handle.rs | 6 +- relayer-rest/src/server.rs | 41 +++- relayer-rest/tests/mock.rs | 23 ++- relayer/Cargo.toml | 10 +- relayer/src/connection.rs | 2 +- relayer/src/rest.rs | 22 ++- relayer/src/rest/error.rs | 71 ++++--- relayer/src/supervisor/spawn.rs | 2 +- telemetry/Cargo.toml | 4 +- 42 files changed, 452 insertions(+), 134 deletions(-) rename .changelog/{unreleased => v0.7.0}/bug-fixes/1261-gm-req-detect.md (100%) rename .changelog/{unreleased => v0.7.0}/bug-fixes/1285-fix-typeok-bug.md (100%) rename .changelog/{unreleased => v0.7.0}/bug-fixes/ibc/1257-set-capability-index.md (100%) rename .changelog/{unreleased => v0.7.0}/features/1065-keys-delete.md (100%) rename .changelog/{unreleased => v0.7.0}/features/1175-update-ci.md (100%) rename .changelog/{unreleased => v0.7.0}/features/1287-upgrade-legacy.md (100%) rename .changelog/{unreleased => v0.7.0}/features/843-rest-api.md (100%) rename .changelog/{unreleased => v0.7.0}/features/901-conditionally-spawn-worker.md (100%) rename .changelog/{unreleased => v0.7.0}/features/948-upgrade-to-cosmos-sdk-v0.43.md (100%) rename .changelog/{unreleased => v0.7.0}/improvements/1132-query-channels-filter.md (100%) rename .changelog/{unreleased => v0.7.0}/improvements/1191-ica-compat.md (100%) rename .changelog/{unreleased => v0.7.0}/improvements/1249-update-modelator.md (100%) create mode 100644 .changelog/v0.7.0/improvements/1265-async-tx-confirmation.md rename .changelog/{unreleased => v0.7.0}/improvements/ibc/1297-impl-consensus-state.md (100%) create mode 100644 .changelog/v0.7.0/summary.md create mode 100644 guide/src/rest-api.md diff --git a/.changelog/unreleased/bug-fixes/1261-gm-req-detect.md b/.changelog/v0.7.0/bug-fixes/1261-gm-req-detect.md similarity index 100% rename from .changelog/unreleased/bug-fixes/1261-gm-req-detect.md rename to .changelog/v0.7.0/bug-fixes/1261-gm-req-detect.md diff --git a/.changelog/unreleased/bug-fixes/1285-fix-typeok-bug.md b/.changelog/v0.7.0/bug-fixes/1285-fix-typeok-bug.md similarity index 100% rename from .changelog/unreleased/bug-fixes/1285-fix-typeok-bug.md rename to .changelog/v0.7.0/bug-fixes/1285-fix-typeok-bug.md diff --git a/.changelog/unreleased/bug-fixes/ibc/1257-set-capability-index.md b/.changelog/v0.7.0/bug-fixes/ibc/1257-set-capability-index.md similarity index 100% rename from .changelog/unreleased/bug-fixes/ibc/1257-set-capability-index.md rename to .changelog/v0.7.0/bug-fixes/ibc/1257-set-capability-index.md diff --git a/.changelog/unreleased/features/1065-keys-delete.md b/.changelog/v0.7.0/features/1065-keys-delete.md similarity index 100% rename from .changelog/unreleased/features/1065-keys-delete.md rename to .changelog/v0.7.0/features/1065-keys-delete.md diff --git a/.changelog/unreleased/features/1175-update-ci.md b/.changelog/v0.7.0/features/1175-update-ci.md similarity index 100% rename from .changelog/unreleased/features/1175-update-ci.md rename to .changelog/v0.7.0/features/1175-update-ci.md diff --git a/.changelog/unreleased/features/1287-upgrade-legacy.md b/.changelog/v0.7.0/features/1287-upgrade-legacy.md similarity index 100% rename from .changelog/unreleased/features/1287-upgrade-legacy.md rename to .changelog/v0.7.0/features/1287-upgrade-legacy.md diff --git a/.changelog/unreleased/features/843-rest-api.md b/.changelog/v0.7.0/features/843-rest-api.md similarity index 100% rename from .changelog/unreleased/features/843-rest-api.md rename to .changelog/v0.7.0/features/843-rest-api.md diff --git a/.changelog/unreleased/features/901-conditionally-spawn-worker.md b/.changelog/v0.7.0/features/901-conditionally-spawn-worker.md similarity index 100% rename from .changelog/unreleased/features/901-conditionally-spawn-worker.md rename to .changelog/v0.7.0/features/901-conditionally-spawn-worker.md diff --git a/.changelog/unreleased/features/948-upgrade-to-cosmos-sdk-v0.43.md b/.changelog/v0.7.0/features/948-upgrade-to-cosmos-sdk-v0.43.md similarity index 100% rename from .changelog/unreleased/features/948-upgrade-to-cosmos-sdk-v0.43.md rename to .changelog/v0.7.0/features/948-upgrade-to-cosmos-sdk-v0.43.md diff --git a/.changelog/unreleased/improvements/1132-query-channels-filter.md b/.changelog/v0.7.0/improvements/1132-query-channels-filter.md similarity index 100% rename from .changelog/unreleased/improvements/1132-query-channels-filter.md rename to .changelog/v0.7.0/improvements/1132-query-channels-filter.md diff --git a/.changelog/unreleased/improvements/1191-ica-compat.md b/.changelog/v0.7.0/improvements/1191-ica-compat.md similarity index 100% rename from .changelog/unreleased/improvements/1191-ica-compat.md rename to .changelog/v0.7.0/improvements/1191-ica-compat.md diff --git a/.changelog/unreleased/improvements/1249-update-modelator.md b/.changelog/v0.7.0/improvements/1249-update-modelator.md similarity index 100% rename from .changelog/unreleased/improvements/1249-update-modelator.md rename to .changelog/v0.7.0/improvements/1249-update-modelator.md diff --git a/.changelog/v0.7.0/improvements/1265-async-tx-confirmation.md b/.changelog/v0.7.0/improvements/1265-async-tx-confirmation.md new file mode 100644 index 0000000000..59cacc2c1b --- /dev/null +++ b/.changelog/v0.7.0/improvements/1265-async-tx-confirmation.md @@ -0,0 +1,5 @@ +- Improve performance and reliability of the relayer by asynchronously waiting for tx confirmations ([#1124], [#1265]) + +[#1124]: https://github.com/informalsystems/ibc-rs/issues/1124 +[#1265]: https://github.com/informalsystems/ibc-rs/issues/1265 + diff --git a/.changelog/unreleased/improvements/ibc/1297-impl-consensus-state.md b/.changelog/v0.7.0/improvements/ibc/1297-impl-consensus-state.md similarity index 100% rename from .changelog/unreleased/improvements/ibc/1297-impl-consensus-state.md rename to .changelog/v0.7.0/improvements/ibc/1297-impl-consensus-state.md diff --git a/.changelog/v0.7.0/summary.md b/.changelog/v0.7.0/summary.md new file mode 100644 index 0000000000..e098cdbc39 --- /dev/null +++ b/.changelog/v0.7.0/summary.md @@ -0,0 +1,3 @@ +This release of Hermes is the first to be compatible with the development version of Cosmos SDK 0.43. +Hermes 0.7.0 also improves the performance and reliability of the relayer, notably by waiting asynchronously for transactions to be confirmed. +Additionnally, Hermes now includes a REST server which exposes the relayer's internal state over HTTP. diff --git a/CHANGELOG.md b/CHANGELOG.md index e617a86051..582a9a3e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,65 @@ # CHANGELOG +## v0.7.0 + +This release of Hermes is the first to be compatible with the development version of Cosmos SDK 0.43. +Hermes 0.7.0 also improves the performance and reliability of the relayer, notably by waiting asynchronously for transactions to be confirmed. +Additionnally, Hermes now includes a REST server which exposes the relayer's internal state over HTTP. + +### BUG FIXES + +- [ibc](modules) + - Set the index of `ibc::ics05_port::capabilities::Capability` ([#1257]) + +- [gm](scripts/gm) + - Fix silent exit when requirements are missing + +[#1257]: https://github.com/informalsystems/ibc-rs/issues/1257 +[#1261]: https://github.com/informalsystems/ibc-rs/issues/1261 + +### FEATURES + +- General + - Update CI to test with gaiad v5.0.5 ([#1175]) + +- [ibc-relayer-cli](relayer-cli) + - Add `keys delete` CLI command ([#1065]) + - Add `--legacy | -l` flag to support upgrades for chains built with Cosmos SDK < v0.43.0 ([#1287]) + +- [ibc-relayer](relayer) + - Expose the Hermes config and internal state over a REST API ([#843]) + - Spawn packet workers only when there are outstanding packets or acknowledgements to relay ([#901]) + - Upgrade to Cosmos SDK proto (v0.43.0) & ibc-go proto (v1.0.0) ([#948]) + +[#843]: https://github.com/informalsystems/ibc-rs/issues/843 +[#901]: https://github.com/informalsystems/ibc-rs/issues/901 +[#948]: https://github.com/informalsystems/ibc-rs/pull/948 +[#1065]: https://github.com/informalsystems/ibc-rs/issues/1065 +[#1175]: https://github.com/informalsystems/ibc-rs/issues/1175 +[#1287]: https://github.com/informalsystems/ibc-rs/issues/1287 + +### IMPROVEMENTS + +- General + - Update Modelator to 0.2.0 ([#1249]) + +- [ibc-relayer-cli](relayer-cli) + - Add optional destination chain and `--verbose` options for `query channels` CLI ([#1132]) + +- [ibc-relayer](relayer) + - Improve support for Interchain Accounts (ICS 027) ([#1191]) + - Improve performance and reliability of the relayer by asynchronously waiting for tx confirmations ([#1124], [#1265]) + +- [ibc](modules) + - Implement `ics02_client::client_consensus::ConsensusState` for `AnyConsensusState` ([#1297]) + +[#1124]: https://github.com/informalsystems/ibc-rs/issues/1124 +[#1132]: https://github.com/informalsystems/ibc-rs/issues/1132 +[#1191]: https://github.com/informalsystems/ibc-rs/issues/1191 +[#1249]: https://github.com/informalsystems/ibc-rs/pull/1249 +[#1265]: https://github.com/informalsystems/ibc-rs/issues/1265 +[#1297]: https://github.com/informalsystems/ibc-rs/issues/1297 + ## v0.6.2 This minor release of Hermes re-enables the `upgrade client`, `upgrade clients`, @@ -36,7 +96,6 @@ handle errors ([#1158]) [#1245]: https://github.com/informalsystems/ibc-rs/issues/1245 - ## v0.6.1 *July 22nd, 2021* diff --git a/Cargo.lock b/Cargo.lock index 89e83e669c..1c8502345b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -242,9 +242,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitvec" @@ -554,9 +554,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32a398eb1ccfbe7e4f452bc749c44d38dd732e9a253f19da224c416f00ee7f4" +checksum = "09910f0830248af4499907177608b81d640c8c404526f8770b87b765fbd8c9a5" dependencies = [ "generic-array", "rand_core 0.6.3", @@ -721,9 +721,9 @@ checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" [[package]] name = "ecdsa" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713c32426287891008edb98f8b5c6abb2130aa043c93a818728fcda78606f274" +checksum = "43ee23aa5b4f68c7a092b5c3beb25f50c406adc75e2363634f242f28ab255372" dependencies = [ "der", "elliptic-curve", @@ -803,9 +803,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63eec06c61e487eecf0f7e6e6372e596a81922c28d33e645d6983ca6493a1af0" +checksum = "d0f40b2dcd8bc322217a5f6559ae5f9e9d1de202a2ecee2e9eafcbece7562a4f" dependencies = [ "rand_core 0.6.3", "subtle", @@ -1335,7 +1335,7 @@ dependencies = [ [[package]] name = "ibc" -version = "0.6.2" +version = "0.7.0" dependencies = [ "bytes", "chrono", @@ -1364,7 +1364,7 @@ dependencies = [ [[package]] name = "ibc-proto" -version = "0.9.1" +version = "0.10.0" dependencies = [ "bytes", "getrandom 0.2.3", @@ -1376,7 +1376,7 @@ dependencies = [ [[package]] name = "ibc-relayer" -version = "0.6.2" +version = "0.7.0" dependencies = [ "anyhow", "async-stream", @@ -1430,7 +1430,7 @@ dependencies = [ [[package]] name = "ibc-relayer-cli" -version = "0.6.2" +version = "0.7.0" dependencies = [ "abscissa_core", "atty", @@ -1485,7 +1485,7 @@ dependencies = [ [[package]] name = "ibc-telemetry" -version = "0.6.2" +version = "0.7.0" dependencies = [ "crossbeam-channel 0.5.1", "ibc", @@ -1634,9 +1634,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.98" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "a7f823d141fe0a24df1e23b4af4e3c7ba9e5966ec514ea068c93024aa7deb765" [[package]] name = "lock_api" @@ -1667,9 +1667,9 @@ dependencies = [ [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "maybe-uninit" @@ -1779,9 +1779,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ "lazy_static", "libc", @@ -1925,9 +1925,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.35" +version = "0.10.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1945,9 +1945,9 @@ checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" [[package]] name = "openssl-sys" -version = "0.9.65" +version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" +checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ "autocfg", "cc", @@ -3288,9 +3288,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c" +checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" dependencies = [ "autocfg", "bytes", @@ -3461,9 +3461,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" dependencies = [ "lazy_static", ] @@ -3605,12 +3605,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" -dependencies = [ - "matches", -] +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" [[package]] name = "unicode-normalization" diff --git a/README.md b/README.md index e8bd64417c..4aa3527633 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Includes [TLA+ specifications](docs/spec). | [ibc](./modules) (modules) | lib| [![IBC Crate][ibc-crate-image]][ibc-crate-link] | [![IBC Docs][ibc-docs-image]][ibc-docs-link] | | [ibc-relayer](./relayer) | lib | [![IBC Relayer Crate][relayer-crate-image]][relayer-crate-link] | [![IBC Relayer Docs][relayer-docs-image]][relayer-docs-link] | | [ibc-relayer-cli](./relayer-cli) | bin: [hermes](relayer-cli/) | [![IBC Relayer CLI Crate][relayer-cli-crate-image]][relayer-cli-crate-link] | [![IBC Relayer CLI Docs][relayer-cli-docs-image]][relayer-cli-docs-link] | +| [ibc-relayer-rest](./relayer-rest) | lib | [![IBC Relayer REST Crate][relayer-rest-crate-image]][relayer-rest-crate-link] | [![IBC Relayer REST Docs][relayer-rest-docs-image]][relayer-rest-docs-link] | | [ibc-proto](./proto) | lib | [![IBC Proto Crate][ibc-proto-crate-image]][ibc-proto-crate-link] | [![IBC Proto Docs][ibc-proto-docs-image]][ibc-proto-docs-link] | | [ibc-telemetry](./telemetry) | lib | [![IBC Telemetry Crate][ibc-telemetry-crate-image]][ibc-telemetry-crate-link] | [![IBC Telemetry Docs][ibc-telemetry-docs-image]][ibc-telemetry-docs-link] | @@ -91,6 +92,10 @@ Unless required by applicable law or agreed to in writing, software distributed [relayer-cli-crate-link]: https://crates.io/crates/ibc-relayer-cli [relayer-cli-docs-image]: https://docs.rs/ibc-relayer-cli/badge.svg [relayer-cli-docs-link]: https://docs.rs/ibc-relayer-cli/ +[relayer-rest-crate-image]: https://img.shields.io/crates/v/ibc-relayer-rest.svg +[relayer-rest-crate-link]: https://crates.io/crates/ibc-relayer-rest +[relayer-rest-docs-image]: https://docs.rs/ibc-relayer-rest/badge.svg +[relayer-rest-docs-link]: https://docs.rs/ibc-relayer-rest/ [ibc-proto-crate-image]: https://img.shields.io/crates/v/ibc-proto.svg [ibc-proto-crate-link]: https://crates.io/crates/ibc-proto [ibc-proto-docs-image]: https://docs.rs/ibc-proto/badge.svg diff --git a/guide/README.md b/guide/README.md index b8439a843e..f9a0cbfc8e 100644 --- a/guide/README.md +++ b/guide/README.md @@ -11,7 +11,7 @@ mdBook is a utility to create modern online books from Markdown files. This guide should be permanently deployed at its latest stable version at [hermes.informal.systems](https://hermes.informal.systems). -Current version: `0.6.2`. +Current version: `0.7.0`. The version of this guide is aligned with the [versioning of the ibc crates](../README.md). diff --git a/guide/src/SUMMARY.md b/guide/src/SUMMARY.md index 9f10f56385..8c9120513e 100644 --- a/guide/src/SUMMARY.md +++ b/guide/src/SUMMARY.md @@ -1,6 +1,6 @@ # Summary -# Hermes (v0.6.2) +# Hermes (v0.7.0) --- - [Introduction](./index.md) @@ -12,6 +12,7 @@ - [Installation](./installation.md) - [Configuration](./config.md) - [Telemetry](./telemetry.md) +- [REST API](./rest-api.md) - [Tutorials](./tutorials/index.md) - [Local chains](./tutorials/local-chains/index.md) - [Install Gaia](./tutorials/local-chains/gaia.md) diff --git a/guide/src/commands/global.md b/guide/src/commands/global.md index 21b86b9ebd..498e9bd5cb 100644 --- a/guide/src/commands/global.md +++ b/guide/src/commands/global.md @@ -3,7 +3,7 @@ Hermes accepts global options which affect all commands. ```shell -hermes 0.6.2 +hermes 0.7.0 Informal Systems Implementation of `hermes`, an IBC Relayer developed in Rust. diff --git a/guide/src/config.md b/guide/src/config.md index ca86ab9dc9..cfddb27fa6 100644 --- a/guide/src/config.md +++ b/guide/src/config.md @@ -27,7 +27,7 @@ The configuration file must have one `global` section, and one `chains` section > **Note:** As of 0.6.0, the Hermes configuration file is self-documented. > This section of the guide which discusses each parameter in turn is no > longer maintained, and we may remove it soon. Please read the configuration -> file [`config.toml`](https://github.com/informalsystems/ibc-rs/blob/v0.6.2/config.toml) itself for the most up-to-date documentation of parameters. +> file [`config.toml`](https://github.com/informalsystems/ibc-rs/blob/v0.7.0/config.toml) itself for the most up-to-date documentation of parameters. ### `[global]` @@ -68,8 +68,29 @@ Here is an example for the `telemetry` section: ```toml [telemetry] enabled = true -host = '127.0.0.1' -port = 3001 +host = '127.0.0.1' +port = 3001 +``` + +### `[rest]` + +The `rest` section defines parameters for Hermes' built-in [REST API](rest-api.md).. + +#### Parameters + +* __enabled__: *(boolean)* Whether or not to enable the built-in REST server. Default: `false`. + +* __host__: *(string)* Specify the IPv4/6 host over which the built-in HTTP server will be listening. Default: `127.0.0.1` + +* __port__: *(u16)* Specify the port over which the built-in HTTP server will be listening. Default: `3000` + +Here is an example for the `rest` section: + +```toml +[rest] +enabled = true +host = '127.0.0.1' +port = 3000 ``` ### `[[chains]]` diff --git a/guide/src/features.md b/guide/src/features.md index 5f68eb83e4..18158dc06a 100644 --- a/guide/src/features.md +++ b/guide/src/features.md @@ -5,7 +5,7 @@ A feature matrix and comparison between the Rust and Go relayer implementations > **Cosmos SDK compatibility:** > Hermes supports Cosmos SDK chains implementing the [IBC v1.0][ibcv1] protocol specification. -> Cosmos SDK versions `0.41.3` to `0.42.6` are officially supported. +> Cosmos SDK versions `0.41.3` to `0.42.9` are officially supported. > In case Hermes finds an incompatible SDK version, it will output a log warning. [ibcv1]: https://github.com/cosmos/ibc-go/tree/main/proto/ibc diff --git a/guide/src/help.md b/guide/src/help.md index ea59a8650c..313c7ff168 100644 --- a/guide/src/help.md +++ b/guide/src/help.md @@ -39,7 +39,7 @@ hermes help create will provide details about all the valid invocations of the `create` CLI command. ``` -hermes 0.6.2 +hermes 0.7.0 Informal Systems Hermes is an IBC Relayer written in Rust. @@ -63,7 +63,7 @@ hermes help create channel ``` ``` -hermes 0.6.2 +hermes 0.7.0 Informal Systems Hermes is an IBC Relayer written in Rust. diff --git a/guide/src/index.md b/guide/src/index.md index c08a4e3a28..b909718434 100644 --- a/guide/src/index.md +++ b/guide/src/index.md @@ -1,4 +1,4 @@ -# Hermes Guide (v0.6.2) +# Hermes Guide (v0.7.0) This guide can help you setup, configure, and operate Hermes to transfer packets between two IBC enabled chains. diff --git a/guide/src/installation.md b/guide/src/installation.md index fa773a3627..6044910ee5 100644 --- a/guide/src/installation.md +++ b/guide/src/installation.md @@ -14,8 +14,8 @@ There are two main approaches for obtaining Hermes: Simply head to the GitHub [Releases][releases] page and download the latest version of Hermes binary matching your platform: -- MacOS: `hermes-v0.6.2-x86_64-apple-darwin.tar.gz` (or .zip), -- Linux: `hermes-v0.6.2-x86_64-unknown-linux-gnu.tar.gz` (or .zip). +- MacOS: `hermes-v0.7.0-x86_64-apple-darwin.tar.gz` (or .zip), +- Linux: `hermes-v0.7.0-x86_64-unknown-linux-gnu.tar.gz` (or .zip). The step-by-step instruction below should carry you through the whole process: @@ -47,7 +47,7 @@ hermes version ``` ``` -hermes 0.6.2 +hermes 0.7.0 ``` ## Install via Cargo @@ -81,7 +81,7 @@ hermes version ``` ``` -hermes 0.6.2 +hermes 0.7.0 ``` ## Build from source @@ -103,10 +103,10 @@ cd ibc-rs Go to the [ibc-rs releases](https://github.com/informalsystems/ibc-rs/releases) page to see what is the most recent release. -Then checkout the release, for example if the most recent release is `v0.6.2` then execute the command: +Then checkout the release, for example if the most recent release is `v0.7.0` then execute the command: ```shell -git checkout v0.6.2 +git checkout v0.7.0 ``` ### Building with `cargo build` @@ -151,7 +151,7 @@ If you run the `hermes` without any additional parameters you should see the usa ``` ``` -hermes 0.6.2 +hermes 0.7.0 Informal Systems USAGE: diff --git a/guide/src/rest-api.md b/guide/src/rest-api.md new file mode 100644 index 0000000000..12a24cb1c3 --- /dev/null +++ b/guide/src/rest-api.md @@ -0,0 +1,178 @@ +# REST API + +*Since version 0.7.0.* + +Hermes features a built-in HTTP server which exposes information +about the relayer configuration and state via a REST API. + +## Table of Contents + + + +## Configuration + +The REST API is not active by default, and must be enabled in the relayer configuration: + +```toml +[rest] +enabled = true +host = '127.0.0.1' +port = 3000 +``` + +Please see the [relevant section in the *Configuration* page](./config.md#rest) for details about the configuration options. + +## Endpoints + +### GET `/version` + +This endpoint returns the version of the Hermes (under the `ibc-relayer` key) as well +as the version of the REST server itself (under the `ibc-relayer-rest` key). + +**Example** + +``` +❯ curl -s -X GET 'http://127.0.0.1:3000/version' | jq +``` + +```json +[ + { + "name": "ibc-relayer", + "version": "0.7.0" + }, + { + "name": "ibc-relayer-rest", + "version": "0.1.0" + } +] +``` + +### GET `/chains` + +This endpoint return the identifiers of the chains that Hermes is connected to. +Those identifiers can be used with the `/chain/:id` endpoint to gather more +information about each chain's configuration. See the next section for more details. + +**Example** + +``` +❯ curl -s -X GET 'http://127.0.0.1:3000/chains' | jq +``` + +```json +{ + "status": "success", + "result": [ + "ibc-0", + "ibc-1" + ] +} +``` + +### GET `/chain/:id` + +This endpoint returns the configuration of the chain with the given identifier, +where `:id` stands for the identififer. + +**Example** + +``` +❯ curl -s -X GET 'http://127.0.0.1:3000/chain/ibc-0' | jq +``` + +```json +{ + "status": "success", + "result": { + "id": "ibc-0", + "rpc_addr": "http://127.0.0.1:26657/", + "websocket_addr": "ws://127.0.0.1:26657/websocket", + "grpc_addr": "http://127.0.0.1:9090/", + "rpc_timeout": "10s", + "account_prefix": "cosmos", + "key_name": "testkey", + "store_prefix": "ibc", + "max_gas": 900000000, + "gas_adjustment": null, + "max_msg_num": 60, + "max_tx_size": 2097152, + "clock_drift": "5s", + "trusting_period": "14days", + "trust_threshold": { + "numerator": "1", + "denominator": "3" + }, + "gas_price": { + "price": 0.001, + "denom": "stake" + }, + "packet_filter": { + "policy": "allowall" + } + } +} +``` + +### GET `/state` + +This endpoint returns the current state of the relayer, +namely which chains it is connected to, as well as a description +of all the workers which are currently active. + +``` +❯ curl -s -X GET 'http://127.0.0.1:3000/state' | jq +``` + +```json +{ + "status": "success", + "result": { + "chains": [ + "ibc-0", + "ibc-1" + ], + "workers": { + "Client": [ + { + "id": 3, + "object": { + "type": "Client", + "dst_chain_id": "ibc-1", + "dst_client_id": "07-tendermint-0", + "src_chain_id": "ibc-0" + } + }, + { + "id": 4, + "object": { + "type": "Client", + "dst_chain_id": "ibc-1", + "dst_client_id": "07-tendermint-1", + "src_chain_id": "ibc-0" + } + }, + { + "id": 1, + "object": { + "type": "Client", + "dst_chain_id": "ibc-0", + "dst_client_id": "07-tendermint-0", + "src_chain_id": "ibc-1" + } + }, + { + "id": 2, + "object": { + "type": "Client", + "dst_chain_id": "ibc-0", + "dst_client_id": "07-tendermint-1", + "src_chain_id": "ibc-1" + } + } + ] + } + } +} +``` + diff --git a/guide/src/tutorials/local-chains/start.md b/guide/src/tutorials/local-chains/start.md index 2ff22741b8..1d0db6eaf5 100644 --- a/guide/src/tutorials/local-chains/start.md +++ b/guide/src/tutorials/local-chains/start.md @@ -8,7 +8,7 @@ To this end, clone the `ibc-rs` repository and check out the current version: ```bash git clone git@github.com:informalsystems/ibc-rs.git cd ibc-rs -git checkout v0.6.2 +git checkout v0.7.0 ``` ### Stop existing `gaiad` processes diff --git a/modules/Cargo.toml b/modules/Cargo.toml index bbf68e92ef..b3e8122127 100644 --- a/modules/Cargo.toml +++ b/modules/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc" -version = "0.6.2" +version = "0.7.0" edition = "2018" license = "Apache-2.0" readme = "README.md" @@ -25,7 +25,7 @@ mocks = [ "tendermint-testgen", "sha2" ] [dependencies] # Proto definitions for all IBC-related interfaces, e.g., connections or channels. -ibc-proto = { version = "0.9.1", path = "../proto" } +ibc-proto = { version = "0.10.0", path = "../proto" } ics23 = "0.6.5" chrono = "0.4.19" thiserror = "1.0.26" diff --git a/proto/Cargo.toml b/proto/Cargo.toml index aaa51ada72..fafda4e937 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc-proto" -version = "0.9.1" +version = "0.10.0" authors = ["Informal Systems "] edition = "2018" license = "Apache-2.0" diff --git a/relayer-cli/Cargo.toml b/relayer-cli/Cargo.toml index f64be02f7a..fc5b3f785d 100644 --- a/relayer-cli/Cargo.toml +++ b/relayer-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc-relayer-cli" -version = "0.6.2" +version = "0.7.0" edition = "2018" license = "Apache-2.0" readme = "README.md" @@ -26,10 +26,10 @@ profiling = ["ibc-relayer/profiling"] telemetry = ["ibc-relayer/telemetry", "ibc-telemetry"] [dependencies] -ibc = { version = "0.6.2", path = "../modules" } -ibc-relayer = { version = "0.6.2", path = "../relayer" } -ibc-proto = { version = "0.9.1", path = "../proto" } -ibc-telemetry = { version = "0.6.2", path = "../telemetry", optional = true } +ibc = { version = "0.7.0", path = "../modules" } +ibc-relayer = { version = "0.7.0", path = "../relayer" } +ibc-proto = { version = "0.10.0", path = "../proto" } +ibc-telemetry = { version = "0.7.0", path = "../telemetry", optional = true } ibc-relayer-rest = { version = "0.1.0", path = "../relayer-rest" } gumdrop = { version = "0.7", features = ["default_expr"] } diff --git a/relayer-cli/src/commands/start.rs b/relayer-cli/src/commands/start.rs index 552d26a583..e6e1e1d8ca 100644 --- a/relayer-cli/src/commands/start.rs +++ b/relayer-cli/src/commands/start.rs @@ -127,7 +127,7 @@ fn make_supervisor( match ibc_telemetry::spawn((telemetry.host, telemetry.port), state.clone()) { Ok((addr, _)) => { info!( - "telemetry service running, exposing metrics at {}/metrics", + "telemetry service running, exposing metrics at http://{}/metrics", addr ); } diff --git a/relayer-rest/Cargo.toml b/relayer-rest/Cargo.toml index 7f1b513127..cded5a9372 100644 --- a/relayer-rest/Cargo.toml +++ b/relayer-rest/Cargo.toml @@ -14,15 +14,15 @@ description = """ """ [dependencies] -ibc = { version = "0.6.1", path = "../modules" } -ibc-relayer = { version = "0.6.1", path = "../relayer" } +ibc = { version = "0.7.0", path = "../modules" } +ibc-relayer = { version = "0.7.0", path = "../relayer" } -crossbeam-channel = { version = "0.5" } -rouille = { version = "3.1" } -tracing = { version = "0.1" } +crossbeam-channel = "0.5" +rouille = "3.1" +serde = "1.0.128" +tracing = "0.1" [dev-dependencies] -serde = "1.0.128" serde_json = "1.0.66" -toml = "0.5.8" -ureq = "2.1.1" +toml = "0.5.8" +ureq = "2.1.1" diff --git a/relayer-rest/src/handle.rs b/relayer-rest/src/handle.rs index 01d577c722..d889281903 100644 --- a/relayer-rest/src/handle.rs +++ b/relayer-rest/src/handle.rs @@ -37,12 +37,12 @@ where // Send the request request_sender .send(req) - .map_err(|e| RestApiError::channel_send(e.to_string()))?; + .map_err(|e| RestApiError::ChannelSend(e.to_string()))?; // Wait for the reply reply_receiver .recv() - .map_err(|e| RestApiError::channel_recv(e.to_string()))? + .map_err(|e| RestApiError::ChannelRecv(e.to_string()))? } pub fn all_chain_ids(sender: &channel::Sender) -> Result, RestApiError> { @@ -55,7 +55,7 @@ pub fn chain_config( ) -> Result { match ChainId::from_str(chain_id) { Ok(chain_id) => submit_request(sender, |reply_to| Request::GetChain { chain_id, reply_to }), - Err(e) => Err(RestApiError::invalid_chain_id(chain_id.to_string(), e)), + Err(e) => Err(RestApiError::InvalidChainId(chain_id.to_string(), e.0)), } } diff --git a/relayer-rest/src/server.rs b/relayer-rest/src/server.rs index 5e2de727d4..89ac24199a 100644 --- a/relayer-rest/src/server.rs +++ b/relayer-rest/src/server.rs @@ -1,6 +1,7 @@ use std::thread; use crossbeam_channel as channel; +use serde::{Deserialize, Serialize}; use tracing::{info, trace}; use ibc_relayer::rest::request::Request; @@ -28,37 +29,57 @@ impl ServerHandle { pub fn spawn(config: Config) -> (ServerHandle, channel::Receiver) { let (req_tx, req_rx) = channel::unbounded::(); - info!("[rest] starting REST API server at {}", config); + info!("starting REST API server listening at http://{}", config); let handle = run(config, req_tx); (handle, req_rx) } +#[derive(Debug, Serialize, Deserialize)] +#[serde(tag = "status", content = "result")] +#[serde(rename_all = "lowercase")] +enum JsonResult { + Success(R), + Error(E), +} + +impl From> for JsonResult { + fn from(r: Result) -> Self { + match r { + Ok(a) => Self::Success(a), + Err(e) => Self::Error(e), + } + } +} + #[allow(clippy::manual_strip)] fn run(config: Config, sender: channel::Sender) -> ServerHandle { let server = rouille::Server::new(config.address(), move |request| { router!(request, - (GET) (/) => { - trace!("[rest/server] GET /"); + (GET) (/version) => { + trace!("[rest/server] GET /version"); let result = assemble_version_info(&sender); rouille::Response::json(&result) }, - (GET) (/chain) => { + (GET) (/chains) => { // TODO(Soares): Add a `into_detail` to consume the error and obtain // the underlying detail, so that we avoid doing `e.0` - trace!("[rest/server] GET /chain"); - rouille::Response::json(&all_chain_ids(&sender).map_err(|e| e.0)) + trace!("[rest] GET /chains"); + let result = all_chain_ids(&sender); + rouille::Response::json(&JsonResult::from(result)) }, (GET) (/chain/{id: String}) => { - trace!("[rest/server] GET /chain/{}", id); - rouille::Response::json(&chain_config(&sender, &id).map_err(|e| e.0)) + trace!("[rest] GET /chain/{}", id); + let result = chain_config(&sender, &id); + rouille::Response::json(&JsonResult::from(result)) }, (GET) (/state) => { - trace!("[rest/server] GET /state"); - rouille::Response::json(&supervisor_state(&sender).map_err(|e| e.0)) + trace!("[rest] GET /state"); + let result = supervisor_state(&sender); + rouille::Response::json(&JsonResult::from(result)) }, _ => rouille::Response::empty_404(), diff --git a/relayer-rest/tests/mock.rs b/relayer-rest/tests/mock.rs index 9a2a69ab00..92b1cd0cfb 100644 --- a/relayer-rest/tests/mock.rs +++ b/relayer-rest/tests/mock.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use ibc::ics24_host::identifier::ChainId; use ibc_relayer::{ @@ -11,11 +11,19 @@ use ibc_relayer::{ use ibc_relayer_rest::{server::spawn, Config}; -pub enum TestResult { +enum TestResult { Success, WrongRequest(Request), } +#[derive(Debug, Serialize, Deserialize)] +#[serde(tag = "status", content = "result")] +#[serde(rename_all = "lowercase")] +enum JsonResult { + Success(R), + Error(E), +} + fn run_test(port: u16, path: &str, expected: R, handler: F) where R: Serialize, @@ -60,10 +68,9 @@ fn version() { let result = vec![version.clone(), rest_api_version]; - run_test(19101, "/", result, |req| match req { + run_test(19101, "/version", result, |req| match req { Request::Version { reply_to } => { reply_to.send(Ok(version)).unwrap(); - TestResult::Success } req => TestResult::WrongRequest(req), @@ -73,9 +80,9 @@ fn version() { #[test] fn get_chains() { let chain_id = ChainId::from_str("mock-0").unwrap(); - let result: Result<_, ()> = Ok(vec![chain_id.clone()]); + let result: JsonResult<_, ()> = JsonResult::Success(vec![chain_id.clone()]); - run_test(19102, "/chain", result, |req| match req { + run_test(19102, "/chains", result, |req| match req { Request::GetChains { reply_to } => { reply_to.send(Ok(vec![chain_id])).unwrap(); TestResult::Success @@ -106,7 +113,7 @@ trust_threshold = { numerator = '1', denominator = '3' } #[test] fn get_chain() { let config: ChainConfig = toml::de::from_str(MOCK_CHAIN_CONFIG).unwrap(); - let result: Result<_, ()> = Ok(config.clone()); + let result: JsonResult<_, ()> = JsonResult::Success(config.clone()); run_test(19103, "/chain/mock-0", result, |req| match req { Request::GetChain { chain_id, reply_to } if chain_id.to_string().as_str() == "mock-0" => { @@ -120,7 +127,7 @@ fn get_chain() { #[test] fn state() { let state = SupervisorState::new(vec!["mock-0".parse().unwrap()], std::iter::empty()); - let result: Result<_, ()> = Ok(state.clone()); + let result: JsonResult<_, ()> = JsonResult::Success(state.clone()); run_test(19104, "/state", result, |req| match req { Request::State { reply_to } => { diff --git a/relayer/Cargo.toml b/relayer/Cargo.toml index 9d1c4281c9..5e2ff833d3 100644 --- a/relayer/Cargo.toml +++ b/relayer/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc-relayer" -version = "0.6.2" +version = "0.7.0" edition = "2018" license = "Apache-2.0" readme = "README.md" @@ -22,9 +22,9 @@ profiling = [] telemetry = ["ibc-telemetry"] [dependencies] -ibc = { version = "0.6.2", path = "../modules" } -ibc-proto = { version = "0.9.1", path = "../proto" } -ibc-telemetry = { version = "0.6.2", path = "../telemetry", optional = true } +ibc = { version = "0.7.0", path = "../modules" } +ibc-proto = { version = "0.10.0", path = "../proto" } +ibc-telemetry = { version = "0.7.0", path = "../telemetry", optional = true } subtle-encoding = "0.5" async-trait = "0.1.50" @@ -78,7 +78,7 @@ features = ["unstable"] version = "=0.21.0" [dev-dependencies] -ibc = { version = "0.6.2", path = "../modules", features = ["mocks"] } +ibc = { version = "0.7.0", path = "../modules", features = ["mocks"] } serial_test = "0.5.0" env_logger = "0.9.0" tracing-subscriber = "0.2.20" diff --git a/relayer/src/connection.rs b/relayer/src/connection.rs index 07daadbbbd..f001a0a4f0 100644 --- a/relayer/src/connection.rs +++ b/relayer/src/connection.rs @@ -37,7 +37,7 @@ define_error! { ConnectionError { Relayer [ RelayerError ] - |_| { "relayer error" }, + |e| { format_args!("relayer error: {}", e.source) }, MissingLocalConnectionId |_| { "failed due to missing local channel id" }, diff --git a/relayer/src/rest.rs b/relayer/src/rest.rs index 9ae146fce3..8ad9e17486 100644 --- a/relayer/src/rest.rs +++ b/relayer/src/rest.rs @@ -1,5 +1,5 @@ use crossbeam_channel::TryRecvError; -use tracing::{debug, error}; +use tracing::{error, trace}; use crate::{ config::Config, @@ -44,38 +44,42 @@ pub fn process_incoming_requests(config: &Config, channel: &Receiver) -> Option< match channel.try_recv() { Ok(request) => match request { Request::Version { reply_to } => { - debug!("[rest/supervisor] Version"); + trace!("[rest] Version"); + let v = VersionInfo { name: NAME.to_string(), version: VER.to_string(), }; + reply_to.send(Ok(v)).unwrap_or_else(|e| { error!("[rest/supervisor] error replying to a REST request {}", e) }); } Request::GetChains { reply_to } => { - debug!("[rest/supervisor] GetChains"); + trace!("[rest] GetChains"); + reply_to .send(Ok(config.chains.iter().map(|c| c.id.clone()).collect())) - .unwrap_or_else(|e| { - error!("[rest/supervisor] error replying to a REST request {}", e) - }); + .unwrap_or_else(|e| error!("[rest] error replying to a REST request {}", e)); } Request::GetChain { chain_id, reply_to } => { - debug!("[rest/supervisor] GetChain {}", chain_id); + trace!("[rest] GetChain {}", chain_id); + let result = config .find_chain(&chain_id) .cloned() - .ok_or_else(|| RestApiError::chain_config_not_found(chain_id)); + .ok_or(RestApiError::ChainConfigNotFound(chain_id)); + reply_to.send(result).unwrap_or_else(|e| { error!("[rest/supervisor] error replying to a REST request {}", e) }); } Request::State { reply_to } => { - debug!("[rest/supervisor] State"); + trace!("[rest] State"); + return Some(Command::DumpState(reply_to)); } }, diff --git a/relayer/src/rest/error.rs b/relayer/src/rest/error.rs index b84d05c66b..bb77ec1e6f 100644 --- a/relayer/src/rest/error.rs +++ b/relayer/src/rest/error.rs @@ -1,37 +1,54 @@ -use flex_error::define_error; -use serde::Serialize; +use serde::ser::{Serialize, SerializeMap, Serializer}; +use thiserror::Error; -use ibc::{ics24_host::error::ValidationError, ics24_host::identifier::ChainId}; +use ibc::ics24_host::{error::ValidationErrorDetail, identifier::ChainId}; -define_error! { - #[derive(Debug, Serialize)] - RestApiError { - ChannelSend - { cause: String } - |e| { format!("failed to send a request through crossbeam channel: {0}", e.cause) }, +#[derive(Error, Debug)] +pub enum RestApiError { + #[error("failed to send a request through crossbeam channel: {0}")] + ChannelSend(String), - ChannelRecv - { cause: String } - |e| { format!("failed to receive a reply from crossbeam channel: {0}", e.cause) }, + #[error("failed to receive a reply from crossbeam channel: {0}")] + ChannelRecv(String), - Serialization - { cause: String } - |e| { format!("failed while serializing reply into json value: {0}", e.cause) }, + #[error("failed while serializing reply into json value: {0}")] + Serialization(String), - ChainConfigNotFound - { chain_id: ChainId } - |e| { format!("could not find configuration for chain id {0}", e.chain_id) }, + #[error("could not find configuration for chain: {0}")] + ChainConfigNotFound(ChainId), - InvalidChainId - { chain_id_raw: String } - [ ValidationError ] - |e| { format!("failed to parse the string {0} into a valid chain identifier", e.chain_id_raw) }, + #[error("failed to parse the string {0} into a valid chain identifier: {1}")] + InvalidChainId(String, ValidationErrorDetail), - InvalidChainConfig - { cause: String } - |e| { format!("failed while parsing the request body into a chain configuration {}", e.cause) }, + #[error("failed while parsing the request body into a chain configuration: {0}")] + InvalidChainConfig(String), - Unimplemented - | _ | { "not implemented".to_string() }, + #[error("not implemented")] + Unimplemented, +} + +impl RestApiError { + pub fn name(&self) -> &'static str { + match self { + RestApiError::ChannelSend(_) => "ChannelSend", + RestApiError::ChannelRecv(_) => "ChannelRecv", + RestApiError::Serialization(_) => "Serialization", + RestApiError::ChainConfigNotFound(_) => "ChainConfigNotFound", + RestApiError::InvalidChainId(_, _) => "InvalidChainId", + RestApiError::InvalidChainConfig(_) => "InvalidChainConfig", + RestApiError::Unimplemented => "Unimplemented", + } + } +} + +impl Serialize for RestApiError { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let mut map = serializer.serialize_map(Some(3))?; + map.serialize_entry("name", self.name())?; + map.serialize_entry("msg", &self.to_string())?; + map.end() } } diff --git a/relayer/src/supervisor/spawn.rs b/relayer/src/supervisor/spawn.rs index 23c76ffc6a..d20452c123 100644 --- a/relayer/src/supervisor/spawn.rs +++ b/relayer/src/supervisor/spawn.rs @@ -296,7 +296,7 @@ impl<'a, Chain: ChainHandle + 'static> SpawnContext<'a, Chain> { chain.id(), ), Err(e) => error!( - "skipped workers for connection {} on chain {} due to error {}", + "skipped workers for connection {} on chain {}, reason: {}", chain.id(), connection.connection_id, e diff --git a/telemetry/Cargo.toml b/telemetry/Cargo.toml index e0c6a5c0f7..d60766c76d 100644 --- a/telemetry/Cargo.toml +++ b/telemetry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ibc-telemetry" -version = "0.6.2" +version = "0.7.0" edition = "2018" license = "Apache-2.0" readme = "README.md" @@ -13,7 +13,7 @@ description = """ """ [dependencies] -ibc = { version = "0.6.2", path = "../modules" } +ibc = { version = "0.7.0", path = "../modules" } crossbeam-channel = "0.5.1" once_cell = "1.8.0"