From 7a9eefbe550a4679157a7d5c7fb3e199e8fe64e4 Mon Sep 17 00:00:00 2001 From: Chris Czub Date: Fri, 15 Mar 2024 16:11:49 -0400 Subject: [PATCH] Merge Astria support into Penumbra branch (#16) * update rustfmt * implement `AstriaEndpoint` (#1) * begin AstriaEndpoint impl; update rustfmt * impl send_messages and verify_header * check_misbehaviour and bootstrap * bump deps and work on query methods * implement rest of queries, lint * getting stuff running! hermes working but issue on astria * increase default rpc timeout to 60s * add proof specs for astria * handle nonce in astria endpoint * use no_prehash for proof spec for now * update localnet config for osmosis * cleanup * fix astria address creation and cleanup * implement ICS20Withdrawal on astria for transfer command * merge w upstream (#2) * merge with upstream * add celestia config * remove unused config * bump astria, penumbra, and ibc-proto deps * Resolve penumbra dependencies across astria/penumbra * Use ibc-types v0.12.0 * Fix compilation with a bunch of todos * cargo fmt * Fix some test imports * Test fixes for Penumbra/Astria * Fix compilation and move penumbra/astria dependencies to recent versions --------- Co-authored-by: elizabeth Co-authored-by: noot <36753753+noot@users.noreply.github.com> --- .rustfmt.toml | 3 + Cargo.lock | 931 ++++++++--- Cargo.toml | 11 +- config-astria-celestia.toml | 67 + config-astria-osmosis.toml | 66 + crates/chain-registry/src/asset_list.rs | 3 +- crates/chain-registry/src/chain.rs | 12 +- crates/chain-registry/src/error.rs | 7 +- crates/chain-registry/src/fetchable.rs | 10 +- crates/chain-registry/src/formatter.rs | 16 +- crates/chain-registry/src/paths.rs | 16 +- crates/chain-registry/src/querier.rs | 9 +- crates/relayer-cli/build.rs | 6 +- crates/relayer-cli/src/application.rs | 3 +- crates/relayer-cli/src/bin/hermes/main.rs | 3 +- crates/relayer-cli/src/chain_registry.rs | 47 +- crates/relayer-cli/src/cli_utils.rs | 23 +- crates/relayer-cli/src/commands.rs | 18 +- crates/relayer-cli/src/commands/clear.rs | 35 +- .../relayer-cli/src/commands/completions.rs | 13 +- crates/relayer-cli/src/commands/config.rs | 3 +- .../relayer-cli/src/commands/config/auto.rs | 19 +- .../src/commands/config/validate.rs | 6 +- crates/relayer-cli/src/commands/create.rs | 10 +- .../src/commands/create/channel.rs | 46 +- .../src/commands/create/connection.rs | 27 +- crates/relayer-cli/src/commands/evidence.rs | 98 +- crates/relayer-cli/src/commands/fee.rs | 10 +- .../fee/register_counterparty_payee.rs | 31 +- .../src/commands/fee/register_payee.rs | 31 +- .../relayer-cli/src/commands/fee/transfer.rs | 7 +- crates/relayer-cli/src/commands/health.rs | 16 +- crates/relayer-cli/src/commands/keys.rs | 3 +- crates/relayer-cli/src/commands/keys/add.rs | 50 +- .../relayer-cli/src/commands/keys/balance.rs | 21 +- .../relayer-cli/src/commands/keys/delete.rs | 32 +- crates/relayer-cli/src/commands/keys/list.rs | 15 +- crates/relayer-cli/src/commands/listen.rs | 28 +- crates/relayer-cli/src/commands/logs.rs | 4 +- .../src/commands/logs/log_level.rs | 12 +- crates/relayer-cli/src/commands/logs/raw.rs | 12 +- crates/relayer-cli/src/commands/logs/reset.rs | 7 +- .../relayer-cli/src/commands/misbehaviour.rs | 41 +- crates/relayer-cli/src/commands/query.rs | 11 +- .../relayer-cli/src/commands/query/channel.rs | 34 +- .../src/commands/query/channel_client.rs | 19 +- .../src/commands/query/channel_ends.rs | 43 +- .../src/commands/query/channels.rs | 33 +- .../relayer-cli/src/commands/query/client.rs | 48 +- .../relayer-cli/src/commands/query/clients.rs | 25 +- .../src/commands/query/connection.rs | 37 +- .../src/commands/query/connections.rs | 23 +- .../relayer-cli/src/commands/query/packet.rs | 3 +- .../src/commands/query/packet/ack.rs | 39 +- .../src/commands/query/packet/acks.rs | 16 +- .../src/commands/query/packet/commitment.rs | 33 +- .../src/commands/query/packet/commitments.rs | 13 +- .../src/commands/query/packet/pending.rs | 21 +- .../src/commands/query/packet/pending_acks.rs | 29 +- .../commands/query/packet/pending_sends.rs | 29 +- .../src/commands/query/packet/util.rs | 9 +- .../src/commands/query/transfer.rs | 3 +- .../commands/query/transfer/denom_trace.rs | 16 +- crates/relayer-cli/src/commands/query/tx.rs | 3 +- .../src/commands/query/tx/events.rs | 28 +- crates/relayer-cli/src/commands/start.rs | 37 +- crates/relayer-cli/src/commands/tx.rs | 3 +- crates/relayer-cli/src/commands/tx/channel.rs | 40 +- crates/relayer-cli/src/commands/tx/client.rs | 50 +- .../relayer-cli/src/commands/tx/connection.rs | 20 +- crates/relayer-cli/src/commands/tx/packet.rs | 33 +- .../relayer-cli/src/commands/tx/transfer.rs | 20 +- crates/relayer-cli/src/commands/tx/upgrade.rs | 23 +- crates/relayer-cli/src/commands/update.rs | 3 +- crates/relayer-cli/src/commands/upgrade.rs | 3 +- crates/relayer-cli/src/commands/version.rs | 4 +- crates/relayer-cli/src/components.rs | 6 +- crates/relayer-cli/src/conclude.rs | 2 +- crates/relayer-cli/src/config.rs | 3 +- crates/relayer-cli/src/entry.rs | 9 +- crates/relayer-cli/src/error.rs | 29 +- crates/relayer-cli/src/tracing_handle.rs | 11 +- crates/relayer-rest/src/handle.rs | 6 +- crates/relayer-rest/src/server.rs | 3 +- crates/relayer-rest/tests/mock.rs | 8 +- .../src/applications/ics27_ica/cosmos_tx.rs | 18 +- .../src/applications/ics27_ica/error.rs | 5 +- .../applications/ics27_ica/msgs/register.rs | 22 +- .../applications/ics27_ica/msgs/send_tx.rs | 20 +- .../ics28_ccv/msgs/ccv_double_voting.rs | 11 +- .../ics28_ccv/msgs/ccv_misbehaviour.rs | 12 +- .../src/applications/ics29_fee/error.rs | 9 +- .../src/applications/ics29_fee/events.rs | 19 +- .../applications/ics29_fee/msgs/pay_packet.rs | 18 +- .../ics29_fee/msgs/pay_packet_async.rs | 28 +- .../ics29_fee/msgs/register_payee.rs | 19 +- .../src/applications/ics29_fee/packet_fee.rs | 22 +- .../src/applications/ics31_icq/error.rs | 4 +- .../src/applications/ics31_icq/events.rs | 10 +- .../src/applications/ics31_icq/response.rs | 6 +- .../src/applications/transfer/amount.rs | 5 +- .../src/applications/transfer/coin.rs | 18 +- .../src/applications/transfer/denom.rs | 12 +- .../src/applications/transfer/error.rs | 20 +- .../src/applications/transfer/events.rs | 12 +- .../src/applications/transfer/msgs/mod.rs | 2 + .../src/applications/transfer/msgs/send.rs | 19 +- .../applications/transfer/msgs/transfer.rs | 47 +- .../src/applications/transfer/packet.rs | 9 +- .../clients/ics07_tendermint/client_state.rs | 73 +- .../ics07_tendermint/consensus_state.rs | 24 +- .../src/clients/ics07_tendermint/error.rs | 20 +- .../src/clients/ics07_tendermint/header.rs | 40 +- .../clients/ics07_tendermint/misbehaviour.rs | 14 +- .../src/core/ics02_client/client_state.rs | 15 +- .../src/core/ics02_client/client_type.rs | 4 +- .../src/core/ics02_client/consensus_state.rs | 12 +- .../src/core/ics02_client/error.rs | 18 +- .../src/core/ics02_client/events.rs | 14 +- .../src/core/ics02_client/header.rs | 17 +- .../src/core/ics02_client/height.rs | 11 +- .../src/core/ics02_client/misbehaviour.rs | 3 +- .../src/core/ics02_client/msgs.rs | 8 +- .../core/ics02_client/msgs/create_client.rs | 27 +- .../core/ics02_client/msgs/misbehaviour.rs | 16 +- .../core/ics02_client/msgs/update_client.rs | 33 +- .../core/ics02_client/msgs/upgrade_client.rs | 32 +- .../src/core/ics02_client/trust_threshold.rs | 17 +- .../src/core/ics03_connection/connection.rs | 34 +- .../src/core/ics03_connection/error.rs | 22 +- .../src/core/ics03_connection/events.rs | 9 +- .../src/core/ics03_connection/msgs.rs | 15 +- .../ics03_connection/msgs/conn_open_ack.rs | 49 +- .../msgs/conn_open_confirm.rs | 33 +- .../ics03_connection/msgs/conn_open_init.rs | 50 +- .../ics03_connection/msgs/conn_open_try.rs | 68 +- .../src/core/ics03_connection/version.rs | 20 +- .../src/core/ics04_channel/channel.rs | 40 +- .../src/core/ics04_channel/error.rs | 30 +- .../src/core/ics04_channel/events.rs | 20 +- .../src/core/ics04_channel/msgs.rs | 17 +- .../ics04_channel/msgs/acknowledgement.rs | 43 +- .../ics04_channel/msgs/chan_close_confirm.rs | 43 +- .../ics04_channel/msgs/chan_close_init.rs | 30 +- .../core/ics04_channel/msgs/chan_open_ack.rs | 41 +- .../ics04_channel/msgs/chan_open_confirm.rs | 44 +- .../core/ics04_channel/msgs/chan_open_init.rs | 34 +- .../core/ics04_channel/msgs/chan_open_try.rs | 53 +- .../core/ics04_channel/msgs/recv_packet.rs | 46 +- .../src/core/ics04_channel/msgs/timeout.rs | 45 +- .../ics04_channel/msgs/timeout_on_close.rs | 37 +- .../src/core/ics04_channel/packet.rs | 25 +- .../src/core/ics04_channel/packet_id.rs | 10 +- .../src/core/ics04_channel/timeout.rs | 3 +- .../src/core/ics04_channel/version.rs | 9 +- .../src/core/ics23_commitment/commitment.rs | 18 +- .../src/core/ics23_commitment/merkle.rs | 20 +- .../src/core/ics24_host/identifier.rs | 12 +- .../relayer-types/src/core/ics24_host/path.rs | 10 +- .../src/core/ics24_host/validate.rs | 3 +- .../src/core/ics26_routing/error.rs | 8 +- .../src/core/ics26_routing/msgs.rs | 22 +- crates/relayer-types/src/events.rs | 49 +- crates/relayer-types/src/handler.rs | 4 +- crates/relayer-types/src/mock/client_state.rs | 26 +- .../relayer-types/src/mock/consensus_state.rs | 23 +- crates/relayer-types/src/mock/header.rs | 15 +- crates/relayer-types/src/mock/misbehaviour.rs | 12 +- crates/relayer-types/src/proofs.rs | 3 +- crates/relayer-types/src/serializers.rs | 3 +- crates/relayer-types/src/test.rs | 1 + crates/relayer-types/src/timestamp.rs | 18 +- crates/relayer-types/src/utils/pretty.rs | 14 +- crates/relayer/Cargo.toml | 5 + crates/relayer/src/cache.rs | 16 +- crates/relayer/src/chain.rs | 1 + crates/relayer/src/chain/astria/endpoint.rs | 1430 +++++++++++++++++ crates/relayer/src/chain/astria/mod.rs | 5 + .../relayer/src/chain/astria/proof_specs.rs | 33 + crates/relayer/src/chain/astria/utils.rs | 52 + crates/relayer/src/chain/client.rs | 17 +- crates/relayer/src/chain/client_settings.rs | 8 +- crates/relayer/src/chain/cosmos.rs | 227 +-- crates/relayer/src/chain/cosmos/batch.rs | 63 +- crates/relayer/src/chain/cosmos/config.rs | 30 +- .../relayer/src/chain/cosmos/config/error.rs | 5 +- crates/relayer/src/chain/cosmos/encode.rs | 38 +- crates/relayer/src/chain/cosmos/estimate.rs | 30 +- crates/relayer/src/chain/cosmos/fee.rs | 28 +- crates/relayer/src/chain/cosmos/gas.rs | 8 +- crates/relayer/src/chain/cosmos/query.rs | 28 +- .../relayer/src/chain/cosmos/query/account.rs | 11 +- .../relayer/src/chain/cosmos/query/balance.rs | 5 +- .../src/chain/cosmos/query/consensus_state.rs | 15 +- .../relayer/src/chain/cosmos/query/custom.rs | 6 +- .../src/chain/cosmos/query/denom_trace.rs | 5 +- crates/relayer/src/chain/cosmos/query/fee.rs | 21 +- .../relayer/src/chain/cosmos/query/status.rs | 6 +- crates/relayer/src/chain/cosmos/query/tx.rs | 39 +- crates/relayer/src/chain/cosmos/retry.rs | 29 +- crates/relayer/src/chain/cosmos/simulate.rs | 8 +- crates/relayer/src/chain/cosmos/tx.rs | 31 +- .../relayer/src/chain/cosmos/types/account.rs | 1 + .../src/chain/cosmos/types/app_state.rs | 3 +- .../relayer/src/chain/cosmos/types/config.rs | 17 +- .../src/chain/cosmos/types/events/channel.rs | 32 +- .../src/chain/cosmos/types/events/fee.rs | 6 +- crates/relayer/src/chain/cosmos/types/gas.rs | 8 +- crates/relayer/src/chain/cosmos/version.rs | 2 +- crates/relayer/src/chain/cosmos/wait.rs | 27 +- crates/relayer/src/chain/counterparty.rs | 22 +- crates/relayer/src/chain/endpoint.rs | 93 +- crates/relayer/src/chain/handle.rs | 18 +- crates/relayer/src/chain/handle/base.rs | 22 +- crates/relayer/src/chain/handle/cache.rs | 83 +- crates/relayer/src/chain/handle/counting.rs | 83 +- crates/relayer/src/chain/penumbra/chain.rs | 22 +- crates/relayer/src/chain/requests.rs | 62 +- crates/relayer/src/chain/runtime.rs | 25 +- crates/relayer/src/channel.rs | 80 +- crates/relayer/src/channel/error.rs | 21 +- crates/relayer/src/channel/version.rs | 3 +- crates/relayer/src/client_state.rs | 50 +- crates/relayer/src/config.rs | 132 +- crates/relayer/src/config/compat_mode.rs | 11 +- crates/relayer/src/config/error.rs | 3 +- crates/relayer/src/config/filter.rs | 20 +- crates/relayer/src/config/gas_multiplier.rs | 10 +- crates/relayer/src/config/proof_specs.rs | 1 + crates/relayer/src/config/types.rs | 20 +- crates/relayer/src/connection.rs | 69 +- crates/relayer/src/connection/error.rs | 21 +- crates/relayer/src/consensus_state.rs | 36 +- crates/relayer/src/error.rs | 64 +- crates/relayer/src/event.rs | 54 +- crates/relayer/src/event/bus.rs | 5 +- crates/relayer/src/event/error.rs | 4 +- crates/relayer/src/event/source.rs | 7 +- crates/relayer/src/event/source/rpc.rs | 26 +- .../relayer/src/event/source/rpc/extract.rs | 17 +- crates/relayer/src/event/source/websocket.rs | 19 +- .../src/event/source/websocket/extract.rs | 29 +- crates/relayer/src/foreign_client.rs | 75 +- crates/relayer/src/keyring.rs | 11 +- .../relayer/src/keyring/ed25519_key_pair.rs | 18 +- crates/relayer/src/keyring/errors.rs | 3 +- .../relayer/src/keyring/secp256k1_key_pair.rs | 4 + crates/relayer/src/lib.rs | 1 + crates/relayer/src/light_client.rs | 11 +- crates/relayer/src/light_client/tendermint.rs | 45 +- .../src/light_client/tendermint/detector.rs | 6 +- crates/relayer/src/link.rs | 18 +- crates/relayer/src/link/cli.rs | 55 +- crates/relayer/src/link/error.rs | 28 +- crates/relayer/src/link/operational_data.rs | 28 +- crates/relayer/src/link/packet_events.rs | 21 +- crates/relayer/src/link/pending.rs | 29 +- crates/relayer/src/link/relay_path.rs | 131 +- crates/relayer/src/link/relay_sender.rs | 13 +- crates/relayer/src/link/tx_hashes.rs | 4 +- crates/relayer/src/misbehaviour.rs | 24 +- crates/relayer/src/object.rs | 37 +- crates/relayer/src/path.rs | 6 +- crates/relayer/src/registry.rs | 6 +- crates/relayer/src/rest.rs | 3 +- crates/relayer/src/rest/error.rs | 3 +- crates/relayer/src/rest/request.rs | 3 +- crates/relayer/src/spawn.rs | 8 +- crates/relayer/src/supervisor.rs | 12 +- .../src/supervisor/client_state_filter.rs | 34 +- crates/relayer/src/supervisor/dump_state.rs | 6 +- crates/relayer/src/supervisor/error.rs | 13 +- crates/relayer/src/supervisor/scan.rs | 20 +- crates/relayer/src/supervisor/spawn.rs | 12 +- crates/relayer/src/transfer.rs | 123 +- crates/relayer/src/upgrade_chain.rs | 40 +- crates/relayer/src/util/compat_mode.rs | 6 +- crates/relayer/src/util/diff.rs | 6 +- crates/relayer/src/util/profiling.rs | 12 +- crates/relayer/src/util/retry.rs | 3 +- crates/relayer/src/util/stream.rs | 9 +- crates/relayer/src/util/task.rs | 11 +- crates/relayer/src/worker.rs | 7 +- crates/relayer/src/worker/channel.rs | 14 +- crates/relayer/src/worker/client.rs | 20 +- crates/relayer/src/worker/connection.rs | 13 +- .../relayer/src/worker/cross_chain_query.rs | 29 +- crates/relayer/src/worker/error.rs | 4 +- crates/relayer/src/worker/handle.rs | 24 +- crates/relayer/src/worker/map.rs | 10 +- crates/relayer/src/worker/packet.rs | 27 +- crates/relayer/src/worker/retry_strategy.rs | 3 +- crates/telemetry/src/encoder.rs | 15 +- crates/telemetry/src/lib.rs | 10 +- crates/telemetry/src/server.rs | 13 +- crates/telemetry/src/state.rs | 33 +- .../src/bin/test_setup_with_binary_channel.rs | 9 +- ...t_setup_with_fee_enabled_binary_channel.rs | 9 +- .../bin/test_setup_with_ternary_channel.rs | 9 +- tools/integration-test/src/mbt/handlers.rs | 22 +- tools/integration-test/src/mbt/itf.rs | 3 +- tools/integration-test/src/mbt/transfer.rs | 24 +- tools/integration-test/src/mbt/utils.rs | 3 + .../src/tests/async_icq/simple_query.rs | 20 +- .../src/tests/clean_workers.rs | 11 +- .../src/tests/clear_packet.rs | 10 +- .../src/tests/client_expiration.rs | 36 +- .../src/tests/client_filter.rs | 22 +- .../src/tests/client_refresh.rs | 17 +- .../src/tests/client_settings.rs | 19 +- .../src/tests/client_upgrade.rs | 24 +- .../src/tests/connection_delay.rs | 8 +- .../src/tests/consensus_states.rs | 1 - .../integration-test/src/tests/denom_trace.rs | 2 +- .../src/tests/dynamic_gas_fee.rs | 4 + .../src/tests/error_events.rs | 3 +- .../src/tests/execute_schedule.rs | 4 +- .../src/tests/fee/auto_forward_relayer.rs | 3 +- .../src/tests/fee/filter_fees.rs | 11 +- .../src/tests/fee/forward_relayer.rs | 3 +- .../src/tests/fee/no_forward_relayer.rs | 3 +- .../src/tests/fee/non_fee_channel.rs | 3 +- .../src/tests/fee/pay_fee_async.rs | 2 + .../src/tests/fee/register_payee.rs | 3 +- .../src/tests/fee/timeout_fee.rs | 6 +- tools/integration-test/src/tests/fee_grant.rs | 9 +- tools/integration-test/src/tests/ica.rs | 2 + .../src/tests/ics20_filter/memo.rs | 1 - tools/integration-test/src/tests/ics31.rs | 19 +- .../tests/interchain_security/ica_transfer.rs | 22 + .../src/tests/interchain_security/icq.rs | 13 +- .../interchain_security/simple_transfer.rs | 14 +- .../src/tests/manual/simulation.rs | 6 + tools/integration-test/src/tests/memo.rs | 18 +- .../src/tests/ordered_channel.rs | 3 + .../src/tests/ordered_channel_clear.rs | 11 +- tools/integration-test/src/tests/python.rs | 11 +- .../src/tests/query_packet.rs | 16 +- .../src/tests/sequence_filter.rs | 6 + .../integration-test/src/tests/supervisor.rs | 14 +- .../src/tests/tendermint/sequential.rs | 15 +- .../src/tests/ternary_transfer.rs | 2 +- tools/integration-test/src/tests/transfer.rs | 3 +- .../src/bootstrap/binary/chain.rs | 38 +- .../src/bootstrap/binary/channel.rs | 31 +- .../src/bootstrap/binary/connection.rs | 26 +- .../test-framework/src/bootstrap/consumer.rs | 22 +- tools/test-framework/src/bootstrap/init.rs | 8 +- .../src/bootstrap/nary/chain.rs | 32 +- .../src/bootstrap/nary/channel.rs | 34 +- .../src/bootstrap/nary/connection.rs | 27 +- tools/test-framework/src/bootstrap/single.rs | 27 +- tools/test-framework/src/chain/builder.rs | 13 +- tools/test-framework/src/chain/chain_type.rs | 18 +- .../test-framework/src/chain/cli/async_icq.rs | 3 +- .../test-framework/src/chain/cli/bootstrap.rs | 20 +- .../test-framework/src/chain/cli/fee_grant.rs | 3 +- .../test-framework/src/chain/cli/host_zone.rs | 3 +- tools/test-framework/src/chain/cli/ica.rs | 6 +- .../test-framework/src/chain/cli/provider.rs | 9 +- tools/test-framework/src/chain/cli/query.rs | 9 +- .../test-framework/src/chain/cli/transfer.rs | 3 +- tools/test-framework/src/chain/cli/upgrade.rs | 3 +- tools/test-framework/src/chain/cli/version.rs | 4 +- tools/test-framework/src/chain/config.rs | 1 + tools/test-framework/src/chain/driver.rs | 31 +- tools/test-framework/src/chain/exec.rs | 4 +- .../test-framework/src/chain/ext/async_icq.rs | 12 +- .../test-framework/src/chain/ext/bootstrap.rs | 48 +- .../src/chain/ext/crosschainquery.rs | 13 +- tools/test-framework/src/chain/ext/fee.rs | 30 +- .../test-framework/src/chain/ext/fee_grant.rs | 10 +- tools/test-framework/src/chain/ext/ica.rs | 22 +- .../test-framework/src/chain/ext/proposal.rs | 21 +- .../test-framework/src/chain/ext/transfer.rs | 34 +- tools/test-framework/src/chain/ext/version.rs | 9 +- tools/test-framework/src/chain/tagged.rs | 34 +- tools/test-framework/src/chain/version.rs | 6 +- tools/test-framework/src/error.rs | 15 +- tools/test-framework/src/framework/base.rs | 9 +- .../src/framework/binary/chain.rs | 42 +- .../src/framework/binary/channel.rs | 56 +- .../src/framework/binary/connection.rs | 37 +- .../src/framework/binary/ics.rs | 27 +- .../src/framework/binary/node.rs | 16 +- .../src/framework/nary/chain.rs | 35 +- .../src/framework/nary/channel.rs | 47 +- .../src/framework/nary/connection.rs | 39 +- .../test-framework/src/framework/nary/node.rs | 20 +- .../test-framework/src/framework/overrides.rs | 42 +- tools/test-framework/src/ibc/denom.rs | 7 +- tools/test-framework/src/ibc/token.rs | 19 +- tools/test-framework/src/prelude.rs | 147 +- tools/test-framework/src/relayer/chain.rs | 75 +- tools/test-framework/src/relayer/channel.rs | 37 +- .../test-framework/src/relayer/connection.rs | 32 +- tools/test-framework/src/relayer/driver.rs | 19 +- tools/test-framework/src/relayer/fee.rs | 51 +- .../src/relayer/foreign_client.rs | 9 +- tools/test-framework/src/relayer/refresh.rs | 9 +- tools/test-framework/src/relayer/transfer.rs | 42 +- tools/test-framework/src/relayer/tx.rs | 16 +- .../test-framework/src/types/binary/chains.rs | 10 +- .../src/types/binary/channel.rs | 9 +- .../test-framework/src/types/binary/client.rs | 6 +- .../src/types/binary/connection.rs | 9 +- .../src/types/binary/foreign_client.rs | 7 +- tools/test-framework/src/types/env.rs | 9 +- tools/test-framework/src/types/id.rs | 3 +- tools/test-framework/src/types/nary/chains.rs | 26 +- .../test-framework/src/types/nary/channel.rs | 19 +- .../src/types/nary/connection.rs | 16 +- .../src/types/nary/foreign_client.rs | 19 +- tools/test-framework/src/types/process.rs | 3 +- tools/test-framework/src/types/single/node.rs | 43 +- tools/test-framework/src/types/tagged/dual.rs | 9 +- tools/test-framework/src/types/tagged/mono.rs | 10 +- tools/test-framework/src/types/wallet.rs | 7 +- tools/test-framework/src/util/array.rs | 2 + tools/test-framework/src/util/file.rs | 4 +- .../src/util/interchain_security.rs | 10 +- .../src/util/proposal_status.rs | 3 +- tools/test-framework/src/util/random.rs | 7 +- tools/test-framework/src/util/retry.rs | 1 + tools/test-framework/src/util/suspend.rs | 7 +- 425 files changed, 7216 insertions(+), 4064 deletions(-) create mode 100644 config-astria-celestia.toml create mode 100644 config-astria-osmosis.toml create mode 100644 crates/relayer/src/chain/astria/endpoint.rs create mode 100644 crates/relayer/src/chain/astria/mod.rs create mode 100644 crates/relayer/src/chain/astria/proof_specs.rs create mode 100644 crates/relayer/src/chain/astria/utils.rs diff --git a/.rustfmt.toml b/.rustfmt.toml index 8c83f08221..3f8091e26c 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,5 +1,8 @@ max_width = 100 reorder_imports = true +imports_layout = "Vertical" +imports_granularity = "Crate" +group_imports = "StdExternalCrate" # nightly only diff --git a/Cargo.lock b/Cargo.lock index f598cef100..79b6b94414 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -415,6 +415,54 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "astria-core" +version = "0.1.0" +source = "git+https://github.com/astriaorg/astria?rev=112a66d6f9bb6638cce4935c949834e1d35416bb#112a66d6f9bb6638cce4935c949834e1d35416bb" +dependencies = [ + "astria-merkle", + "bytes", + "ed25519-consensus", + "hex", + "ibc-types 0.12.0", + "indexmap 2.2.6", + "penumbra-ibc", + "penumbra-proto", + "prost 0.12.4", + "prost-types", + "sha2 0.10.8", + "tendermint 0.32.0", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "thiserror", + "tracing", +] + +[[package]] +name = "astria-merkle" +version = "0.1.0" +source = "git+https://github.com/astriaorg/astria?rev=112a66d6f9bb6638cce4935c949834e1d35416bb#112a66d6f9bb6638cce4935c949834e1d35416bb" +dependencies = [ + "sha2 0.10.8", +] + +[[package]] +name = "astria-sequencer-client" +version = "0.1.0" +source = "git+https://github.com/astriaorg/astria?rev=112a66d6f9bb6638cce4935c949834e1d35416bb#112a66d6f9bb6638cce4935c949834e1d35416bb" +dependencies = [ + "astria-core", + "async-trait", + "futures", + "hex", + "prost 0.12.4", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "tendermint-rpc", + "thiserror", + "tracing", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -434,7 +482,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -445,7 +493,7 @@ checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -560,6 +608,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -617,7 +671,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -640,9 +694,9 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.31.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd00f3c09b5f21fb357abe32d29946eb8bb7a0862bae62c0b5e4a692acbbe73c" +checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" dependencies = [ "bech32 0.10.0-beta", "bitcoin-internals", @@ -1045,7 +1099,7 @@ version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro-error 1.0.4", "proc-macro2 1.0.79", "quote", @@ -1071,9 +1125,9 @@ dependencies = [ "borsh", "futures", "hex", - "ibc-types", - "ics23", - "jmt", + "ibc-types 0.12.0", + "ics23 0.11.1", + "jmt 0.9.0", "metrics", "once_cell", "parking_lot", @@ -1083,7 +1137,7 @@ dependencies = [ "sha2 0.10.8", "smallvec", "tempfile", - "tendermint", + "tendermint 0.34.1", "tokio", "tokio-stream", "tracing", @@ -1098,7 +1152,7 @@ dependencies = [ "async-trait", "cnidarium", "hex", - "tendermint", + "tendermint 0.34.1", ] [[package]] @@ -1327,7 +1381,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -1364,7 +1418,7 @@ dependencies = [ "proc-macro2 1.0.79", "quote", "strsim", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -1375,7 +1429,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -1519,9 +1573,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -1639,7 +1693,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -2033,7 +2087,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -2165,9 +2219,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", @@ -2276,6 +2330,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -2318,15 +2378,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "0.2.12" @@ -2478,11 +2529,11 @@ dependencies = [ "ibc-relayer", "ibc-relayer-types", "ibc-test-framework", - "prost", + "prost 0.12.4", "serde", "serde_json", "tempfile", - "tendermint", + "tendermint 0.34.1", "tendermint-rpc", "time", "toml 0.8.12", @@ -2495,15 +2546,15 @@ version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd4ee32b22d3b06f31529b956f4928e5c9a068d71e46cf6abfa19c31ca550553" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "flex-error", - "ics23", - "informalsystems-pbjson", - "prost", + "ics23 0.11.1", + "informalsystems-pbjson 0.7.0", + "prost 0.12.4", "serde", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.34.1", "tonic", ] @@ -2513,15 +2564,15 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1a6f2bbf7e1d12f98d8d54d9114231b865418d0f8b619c0873180eafdee07fd" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "flex-error", - "ics23", - "informalsystems-pbjson", - "prost", + "ics23 0.11.1", + "informalsystems-pbjson 0.7.0", + "prost 0.12.4", "serde", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.34.1", "tonic", ] @@ -2530,6 +2581,8 @@ name = "ibc-relayer" version = "0.27.2" dependencies = [ "anyhow", + "astria-core", + "astria-sequencer-client", "async-stream", "bech32 0.9.1", "bitcoin", @@ -2540,6 +2593,7 @@ dependencies = [ "digest 0.10.7", "dirs-next", "ed25519", + "ed25519-consensus", "ed25519-dalek", "ed25519-dalek-bip32", "env_logger", @@ -2554,7 +2608,9 @@ dependencies = [ "ibc-proto 0.42.2", "ibc-relayer-types", "ibc-telemetry", + "ibc-types 0.13.0", "itertools 0.10.5", + "jmt 0.6.0", "moka", "num-bigint", "num-rational", @@ -2569,7 +2625,7 @@ dependencies = [ "penumbra-transaction", "penumbra-view", "penumbra-wallet", - "prost", + "prost 0.12.4", "regex", "reqwest", "retry", @@ -2584,11 +2640,11 @@ dependencies = [ "signature", "strum", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client", "tendermint-light-client-detector", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.34.1", "tendermint-rpc", "tendermint-testgen", "test-log", @@ -2636,7 +2692,7 @@ dependencies = [ "serial_test", "signal-hook", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", "tendermint-rpc", "time", @@ -2669,19 +2725,19 @@ dependencies = [ "env_logger", "flex-error", "ibc-proto 0.42.2", - "ics23", + "ics23 0.11.1", "itertools 0.10.5", "num-rational", "primitive-types", - "prost", + "prost 0.12.4", "regex", "serde", "serde_derive", "serde_json", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.34.1", "tendermint-rpc", "tendermint-testgen", "test-log", @@ -2705,7 +2761,7 @@ dependencies = [ "prometheus", "serde", "serde_json", - "tendermint", + "tendermint 0.34.1", "tokio", "tracing", ] @@ -2727,7 +2783,7 @@ dependencies = [ "ibc-relayer-types", "itertools 0.10.5", "once_cell", - "prost", + "prost 0.12.4", "rand", "semver", "serde", @@ -2749,16 +2805,34 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba606d86e2015991f86a129935dbaeacd94beab72fb90a733c1b1ea76be708a2" dependencies = [ - "ibc-types-core-channel", - "ibc-types-core-client", - "ibc-types-core-commitment", - "ibc-types-core-connection", - "ibc-types-domain-type", - "ibc-types-identifier", - "ibc-types-lightclients-tendermint", - "ibc-types-path", - "ibc-types-timestamp", - "ibc-types-transfer", + "ibc-types-core-channel 0.12.0", + "ibc-types-core-client 0.12.0", + "ibc-types-core-commitment 0.12.0", + "ibc-types-core-connection 0.12.0", + "ibc-types-domain-type 0.12.0", + "ibc-types-identifier 0.12.0", + "ibc-types-lightclients-tendermint 0.12.0", + "ibc-types-path 0.12.0", + "ibc-types-timestamp 0.12.0", + "ibc-types-transfer 0.12.0", +] + +[[package]] +name = "ibc-types" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dcf499b03078fe945b03d0167cba4a3db3014d893f2732f12243be82b323d31" +dependencies = [ + "ibc-types-core-channel 0.13.0", + "ibc-types-core-client 0.13.0", + "ibc-types-core-commitment 0.13.0", + "ibc-types-core-connection 0.13.0", + "ibc-types-domain-type 0.13.0", + "ibc-types-identifier 0.13.0", + "ibc-types-lightclients-tendermint 0.13.0", + "ibc-types-path 0.13.0", + "ibc-types-timestamp 0.13.0", + "ibc-types-transfer 0.13.0", ] [[package]] @@ -2772,23 +2846,55 @@ dependencies = [ "derive_more", "displaydoc", "ibc-proto 0.41.0", - "ibc-types-core-client", - "ibc-types-core-commitment", - "ibc-types-core-connection", - "ibc-types-domain-type", - "ibc-types-identifier", - "ibc-types-timestamp", - "ics23", + "ibc-types-core-client 0.12.0", + "ibc-types-core-commitment 0.12.0", + "ibc-types-core-connection 0.12.0", + "ibc-types-domain-type 0.12.0", + "ibc-types-identifier 0.12.0", + "ibc-types-timestamp 0.12.0", + "ics23 0.11.1", + "num-traits", + "proc-macro2 0.1.10", + "prost 0.12.4", + "safe-regex", + "serde", + "serde_json", + "sha2 0.10.8", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "time", + "tracing", +] + +[[package]] +name = "ibc-types-core-channel" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad6293fe787300f0f0ca1b77bffe19788aea1a3af7d258168f79d310965c02a" +dependencies = [ + "anyhow", + "bytes", + "derive_more", + "displaydoc", + "ibc-proto 0.42.2", + "ibc-types-core-client 0.13.0", + "ibc-types-core-commitment 0.13.0", + "ibc-types-core-connection 0.13.0", + "ibc-types-domain-type 0.13.0", + "ibc-types-identifier 0.13.0", + "ibc-types-timestamp 0.13.0", + "ics23 0.11.1", "num-traits", "proc-macro2 0.1.10", - "prost", + "prost 0.12.4", "safe-regex", "serde", "serde_json", "sha2 0.10.8", "subtle-encoding", - "tendermint", - "tendermint-proto", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "time", "tracing", ] @@ -2804,18 +2910,44 @@ dependencies = [ "derive_more", "displaydoc", "ibc-proto 0.41.0", - "ibc-types-domain-type", - "ibc-types-identifier", - "ibc-types-timestamp", - "ics23", + "ibc-types-domain-type 0.12.0", + "ibc-types-identifier 0.12.0", + "ibc-types-timestamp 0.12.0", + "ics23 0.11.1", + "num-traits", + "prost 0.12.4", + "serde", + "serde_json", + "sha2 0.10.8", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "time", +] + +[[package]] +name = "ibc-types-core-client" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ac5b54e5d75ad0fbbcf7aa345d4b759e7d10fff7dd3698b183f7e7b6a067aa" +dependencies = [ + "anyhow", + "bytes", + "derive_more", + "displaydoc", + "ibc-proto 0.42.2", + "ibc-types-domain-type 0.13.0", + "ibc-types-identifier 0.13.0", + "ibc-types-timestamp 0.13.0", + "ics23 0.11.1", "num-traits", - "prost", + "prost 0.12.4", "serde", "serde_json", "sha2 0.10.8", "subtle-encoding", - "tendermint", - "tendermint-proto", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "time", ] @@ -2833,21 +2965,55 @@ dependencies = [ "erased-serde", "hex", "ibc-proto 0.41.0", - "ibc-types-domain-type", - "ibc-types-identifier", - "ibc-types-timestamp", - "ics23", + "ibc-types-domain-type 0.12.0", + "ibc-types-identifier 0.12.0", + "ibc-types-timestamp 0.12.0", + "ics23 0.11.1", "num-traits", "primitive-types", - "prost", + "prost 0.12.4", "safe-regex", "serde", "serde_json", "sha2 0.10.8", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.34.1", + "time", + "tracing", + "uint", +] + +[[package]] +name = "ibc-types-core-commitment" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029431ff7dfd85736b1d951ae84ab1ecd38b1e0de0cf503c8bcc7b7b8b1ff4ef" +dependencies = [ + "anyhow", + "bytes", + "derive_more", + "displaydoc", + "dyn-clone", + "erased-serde", + "hex", + "ibc-proto 0.42.2", + "ibc-types-domain-type 0.13.0", + "ibc-types-identifier 0.13.0", + "ibc-types-timestamp 0.13.0", + "ics23 0.11.1", + "num-traits", + "primitive-types", + "prost 0.12.4", + "safe-regex", + "serde", + "serde_json", + "sha2 0.10.8", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-light-client-verifier", + "tendermint-proto 0.34.1", "time", "tracing", "uint", @@ -2864,21 +3030,50 @@ dependencies = [ "derive_more", "displaydoc", "ibc-proto 0.41.0", - "ibc-types-core-client", - "ibc-types-core-commitment", - "ibc-types-domain-type", - "ibc-types-identifier", - "ibc-types-timestamp", - "ics23", + "ibc-types-core-client 0.12.0", + "ibc-types-core-commitment 0.12.0", + "ibc-types-domain-type 0.12.0", + "ibc-types-identifier 0.12.0", + "ibc-types-timestamp 0.12.0", + "ics23 0.11.1", "num-traits", - "prost", + "prost 0.12.4", "safe-regex", "serde", "serde_json", "sha2 0.10.8", "subtle-encoding", - "tendermint", - "tendermint-proto", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "time", +] + +[[package]] +name = "ibc-types-core-connection" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "593fff2c4b4cfdb48e38c0dd89d7f2c0d11cda51bca4f72e5fd0ee646e9f0d6e" +dependencies = [ + "anyhow", + "bytes", + "derive_more", + "displaydoc", + "ibc-proto 0.42.2", + "ibc-types-core-client 0.13.0", + "ibc-types-core-commitment 0.13.0", + "ibc-types-domain-type 0.13.0", + "ibc-types-identifier 0.13.0", + "ibc-types-timestamp 0.13.0", + "ics23 0.11.1", + "num-traits", + "prost 0.12.4", + "safe-regex", + "serde", + "serde_json", + "sha2 0.10.8", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "time", ] @@ -2890,7 +3085,18 @@ checksum = "3abc9619b9dd7201804f45fc7f335dda72d2e4d6f82d96e8fe3abf4585e6101b" dependencies = [ "anyhow", "bytes", - "prost", + "prost 0.12.4", +] + +[[package]] +name = "ibc-types-domain-type" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "777a22b16fcf9891d845ea9d6f69883f4cd490bbfc7ca74030910f51760a400b" +dependencies = [ + "anyhow", + "bytes", + "prost 0.12.4", ] [[package]] @@ -2903,6 +3109,16 @@ dependencies = [ "serde", ] +[[package]] +name = "ibc-types-identifier" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a082a67bbf2dacb5584d8cb121f25af587e4400b12cbb3efb9b398cdb8a3cc" +dependencies = [ + "displaydoc", + "serde", +] + [[package]] name = "ibc-types-lightclients-tendermint" version = "0.12.0" @@ -2916,24 +3132,60 @@ dependencies = [ "dyn-clone", "erased-serde", "ibc-proto 0.41.0", - "ibc-types-core-client", - "ibc-types-core-commitment", - "ibc-types-core-connection", - "ibc-types-domain-type", - "ibc-types-identifier", - "ibc-types-timestamp", - "ics23", + "ibc-types-core-client 0.12.0", + "ibc-types-core-commitment 0.12.0", + "ibc-types-core-connection 0.12.0", + "ibc-types-domain-type 0.12.0", + "ibc-types-identifier 0.12.0", + "ibc-types-timestamp 0.12.0", + "ics23 0.11.1", + "num-traits", + "primitive-types", + "prost 0.12.4", + "safe-regex", + "serde", + "serde_json", + "sha2 0.10.8", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-light-client-verifier", + "tendermint-proto 0.34.1", + "time", + "tracing", + "uint", +] + +[[package]] +name = "ibc-types-lightclients-tendermint" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1444a7fb929e83d3250a1f969cd211abbbbaaba929285d628474327875bc20" +dependencies = [ + "anyhow", + "bytes", + "derive_more", + "displaydoc", + "dyn-clone", + "erased-serde", + "ibc-proto 0.42.2", + "ibc-types-core-client 0.13.0", + "ibc-types-core-commitment 0.13.0", + "ibc-types-core-connection 0.13.0", + "ibc-types-domain-type 0.13.0", + "ibc-types-identifier 0.13.0", + "ibc-types-timestamp 0.13.0", + "ics23 0.11.1", "num-traits", "primitive-types", - "prost", + "prost 0.12.4", "safe-regex", "serde", "serde_json", "sha2 0.10.8", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.34.1", "time", "tracing", "uint", @@ -2948,16 +3200,38 @@ dependencies = [ "bytes", "derive_more", "displaydoc", - "ibc-types-core-channel", - "ibc-types-core-client", - "ibc-types-core-connection", + "ibc-types-core-channel 0.12.0", + "ibc-types-core-client 0.12.0", + "ibc-types-core-connection 0.12.0", "num-traits", - "prost", + "prost 0.12.4", "serde", "serde_json", "subtle-encoding", - "tendermint", - "tendermint-proto", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "time", +] + +[[package]] +name = "ibc-types-path" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fef66d01d7a58d9b4161ef165b68b6aa5963b7170150f07c9870738560290abf" +dependencies = [ + "bytes", + "derive_more", + "displaydoc", + "ibc-types-core-channel 0.13.0", + "ibc-types-core-client 0.13.0", + "ibc-types-core-connection 0.13.0", + "num-traits", + "prost 0.12.4", + "serde", + "serde_json", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "time", ] @@ -2970,12 +3244,30 @@ dependencies = [ "bytes", "displaydoc", "num-traits", - "prost", + "prost 0.12.4", "serde", "serde_json", "subtle-encoding", - "tendermint", - "tendermint-proto", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", + "time", +] + +[[package]] +name = "ibc-types-timestamp" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad40bbb3c5e821c6fd77946afd16fb6abe15d8f81bfdbac39b045ae450eb314" +dependencies = [ + "bytes", + "displaydoc", + "num-traits", + "prost 0.12.4", + "serde", + "serde_json", + "subtle-encoding", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "time", ] @@ -2989,6 +3281,16 @@ dependencies = [ "serde", ] +[[package]] +name = "ibc-types-transfer" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95292e7b895363ccd4eea820e6bcd6f95ae1225d7342cc3b73fe2be594c9f75" +dependencies = [ + "displaydoc", + "serde", +] + [[package]] name = "ibig" version = "0.3.6" @@ -3001,6 +3303,23 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "ics23" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "442d4bab37956e76f739c864f246c825d87c0bb7f9afa65660c57833c91bf6d4" +dependencies = [ + "anyhow", + "bytes", + "hex", + "informalsystems-pbjson 0.6.0", + "prost 0.11.9", + "ripemd", + "serde", + "sha2 0.10.8", + "sha3", +] + [[package]] name = "ics23" version = "0.11.1" @@ -3012,8 +3331,8 @@ dependencies = [ "blake3", "bytes", "hex", - "informalsystems-pbjson", - "prost", + "informalsystems-pbjson 0.7.0", + "prost 0.12.4", "ripemd", "serde", "sha2 0.10.8", @@ -3108,13 +3427,23 @@ dependencies = [ "serde", ] +[[package]] +name = "informalsystems-pbjson" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eecd90f87bea412eac91c6ef94f6b1e390128290898cbe14f2b926787ae1fb" +dependencies = [ + "base64 0.13.1", + "serde", +] + [[package]] name = "informalsystems-pbjson" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aa4a0980c8379295100d70854354e78df2ee1c6ca0f96ffe89afeb3140e3a3d" dependencies = [ - "base64", + "base64 0.21.7", "serde", ] @@ -3151,12 +3480,42 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jmt" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1a302f0defd323b833c9848c20ab40c3156128f50d7bf8eebeed2ef58167258" +dependencies = [ + "anyhow", + "borsh", + "hashbrown 0.13.2", + "hex", + "ics23 0.10.2", + "itertools 0.10.5", + "mirai-annotations", + "num-derive", + "num-traits", + "serde", + "sha2 0.10.8", + "thiserror", + "tracing", +] + [[package]] name = "jmt" version = "0.9.0" @@ -3168,7 +3527,7 @@ dependencies = [ "digest 0.10.7", "hashbrown 0.13.2", "hex", - "ics23", + "ics23 0.11.1", "itertools 0.10.5", "mirai-annotations", "num-derive", @@ -3248,13 +3607,12 @@ dependencies = [ [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.5.0", "libc", - "redox_syscall", ] [[package]] @@ -3452,9 +3810,9 @@ dependencies = [ [[package]] name = "multimap" -version = "0.8.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" [[package]] name = "nom" @@ -3752,7 +4110,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" dependencies = [ - "base64", + "base64 0.21.7", "serde", ] @@ -3762,9 +4120,9 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" dependencies = [ - "heck", + "heck 0.4.1", "itertools 0.11.0", - "prost", + "prost 0.12.4", "prost-types", ] @@ -3778,7 +4136,7 @@ dependencies = [ "chrono", "pbjson", "pbjson-build", - "prost", + "prost 0.12.4", "prost-build", "serde", ] @@ -3843,7 +4201,7 @@ dependencies = [ "anyhow", "ark-ff", "async-trait", - "base64", + "base64 0.21.7", "bech32 0.8.1", "bincode", "bitvec", @@ -3855,10 +4213,10 @@ dependencies = [ "futures", "hex", "ibc-proto 0.41.0", - "ibc-types", - "ics23", + "ibc-types 0.12.0", + "ics23 0.11.1", "im", - "jmt", + "jmt 0.9.0", "metrics", "once_cell", "parking_lot", @@ -3883,7 +4241,7 @@ dependencies = [ "penumbra-tower-trace", "penumbra-transaction", "penumbra-txhash", - "prost", + "prost 0.12.4", "rand_chacha", "regex", "serde", @@ -3892,9 +4250,9 @@ dependencies = [ "serde_with", "sha2 0.10.8", "tempfile", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", - "tendermint-proto", + "tendermint-proto 0.34.1", "tokio", "tokio-util 0.7.10", "tonic", @@ -3916,7 +4274,7 @@ dependencies = [ "ark-relations", "ark-serialize", "ark-std", - "base64", + "base64 0.21.7", "bech32 0.8.1", "blake2b_simd 1.0.2", "bytes", @@ -3950,7 +4308,7 @@ dependencies = [ "anyhow", "ark-ff", "async-trait", - "base64", + "base64 0.21.7", "blake2b_simd 1.0.2", "cnidarium", "cnidarium-component", @@ -3966,10 +4324,10 @@ dependencies = [ "penumbra-sct", "penumbra-shielded-pool", "penumbra-txhash", - "prost", + "prost 0.12.4", "serde", "sha2 0.10.8", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", "tracing", ] @@ -4004,7 +4362,7 @@ dependencies = [ "rand", "rand_core", "serde", - "tendermint", + "tendermint 0.34.1", "tokio", "tokio-stream", "tonic", @@ -4019,7 +4377,7 @@ dependencies = [ "anyhow", "ark-ff", "ark-serialize", - "base64", + "base64 0.21.7", "blake2b_simd 1.0.2", "bytes", "chacha20poly1305", @@ -4034,7 +4392,7 @@ dependencies = [ "penumbra-proto", "penumbra-transaction", "penumbra-txhash", - "prost", + "prost 0.12.4", "rand_core", "serde", "serde_json", @@ -4058,7 +4416,7 @@ dependencies = [ "ark-snark", "async-stream", "async-trait", - "base64", + "base64 0.21.7", "bincode", "blake2b_simd 1.0.2", "cnidarium", @@ -4085,14 +4443,14 @@ dependencies = [ "penumbra-tct", "penumbra-txhash", "poseidon377", - "prost", + "prost 0.12.4", "rand_core", "regex", "serde", "serde_json", "sha2 0.10.8", "tap", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", "thiserror", "tokio", @@ -4114,7 +4472,7 @@ dependencies = [ "penumbra-proto", "penumbra-sct", "serde", - "tendermint", + "tendermint 0.34.1", "tracing", ] @@ -4139,7 +4497,7 @@ dependencies = [ "rand", "rand_core", "serde", - "tendermint", + "tendermint 0.34.1", "tonic", "tracing", ] @@ -4163,7 +4521,7 @@ dependencies = [ "penumbra-shielded-pool", "penumbra-stake", "serde", - "tendermint", + "tendermint 0.34.1", "tracing", ] @@ -4200,7 +4558,7 @@ dependencies = [ "ark-snark", "async-stream", "async-trait", - "base64", + "base64 0.21.7", "blake2b_simd 1.0.2", "bytes", "cnidarium", @@ -4208,7 +4566,7 @@ dependencies = [ "decaf377 0.5.0", "decaf377-rdsa", "futures", - "ibc-types", + "ibc-types 0.12.0", "im", "metrics", "once_cell", @@ -4234,7 +4592,7 @@ dependencies = [ "regex", "serde", "tap", - "tendermint", + "tendermint 0.34.1", "thiserror", "tokio", "tonic", @@ -4249,13 +4607,13 @@ dependencies = [ "anyhow", "ark-ff", "async-trait", - "base64", + "base64 0.21.7", "blake2b_simd 1.0.2", "cnidarium", "hex", "ibc-proto 0.41.0", - "ibc-types", - "ics23", + "ibc-types 0.12.0", + "ics23 0.11.1", "metrics", "num-traits", "once_cell", @@ -4265,11 +4623,11 @@ dependencies = [ "penumbra-proto", "penumbra-sct", "penumbra-txhash", - "prost", + "prost 0.12.4", "serde", "serde_json", "sha2 0.10.8", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", "tower", "tracing", @@ -4287,7 +4645,7 @@ dependencies = [ "ark-relations", "ark-serialize", "ark-std", - "base64", + "base64 0.21.7", "bech32 0.8.1", "bip32", "blake2b_simd 1.0.2", @@ -4332,7 +4690,7 @@ dependencies = [ "ark-serialize", "ark-snark", "ark-std", - "base64", + "base64 0.21.7", "bech32 0.8.1", "blake2b_simd 1.0.2", "bytes", @@ -4397,16 +4755,16 @@ dependencies = [ "hex", "http-body", "ibc-proto 0.41.0", - "ibc-types", - "ics23", + "ibc-types 0.12.0", + "ics23 0.11.1", "pbjson", "pbjson-types", "pin-project", - "prost", + "prost 0.12.4", "serde", "serde_json", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tonic", "tower", "tracing", @@ -4441,7 +4799,7 @@ dependencies = [ "rand", "rand_core", "serde", - "tendermint", + "tendermint 0.34.1", "tonic", "tracing", ] @@ -4459,7 +4817,7 @@ dependencies = [ "ark-serialize", "ark-snark", "async-trait", - "base64", + "base64 0.21.7", "blake2b_simd 1.0.2", "bytes", "chacha20poly1305", @@ -4470,7 +4828,7 @@ dependencies = [ "decaf377-ka", "decaf377-rdsa", "hex", - "ibc-types", + "ibc-types 0.12.0", "im", "metrics", "once_cell", @@ -4484,13 +4842,13 @@ dependencies = [ "penumbra-tct", "penumbra-txhash", "poseidon377", - "prost", + "prost 0.12.4", "rand", "rand_core", "serde", "serde_json", "tap", - "tendermint", + "tendermint 0.34.1", "thiserror", "tonic", "tracing", @@ -4510,7 +4868,7 @@ dependencies = [ "ark-snark", "async-stream", "async-trait", - "base64", + "base64 0.21.7", "bech32 0.8.1", "bitvec", "cnidarium", @@ -4540,7 +4898,7 @@ dependencies = [ "serde_unit_struct", "serde_with", "sha2 0.10.8", - "tendermint", + "tendermint 0.34.1", "tokio", "tonic", "tracing", @@ -4585,8 +4943,8 @@ dependencies = [ "pin-project", "pin-project-lite", "sha2 0.10.8", - "tendermint", - "tendermint-proto", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "tokio", "tokio-stream", "tokio-util 0.7.10", @@ -4604,7 +4962,7 @@ dependencies = [ "anyhow", "ark-ff", "ark-serialize", - "base64", + "base64 0.21.7", "bech32 0.8.1", "blake2b_simd 1.0.2", "bytes", @@ -4616,7 +4974,7 @@ dependencies = [ "derivative", "hex", "ibc-proto 0.41.0", - "ibc-types", + "ibc-types 0.12.0", "num-bigint", "once_cell", "pbjson-types", @@ -4677,7 +5035,7 @@ dependencies = [ "futures", "genawaiter", "hex", - "ibc-types", + "ibc-types 0.12.0", "metrics", "once_cell", "parking_lot", @@ -4699,7 +5057,7 @@ dependencies = [ "penumbra-stake", "penumbra-tct", "penumbra-transaction", - "prost", + "prost 0.12.4", "r2d2", "r2d2_sqlite", "rand", @@ -4707,7 +5065,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "tendermint", + "tendermint 0.34.1", "tokio", "tokio-stream", "tonic", @@ -4784,14 +5142,14 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -4934,7 +5292,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2 1.0.79", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -5058,56 +5416,78 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.3" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" +dependencies = [ + "bytes", + "prost-derive 0.12.4", ] [[package]] name = "prost-build" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes", - "heck", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.12.1", "log", "multimap", "once_cell", "petgraph", "prettyplease", - "prost", + "prost 0.12.4", "prost-types", "regex", - "syn 2.0.55", + "syn 2.0.58", "tempfile", - "which", ] [[package]] name = "prost-derive" -version = "0.12.3" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools 0.11.0", + "itertools 0.10.5", "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 1.0.109", +] + +[[package]] +name = "prost-derive" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2 1.0.79", + "quote", + "syn 2.0.58", ] [[package]] name = "prost-types" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" +checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost", + "prost 0.12.4", ] [[package]] @@ -5129,9 +5509,9 @@ dependencies = [ [[package]] name = "quanta" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" +checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" dependencies = [ "crossbeam-utils 0.8.19", "libc", @@ -5258,9 +5638,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", @@ -5317,7 +5697,7 @@ version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -5486,7 +5866,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", + "base64 0.21.7", ] [[package]] @@ -5531,18 +5911,18 @@ dependencies = [ [[package]] name = "safe-regex" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15289bf322e0673d52756a18194167f2378ec1a15fe884af6e2d2cb934822b0" +checksum = "e6ab4bc484ef480a9ce79b381efd7b6767700f514d47bc599036e9d6f7f3c49d" dependencies = [ "safe-regex-macro", ] [[package]] name = "safe-regex-compiler" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba76fae590a2aa665279deb1f57b5098cbace01a0c5e60e262fcf55f7c51542" +checksum = "6d71f8c78bffb07962595e1bfa5ed11d24dd855eedc50b6a735f5ef648ce621b" dependencies = [ "safe-proc-macro2", "safe-quote", @@ -5550,9 +5930,9 @@ dependencies = [ [[package]] name = "safe-regex-macro" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c2e96b5c03f158d1b16ba79af515137795f4ad4e8de3f790518aae91f1d127" +checksum = "0909ab4b77511df24201cd66541d6a028887c77ecc065f277c68a12a663274ef" dependencies = [ "safe-proc-macro2", "safe-regex-compiler", @@ -5648,9 +6028,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -5661,9 +6041,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -5714,7 +6094,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -5746,7 +6126,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -5774,7 +6154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f1b15838534b38fb67ffe60033fe3ffad48f916c175e8baa0400e0cdb958dec" dependencies = [ "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -5795,7 +6175,7 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ - "base64", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -5816,7 +6196,7 @@ dependencies = [ "darling", "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -5864,7 +6244,7 @@ checksum = "b93fb4adc70021ac1b47f7d45e8cc4169baaa7ea58483bc5b721d19a26202212" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -6070,11 +6450,11 @@ version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2 1.0.79", "quote", "rustversion", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -6111,9 +6491,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.55" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2 1.0.79", "quote", @@ -6194,6 +6574,34 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "tendermint" +version = "0.32.0" +source = "git+https://github.com/eigerco/celestia-tendermint-rs?rev=bbe7de8#bbe7de8c777f0c44b338f4bf26f0f6efb18e87f0" +dependencies = [ + "bytes", + "digest 0.10.7", + "ed25519", + "ed25519-consensus", + "flex-error", + "futures", + "num-traits", + "once_cell", + "prost 0.12.4", + "prost-types", + "serde", + "serde_bytes", + "serde_json", + "serde_repr", + "sha2 0.10.8", + "signature", + "subtle", + "subtle-encoding", + "tendermint-proto 0.32.0", + "time", + "zeroize", +] + [[package]] name = "tendermint" version = "0.34.1" @@ -6209,7 +6617,7 @@ dependencies = [ "k256", "num-traits", "once_cell", - "prost", + "prost 0.12.4", "prost-types", "ripemd", "serde", @@ -6220,7 +6628,7 @@ dependencies = [ "signature", "subtle", "subtle-encoding", - "tendermint-proto", + "tendermint-proto 0.34.1", "time", "zeroize", ] @@ -6234,7 +6642,7 @@ dependencies = [ "flex-error", "serde", "serde_json", - "tendermint", + "tendermint 0.34.1", "toml 0.5.11", "url", ] @@ -6256,7 +6664,7 @@ dependencies = [ "serde_derive", "serde_json", "static_assertions", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client-verifier", "tendermint-rpc", "time", @@ -6279,9 +6687,9 @@ dependencies = [ "serde_derive", "serde_json", "static_assertions", - "tendermint", + "tendermint 0.34.1", "tendermint-light-client", - "tendermint-proto", + "tendermint-proto 0.34.1", "tendermint-rpc", "time", "tracing", @@ -6296,7 +6704,24 @@ dependencies = [ "derive_more", "flex-error", "serde", - "tendermint", + "tendermint 0.34.1", + "time", +] + +[[package]] +name = "tendermint-proto" +version = "0.32.0" +source = "git+https://github.com/eigerco/celestia-tendermint-rs?rev=bbe7de8#bbe7de8c777f0c44b338f4bf26f0f6efb18e87f0" +dependencies = [ + "bytes", + "flex-error", + "num-derive", + "num-traits", + "prost 0.12.4", + "prost-types", + "serde", + "serde_bytes", + "subtle-encoding", "time", ] @@ -6310,7 +6735,7 @@ dependencies = [ "flex-error", "num-derive", "num-traits", - "prost", + "prost 0.12.4", "prost-types", "serde", "serde_bytes", @@ -6340,9 +6765,9 @@ dependencies = [ "serde_json", "subtle", "subtle-encoding", - "tendermint", + "tendermint 0.34.1", "tendermint-config", - "tendermint-proto", + "tendermint-proto 0.34.1", "thiserror", "time", "tokio", @@ -6364,7 +6789,7 @@ dependencies = [ "serde_json", "simple-error", "tempfile", - "tendermint", + "tendermint 0.34.1", "time", ] @@ -6396,7 +6821,7 @@ checksum = "c8f546451eaa38373f549093fe9fd05e7d2bade739e2ddf834b9968621d60107" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -6422,7 +6847,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -6547,7 +6972,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -6663,7 +7088,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64", + "base64 0.21.7", "bytes", "h2", "http", @@ -6672,7 +7097,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost", + "prost 0.12.4", "rustls", "rustls-native-certs", "rustls-pemfile", @@ -6715,9 +7140,9 @@ dependencies = [ "bytes", "futures", "pin-project", - "prost", - "tendermint", - "tendermint-proto", + "prost 0.12.4", + "tendermint 0.34.1", + "tendermint-proto 0.34.1", "tokio", "tokio-stream", "tokio-util 0.6.10", @@ -6772,7 +7197,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -7061,7 +7486,7 @@ checksum = "b3fd98999db9227cf28e59d83e1f120f42bc233d4b152e8fab9bc87d5bb1e0f8" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -7119,7 +7544,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", "wasm-bindgen-shared", ] @@ -7153,7 +7578,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7174,18 +7599,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "winapi" version = "0.3.9" @@ -7412,7 +7825,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] @@ -7432,7 +7845,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2 1.0.79", "quote", - "syn 2.0.55", + "syn 2.0.58", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index aa2612d1c6..603983b039 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,12 @@ tendermint-proto = "0.34.1" tendermint-rpc = "0.34.0" tendermint-testgen = "0.34.0" +# Astria dependencies +astria-core = { git = "https://github.com/astriaorg/astria", rev = "112a66d6f9bb6638cce4935c949834e1d35416bb" } +astria-sequencer-client = { git = "https://github.com/astriaorg/astria", rev = "112a66d6f9bb6638cce4935c949834e1d35416bb", features = [ + "http", +] } + # Penumbra dependencies penumbra-asset = { git = "https://github.com/penumbra-zone/penumbra", tag = "v0.68.1" } penumbra-custody = { git = "https://github.com/penumbra-zone/penumbra", tag = "v0.68.1" } @@ -71,6 +77,7 @@ dialoguer = "0.11.0" digest = "0.10.6" dirs-next = "2.0.0" ed25519 = "2.2.2" +ed25519-consensus = "2.1.0" ed25519-dalek = "2.0.0" ed25519-dalek-bip32 = "0.3.0" env_logger = "0.11.1" @@ -83,9 +90,11 @@ hex = "0.4.3" http = "0.2.9" humantime = "2.1.0" humantime-serde = "1.1.1" -ibc-proto = "0.42.0" +ibc-proto = "0.42.2" +ibc-types = "0.13.0" ics23 = "0.11.1" itertools = "0.10.5" +jmt = "0.6" moka = "0.12.5" num-bigint = "0.4" num-rational = "0.4.1" diff --git a/config-astria-celestia.toml b/config-astria-celestia.toml new file mode 100644 index 0000000000..78f6cc7c3c --- /dev/null +++ b/config-astria-celestia.toml @@ -0,0 +1,67 @@ + +[global] +log_level = 'debug' + +[mode] + +[mode.clients] +enabled = true +refresh = true +misbehaviour = false + +[mode.connections] +enabled = true + +[mode.channels] +enabled = true + +[mode.packets] +enabled = true +clear_interval = 100 +clear_on_start = true +tx_confirmation = true + +[telemetry] +enabled = false +host = '127.0.0.1' +port = 3001 + +[[chains]] +id = 'astria' +type = 'Astria' +rpc_addr = 'http://localhost:26657' +grpc_addr = 'http://localhost:8080' +event_source = { mode = 'pull', interval = '1s' } +rpc_timeout = '15s' +account_prefix = 'fake' # not used +key_name = 'astria-wallet' +store_prefix = 'ibc-data' +gas_price = { price = 1, denom = 'nria' } # not used +max_gas = 10000000 # not used +clock_drift = '5s' +trusting_period = '2h' # this should be changed in the future +trust_threshold = { numerator = '1', denominator = '3' } + +[[chains]] +id = 'celestia' +type = 'CosmosSdk' +rpc_addr = 'http://localhost:27050' +grpc_addr = 'http://localhost:9090' +event_source = { mode = 'push', url = 'ws://localhost:27050/websocket', batch_delay = '200ms' } +rpc_timeout = '15s' +trusted_node = true +account_prefix = 'celestia' +key_name = 'wallet' +store_prefix = 'ibc' +gas_price = { price = 0.0026, denom = 'utia' } +gas_multiplier = 1.2 +default_gas = 1000000 +max_gas = 10000000 +max_msg_num = 30 +max_tx_size = 2097152 +clock_drift = '5s' +max_block_time = '30s' +trusting_period = '14days' +trust_threshold = { numerator = '2', denominator = '3' } +memo_prefix = 'astriawashere' +compat_mode = "0.34" diff --git a/config-astria-osmosis.toml b/config-astria-osmosis.toml new file mode 100644 index 0000000000..627061b9a6 --- /dev/null +++ b/config-astria-osmosis.toml @@ -0,0 +1,66 @@ + +[global] +log_level = 'debug' + +[mode] + +[mode.clients] +enabled = true +refresh = true +misbehaviour = false + +[mode.connections] +enabled = true + +[mode.channels] +enabled = true + +[mode.packets] +enabled = true +clear_interval = 100 +clear_on_start = true +tx_confirmation = true + +[telemetry] +enabled = false +host = '127.0.0.1' +port = 3001 + +[[chains]] +id = 'astria' +type = 'Astria' +rpc_addr = 'http://localhost:26657' +grpc_addr = 'http://localhost:8080' +event_source = { mode = 'pull', interval = '1s' } +rpc_timeout = '15s' +account_prefix = 'fake' # not used +key_name = 'astria-wallet' +store_prefix = 'ibc-data' +gas_price = { price = 1, denom = 'nria' } # not used +max_gas = 10000000 # not used +clock_drift = '5s' +trusting_period = '2h' # this should be changed in the future +trust_threshold = { numerator = '1', denominator = '3' } + +[[chains]] +id = 'ibc-0' +type = 'CosmosSdk' +rpc_addr = 'http://localhost:27050' +grpc_addr = 'http://localhost:9090' +event_source = { mode = 'push', url = 'ws://localhost:27050/websocket', batch_delay = '200ms' } +rpc_timeout = '15s' +trusted_node = true +account_prefix = 'osmo' +key_name = 'wallet' +store_prefix = 'ibc' +gas_price = { price = 0.0026, denom = 'stake' } +gas_multiplier = 1.2 +default_gas = 1000000 +max_gas = 10000000 +max_msg_num = 30 +max_tx_size = 2097152 +clock_drift = '5s' +max_block_time = '30s' +trusting_period = '14days' +trust_threshold = { numerator = '2', denominator = '3' } +memo_prefix = 'astriawashere' diff --git a/crates/chain-registry/src/asset_list.rs b/crates/chain-registry/src/asset_list.rs index af0f513f03..fc7b3115da 100644 --- a/crates/chain-registry/src/asset_list.rs +++ b/crates/chain-registry/src/asset_list.rs @@ -55,8 +55,7 @@ impl Fetchable for AssetList { #[cfg(test)] mod tests { use super::*; - use crate::constants::ALL_CHAINS; - use crate::error::RegistryError; + use crate::{constants::ALL_CHAINS, error::RegistryError}; #[tokio::test] #[ignore] diff --git a/crates/chain-registry/src/chain.rs b/crates/chain-registry/src/chain.rs index 72c654160e..c806461b64 100644 --- a/crates/chain-registry/src/chain.rs +++ b/crates/chain-registry/src/chain.rs @@ -1,9 +1,11 @@ //! Contains models for serializing and deserializing `chain.json` for a given chain //! Taken from -use crate::fetchable::Fetchable; +use std::path::PathBuf; + use ibc_relayer_types::core::ics24_host::identifier::ChainId; use serde::{Deserialize, Serialize}; -use std::path::PathBuf; + +use crate::fetchable::Fetchable; #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(default)] @@ -163,8 +165,7 @@ impl Fetchable for ChainData { #[cfg(test)] mod tests { use super::*; - use crate::constants::ALL_CHAINS; - use crate::error::RegistryError; + use crate::{constants::ALL_CHAINS, error::RegistryError}; #[tokio::test] #[ignore] @@ -188,8 +189,9 @@ mod tests { #[test] fn chain_data_deserialize() { - use ibc_relayer_types::core::ics24_host::identifier::ChainId; use std::str::FromStr; + + use ibc_relayer_types::core::ics24_host::identifier::ChainId; let json = r#"{ "$schema": "https://github.com/cosmos/chain-registry/blob/master/chain.schema.json", "chain_name": "test", diff --git a/crates/chain-registry/src/error.rs b/crates/chain-registry/src/error.rs index 01ccf6af39..3fec2e6ee3 100644 --- a/crates/chain-registry/src/error.rs +++ b/crates/chain-registry/src/error.rs @@ -1,9 +1,12 @@ use std::path::PathBuf; use flex_error::{define_error, TraceError}; +use http; use itertools::Itertools; -use tokio::task::JoinError; -use tokio::time::error::Elapsed; +use reqwest; +use serde_json; +use tendermint_rpc; +use tokio::{task::JoinError, time::error::Elapsed}; define_error! { RegistryError { diff --git a/crates/chain-registry/src/fetchable.rs b/crates/chain-registry/src/fetchable.rs index bf66dedb6f..8310a550d0 100644 --- a/crates/chain-registry/src/fetchable.rs +++ b/crates/chain-registry/src/fetchable.rs @@ -1,12 +1,14 @@ //! Contains the trait required to fetch and deserialize data from the chain repository +use std::path::PathBuf; + +use async_trait::async_trait; +use http::uri::Builder; +use serde::de::DeserializeOwned; + use crate::{ constants::{DEFAULT_REF, HOST, PROTOCOL, REGISTRY_PATH}, error::RegistryError, }; -use async_trait::async_trait; -use http::uri::Builder; -use serde::de::DeserializeOwned; -use std::path::PathBuf; /// `Fetchable` represents the basic expectations for external data or resources that /// can be fetched. diff --git a/crates/chain-registry/src/formatter.rs b/crates/chain-registry/src/formatter.rs index 5d97832703..44b46a1cdc 100644 --- a/crates/chain-registry/src/formatter.rs +++ b/crates/chain-registry/src/formatter.rs @@ -5,9 +5,7 @@ use std::str::FromStr; -use http::uri::Scheme; -use http::Uri; - +use http::{uri::Scheme, Uri}; use tendermint_rpc::Url; use crate::error::RegistryError; @@ -99,9 +97,9 @@ impl UriFormatter for SimpleGrpcFormatter { #[cfg(test)] mod tests { - use super::*; + use std::{cmp::PartialEq, fmt::Debug}; - use std::fmt::Debug; + use super::*; struct FormatterTest { input: &'static str, @@ -183,9 +181,7 @@ mod tests { #[tokio::test] #[ignore] async fn all_chain_registry_grpc_address() -> Result<(), RegistryError> { - use crate::chain::ChainData; - use crate::constants::ALL_CHAINS; - use crate::fetchable::Fetchable; + use crate::{chain::ChainData, constants::ALL_CHAINS, fetchable::Fetchable}; let mut handles = Vec::with_capacity(ALL_CHAINS.len()); @@ -206,9 +202,7 @@ mod tests { #[tokio::test] #[ignore] async fn all_chain_registry_rpc_address() -> Result<(), RegistryError> { - use crate::chain::ChainData; - use crate::constants::ALL_CHAINS; - use crate::fetchable::Fetchable; + use crate::{chain::ChainData, constants::ALL_CHAINS, fetchable::Fetchable}; let mut handles = Vec::with_capacity(ALL_CHAINS.len()); diff --git a/crates/chain-registry/src/paths.rs b/crates/chain-registry/src/paths.rs index e7cf1bc918..b41b9e1d43 100644 --- a/crates/chain-registry/src/paths.rs +++ b/crates/chain-registry/src/paths.rs @@ -1,9 +1,10 @@ +use std::path::PathBuf; + +use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}; +use serde::{Deserialize, Serialize}; + /// Models for serializing and deserializing IBC path JSON data found in the `_IBC/` directory of the registry repository use crate::fetchable::Fetchable; -use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}; -use serde::Deserialize; -use serde::Serialize; -use std::path::PathBuf; #[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] @@ -69,9 +70,7 @@ impl Fetchable for IBCPath { #[cfg(test)] mod tests { use super::*; - use crate::error::RegistryError; - - use crate::constants::ALL_PATHS; + use crate::{constants::ALL_PATHS, error::RegistryError}; #[tokio::test] #[ignore] @@ -98,10 +97,11 @@ mod tests { #[test] fn paths_deserialize() { + use std::str::FromStr; + use ibc_relayer_types::core::ics24_host::identifier::{ ChannelId, ClientId, ConnectionId, PortId, }; - use std::str::FromStr; let path = r#"{ "$schema": "https://github.com/cosmos/chain-registry/blob/master/ibc_data.schema.json", diff --git a/crates/chain-registry/src/querier.rs b/crates/chain-registry/src/querier.rs index 3102011f16..6766545d22 100644 --- a/crates/chain-registry/src/querier.rs +++ b/crates/chain-registry/src/querier.rs @@ -2,18 +2,15 @@ //! Contains struct to perform a health check on a gRPC/WebSocket endpoint and //! to retrieve the `max_block_size` from a RPC endpoint. -use std::fmt::Debug; -use std::str::FromStr; +use std::{fmt::Debug, str::FromStr}; use async_trait::async_trait; use futures::{stream::FuturesUnordered, StreamExt}; use http::Uri; -use tendermint_rpc::HttpClient; -use tendermint_rpc::HttpClientUrl; -use tracing::{debug, info}; use ibc_proto::cosmos::bank::v1beta1::query_client::QueryClient; -use tendermint_rpc::{Client, Url}; +use tendermint_rpc::{Client as _, HttpClient, HttpClientUrl, Url}; +use tracing::{debug, info}; use crate::error::RegistryError; diff --git a/crates/relayer-cli/build.rs b/crates/relayer-cli/build.rs index 7fdab17b07..5983d57a8e 100644 --- a/crates/relayer-cli/build.rs +++ b/crates/relayer-cli/build.rs @@ -36,8 +36,10 @@ fn is_ci_release() -> bool { mod git { use core::marker::PhantomData; - use std::ffi::OsStr; - use std::process::{Command, Output}; + use std::{ + ffi::OsStr, + process::{Command, Output}, + }; // A wrapper over a git shell command that is only constructable if git is available & the // current directory is a git repository diff --git a/crates/relayer-cli/src/application.rs b/crates/relayer-cli/src/application.rs index a6b9c656e0..48bfcc3a81 100644 --- a/crates/relayer-cli/src/application.rs +++ b/crates/relayer-cli/src/application.rs @@ -6,8 +6,7 @@ use abscissa_core::{ application::{self, AppCell}, component::Component, config::{self, CfgCell}, - terminal::component::Terminal, - terminal::ColorChoice, + terminal::{component::Terminal, ColorChoice}, Application, Configurable, FrameworkError, FrameworkErrorKind, StandardPaths, }; use ibc_relayer::{ diff --git a/crates/relayer-cli/src/bin/hermes/main.rs b/crates/relayer-cli/src/bin/hermes/main.rs index 214fbb6ab5..567bd4dd09 100644 --- a/crates/relayer-cli/src/bin/hermes/main.rs +++ b/crates/relayer-cli/src/bin/hermes/main.rs @@ -3,8 +3,7 @@ #![deny(warnings, missing_docs, trivial_casts)] #![forbid(unsafe_code)] -use ibc_relayer_cli::application::APPLICATION; -use ibc_relayer_cli::components::enable_ansi; +use ibc_relayer_cli::{application::APPLICATION, components::enable_ansi}; fn main() -> eyre::Result<()> { install_error_reporter()?; diff --git a/crates/relayer-cli/src/chain_registry.rs b/crates/relayer-cli/src/chain_registry.rs index a0152b0af2..3315596cba 100644 --- a/crates/relayer-cli/src/chain_registry.rs +++ b/crates/relayer-cli/src/chain_registry.rs @@ -1,29 +1,34 @@ //! Contains functions to generate a relayer config for a given chain -use std::collections::BTreeMap; -use std::collections::HashMap; -use std::fmt::Display; - use futures::future::join_all; use http::Uri; use tendermint_rpc::Url; use tokio::task::{JoinError, JoinHandle}; use tracing::{error, trace}; -use ibc_chain_registry::asset_list::AssetList; -use ibc_chain_registry::chain::ChainData; -use ibc_chain_registry::error::RegistryError; -use ibc_chain_registry::fetchable::Fetchable; -use ibc_chain_registry::formatter::{SimpleGrpcFormatter, UriFormatter}; -use ibc_chain_registry::paths::IBCPath; -use ibc_chain_registry::querier::*; -use ibc_relayer::chain::cosmos::config::CosmosSdkConfig; -use ibc_relayer::config::dynamic_gas::DynamicGasPrice; -use ibc_relayer::config::filter::{FilterPattern, PacketFilter}; -use ibc_relayer::config::gas_multiplier::GasMultiplier; -use ibc_relayer::config::types::{MaxMsgNum, MaxTxSize, Memo, TrustThreshold}; -use ibc_relayer::config::{default, AddressType, ChainConfig, EventSourceMode, GasPrice}; -use ibc_relayer::keyring::Store; +use std::{collections::BTreeMap, collections::HashMap, fmt::Display, marker::Send}; + +use ibc_chain_registry::{ + asset_list::AssetList, + chain::ChainData, + error::RegistryError, + fetchable::Fetchable, + formatter::{SimpleGrpcFormatter, UriFormatter}, + paths::IBCPath, + querier::*, +}; +use ibc_relayer::{ + chain::cosmos::config::CosmosSdkConfig, + config::{ + default, + dynamic_gas::DynamicGasPrice, + filter::{FilterPattern, PacketFilter}, + gas_multiplier::GasMultiplier, + types::{MaxMsgNum, MaxTxSize, Memo, TrustThreshold}, + AddressType, ChainConfig, EventSourceMode, GasPrice, + }, + keyring::Store, +}; const MAX_HEALTHY_QUERY_RETRIES: u8 = 5; @@ -364,11 +369,13 @@ pub async fn get_configs( /// else they will fail due to the amount of concurrent queries. #[cfg(test)] mod tests { - use super::*; + use std::str::FromStr; + use ibc_relayer::config::filter::ChannelPolicy; use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, PortId}; use serial_test::serial; - use std::str::FromStr; + + use super::*; // Use commit from 28.04.23 for tests const TEST_COMMIT: &str = "95b99457e828402bde994816ce57e548d7e1a76d"; diff --git a/crates/relayer-cli/src/cli_utils.rs b/crates/relayer-cli/src/cli_utils.rs index 733914fd06..5441bb1594 100644 --- a/crates/relayer-cli/src/cli_utils.rs +++ b/crates/relayer-cli/src/cli_utils.rs @@ -1,18 +1,23 @@ //! Various utilities for the Hermes CLI use alloc::sync::Arc; -use eyre::eyre; -use tokio::runtime::Runtime as TokioRuntime; -use tracing::debug; -use ibc_relayer::chain::counterparty::{channel_connection_client, ChannelConnectionClient}; -use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; -use ibc_relayer::chain::requests::{ - IncludeProof, QueryChannelRequest, QueryClientStateRequest, QueryConnectionRequest, QueryHeight, +use eyre::eyre; +use ibc_relayer::{ + chain::{ + counterparty::{channel_connection_client, ChannelConnectionClient}, + handle::{BaseChainHandle, ChainHandle}, + requests::{ + IncludeProof, QueryChannelRequest, QueryClientStateRequest, QueryConnectionRequest, + QueryHeight, + }, + }, + config::Config, + spawn, }; -use ibc_relayer::config::Config; -use ibc_relayer::spawn; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; +use tokio::runtime::Runtime as TokioRuntime; +use tracing::debug; use crate::error::Error; diff --git a/crates/relayer-cli/src/commands.rs b/crates/relayer-cli/src/commands.rs index e922061029..dda273f4c8 100644 --- a/crates/relayer-cli/src/commands.rs +++ b/crates/relayer-cli/src/commands.rs @@ -18,22 +18,22 @@ mod update; mod upgrade; mod version; +use core::time::Duration; +use std::path::PathBuf; + +use abscissa_core::{ + clap::Parser, config::Override, Command, Configurable, FrameworkError, Runnable, +}; +use ibc_relayer::config::{ChainConfig, Config}; +use tracing::{error, info}; + use self::{ clear::ClearCmds, completions::CompletionsCmd, config::ConfigCmd, create::CreateCmds, evidence::EvidenceCmd, fee::FeeCmd, health::HealthCheckCmd, keys::KeysCmd, listen::ListenCmd, logs::LogsCmd, misbehaviour::MisbehaviourCmd, query::QueryCmd, start::StartCmd, tx::TxCmd, update::UpdateCmds, upgrade::UpgradeCmds, version::VersionCmd, }; - -use core::time::Duration; -use std::path::PathBuf; - -use abscissa_core::clap::Parser; -use abscissa_core::{config::Override, Command, Configurable, FrameworkError, Runnable}; -use tracing::{error, info}; - use crate::DEFAULT_CONFIG_PATH; -use ibc_relayer::config::{ChainConfig, Config}; /// Default configuration file path pub fn default_config_file() -> Option { diff --git a/crates/relayer-cli/src/commands/clear.rs b/crates/relayer-cli/src/commands/clear.rs index 14868011a2..9b3b5c4438 100644 --- a/crates/relayer-cli/src/commands/clear.rs +++ b/crates/relayer-cli/src/commands/clear.rs @@ -1,19 +1,22 @@ use eyre::eyre; use std::ops::RangeInclusive; -use abscissa_core::clap::Parser; -use abscissa_core::config::Override; -use abscissa_core::{Command, FrameworkErrorKind, Runnable}; +use abscissa_core::{clap::Parser, config::Override, Command, FrameworkErrorKind, Runnable}; +use ibc_relayer::{ + chain::handle::{BaseChainHandle, ChainHandle}, + config::Config, + link::{error::LinkError, Link, LinkParameters}, + util::seq_range::parse_seq_range, +}; +use ibc_relayer_types::{ + core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }, + events::IbcEvent, +}; -use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; use ibc_relayer::chain::requests::{IncludeProof, QueryChannelRequest, QueryHeight}; -use ibc_relayer::config::Config; -use ibc_relayer::link::error::LinkError; -use ibc_relayer::link::{Link, LinkParameters}; -use ibc_relayer::util::seq_range::parse_seq_range; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use ibc_relayer_types::events::IbcEvent; use crate::application::app_config; use crate::cli_utils::spawn_chain_counterparty; @@ -265,13 +268,15 @@ where #[cfg(test)] mod tests { - use super::ClearPacketsCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; - use ibc_relayer_types::core::ics04_channel::packet::Sequence; - use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use ibc_relayer_types::core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }; + + use crate::commands::clear::ClearPacketsCmd; #[test] fn test_clear_packets_required_only() { diff --git a/crates/relayer-cli/src/commands/completions.rs b/crates/relayer-cli/src/commands/completions.rs index 5ed1696eea..4e1b30cd62 100644 --- a/crates/relayer-cli/src/commands/completions.rs +++ b/crates/relayer-cli/src/commands/completions.rs @@ -1,9 +1,10 @@ -use crate::entry::EntryPoint; -use abscissa_core::clap::Parser; -use abscissa_core::Runnable; +use std::io; + +use abscissa_core::{clap::Parser, Runnable}; use clap::IntoApp; use clap_complete::Shell; -use std::io; + +use crate::entry::EntryPoint; #[derive(Debug, Parser, PartialEq, Eq)] pub struct CompletionsCmd { @@ -26,11 +27,11 @@ impl Runnable for CompletionsCmd { #[cfg(test)] mod tests { - use super::CompletionsCmd; - use abscissa_core::clap::Parser; use clap_complete::Shell; + use super::CompletionsCmd; + #[test] fn test_completions() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/config.rs b/crates/relayer-cli/src/commands/config.rs index cbe73c9403..737b4e877b 100644 --- a/crates/relayer-cli/src/commands/config.rs +++ b/crates/relayer-cli/src/commands/config.rs @@ -1,7 +1,6 @@ //! `config` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; mod auto; mod validate; diff --git a/crates/relayer-cli/src/commands/config/auto.rs b/crates/relayer-cli/src/commands/config/auto.rs index dde3742428..35087246ca 100644 --- a/crates/relayer-cli/src/commands/config/auto.rs +++ b/crates/relayer-cli/src/commands/config/auto.rs @@ -1,16 +1,13 @@ -use crate::chain_registry::get_configs; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; -use itertools::Itertools; - -use crate::conclude::Output; +use std::{collections::HashSet, path::PathBuf}; +use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::config::{store, ChainConfig, Config}; -use std::collections::HashSet; -use std::path::PathBuf; +use itertools::Itertools; use tracing::{error, info, warn}; +use crate::{chain_registry::get_configs, conclude::Output}; + fn find_key(chain_config: &ChainConfig) -> Option { let keys = chain_config.list_keys().ok()?; keys.into_iter().next().map(|(name, _)| name) @@ -189,10 +186,12 @@ impl Runnable for AutoCmd { #[cfg(test)] mod tests { - use super::AutoCmd; - use abscissa_core::clap::Parser; use std::path::PathBuf; + use abscissa_core::clap::Parser; + + use super::AutoCmd; + #[test] fn auto_config_without_commit() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/config/validate.rs b/crates/relayer-cli/src/commands/config/validate.rs index 1be5e3f78c..cecad2fff5 100644 --- a/crates/relayer-cli/src/commands/config/validate.rs +++ b/crates/relayer-cli/src/commands/config/validate.rs @@ -1,10 +1,8 @@ use std::fs; -use abscissa_core::clap::Parser; +use abscissa_core::{clap::Parser, Command, Runnable}; -use crate::conclude::Output; -use crate::config; -use crate::prelude::*; +use crate::{conclude::Output, config, prelude::*}; /// In order to validate the configuration file the command will check that the file exists, /// that it is readable and not empty. It will then check the validity of the fields inside diff --git a/crates/relayer-cli/src/commands/create.rs b/crates/relayer-cli/src/commands/create.rs index 0bb2dd9e19..d1b0433f53 100644 --- a/crates/relayer-cli/src/commands/create.rs +++ b/crates/relayer-cli/src/commands/create.rs @@ -1,10 +1,10 @@ //! `create` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; -use crate::commands::create::channel::CreateChannelCommand; -use crate::commands::create::connection::CreateConnectionCommand; -use crate::commands::tx::client::TxCreateClientCmd; +use crate::commands::{ + create::{channel::CreateChannelCommand, connection::CreateConnectionCommand}, + tx::client::TxCreateClientCmd, +}; mod channel; mod connection; diff --git a/crates/relayer-cli/src/commands/create/channel.rs b/crates/relayer-cli/src/commands/create/channel.rs index 2295d09e6c..2763cbd2b3 100644 --- a/crates/relayer-cli/src/commands/create/channel.rs +++ b/crates/relayer-cli/src/commands/create/channel.rs @@ -1,24 +1,27 @@ -use abscissa_core::clap::Parser; - +use abscissa_core::{clap::Parser, Command, Runnable}; use console::style; use dialoguer::Confirm; +use ibc_relayer::{ + chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryClientStateRequest, QueryConnectionRequest, QueryHeight}, + }, + channel::Channel, + config::default::connection_delay, + connection::Connection, + foreign_client::ForeignClient, +}; +use ibc_relayer_types::core::{ + ics03_connection::connection::IdentifiedConnectionEnd, + ics04_channel::{channel::Ordering, version::Version}, + ics24_host::identifier::{ChainId, ConnectionId, PortId}, +}; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{ - IncludeProof, QueryClientStateRequest, QueryConnectionRequest, QueryHeight, +use crate::{ + cli_utils::{spawn_chain_runtime, ChainHandlePair}, + conclude::{exit_with_unrecoverable_error, Output}, + prelude::*, }; -use ibc_relayer::channel::Channel; -use ibc_relayer::config::default::connection_delay; -use ibc_relayer::connection::Connection; -use ibc_relayer::foreign_client::ForeignClient; -use ibc_relayer_types::core::ics03_connection::connection::IdentifiedConnectionEnd; -use ibc_relayer_types::core::ics04_channel::channel::Ordering; -use ibc_relayer_types::core::ics04_channel::version::Version; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ConnectionId, PortId}; - -use crate::cli_utils::{spawn_chain_runtime, ChainHandlePair}; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::prelude::*; static PROMPT: &str = "Are you sure you want a new connection & clients to be created? Hermes will use default security parameters."; static HINT: &str = "Consider using the default invocation\n\nhermes create channel --a-port --b-port --a-chain --a-connection \n\nto reuse a pre-existing connection."; @@ -270,12 +273,13 @@ impl CreateChannelCommand { mod tests { use std::str::FromStr; - use super::CreateChannelCommand; use abscissa_core::clap::Parser; + use ibc_relayer_types::core::{ + ics04_channel::{channel::Ordering, version::Version}, + ics24_host::identifier::{ChainId, ConnectionId, PortId}, + }; - use ibc_relayer_types::core::ics04_channel::channel::Ordering; - use ibc_relayer_types::core::ics04_channel::version::Version; - use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ConnectionId, PortId}; + use super::CreateChannelCommand; #[test] fn test_create_channel_a_conn_required() { diff --git a/crates/relayer-cli/src/commands/create/connection.rs b/crates/relayer-cli/src/commands/create/connection.rs index e6d5982c25..6b50b284e2 100644 --- a/crates/relayer-cli/src/commands/create/connection.rs +++ b/crates/relayer-cli/src/commands/create/connection.rs @@ -1,16 +1,21 @@ use core::time::Duration; -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{IncludeProof, QueryClientStateRequest, QueryHeight}; -use ibc_relayer::connection::Connection; -use ibc_relayer::foreign_client::ForeignClient; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{ + chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryClientStateRequest, QueryHeight}, + }, + connection::Connection, + foreign_client::ForeignClient, +}; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; -use crate::cli_utils::{spawn_chain_runtime, ChainHandlePair}; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::prelude::*; +use crate::{ + cli_utils::{spawn_chain_runtime, ChainHandlePair}, + conclude::{exit_with_unrecoverable_error, Output}, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] #[clap(override_usage("hermes create connection [OPTIONS] --a-chain --b-chain @@ -175,12 +180,12 @@ impl CreateConnectionCommand { #[cfg(test)] mod tests { - use super::CreateConnectionCommand; + use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; - use std::str::FromStr; + use super::CreateConnectionCommand; #[test] fn test_create_connection_b_chain() { diff --git a/crates/relayer-cli/src/commands/evidence.rs b/crates/relayer-cli/src/commands/evidence.rs index c034d7318e..f6b15c3bad 100644 --- a/crates/relayer-cli/src/commands/evidence.rs +++ b/crates/relayer-cli/src/commands/evidence.rs @@ -1,37 +1,48 @@ -use std::collections::HashMap; -use std::ops::{ControlFlow, Deref}; -use std::sync::Arc; -use std::thread::sleep; -use std::time::Duration; - -use abscissa_core::clap::Parser; -use ibc_relayer::config::{ChainConfig, Config}; -use tokio::runtime::Runtime as TokioRuntime; - -use tendermint::block::Height as TendermintHeight; -use tendermint::evidence::{DuplicateVoteEvidence, LightClientAttackEvidence}; -use tendermint::validator; +use std::{ + collections::HashMap, + ops::{ControlFlow, Deref}, + sync::Arc, + thread::sleep, + time::Duration, +}; + +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{ + chain::{ + cosmos::CosmosSdkChain, + endpoint::ChainEndpoint, + handle::{BaseChainHandle, ChainHandle}, + requests::{IncludeProof, PageRequest, QueryHeight}, + tracking::TrackedMsgs, + }, + config::{ChainConfig, Config}, + foreign_client::ForeignClient, + spawn::spawn_chain_runtime_with_modified_config, +}; +use ibc_relayer_types::{ + applications::ics28_ccv::msgs::{ + ccv_double_voting::MsgSubmitIcsConsumerDoubleVoting, + ccv_misbehaviour::MsgSubmitIcsConsumerMisbehaviour, + }, + clients::ics07_tendermint::{ + header::Header as TendermintHeader, misbehaviour::Misbehaviour as TendermintMisbehaviour, + }, + core::{ + ics02_client::{height::Height, msgs::misbehaviour::MsgSubmitMisbehaviour}, + ics24_host::identifier::{ChainId, ClientId}, + }, + events::IbcEvent, + tx_msg::Msg, +}; +use tendermint::{ + block::Height as TendermintHeight, + evidence::{DuplicateVoteEvidence, LightClientAttackEvidence}, + validator, +}; use tendermint_rpc::{Client, Paging}; +use tokio::runtime::Runtime as TokioRuntime; -use ibc_relayer::chain::cosmos::CosmosSdkChain; -use ibc_relayer::chain::endpoint::ChainEndpoint; -use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; -use ibc_relayer::chain::requests::{IncludeProof, PageRequest, QueryHeight}; -use ibc_relayer::chain::tracking::TrackedMsgs; -use ibc_relayer::foreign_client::ForeignClient; -use ibc_relayer::spawn::spawn_chain_runtime_with_modified_config; -use ibc_relayer_types::applications::ics28_ccv::msgs::ccv_double_voting::MsgSubmitIcsConsumerDoubleVoting; -use ibc_relayer_types::applications::ics28_ccv::msgs::ccv_misbehaviour::MsgSubmitIcsConsumerMisbehaviour; -use ibc_relayer_types::clients::ics07_tendermint::header::Header as TendermintHeader; -use ibc_relayer_types::clients::ics07_tendermint::misbehaviour::Misbehaviour as TendermintMisbehaviour; -use ibc_relayer_types::core::ics02_client::height::Height; -use ibc_relayer_types::core::ics02_client::msgs::misbehaviour::MsgSubmitMisbehaviour; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; -use ibc_relayer_types::events::IbcEvent; -use ibc_relayer_types::tx_msg::Msg; - -use crate::conclude::Output; -use crate::prelude::*; +use crate::{conclude::Output, prelude::*}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct EvidenceCmd { @@ -75,14 +86,6 @@ impl Runnable for EvidenceCmd { .exit() }); - if !matches!(chain_config, ChainConfig::CosmosSdk(_)) { - Output::error(format!( - "chain `{}` is not a Cosmos SDK chain", - self.chain_id - )) - .exit(); - } - if let Some(ref key_name) = self.key_name { chain_config.set_key_name(key_name.to_string()); } @@ -94,7 +97,16 @@ impl Runnable for EvidenceCmd { .unwrap(), ); - let chain = CosmosSdkChain::bootstrap(chain_config, rt.clone()).unwrap(); + let chain = match chain_config { + ChainConfig::Astria(_) => { + todo!("AstriaEndpoint::bootstrap"); + } + ChainConfig::CosmosSdk(ref _cfg) => { + CosmosSdkChain::bootstrap(chain_config, rt.clone()).unwrap() + } + ChainConfig::Penumbra(_) => todo!(), + }; + let res = monitor_misbehaviours( rt, &config, @@ -828,11 +840,11 @@ fn build_evidence_headers( #[cfg(test)] mod tests { - use super::EvidenceCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::EvidenceCmd; + #[test] fn test_misbehaviour() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/fee.rs b/crates/relayer-cli/src/commands/fee.rs index 0c8af55ed7..bc713c621b 100644 --- a/crates/relayer-cli/src/commands/fee.rs +++ b/crates/relayer-cli/src/commands/fee.rs @@ -1,12 +1,12 @@ //! `fee` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{config::Override, Command, Runnable}; +use abscissa_core::{clap::Parser, config::Override, Command, Runnable}; use ibc_relayer::config::Config; -use self::register_counterparty_payee::RegisterCounterpartyPayeeCmd; -use self::register_payee::RegisterPayeeCmd; -use self::transfer::FeeTransferCmd; +use self::{ + register_counterparty_payee::RegisterCounterpartyPayeeCmd, register_payee::RegisterPayeeCmd, + transfer::FeeTransferCmd, +}; pub mod register_counterparty_payee; pub mod register_payee; diff --git a/crates/relayer-cli/src/commands/fee/register_counterparty_payee.rs b/crates/relayer-cli/src/commands/fee/register_counterparty_payee.rs index de82f5a7ec..864f8a5f3d 100644 --- a/crates/relayer-cli/src/commands/fee/register_counterparty_payee.rs +++ b/crates/relayer-cli/src/commands/fee/register_counterparty_payee.rs @@ -1,16 +1,19 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; use core::str::FromStr; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::tracking::TrackedMsgs; -use ibc_relayer_types::applications::ics29_fee::msgs::register_payee::build_register_counterparty_payee_message; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use ibc_relayer_types::signer::Signer; -use crate::application::app_config; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{handle::ChainHandle, tracking::TrackedMsgs}; +use ibc_relayer_types::{ + applications::ics29_fee::msgs::register_payee::build_register_counterparty_payee_message, + core::ics24_host::identifier::{ChainId, ChannelId, PortId}, + signer::Signer, +}; + +use crate::{ + application::app_config, + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct RegisterCounterpartyPayeeCmd { @@ -104,13 +107,13 @@ fn run_register_counterparty_payee_command( #[cfg(test)] mod tests { - use super::RegisterCounterpartyPayeeCmd; - - use abscissa_core::clap::Parser; use std::str::FromStr; + use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::RegisterCounterpartyPayeeCmd; + #[test] fn test_register_counterparty_payee() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/fee/register_payee.rs b/crates/relayer-cli/src/commands/fee/register_payee.rs index 4c43917b4c..a8aa42df58 100644 --- a/crates/relayer-cli/src/commands/fee/register_payee.rs +++ b/crates/relayer-cli/src/commands/fee/register_payee.rs @@ -1,16 +1,19 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; use core::str::FromStr; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::tracking::TrackedMsgs; -use ibc_relayer_types::applications::ics29_fee::msgs::register_payee::build_register_payee_message; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use ibc_relayer_types::signer::Signer; -use crate::application::app_config; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{handle::ChainHandle, tracking::TrackedMsgs}; +use ibc_relayer_types::{ + applications::ics29_fee::msgs::register_payee::build_register_payee_message, + core::ics24_host::identifier::{ChainId, ChannelId, PortId}, + signer::Signer, +}; + +use crate::{ + application::app_config, + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct RegisterPayeeCmd { @@ -95,13 +98,13 @@ fn run_register_payee_command( #[cfg(test)] mod tests { - use super::RegisterPayeeCmd; - - use abscissa_core::clap::Parser; use std::str::FromStr; + use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::RegisterPayeeCmd; + #[test] fn test_regiser_payee() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/fee/transfer.rs b/crates/relayer-cli/src/commands/fee/transfer.rs index 2ea80d63b3..ea5d0523a7 100644 --- a/crates/relayer-cli/src/commands/fee/transfer.rs +++ b/crates/relayer-cli/src/commands/fee/transfer.rs @@ -2,7 +2,6 @@ use core::time::Duration; use abscissa_core::{clap::Parser, config::Override, FrameworkError, FrameworkErrorKind}; use eyre::eyre; - use ibc_relayer::{ chain::handle::ChainHandle, config::Config, @@ -303,16 +302,16 @@ fn fee_transfer(chains: ChainHandlePair, opts: FeeTransferOptions) -> Result<(), #[cfg(test)] mod tests { - use super::FeeTransferCmd; - - use abscissa_core::clap::Parser; use std::str::FromStr; + use abscissa_core::clap::Parser; use ibc_relayer_types::{ applications::transfer::Amount, core::ics24_host::identifier::{ChainId, ChannelId, PortId}, }; + use super::FeeTransferCmd; + #[test] fn test_fee_transfer_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/health.rs b/crates/relayer-cli/src/commands/health.rs index 6ecdd588dd..7a4758f051 100644 --- a/crates/relayer-cli/src/commands/health.rs +++ b/crates/relayer-cli/src/commands/health.rs @@ -1,11 +1,11 @@ -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::endpoint::HealthCheck::*; -use ibc_relayer::chain::handle::ChainHandle; - -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::prelude::*; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{endpoint::HealthCheck::*, handle::ChainHandle}; + +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser)] pub struct HealthCheckCmd {} diff --git a/crates/relayer-cli/src/commands/keys.rs b/crates/relayer-cli/src/commands/keys.rs index 42dee11ff4..4d1c3f0986 100644 --- a/crates/relayer-cli/src/commands/keys.rs +++ b/crates/relayer-cli/src/commands/keys.rs @@ -1,6 +1,5 @@ //! `keys` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; mod add; mod balance; diff --git a/crates/relayer-cli/src/commands/keys/add.rs b/crates/relayer-cli/src/commands/keys/add.rs index 470667cfe4..c11547fc01 100644 --- a/crates/relayer-cli/src/commands/keys/add.rs +++ b/crates/relayer-cli/src/commands/keys/add.rs @@ -4,22 +4,20 @@ use std::{ path::{Path, PathBuf}, }; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - +use abscissa_core::{clap::Parser, Command, Runnable}; use eyre::eyre; use hdpath::StandardHDPath; use ibc_relayer::{ config::{ChainConfig, Config}, keyring::{ - AnySigningKeyPair, KeyRing, Secp256k1KeyPair, SigningKeyPair, SigningKeyPairSized, Store, + AnySigningKeyPair, Ed25519KeyPair, KeyRing, Secp256k1KeyPair, SigningKeyPair, + SigningKeyPairSized, Store, }, }; use ibc_relayer_types::core::ics24_host::identifier::ChainId; use tracing::warn; -use crate::application::app_config; -use crate::conclude::Output; +use crate::{application::app_config, conclude::Output}; /// The data structure that represents the arguments when invoking the `keys add` CLI command. /// @@ -220,6 +218,23 @@ pub fn add_key( keyring.add_key(key_name, key_pair.clone())?; key_pair.into() } + ChainConfig::Astria(config) => { + let mut keyring = KeyRing::new_ed25519( + Store::Test, + &config.account_prefix, + &config.id, + &config.key_store_folder, + )?; + + check_key_exists(&keyring, key_name, overwrite); + + let key_contents = + fs::read_to_string(file).map_err(|_| eyre!("error reading the key file"))?; + let key_pair = Ed25519KeyPair::from_seed_file(&key_contents, hd_path)?; + + keyring.add_key(key_name, key_pair.clone())?; + key_pair.into() + } ChainConfig::Penumbra(_) => todo!(), }; @@ -257,6 +272,26 @@ pub fn restore_key( keyring.add_key(key_name, key_pair.clone())?; key_pair.into() } + ChainConfig::Astria(config) => { + let mut keyring = KeyRing::new_ed25519( + Store::Test, + &config.account_prefix, + &config.id, + &config.key_store_folder, + )?; + + check_key_exists(&keyring, key_name, overwrite); + + let key_pair = Ed25519KeyPair::from_mnemonic( + &mnemonic_content, + hdpath, + &config.address_type, + keyring.account_prefix(), + )?; + + keyring.add_key(key_name, key_pair.clone())?; + key_pair.into() + } ChainConfig::Penumbra(_) => todo!(), }; @@ -279,12 +314,13 @@ fn check_key_exists(keyring: &KeyRing, key_name: &str #[cfg(test)] mod tests { - use super::KeysAddCmd; use std::path::PathBuf; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::KeysAddCmd; + #[test] fn test_keys_add_key_file() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/keys/balance.rs b/crates/relayer-cli/src/commands/keys/balance.rs index d0e8611c67..8d59e35c7c 100644 --- a/crates/relayer-cli/src/commands/keys/balance.rs +++ b/crates/relayer-cli/src/commands/keys/balance.rs @@ -1,15 +1,14 @@ use std::fmt::Write; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::config::ChainConfig; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{chain::handle::ChainHandle, config::ChainConfig}; use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use crate::application::app_config; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, json, Output}; +use crate::{ + application::app_config, + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, json, Output}, +}; /// The data structure that represents the arguments when invoking the `keys balance` CLI command. /// @@ -78,6 +77,7 @@ fn get_balance(chain: impl ChainHandle, key_name: Option, denom: Option< let chain_config = chain.config().unwrap_or_else(exit_with_unrecoverable_error); match chain_config { ChainConfig::CosmosSdk(chain_config) => chain_config.key_name, + ChainConfig::Astria(chain_config) => chain_config.key_name, ChainConfig::Penumbra(_) => todo!(), } }); @@ -101,6 +101,7 @@ fn get_balances(chain: impl ChainHandle, key_name: Option) { let chain_config = chain.config().unwrap_or_else(exit_with_unrecoverable_error); match chain_config { ChainConfig::CosmosSdk(chain_config) => chain_config.key_name, + ChainConfig::Astria(chain_config) => chain_config.key_name, ChainConfig::Penumbra(_) => todo!(), } }); @@ -120,11 +121,11 @@ fn get_balances(chain: impl ChainHandle, key_name: Option) { #[cfg(test)] mod tests { - use super::KeyBalanceCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::KeyBalanceCmd; + #[test] fn test_keys_balance_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/keys/delete.rs b/crates/relayer-cli/src/commands/keys/delete.rs index 5104e8d639..2279264dbe 100644 --- a/crates/relayer-cli/src/commands/keys/delete.rs +++ b/crates/relayer-cli/src/commands/keys/delete.rs @@ -1,6 +1,4 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - +use abscissa_core::{clap::Parser, Command, Runnable}; use eyre::eyre; use ibc_relayer::{ config::{ChainConfig, Config}, @@ -8,8 +6,7 @@ use ibc_relayer::{ }; use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use crate::application::app_config; -use crate::conclude::Output; +use crate::{application::app_config, conclude::Output}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] #[clap( @@ -123,6 +120,15 @@ pub fn delete_key(config: &ChainConfig, key_name: &str) -> eyre::Result<()> { )?; keyring.remove_key(key_name)?; } + ChainConfig::Astria(config) => { + let mut keyring = KeyRing::new_ed25519( + Store::Test, + &config.account_prefix, + &config.id, + &config.key_store_folder, + )?; + keyring.remove_key(key_name)?; + } ChainConfig::Penumbra(_) => todo!(), } Ok(()) @@ -142,6 +148,18 @@ pub fn delete_all_keys(config: &ChainConfig) -> eyre::Result<()> { keyring.remove_key(&key_name)?; } } + ChainConfig::Astria(config) => { + let mut keyring = KeyRing::new_ed25519( + Store::Test, + &config.account_prefix, + &config.id, + &config.key_store_folder, + )?; + let keys = keyring.keys()?; + for (key_name, _) in keys { + keyring.remove_key(&key_name)?; + } + } ChainConfig::Penumbra(_) => todo!(), } Ok(()) @@ -149,11 +167,11 @@ pub fn delete_all_keys(config: &ChainConfig) -> eyre::Result<()> { #[cfg(test)] mod tests { - use super::KeysDeleteCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::KeysDeleteCmd; + #[test] fn test_keys_delete_key_name() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/keys/list.rs b/crates/relayer-cli/src/commands/keys/list.rs index cf3ec72651..ac6c202755 100644 --- a/crates/relayer-cli/src/commands/keys/list.rs +++ b/crates/relayer-cli/src/commands/keys/list.rs @@ -1,14 +1,15 @@ use alloc::collections::btree_map::BTreeMap as HashMap; use core::fmt::Write; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - -use crate::conclude::Output; -use crate::{application::app_config, conclude::json}; +use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::config::{ChainConfig, Config}; use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use crate::{ + application::app_config, + conclude::{json, Output}, +}; + #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct KeysListCmd { #[clap( @@ -66,11 +67,11 @@ pub struct KeysListOptions { #[cfg(test)] mod tests { - use super::KeysListCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::KeysListCmd; + #[test] fn test_keys_list() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/listen.rs b/crates/relayer-cli/src/commands/listen.rs index 77ec58937f..25bf9ff5af 100644 --- a/crates/relayer-cli/src/commands/listen.rs +++ b/crates/relayer-cli/src/commands/listen.rs @@ -5,14 +5,8 @@ use core::{ }; use std::thread; -use abscissa_core::application::fatal_error; -use abscissa_core::clap::Parser; +use abscissa_core::{application::fatal_error, clap::Parser, Runnable}; use eyre::eyre; -use itertools::Itertools; -use tendermint_rpc::{client::CompatMode, Client, HttpClient}; -use tokio::runtime::Runtime as TokioRuntime; -use tracing::{error, info, instrument}; - use ibc_relayer::{ chain::handle::Subscription, config::{ChainConfig, EventSourceMode}, @@ -21,6 +15,10 @@ use ibc_relayer::{ util::compat_mode::compat_mode_from_version, }; use ibc_relayer_types::{core::ics24_host::identifier::ChainId, events::IbcEvent}; +use itertools::Itertools; +use tendermint_rpc::{client::CompatMode, Client, HttpClient}; +use tokio::runtime::Runtime as TokioRuntime; +use tracing::{error, info, instrument}; use crate::prelude::*; @@ -148,7 +146,7 @@ fn subscribe( // Q: Should this be restricted only to backends that support it, // or are all backends expected to support subscriptions? match chain_config { - ChainConfig::CosmosSdk(config) => { + ChainConfig::CosmosSdk(config) | ChainConfig::Astria(config) => { let (event_source, monitor_tx) = match &config.event_source { EventSourceMode::Push { url, batch_delay } => EventSource::websocket( chain_config.id().clone(), @@ -189,10 +187,14 @@ fn subscribe( *batch_delay, rt, ), - EventSourceMode::Pull { interval } => EventSource::rpc( + EventSourceMode::Pull { + interval, + max_retries, + } => EventSource::rpc( chain_config.id().clone(), HttpClient::new(config.rpc_addr.clone())?, *interval, + *max_retries, rt, ), }?; @@ -212,6 +214,7 @@ fn detect_compatibility_mode( // TODO(erwan): move this to the cosmos sdk endpoint implementation let rpc_addr = match config { ChainConfig::CosmosSdk(config) => config.rpc_addr.clone(), + ChainConfig::Astria(config) => config.rpc_addr.clone(), ChainConfig::Penumbra(config) => config.rpc_addr.clone(), }; let client = HttpClient::new(rpc_addr)?; @@ -220,6 +223,9 @@ fn detect_compatibility_mode( ChainConfig::CosmosSdk(config) => { compat_mode_from_version(&config.compat_mode, status.node_info.version)?.into() } + ChainConfig::Astria(config) => { + compat_mode_from_version(&config.compat_mode, status.node_info.version)?.into() + } ChainConfig::Penumbra(config) => { compat_mode_from_version(&config.compat_mode, status.node_info.version)?.into() } @@ -229,13 +235,13 @@ fn detect_compatibility_mode( #[cfg(test)] mod tests { - use super::{EventFilter, ListenCmd}; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::{EventFilter, ListenCmd}; + #[test] fn test_listen_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/logs.rs b/crates/relayer-cli/src/commands/logs.rs index 2a55b2a8f1..46f5e8f1ec 100644 --- a/crates/relayer-cli/src/commands/logs.rs +++ b/crates/relayer-cli/src/commands/logs.rs @@ -1,6 +1,4 @@ -use abscissa_core::clap::Parser; -use abscissa_core::Command; -use abscissa_core::Runnable; +use abscissa_core::{clap::Parser, Command, Runnable}; pub mod log_level; pub mod raw; diff --git a/crates/relayer-cli/src/commands/logs/log_level.rs b/crates/relayer-cli/src/commands/logs/log_level.rs index 51d349bfd1..58b115488a 100644 --- a/crates/relayer-cli/src/commands/logs/log_level.rs +++ b/crates/relayer-cli/src/commands/logs/log_level.rs @@ -1,11 +1,7 @@ -use abscissa_core::clap::Parser; -use abscissa_core::Command; -use abscissa_core::Runnable; -use tracing::info; -use tracing::Level; - -use crate::prelude::app_config; -use crate::tracing_handle::send_command; +use abscissa_core::{clap::Parser, Command, Runnable}; +use tracing::{info, Level}; + +use crate::{prelude::app_config, tracing_handle::send_command}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct SetLogLevelCmd { diff --git a/crates/relayer-cli/src/commands/logs/raw.rs b/crates/relayer-cli/src/commands/logs/raw.rs index 6c680e0c9b..82316d0e4e 100644 --- a/crates/relayer-cli/src/commands/logs/raw.rs +++ b/crates/relayer-cli/src/commands/logs/raw.rs @@ -1,11 +1,7 @@ -use abscissa_core::clap::Parser; -use abscissa_core::Command; -use abscissa_core::Runnable; -use tracing::error; -use tracing::info; - -use crate::prelude::app_config; -use crate::tracing_handle::send_command; +use abscissa_core::{clap::Parser, Command, Runnable}; +use tracing::{error, info}; + +use crate::{prelude::app_config, tracing_handle::send_command}; // TODO `hermes set-raw-filter` #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] diff --git a/crates/relayer-cli/src/commands/logs/reset.rs b/crates/relayer-cli/src/commands/logs/reset.rs index f9165b9da1..901d9c6ba9 100644 --- a/crates/relayer-cli/src/commands/logs/reset.rs +++ b/crates/relayer-cli/src/commands/logs/reset.rs @@ -1,9 +1,6 @@ -use abscissa_core::clap::Parser; -use abscissa_core::Command; +use abscissa_core::{clap::Parser, Command, Runnable}; -use crate::components::default_directive; -use crate::prelude::*; -use crate::tracing_handle::send_command; +use crate::{components::default_directive, prelude::*, tracing_handle::send_command}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct ResetCmd {} diff --git a/crates/relayer-cli/src/commands/misbehaviour.rs b/crates/relayer-cli/src/commands/misbehaviour.rs index a231c7c1bc..63fc55c66c 100644 --- a/crates/relayer-cli/src/commands/misbehaviour.rs +++ b/crates/relayer-cli/src/commands/misbehaviour.rs @@ -1,20 +1,29 @@ -use abscissa_core::clap::Parser; -use abscissa_core::Command; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{IncludeProof, QueryClientStateRequest, QueryHeight}; -use ibc_relayer::config::Config; -use ibc_relayer::foreign_client::{ForeignClient, MisbehaviourResults}; -use ibc_relayer::util::pretty::PrettySlice; -use ibc_relayer_types::core::ics02_client::events::UpdateClient; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; -use ibc_relayer_types::events::IbcEvent; use std::ops::Deref; -use crate::cli_utils::{spawn_chain_runtime, spawn_chain_runtime_generic}; -use crate::conclude::Output; -use crate::prelude::*; +use abscissa_core::{clap::Parser, Command, Runnable}; use eyre::eyre; -use ibc_relayer_types::core::ics02_client::client_state::ClientState; +use ibc_relayer::{ + chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryClientStateRequest, QueryHeight}, + }, + config::Config, + foreign_client::{ForeignClient, MisbehaviourResults}, + util::pretty::PrettySlice, +}; +use ibc_relayer_types::{ + core::{ + ics02_client::{client_state::ClientState, events::UpdateClient}, + ics24_host::identifier::{ChainId, ClientId}, + }, + events::IbcEvent, +}; + +use crate::{ + cli_utils::{spawn_chain_runtime, spawn_chain_runtime_generic}, + conclude::Output, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct MisbehaviourCmd { @@ -155,13 +164,13 @@ fn misbehaviour_handling( #[cfg(test)] mod tests { - use super::MisbehaviourCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; + use super::MisbehaviourCmd; + #[test] fn test_misbehaviour() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query.rs b/crates/relayer-cli/src/commands/query.rs index e154f6a98c..3dd73168a2 100644 --- a/crates/relayer-cli/src/commands/query.rs +++ b/crates/relayer-cli/src/commands/query.rs @@ -1,12 +1,11 @@ //! `query` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; -use crate::commands::query::channel_client::QueryChannelClientCmd; -use crate::commands::query::channel_ends::QueryChannelEndsCmd; -use crate::commands::query::channels::QueryChannelsCmd; -use crate::commands::query::packet::QueryPacketCmds; +use crate::commands::query::{ + channel_client::QueryChannelClientCmd, channel_ends::QueryChannelEndsCmd, + channels::QueryChannelsCmd, packet::QueryPacketCmds, +}; mod channel; mod channel_client; diff --git a/crates/relayer-cli/src/commands/query/channel.rs b/crates/relayer-cli/src/commands/query/channel.rs index 14b402d3dc..2502983d20 100644 --- a/crates/relayer-cli/src/commands/query/channel.rs +++ b/crates/relayer-cli/src/commands/query/channel.rs @@ -1,15 +1,21 @@ -use abscissa_core::clap::Parser; -use ibc_relayer::chain::handle::ChainHandle; - -use ibc_relayer::chain::requests::{IncludeProof, QueryChannelRequest, QueryHeight}; -use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, PortId}; - -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::prelude::*; -use ibc_relayer_types::core::ics04_channel::channel::State; -use ibc_relayer_types::Height; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryChannelRequest, QueryHeight}, +}; +use ibc_relayer_types::{ + core::{ + ics04_channel::channel::State, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }, + Height, +}; + +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryChannelEndCmd { @@ -88,13 +94,13 @@ impl Runnable for QueryChannelEndCmd { #[cfg(test)] mod tests { - use super::QueryChannelEndCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryChannelEndCmd; + #[test] fn test_query_channel_end_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/channel_client.rs b/crates/relayer-cli/src/commands/query/channel_client.rs index 4824aa53a1..e8a2ae0cca 100644 --- a/crates/relayer-cli/src/commands/query/channel_client.rs +++ b/crates/relayer-cli/src/commands/query/channel_client.rs @@ -1,13 +1,12 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::QueryChannelClientStateRequest; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{handle::ChainHandle, requests::QueryChannelClientStateRequest}; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use crate::application::app_config; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::{ + application::app_config, + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, +}; /// The data structure that represents the arguments when invoking the `query channel client` CLI command. /// @@ -64,13 +63,13 @@ impl Runnable for QueryChannelClientCmd { #[cfg(test)] mod tests { - use super::QueryChannelClientCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryChannelClientCmd; + #[test] fn test_query_channel_client() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/channel_ends.rs b/crates/relayer-cli/src/commands/query/channel_ends.rs index bc316865ab..0f372ab8d3 100644 --- a/crates/relayer-cli/src/commands/query/channel_ends.rs +++ b/crates/relayer-cli/src/commands/query/channel_ends.rs @@ -1,21 +1,30 @@ -use abscissa_core::clap::Parser; -use serde::{Deserialize, Serialize}; - +use abscissa_core::{clap::Parser, Command, Runnable}; use eyre::eyre; -use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; -use ibc_relayer::chain::requests::{ - IncludeProof, QueryChannelRequest, QueryClientStateRequest, QueryConnectionRequest, QueryHeight, +use ibc_relayer::{ + chain::{ + handle::{BaseChainHandle, ChainHandle}, + requests::{ + IncludeProof, QueryChannelRequest, QueryClientStateRequest, QueryConnectionRequest, + QueryHeight, + }, + }, + client_state::AnyClientState, + registry::Registry, }; -use ibc_relayer::client_state::AnyClientState; -use ibc_relayer::registry::Registry; -use ibc_relayer_types::core::ics03_connection::connection::ConnectionEnd; -use ibc_relayer_types::core::ics04_channel::channel::{ChannelEnd, State}; -use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use ibc_relayer_types::core::ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}; -use ibc_relayer_types::Height; +use ibc_relayer_types::{ + core::{ + ics03_connection::connection::ConnectionEnd, + ics04_channel::channel::{ChannelEnd, State}, + ics24_host::identifier::{ChainId, ChannelId, ClientId, ConnectionId, PortId}, + }, + Height, +}; +use serde::{Deserialize, Serialize}; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::prelude::*; +use crate::{ + conclude::{exit_with_unrecoverable_error, Output}, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryChannelEndsCmd { @@ -253,13 +262,13 @@ impl Runnable for QueryChannelEndsCmd { #[cfg(test)] mod tests { - use super::QueryChannelEndsCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryChannelEndsCmd; + #[test] fn test_query_channel_ends_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/channels.rs b/crates/relayer-cli/src/commands/query/channels.rs index 88d85fe103..97b2e4075f 100644 --- a/crates/relayer-cli/src/commands/query/channels.rs +++ b/crates/relayer-cli/src/commands/query/channels.rs @@ -1,23 +1,24 @@ use core::fmt::{Debug, Error, Formatter}; -use abscissa_core::clap::Parser; -use serde::Serialize; - +use abscissa_core::{clap::Parser, Runnable}; use eyre::eyre; -use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; -use ibc_relayer::chain::requests::{ - IncludeProof, PageRequest, QueryChannelRequest, QueryChannelsRequest, QueryClientStateRequest, - QueryConnectionRequest, QueryHeight, +use ibc_relayer::{ + chain::{ + handle::{BaseChainHandle, ChainHandle}, + requests::{ + IncludeProof, PageRequest, QueryChannelRequest, QueryChannelsRequest, + QueryClientStateRequest, QueryConnectionRequest, QueryHeight, + }, + }, + registry::Registry, }; -use ibc_relayer::registry::Registry; -use ibc_relayer_types::core::ics04_channel::channel::{ChannelEnd, State}; -use ibc_relayer_types::core::ics24_host::identifier::{ - ChainId, ChannelId, ConnectionId, PortChannelId, PortId, +use ibc_relayer_types::core::{ + ics04_channel::channel::{ChannelEnd, State}, + ics24_host::identifier::{ChainId, ChannelId, ConnectionId, PortChannelId, PortId}, }; +use serde::Serialize; -use crate::commands::query::channel_ends::ChannelEnds; -use crate::conclude::Output; -use crate::prelude::*; +use crate::{commands::query::channel_ends::ChannelEnds, conclude::Output, prelude::*}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryChannelsCmd { @@ -382,11 +383,11 @@ impl Debug for QueryChannelsOutput { #[cfg(test)] mod tests { - use super::QueryChannelsCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::QueryChannelsCmd; + #[test] fn test_query_channels_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/client.rs b/crates/relayer-cli/src/commands/query/client.rs index 30c0ba0cfc..8a2beda9cd 100644 --- a/crates/relayer-cli/src/commands/query/client.rs +++ b/crates/relayer-cli/src/commands/query/client.rs @@ -1,22 +1,26 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{ - IncludeProof, PageRequest, QueryClientConnectionsRequest, QueryClientEventRequest, - QueryClientStateRequest, QueryConsensusStateHeightsRequest, QueryConsensusStateRequest, - QueryHeight, QueryTxRequest, +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{ + IncludeProof, PageRequest, QueryClientConnectionsRequest, QueryClientEventRequest, + QueryClientStateRequest, QueryConsensusStateHeightsRequest, QueryConsensusStateRequest, + QueryHeight, QueryTxRequest, + }, +}; +use ibc_relayer_types::{ + core::{ + ics02_client::client_state::ClientState, + ics24_host::identifier::{ChainId, ClientId}, + }, + events::WithBlockDataType, + Height, }; -use ibc_relayer_types::core::ics02_client::client_state::ClientState; -use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use ibc_relayer_types::core::ics24_host::identifier::ClientId; -use ibc_relayer_types::events::WithBlockDataType; -use ibc_relayer_types::Height; - -use crate::application::app_config; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; +use crate::{ + application::app_config, + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, +}; /// Query client state command #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] @@ -392,16 +396,16 @@ impl Runnable for QueryClientConnectionsCmd { #[cfg(test)] mod tests { - use super::{ - QueryClientConnectionsCmd, QueryClientConsensusCmd, QueryClientHeaderCmd, - QueryClientStateCmd, QueryClientStatusCmd, - }; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; + use super::{ + QueryClientConnectionsCmd, QueryClientConsensusCmd, QueryClientHeaderCmd, + QueryClientStateCmd, QueryClientStatusCmd, + }; + #[test] fn test_query_client_connections_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/clients.rs b/crates/relayer-cli/src/commands/query/clients.rs index e852636801..242b12213f 100644 --- a/crates/relayer-cli/src/commands/query/clients.rs +++ b/crates/relayer-cli/src/commands/query/clients.rs @@ -1,14 +1,17 @@ -use abscissa_core::clap::Parser; -use ibc_relayer::chain::handle::ChainHandle; -use serde::Serialize; - -use ibc_relayer::chain::requests::{PageRequest, QueryClientStatesRequest}; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{PageRequest, QueryClientStatesRequest}, +}; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; +use serde::Serialize; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::*; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::*, +}; /// Query clients command #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] @@ -108,11 +111,11 @@ impl Runnable for QueryAllClientsCmd { #[cfg(test)] mod tests { - use super::QueryAllClientsCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::QueryAllClientsCmd; + #[test] fn test_query_clients_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/connection.rs b/crates/relayer-cli/src/commands/query/connection.rs index 0dbf675bb7..10c27d61d3 100644 --- a/crates/relayer-cli/src/commands/query/connection.rs +++ b/crates/relayer-cli/src/commands/query/connection.rs @@ -1,20 +1,25 @@ -use abscissa_core::clap::Parser; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{ - IncludeProof, PageRequest, QueryConnectionChannelsRequest, QueryConnectionRequest, QueryHeight, +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{ + IncludeProof, PageRequest, QueryConnectionChannelsRequest, QueryConnectionRequest, + QueryHeight, + }, }; - -use ibc_relayer_types::core::{ - ics03_connection::connection::State, - ics24_host::identifier::ConnectionId, - ics24_host::identifier::{ChainId, PortChannelId}, +use ibc_relayer_types::{ + core::{ + ics03_connection::connection::State, + ics24_host::identifier::{ChainId, ConnectionId, PortChannelId}, + }, + Height, }; -use ibc_relayer_types::Height; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::*; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryConnectionEndCmd { @@ -139,13 +144,13 @@ impl Runnable for QueryConnectionChannelsCmd { #[cfg(test)] mod tests { - use super::{QueryConnectionChannelsCmd, QueryConnectionEndCmd}; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ConnectionId}; + use super::{QueryConnectionChannelsCmd, QueryConnectionEndCmd}; + #[test] fn test_query_connection_channels() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/connections.rs b/crates/relayer-cli/src/commands/query/connections.rs index 69aa86526a..63bf6cc94b 100644 --- a/crates/relayer-cli/src/commands/query/connections.rs +++ b/crates/relayer-cli/src/commands/query/connections.rs @@ -1,14 +1,17 @@ -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{ - IncludeProof, PageRequest, QueryClientStateRequest, QueryConnectionsRequest, QueryHeight, +use abscissa_core::{clap::Parser, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{ + IncludeProof, PageRequest, QueryClientStateRequest, QueryConnectionsRequest, QueryHeight, + }, }; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ConnectionId}; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::prelude::*; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryConnectionsCmd { @@ -98,11 +101,11 @@ impl Runnable for QueryConnectionsCmd { #[cfg(test)] mod tests { - use super::QueryConnectionsCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::QueryConnectionsCmd; + #[test] fn test_query_connections_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet.rs b/crates/relayer-cli/src/commands/query/packet.rs index b4bdbd4331..0920605ce3 100644 --- a/crates/relayer-cli/src/commands/query/packet.rs +++ b/crates/relayer-cli/src/commands/query/packet.rs @@ -1,5 +1,4 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; mod ack; mod acks; diff --git a/crates/relayer-cli/src/commands/query/packet/ack.rs b/crates/relayer-cli/src/commands/query/packet/ack.rs index 86fbb65361..7353acd594 100644 --- a/crates/relayer-cli/src/commands/query/packet/ack.rs +++ b/crates/relayer-cli/src/commands/query/packet/ack.rs @@ -1,16 +1,23 @@ -use abscissa_core::clap::Parser; -use ibc_relayer::chain::requests::{IncludeProof, QueryHeight, QueryPacketAcknowledgementRequest}; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryHeight, QueryPacketAcknowledgementRequest}, +}; +use ibc_relayer_types::{ + core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }, + Height, +}; use subtle_encoding::{Encoding, Hex}; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use ibc_relayer_types::Height; - -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::*; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryPacketAcknowledgmentCmd { @@ -101,13 +108,15 @@ impl Runnable for QueryPacketAcknowledgmentCmd { #[cfg(test)] mod tests { - use super::QueryPacketAcknowledgmentCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; - use ibc_relayer_types::core::ics04_channel::packet::Sequence; - use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use ibc_relayer_types::core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }; + + use super::QueryPacketAcknowledgmentCmd; #[test] fn test_query_packet_ack_required_only() { diff --git a/crates/relayer-cli/src/commands/query/packet/acks.rs b/crates/relayer-cli/src/commands/query/packet/acks.rs index 9d7a0c4f2e..afa493321b 100644 --- a/crates/relayer-cli/src/commands/query/packet/acks.rs +++ b/crates/relayer-cli/src/commands/query/packet/acks.rs @@ -1,15 +1,9 @@ -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::counterparty::acknowledgements_on_chain; -use ibc_relayer::chain::handle::BaseChainHandle; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{counterparty::acknowledgements_on_chain, handle::BaseChainHandle}; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use crate::cli_utils::spawn_chain_counterparty; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; - use super::util::PacketSeqs; +use crate::{cli_utils::spawn_chain_counterparty, conclude::Output, error::Error, prelude::*}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryPacketAcknowledgementsCmd { @@ -80,13 +74,13 @@ impl Runnable for QueryPacketAcknowledgementsCmd { #[cfg(test)] mod tests { - use super::QueryPacketAcknowledgementsCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryPacketAcknowledgementsCmd; + #[test] fn test_query_packet_acks() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet/commitment.rs b/crates/relayer-cli/src/commands/query/packet/commitment.rs index 4c4edd911b..6a9777322b 100644 --- a/crates/relayer-cli/src/commands/query/packet/commitment.rs +++ b/crates/relayer-cli/src/commands/query/packet/commitment.rs @@ -1,16 +1,23 @@ -use abscissa_core::clap::Parser; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryHeight, QueryPacketCommitmentRequest}, +}; +use ibc_relayer_types::{ + core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }, + Height, +}; use subtle_encoding::{Encoding, Hex}; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{IncludeProof, QueryHeight, QueryPacketCommitmentRequest}; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use ibc_relayer_types::Height; - -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::*; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryPacketCommitmentCmd { @@ -104,8 +111,6 @@ impl Runnable for QueryPacketCommitmentCmd { #[cfg(test)] mod tests { - use super::QueryPacketCommitmentCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; @@ -114,6 +119,8 @@ mod tests { ics24_host::identifier::{ChainId, ChannelId, PortId}, }; + use super::QueryPacketCommitmentCmd; + #[test] fn test_query_packet_commitment_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet/commitments.rs b/crates/relayer-cli/src/commands/query/packet/commitments.rs index 4ab40143da..648770e762 100644 --- a/crates/relayer-cli/src/commands/query/packet/commitments.rs +++ b/crates/relayer-cli/src/commands/query/packet/commitments.rs @@ -1,14 +1,9 @@ -use abscissa_core::clap::Parser; - +use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::chain::counterparty::commitments_on_chain; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; - use super::util::PacketSeqs; +use crate::{cli_utils::spawn_chain_runtime, conclude::Output, error::Error, prelude::*}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct QueryPacketCommitmentsCmd { @@ -71,13 +66,13 @@ impl Runnable for QueryPacketCommitmentsCmd { #[cfg(test)] mod tests { - use super::QueryPacketCommitmentsCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryPacketCommitmentsCmd; + #[test] fn test_query_packet_commitments() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet/pending.rs b/crates/relayer-cli/src/commands/query/packet/pending.rs index 188379969b..ed6a679e04 100644 --- a/crates/relayer-cli/src/commands/query/packet/pending.rs +++ b/crates/relayer-cli/src/commands/query/packet/pending.rs @@ -1,20 +1,15 @@ use core::fmt; -use abscissa_core::clap::Parser; -use serde::Serialize; - -use ibc_relayer::chain::counterparty::{ - channel_on_destination, pending_packet_summary, PendingPackets, +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + counterparty::{channel_on_destination, pending_packet_summary, PendingPackets}, + handle::{BaseChainHandle, ChainHandle}, }; -use ibc_relayer::chain::handle::{BaseChainHandle, ChainHandle}; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; - -use crate::cli_utils::spawn_chain_counterparty; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; +use serde::Serialize; use super::util::CollatedPendingPackets; +use crate::{cli_utils::spawn_chain_counterparty, conclude::Output, error::Error, prelude::*}; /// A structure to display pending packet commitment sequence IDs /// at both ends of a channel. @@ -167,13 +162,13 @@ impl Runnable for QueryPendingPacketsCmd { #[cfg(test)] mod tests { - use super::QueryPendingPacketsCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryPendingPacketsCmd; + #[test] fn test_query_packet_pending() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet/pending_acks.rs b/crates/relayer-cli/src/commands/query/packet/pending_acks.rs index d946a32422..aef53a7511 100644 --- a/crates/relayer-cli/src/commands/query/packet/pending_acks.rs +++ b/crates/relayer-cli/src/commands/query/packet/pending_acks.rs @@ -1,16 +1,15 @@ -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::counterparty::unreceived_acknowledgements; -use ibc_relayer::chain::handle::BaseChainHandle; -use ibc_relayer::path::PathIdentifiers; -use ibc_relayer::util::collate::CollatedIterExt; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; - -use crate::cli_utils::spawn_chain_counterparty; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{ + chain::{counterparty::unreceived_acknowledgements, handle::BaseChainHandle}, + path::PathIdentifiers, + util::collate::CollatedIterExt, +}; +use ibc_relayer_types::core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, +}; + +use crate::{cli_utils::spawn_chain_counterparty, conclude::Output, error::Error, prelude::*}; /// This command does the following: /// 1. queries the chain to get its counterparty, channel and port identifiers (needed in 2) @@ -89,13 +88,13 @@ impl Runnable for QueryPendingAcksCmd { #[cfg(test)] mod tests { - use super::QueryPendingAcksCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryPendingAcksCmd; + #[test] fn test_query_packet_unreceived_acks() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet/pending_sends.rs b/crates/relayer-cli/src/commands/query/packet/pending_sends.rs index c83576f7da..4cbbc81179 100644 --- a/crates/relayer-cli/src/commands/query/packet/pending_sends.rs +++ b/crates/relayer-cli/src/commands/query/packet/pending_sends.rs @@ -1,16 +1,15 @@ -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::counterparty::unreceived_packets; -use ibc_relayer::chain::handle::BaseChainHandle; -use ibc_relayer::path::PathIdentifiers; -use ibc_relayer::util::collate::CollatedIterExt; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; - -use crate::cli_utils::spawn_chain_counterparty; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{ + chain::{counterparty::unreceived_packets, handle::BaseChainHandle}, + path::PathIdentifiers, + util::collate::CollatedIterExt, +}; +use ibc_relayer_types::core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, +}; + +use crate::{cli_utils::spawn_chain_counterparty, conclude::Output, error::Error, prelude::*}; /// This command does the following: /// 1. queries the chain to get its counterparty chain, channel and port identifiers (needed in 2) @@ -88,13 +87,13 @@ impl Runnable for QueryPendingSendsCmd { #[cfg(test)] mod tests { - use super::QueryPendingSendsCmd; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::QueryPendingSendsCmd; + #[test] fn test_query_packet_unreceived_packets() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/packet/util.rs b/crates/relayer-cli/src/commands/query/packet/util.rs index 781bb96552..b7068cf344 100644 --- a/crates/relayer-cli/src/commands/query/packet/util.rs +++ b/crates/relayer-cli/src/commands/query/packet/util.rs @@ -1,12 +1,9 @@ use core::fmt; -use serde::Serialize; - -use ibc_relayer::util::collate::{Collated, CollatedIterExt}; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::Height; - pub use ibc_relayer::chain::counterparty::PendingPackets; +use ibc_relayer::util::collate::{Collated, CollatedIterExt}; +use ibc_relayer_types::{core::ics04_channel::packet::Sequence, Height}; +use serde::Serialize; #[derive(Serialize)] pub struct CollatedPendingPackets { diff --git a/crates/relayer-cli/src/commands/query/transfer.rs b/crates/relayer-cli/src/commands/query/transfer.rs index 1c59cccb5a..d1ec140a61 100644 --- a/crates/relayer-cli/src/commands/query/transfer.rs +++ b/crates/relayer-cli/src/commands/query/transfer.rs @@ -1,7 +1,6 @@ //! `query transfer` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; mod denom_trace; diff --git a/crates/relayer-cli/src/commands/query/transfer/denom_trace.rs b/crates/relayer-cli/src/commands/query/transfer/denom_trace.rs index 3ce25c0658..dcffce2657 100644 --- a/crates/relayer-cli/src/commands/query/transfer/denom_trace.rs +++ b/crates/relayer-cli/src/commands/query/transfer/denom_trace.rs @@ -1,12 +1,12 @@ -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - +use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::chain::handle::ChainHandle; use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use crate::application::app_config; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, json, Output}; +use crate::{ + application::app_config, + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, json, Output}, +}; /// The data structure that represents the arguments when invoking the `query transfer denom-trace` CLI command. /// @@ -58,11 +58,11 @@ impl Runnable for DenomTraceCmd { #[cfg(test)] mod tests { - use super::DenomTraceCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::DenomTraceCmd; + #[test] fn test_transfer_denom_trace() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/query/tx.rs b/crates/relayer-cli/src/commands/query/tx.rs index 0a7849ed0e..4d06b38256 100644 --- a/crates/relayer-cli/src/commands/query/tx.rs +++ b/crates/relayer-cli/src/commands/query/tx.rs @@ -1,7 +1,6 @@ //! `query tx` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; mod events; diff --git a/crates/relayer-cli/src/commands/query/tx/events.rs b/crates/relayer-cli/src/commands/query/tx/events.rs index 0cd1a878cf..cd77ab0d04 100644 --- a/crates/relayer-cli/src/commands/query/tx/events.rs +++ b/crates/relayer-cli/src/commands/query/tx/events.rs @@ -1,19 +1,19 @@ use core::str::FromStr; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - -use tendermint::Hash; - +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::chain::{ + handle::ChainHandle, + requests::{QueryTxHash, QueryTxRequest}, +}; use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use tendermint::Hash; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{QueryTxHash, QueryTxRequest}; - -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::app_config; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::app_config, +}; /// Query the events emitted by transaction #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] @@ -62,11 +62,11 @@ impl Runnable for QueryTxEventsCmd { #[cfg(test)] mod tests { - use super::QueryTxEventsCmd; - use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::ChainId; + use super::QueryTxEventsCmd; + #[test] fn test_query_tx_events() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/start.rs b/crates/relayer-cli/src/commands/start.rs index a102e66c0c..6ca38f9df7 100644 --- a/crates/relayer-cli/src/commands/start.rs +++ b/crates/relayer-cli/src/commands/start.rs @@ -1,20 +1,20 @@ -use ibc_relayer::supervisor::SupervisorOptions; -use ibc_relayer::util::debug_section::DebugSection; -use std::error::Error; -use std::io; +use std::{error::Error, io}; -use abscissa_core::clap::Parser; +use abscissa_core::{clap::Parser, Command, Runnable}; use crossbeam_channel::Sender; - -use ibc_relayer::chain::handle::{CachingChainHandle, ChainHandle}; -use ibc_relayer::config::Config; -use ibc_relayer::registry::SharedRegistry; -use ibc_relayer::rest; -use ibc_relayer::supervisor::{cmd::SupervisorCmd, spawn_supervisor, SupervisorHandle}; - -use crate::conclude::json; -use crate::conclude::Output; -use crate::prelude::*; +use ibc_relayer::{ + chain::handle::{CachingChainHandle, ChainHandle}, + config::Config, + registry::SharedRegistry, + rest, + supervisor::{cmd::SupervisorCmd, spawn_supervisor, SupervisorHandle, SupervisorOptions}, + util::debug_section::DebugSection, +}; + +use crate::{ + conclude::{json, Output}, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct StartCmd { @@ -30,8 +30,7 @@ impl Runnable for StartCmd { let app = app_reader(); if app.debug_enabled(DebugSection::ProfilingJson) { - use std::env; - use std::path::Path; + use std::{env, path::Path}; use ibc_relayer::util::profiling::open_or_create_profile_file; @@ -245,10 +244,10 @@ fn make_supervisor( #[cfg(test)] mod tests { - use super::StartCmd; - use abscissa_core::clap::Parser; + use super::StartCmd; + #[test] fn test_start_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/tx.rs b/crates/relayer-cli/src/commands/tx.rs index f8cadf766b..0908cfb837 100644 --- a/crates/relayer-cli/src/commands/tx.rs +++ b/crates/relayer-cli/src/commands/tx.rs @@ -1,6 +1,5 @@ //! `tx` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{config::Override, Command, Runnable}; +use abscissa_core::{clap::Parser, config::Override, Command, Runnable}; use ibc_relayer::config::Config; mod channel; diff --git a/crates/relayer-cli/src/commands/tx/channel.rs b/crates/relayer-cli/src/commands/tx/channel.rs index 84b93a2e49..2d7f625e3c 100644 --- a/crates/relayer-cli/src/commands/tx/channel.rs +++ b/crates/relayer-cli/src/commands/tx/channel.rs @@ -1,21 +1,23 @@ #![allow(clippy::redundant_closure_call)] -use abscissa_core::clap::Parser; - -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::chain::requests::{IncludeProof, QueryConnectionRequest, QueryHeight}; -use ibc_relayer::channel::{Channel, ChannelSide}; -use ibc_relayer_types::core::ics03_connection::connection::ConnectionEnd; -use ibc_relayer_types::core::ics04_channel::channel::Ordering; -use ibc_relayer_types::core::ics24_host::identifier::{ - ChainId, ChannelId, ClientId, ConnectionId, PortId, +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{ + chain::{ + handle::ChainHandle, + requests::{IncludeProof, QueryConnectionRequest, QueryHeight}, + }, + channel::{Channel, ChannelSide}, +}; +use ibc_relayer_types::{ + core::{ + ics03_connection::connection::ConnectionEnd, + ics04_channel::channel::Ordering, + ics24_host::identifier::{ChainId, ChannelId, ClientId, ConnectionId, PortId}, + }, + events::IbcEvent, }; -use ibc_relayer_types::events::IbcEvent; -use crate::cli_utils::ChainHandlePair; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; +use crate::{cli_utils::ChainHandlePair, conclude::Output, error::Error, prelude::*}; macro_rules! tx_chan_cmd { ($dbg_string:literal, $func:ident, $self:expr, $chan:expr) => { @@ -670,11 +672,6 @@ impl Runnable for TxChanCloseConfirmCmd { #[cfg(test)] mod tests { - use super::{ - TxChanCloseConfirmCmd, TxChanCloseInitCmd, TxChanOpenAckCmd, TxChanOpenConfirmCmd, - TxChanOpenInitCmd, TxChanOpenTryCmd, - }; - use std::str::FromStr; use abscissa_core::clap::Parser; @@ -683,6 +680,11 @@ mod tests { ics24_host::identifier::{ChainId, ChannelId, ConnectionId, PortId}, }; + use super::{ + TxChanCloseConfirmCmd, TxChanCloseInitCmd, TxChanOpenAckCmd, TxChanOpenConfirmCmd, + TxChanOpenInitCmd, TxChanOpenTryCmd, + }; + #[test] fn test_chan_open_init_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/tx/client.rs b/crates/relayer-cli/src/commands/tx/client.rs index 96d4496e96..1c813487a5 100644 --- a/crates/relayer-cli/src/commands/tx/client.rs +++ b/crates/relayer-cli/src/commands/tx/client.rs @@ -4,31 +4,35 @@ use core::{ }; use std::thread; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; - -use ibc_relayer::config::Config; -use ibc_relayer::event::IbcEventWithHeight; -use ibc_relayer::foreign_client::{CreateOptions, ForeignClient}; -use ibc_relayer::{chain::handle::ChainHandle, config::GenesisRestart}; +use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::{ - chain::requests::{ - IncludeProof, PageRequest, QueryClientStateRequest, QueryClientStatesRequest, QueryHeight, + chain::{ + handle::ChainHandle, + requests::{ + IncludeProof, PageRequest, QueryClientStateRequest, QueryClientStatesRequest, + QueryHeight, + }, }, - config::ChainConfig, + config::{ChainConfig, Config, GenesisRestart}, + event::IbcEventWithHeight, + foreign_client::{CreateOptions, ForeignClient}, +}; +use ibc_relayer_types::{ + core::ics24_host::identifier::{ChainId, ClientId}, + events::IbcEvent, + Height, }; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; -use ibc_relayer_types::events::IbcEvent; -use ibc_relayer_types::Height; use tendermint::block::Height as BlockHeight; use tendermint_light_client_verifier::types::TrustThreshold; use tendermint_rpc::Url; use tracing::debug; -use crate::application::app_config; -use crate::cli_utils::{spawn_chain_runtime, spawn_chain_runtime_generic, ChainHandlePair}; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; +use crate::{ + application::app_config, + cli_utils::{spawn_chain_runtime, spawn_chain_runtime_generic, ChainHandlePair}, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct TxCreateClientCmd { @@ -206,7 +210,7 @@ impl Runnable for TxUpdateClientCmd { if let Some(restart_params) = self.genesis_restart_params() { match config.find_chain_mut(&reference_chain_id) { Some(chain_config) => match chain_config { - ChainConfig::CosmosSdk(chain_config) => { + ChainConfig::CosmosSdk(chain_config) | ChainConfig::Astria(chain_config) => { chain_config.genesis_restart = Some(restart_params) } ChainConfig::Penumbra(_) => todo!(), @@ -609,11 +613,6 @@ impl OutputBuffer { #[cfg(test)] mod tests { - use super::{ - parse_trust_threshold, TxCreateClientCmd, TxUpdateClientCmd, TxUpgradeClientCmd, - TxUpgradeClientsCmd, - }; - use std::str::FromStr; use abscissa_core::clap::Parser; @@ -621,6 +620,11 @@ mod tests { use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; use tendermint_light_client_verifier::types::TrustThreshold; + use super::{ + parse_trust_threshold, TxCreateClientCmd, TxUpdateClientCmd, TxUpgradeClientCmd, + TxUpgradeClientsCmd, + }; + #[test] fn test_parse_trust_threshold() { let threshold = parse_trust_threshold("3/5").unwrap(); diff --git a/crates/relayer-cli/src/commands/tx/connection.rs b/crates/relayer-cli/src/commands/tx/connection.rs index 20f602e5f7..89803dc16e 100644 --- a/crates/relayer-cli/src/commands/tx/connection.rs +++ b/crates/relayer-cli/src/commands/tx/connection.rs @@ -1,16 +1,14 @@ #![allow(clippy::redundant_closure_call)] -use abscissa_core::clap::Parser; - +use abscissa_core::{clap::Parser, Command, Runnable}; use ibc_relayer::connection::{Connection, ConnectionSide}; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId, ConnectionId}; -use ibc_relayer_types::events::IbcEvent; -use ibc_relayer_types::timestamp::ZERO_DURATION; +use ibc_relayer_types::{ + core::ics24_host::identifier::{ChainId, ClientId, ConnectionId}, + events::IbcEvent, + timestamp::ZERO_DURATION, +}; -use crate::cli_utils::ChainHandlePair; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; +use crate::{cli_utils::ChainHandlePair, conclude::Output, error::Error, prelude::*}; macro_rules! conn_open_cmd { ($dbg_string:literal, $func:ident, $self:expr, $conn:expr) => { @@ -344,13 +342,13 @@ impl Runnable for TxConnConfirmCmd { #[cfg(test)] mod tests { - use super::{TxConnAckCmd, TxConnConfirmCmd, TxConnInitCmd, TxConnTryCmd}; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId, ConnectionId}; + use super::{TxConnAckCmd, TxConnConfirmCmd, TxConnInitCmd, TxConnTryCmd}; + #[test] fn test_conn_init() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/tx/packet.rs b/crates/relayer-cli/src/commands/tx/packet.rs index 89fc8d6aa7..7fff05f3eb 100644 --- a/crates/relayer-cli/src/commands/tx/packet.rs +++ b/crates/relayer-cli/src/commands/tx/packet.rs @@ -1,18 +1,21 @@ -use abscissa_core::clap::Parser; -use ibc_relayer_types::core::ics02_client::height::Height; use std::ops::RangeInclusive; -use ibc_relayer::chain::handle::ChainHandle; -use ibc_relayer::link::{Link, LinkParameters}; -use ibc_relayer::util::seq_range::parse_seq_range; -use ibc_relayer_types::core::ics04_channel::packet::Sequence; -use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; -use ibc_relayer_types::events::IbcEvent; - -use crate::cli_utils::ChainHandlePair; -use crate::conclude::Output; -use crate::error::Error; -use crate::prelude::*; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::{ + chain::handle::ChainHandle, + link::{Link, LinkParameters}, + util::seq_range::parse_seq_range, +}; +use ibc_relayer_types::{ + core::{ + ics02_client::height::Height, + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChainId, ChannelId, PortId}, + }, + events::IbcEvent, +}; + +use crate::{cli_utils::ChainHandlePair, conclude::Output, error::Error, prelude::*}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct TxPacketRecvCmd { @@ -218,13 +221,13 @@ impl Runnable for TxPacketAckCmd { #[cfg(test)] mod tests { - use super::{TxPacketAckCmd, TxPacketRecvCmd}; - use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ChannelId, PortId}; + use super::{TxPacketAckCmd, TxPacketRecvCmd}; + #[test] fn test_packet_recv_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/tx/transfer.rs b/crates/relayer-cli/src/commands/tx/transfer.rs index 62c3d96625..5f2933718a 100644 --- a/crates/relayer-cli/src/commands/tx/transfer.rs +++ b/crates/relayer-cli/src/commands/tx/transfer.rs @@ -1,9 +1,7 @@ use core::time::Duration; -use abscissa_core::clap::Parser; -use abscissa_core::{config::Override, FrameworkErrorKind}; +use abscissa_core::{clap::Parser, config::Override, Command, FrameworkErrorKind, Runnable}; use eyre::eyre; - use ibc_relayer::{ chain::handle::ChainHandle, config::Config, @@ -15,10 +13,12 @@ use ibc_relayer_types::{ core::ics24_host::identifier::{ChainId, ChannelId, PortId}, }; -use crate::cli_utils::{check_can_send_on_channel, ChainHandlePair}; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::*; +use crate::{ + cli_utils::{check_can_send_on_channel, ChainHandlePair}, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct TxIcs20MsgTransferCmd { @@ -211,6 +211,9 @@ impl Runnable for TxIcs20MsgTransferCmd { #[cfg(test)] mod tests { + use std::str::FromStr; + + use abscissa_core::clap::Parser; use ibc_relayer_types::{ applications::transfer::Amount, core::ics24_host::identifier::{ChainId, ChannelId, PortId}, @@ -218,9 +221,6 @@ mod tests { use super::TxIcs20MsgTransferCmd; - use abscissa_core::clap::Parser; - use std::str::FromStr; - #[test] fn test_ft_transfer_required_only() { assert_eq!( diff --git a/crates/relayer-cli/src/commands/tx/upgrade.rs b/crates/relayer-cli/src/commands/tx/upgrade.rs index d41bf6ce1e..a8931c6cad 100644 --- a/crates/relayer-cli/src/commands/tx/upgrade.rs +++ b/crates/relayer-cli/src/commands/tx/upgrade.rs @@ -1,15 +1,17 @@ use core::time::Duration; -use abscissa_core::clap::Parser; - -use ibc_relayer::upgrade_chain::requires_legacy_upgrade_proposal; -use ibc_relayer::upgrade_chain::{build_and_send_ibc_upgrade_proposal, UpgradePlanOptions}; +use abscissa_core::{clap::Parser, Command, Runnable}; +use ibc_relayer::upgrade_chain::{ + build_and_send_ibc_upgrade_proposal, requires_legacy_upgrade_proposal, UpgradePlanOptions, +}; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; -use crate::cli_utils::spawn_chain_runtime; -use crate::conclude::{exit_with_unrecoverable_error, Output}; -use crate::error::Error; -use crate::prelude::*; +use crate::{ + cli_utils::spawn_chain_runtime, + conclude::{exit_with_unrecoverable_error, Output}, + error::Error, + prelude::*, +}; #[derive(Clone, Command, Debug, Parser, PartialEq, Eq)] pub struct TxIbcUpgradeChainCmd { @@ -152,11 +154,12 @@ impl Runnable for TxIbcUpgradeChainCmd { #[cfg(test)] mod tests { - use super::TxIbcUpgradeChainCmd; + use std::str::FromStr; use abscissa_core::clap::Parser; use ibc_relayer_types::core::ics24_host::identifier::{ChainId, ClientId}; - use std::str::FromStr; + + use super::TxIbcUpgradeChainCmd; #[test] fn test_upgrade_chain_required_only() { diff --git a/crates/relayer-cli/src/commands/update.rs b/crates/relayer-cli/src/commands/update.rs index 351c764b0f..29967578ed 100644 --- a/crates/relayer-cli/src/commands/update.rs +++ b/crates/relayer-cli/src/commands/update.rs @@ -1,7 +1,6 @@ //! `update` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; use crate::commands::tx::client::TxUpdateClientCmd; diff --git a/crates/relayer-cli/src/commands/upgrade.rs b/crates/relayer-cli/src/commands/upgrade.rs index f69f904142..e0fa869d53 100644 --- a/crates/relayer-cli/src/commands/upgrade.rs +++ b/crates/relayer-cli/src/commands/upgrade.rs @@ -1,7 +1,6 @@ //! `upgrade` subcommand -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; +use abscissa_core::{clap::Parser, Command, Runnable}; use crate::commands::tx::client::{TxUpgradeClientCmd, TxUpgradeClientsCmd}; diff --git a/crates/relayer-cli/src/commands/version.rs b/crates/relayer-cli/src/commands/version.rs index 427afd3808..270b2b0a26 100644 --- a/crates/relayer-cli/src/commands/version.rs +++ b/crates/relayer-cli/src/commands/version.rs @@ -1,8 +1,8 @@ //! `version` subcommand +use abscissa_core::{clap::Parser, Command, Runnable}; + use super::CliCmd; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Runnable}; /// `version` subcommand /// diff --git a/crates/relayer-cli/src/components.rs b/crates/relayer-cli/src/components.rs index a4751e343f..91c76b216e 100644 --- a/crates/relayer-cli/src/components.rs +++ b/crates/relayer-cli/src/components.rs @@ -1,15 +1,13 @@ //! Various components for internal use by the Abscissa subsystem. use abscissa_core::{Component, FrameworkError, FrameworkErrorKind}; -use tracing_subscriber::{filter::EnvFilter, util::SubscriberInitExt, FmtSubscriber}; - use ibc_relayer::{ - config::{GlobalConfig, LogLevel}, + config::{Error, GlobalConfig, LogLevel}, util::debug_section::DebugSection, }; +use tracing_subscriber::{filter::EnvFilter, util::SubscriberInitExt, FmtSubscriber}; use crate::tracing_handle::ReloadHandle; -use ibc_relayer::config::Error; /// The name of the environment variable through which one can override /// the tracing filter built in [`build_tracing_filter`]. diff --git a/crates/relayer-cli/src/conclude.rs b/crates/relayer-cli/src/conclude.rs index f2190ceb42..4ea674a1a8 100644 --- a/crates/relayer-cli/src/conclude.rs +++ b/crates/relayer-cli/src/conclude.rs @@ -55,9 +55,9 @@ //! Output::success(h).with_result(end).exit(); //! ``` -use console::style; use core::fmt; +use console::style; use serde::Serialize; use tracing::warn; diff --git a/crates/relayer-cli/src/config.rs b/crates/relayer-cli/src/config.rs index 39e5f9106d..8f58312633 100644 --- a/crates/relayer-cli/src/config.rs +++ b/crates/relayer-cli/src/config.rs @@ -1,6 +1,7 @@ -use crate::prelude::app_reader; use std::path::PathBuf; +use crate::prelude::app_reader; + /// Get the path to configuration file pub fn config_path() -> Option { let app = app_reader(); diff --git a/crates/relayer-cli/src/entry.rs b/crates/relayer-cli/src/entry.rs index 29fa21c0da..a550bdb6d7 100644 --- a/crates/relayer-cli/src/entry.rs +++ b/crates/relayer-cli/src/entry.rs @@ -1,13 +1,10 @@ //! Definition of the entrypoint for the Hermes CLI. -use std::path::PathBuf; -use std::process; +use std::{path::PathBuf, process}; -use abscissa_core::clap::Parser; -use abscissa_core::{Command, Configurable, FrameworkError, Runnable}; +use abscissa_core::{clap::Parser, Command, Configurable, FrameworkError, Runnable}; use clap::{IntoApp, ValueEnum}; -use ibc_relayer::config::Config; -use ibc_relayer::util::debug_section::DebugSection; +use ibc_relayer::{config::Config, util::debug_section::DebugSection}; use crate::commands::CliCmd; diff --git a/crates/relayer-cli/src/error.rs b/crates/relayer-cli/src/error.rs index a87c15a5d4..b989ccbb7b 100644 --- a/crates/relayer-cli/src/error.rs +++ b/crates/relayer-cli/src/error.rs @@ -1,26 +1,21 @@ //! All errors which can be raised from a command. -use flex_error::{define_error, DisplayError}; use std::io::Error as IoError; +use flex_error::{define_error, DisplayError}; +use ibc_relayer::{ + channel::ChannelError, connection::ConnectionError, error::Error as RelayerError, + foreign_client::ForeignClientError, keyring::errors::Error as KeyRingError, + link::error::LinkError, spawn::SpawnError, supervisor::Error as SupervisorError, + transfer::TransferError, upgrade_chain::UpgradeChainError, +}; +use ibc_relayer_types::{ + applications::ics29_fee::error::Error as FeeError, + core::{ics04_channel::channel::IdentifiedChannelEnd, ics24_host::identifier::ChainId}, + signer::SignerError, +}; use tendermint::Error as TendermintError; -use ibc_relayer_types::applications::ics29_fee::error::Error as FeeError; -use ibc_relayer_types::core::ics04_channel::channel::IdentifiedChannelEnd; -use ibc_relayer_types::core::ics24_host::identifier::ChainId; -use ibc_relayer_types::signer::SignerError; - -use ibc_relayer::channel::ChannelError; -use ibc_relayer::connection::ConnectionError; -use ibc_relayer::error::Error as RelayerError; -use ibc_relayer::foreign_client::ForeignClientError; -use ibc_relayer::keyring::errors::Error as KeyRingError; -use ibc_relayer::link::error::LinkError; -use ibc_relayer::spawn::SpawnError; -use ibc_relayer::supervisor::Error as SupervisorError; -use ibc_relayer::transfer::TransferError; -use ibc_relayer::upgrade_chain::UpgradeChainError; - define_error! { /// An error raised within the relayer CLI Error { diff --git a/crates/relayer-cli/src/tracing_handle.rs b/crates/relayer-cli/src/tracing_handle.rs index aa70af4294..6f7ca2c8e5 100644 --- a/crates/relayer-cli/src/tracing_handle.rs +++ b/crates/relayer-cli/src/tracing_handle.rs @@ -1,12 +1,11 @@ use std::io; -use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader}; -use tokio::net::TcpListener; -use tokio::net::TcpStream; -use tracing_subscriber::filter; -use tracing_subscriber::reload::Handle; - use ibc_relayer::config::TracingServerConfig; +use tokio::{ + io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader}, + net::{TcpListener, TcpStream}, +}; +use tracing_subscriber::{filter, reload::Handle}; pub type ReloadHandle = Handle; diff --git a/crates/relayer-rest/src/handle.rs b/crates/relayer-rest/src/handle.rs index e2dd00899f..0f9f9f1f74 100644 --- a/crates/relayer-rest/src/handle.rs +++ b/crates/relayer-rest/src/handle.rs @@ -1,18 +1,16 @@ use core::fmt::Debug; -use tracing::error; - use crossbeam_channel as channel; - -use ibc_relayer::supervisor::dump_state::SupervisorState; use ibc_relayer::{ config::ChainConfig, rest::{ request::{reply_channel, ReplySender, Request, VersionInfo}, RestApiError, }, + supervisor::dump_state::SupervisorState, }; use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use tracing::error; pub const NAME: &str = env!( "CARGO_PKG_NAME", diff --git a/crates/relayer-rest/src/server.rs b/crates/relayer-rest/src/server.rs index 4ad1d297bc..53b1bfbbaa 100644 --- a/crates/relayer-rest/src/server.rs +++ b/crates/relayer-rest/src/server.rs @@ -10,12 +10,11 @@ use axum::{ Extension, Json, Router, Server, }; use crossbeam_channel as channel; +use ibc_relayer::rest::{request::Request, RestApiError}; use ibc_relayer_types::core::ics24_host::identifier::ChainId; use serde::{Deserialize, Serialize}; use tokio::task::JoinHandle; -use ibc_relayer::rest::{request::Request, RestApiError}; - use crate::handle::{ all_chain_ids, assemble_version_info, chain_config, supervisor_state, trigger_clear_packets, }; diff --git a/crates/relayer-rest/tests/mock.rs b/crates/relayer-rest/tests/mock.rs index c26a225215..c2fd28dea2 100644 --- a/crates/relayer-rest/tests/mock.rs +++ b/crates/relayer-rest/tests/mock.rs @@ -1,15 +1,13 @@ use std::{fmt::Debug, str::FromStr, time::Duration}; -use serde::{de::DeserializeOwned, Deserialize, Serialize}; - use ibc_relayer::{ config::ChainConfig, rest::request::{Request, VersionInfo}, supervisor::dump_state::SupervisorState, }; -use ibc_relayer_types::core::ics24_host::identifier::ChainId; - use ibc_relayer_rest::spawn; +use ibc_relayer_types::core::ics24_host::identifier::ChainId; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; enum TestResult { Success, @@ -100,7 +98,7 @@ type = 'CosmosSdk' rpc_addr = 'http://127.0.0.1:26557' grpc_addr = 'http://127.0.0.1:9091' event_source = { mode = 'push', url = 'ws://127.0.0.1:26557/websocket', batch_delay = '500ms' } -rpc_timeout = '10s' +rpc_timeout = '60s' account_prefix = 'cosmos' key_name = 'testkey' store_prefix = 'ibc' diff --git a/crates/relayer-types/src/applications/ics27_ica/cosmos_tx.rs b/crates/relayer-types/src/applications/ics27_ica/cosmos_tx.rs index f6b6043de8..4c08c6b617 100644 --- a/crates/relayer-types/src/applications/ics27_ica/cosmos_tx.rs +++ b/crates/relayer-types/src/applications/ics27_ica/cosmos_tx.rs @@ -1,12 +1,12 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::applications::interchain_accounts::v1::CosmosTx as RawCosmosTx; -use ibc_proto::Protobuf; -use serde_derive::Deserialize; -use serde_derive::Serialize; - -use crate::applications::ics27_ica::error::Error; -use crate::core::ics24_host::error::ValidationError; -use crate::tx_msg::Msg; +use ibc_proto::{ + google::protobuf::Any, ibc::applications::interchain_accounts::v1::CosmosTx as RawCosmosTx, + Protobuf, +}; +use serde_derive::{Deserialize, Serialize}; + +use crate::{ + applications::ics27_ica::error::Error, core::ics24_host::error::ValidationError, tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.applications.interchain_accounts.v1.CosmosTx"; diff --git a/crates/relayer-types/src/applications/ics27_ica/error.rs b/crates/relayer-types/src/applications/ics27_ica/error.rs index 4143b2467f..8127c9557c 100644 --- a/crates/relayer-types/src/applications/ics27_ica/error.rs +++ b/crates/relayer-types/src/applications/ics27_ica/error.rs @@ -1,8 +1,7 @@ -use crate::core::ics24_host::error::ValidationError; -use crate::signer::SignerError; - use flex_error::define_error; +use crate::{core::ics24_host::error::ValidationError, signer::SignerError}; + define_error! { #[derive(Debug, PartialEq, Eq)] Error { diff --git a/crates/relayer-types/src/applications/ics27_ica/msgs/register.rs b/crates/relayer-types/src/applications/ics27_ica/msgs/register.rs index 9258c4c07f..7ca04b7c43 100644 --- a/crates/relayer-types/src/applications/ics27_ica/msgs/register.rs +++ b/crates/relayer-types/src/applications/ics27_ica/msgs/register.rs @@ -1,15 +1,19 @@ +use ibc_proto::{ + ibc::applications::interchain_accounts::controller::v1::MsgRegisterInterchainAccount as RawMsgRegisterInterchainAccount, + Protobuf, +}; use serde::{Deserialize, Serialize}; -use ibc_proto::ibc::applications::interchain_accounts::controller::v1::MsgRegisterInterchainAccount as RawMsgRegisterInterchainAccount; -use ibc_proto::Protobuf; - -use crate::applications::ics27_ica::error::Error; use crate::core::ics04_channel::channel::Ordering; -use crate::core::ics04_channel::version::Version; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::ConnectionId; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{ + applications::ics27_ica::error::Error, + core::{ + ics04_channel::version::Version, + ics24_host::{error::ValidationError, identifier::ConnectionId}, + }, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.applications.interchain_accounts.controller.v1.MsgRegisterInterchainAccount"; diff --git a/crates/relayer-types/src/applications/ics27_ica/msgs/send_tx.rs b/crates/relayer-types/src/applications/ics27_ica/msgs/send_tx.rs index 72bc922a2d..939ab6072a 100644 --- a/crates/relayer-types/src/applications/ics27_ica/msgs/send_tx.rs +++ b/crates/relayer-types/src/applications/ics27_ica/msgs/send_tx.rs @@ -1,15 +1,15 @@ +use ibc_proto::{ + ibc::applications::interchain_accounts::controller::v1::MsgSendTx as RawMsgSendTx, Protobuf, +}; use serde_derive::{Deserialize, Serialize}; -use ibc_proto::ibc::applications::interchain_accounts::controller::v1::MsgSendTx as RawMsgSendTx; -use ibc_proto::Protobuf; - -use crate::applications::ics27_ica::error::Error; -use crate::applications::ics27_ica::packet_data::InterchainAccountPacketData; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::ConnectionId; -use crate::signer::Signer; -use crate::timestamp::Timestamp; -use crate::tx_msg::Msg; +use crate::{ + applications::ics27_ica::{error::Error, packet_data::InterchainAccountPacketData}, + core::ics24_host::{error::ValidationError, identifier::ConnectionId}, + signer::Signer, + timestamp::Timestamp, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.applications.interchain_accounts.controller.v1.MsgSendTx"; diff --git a/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_double_voting.rs b/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_double_voting.rs index a1ce4291d9..2f058cc01b 100644 --- a/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_double_voting.rs +++ b/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_double_voting.rs @@ -1,14 +1,13 @@ use core::fmt; -use ibc_proto::interchain_security::ccv::provider::v1::MsgSubmitConsumerDoubleVoting as RawIcsDoubleVoting; -use ibc_proto::Protobuf; +use ibc_proto::{ + interchain_security::ccv::provider::v1::MsgSubmitConsumerDoubleVoting as RawIcsDoubleVoting, + Protobuf, +}; use tendermint::evidence::DuplicateVoteEvidence; -use crate::clients::ics07_tendermint::header::Header; -use crate::signer::Signer; -use crate::tx_msg::Msg; - use super::error::Error; +use crate::{clients::ics07_tendermint::header::Header, signer::Signer, tx_msg::Msg}; pub const ICS_DOUBLE_VOTING_TYPE_URL: &str = "/interchain_security.ccv.provider.v1.MsgSubmitConsumerDoubleVoting"; diff --git a/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_misbehaviour.rs b/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_misbehaviour.rs index 8b5c6c2750..a46bfc26ce 100644 --- a/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_misbehaviour.rs +++ b/crates/relayer-types/src/applications/ics28_ccv/msgs/ccv_misbehaviour.rs @@ -1,15 +1,13 @@ use core::fmt; +use ibc_proto::{ + interchain_security::ccv::provider::v1::MsgSubmitConsumerMisbehaviour as RawIcsMisbehaviour, + Protobuf, +}; use serde::{Deserialize, Serialize}; -use ibc_proto::interchain_security::ccv::provider::v1::MsgSubmitConsumerMisbehaviour as RawIcsMisbehaviour; -use ibc_proto::Protobuf; - -use crate::clients::ics07_tendermint::misbehaviour::Misbehaviour; -use crate::signer::Signer; -use crate::tx_msg::Msg; - use super::error::Error; +use crate::{clients::ics07_tendermint::misbehaviour::Misbehaviour, signer::Signer, tx_msg::Msg}; pub const ICS_MISBEHAVIOR_TYPE_URL: &str = "/interchain_security.ccv.provider.v1.MsgSubmitConsumerMisbehaviour"; diff --git a/crates/relayer-types/src/applications/ics29_fee/error.rs b/crates/relayer-types/src/applications/ics29_fee/error.rs index 79ba5e1bc2..2b623c61ca 100644 --- a/crates/relayer-types/src/applications/ics29_fee/error.rs +++ b/crates/relayer-types/src/applications/ics29_fee/error.rs @@ -1,10 +1,11 @@ use flex_error::{define_error, TraceError}; use prost::EncodeError; -use crate::applications::transfer::error::Error as TransferError; -use crate::core::ics04_channel::error::Error as ChannelError; -use crate::core::ics24_host::error::ValidationError; -use crate::signer::SignerError; +use crate::{ + applications::transfer::error::Error as TransferError, + core::{ics04_channel::error::Error as ChannelError, ics24_host::error::ValidationError}, + signer::SignerError, +}; define_error! { #[derive(Debug, PartialEq, Eq)] diff --git a/crates/relayer-types/src/applications/ics29_fee/events.rs b/crates/relayer-types/src/applications/ics29_fee/events.rs index 34ea98c8c0..4e34b32e1b 100644 --- a/crates/relayer-types/src/applications/ics29_fee/events.rs +++ b/crates/relayer-types/src/applications/ics29_fee/events.rs @@ -1,16 +1,19 @@ +use std::{fmt::Display, str::FromStr}; + use itertools::Itertools; use serde_derive::{Deserialize, Serialize}; -use std::fmt::Display; -use std::str::FromStr; use tendermint::abci; use super::error::Error; -use crate::applications::transfer::coin::RawCoin; -use crate::core::ics04_channel::packet::Sequence; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::events::IbcEventType; - -use crate::signer::Signer; +use crate::{ + applications::transfer::coin::RawCoin, + core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChannelId, PortId}, + }, + events::IbcEventType, + signer::Signer, +}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] pub struct IncentivizedPacket { diff --git a/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet.rs b/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet.rs index 80e74c04a4..8fcda126a0 100644 --- a/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet.rs +++ b/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet.rs @@ -1,12 +1,14 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::applications::fee::v1::{Fee as ProtoFee, MsgPayPacketFee}; +use ibc_proto::{ + google::protobuf::Any, + ibc::applications::fee::v1::{Fee as ProtoFee, MsgPayPacketFee}, +}; -use crate::applications::ics29_fee::error::Error; -use crate::applications::transfer::coin::RawCoin; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; - -use crate::signer::Signer; -use crate::tx_msg::encode_message; +use crate::{ + applications::{ics29_fee::error::Error, transfer::coin::RawCoin}, + core::ics24_host::identifier::{ChannelId, PortId}, + signer::Signer, + tx_msg::encode_message, +}; const TYPE_URL: &str = "/ibc.applications.fee.v1.MsgPayPacketFee"; diff --git a/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet_async.rs b/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet_async.rs index 4787f74f63..4382321734 100644 --- a/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet_async.rs +++ b/crates/relayer-types/src/applications/ics29_fee/msgs/pay_packet_async.rs @@ -1,16 +1,22 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::applications::fee::v1::{ - Fee as ProtoFee, MsgPayPacketFeeAsync, PacketFee as ProtoPacketFee, +use ibc_proto::{ + google::protobuf::Any, + ibc::{ + applications::fee::v1::{ + Fee as ProtoFee, MsgPayPacketFeeAsync, PacketFee as ProtoPacketFee, + }, + core::channel::v1::PacketId as ProtoPacketId, + }, }; -use ibc_proto::ibc::core::channel::v1::PacketId as ProtoPacketId; -use crate::applications::ics29_fee::error::Error; -use crate::applications::transfer::coin::RawCoin; -use crate::core::ics04_channel::packet::Sequence; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; - -use crate::signer::Signer; -use crate::tx_msg::encode_message; +use crate::{ + applications::{ics29_fee::error::Error, transfer::coin::RawCoin}, + core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChannelId, PortId}, + }, + signer::Signer, + tx_msg::encode_message, +}; const TYPE_URL: &str = "/ibc.applications.fee.v1.MsgPayPacketFeeAsync"; diff --git a/crates/relayer-types/src/applications/ics29_fee/msgs/register_payee.rs b/crates/relayer-types/src/applications/ics29_fee/msgs/register_payee.rs index 5ba8901471..2c70d036b9 100644 --- a/crates/relayer-types/src/applications/ics29_fee/msgs/register_payee.rs +++ b/crates/relayer-types/src/applications/ics29_fee/msgs/register_payee.rs @@ -1,11 +1,14 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::applications::fee::v1::{MsgRegisterCounterpartyPayee, MsgRegisterPayee}; - -use crate::applications::ics29_fee::error::Error; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; - -use crate::signer::Signer; -use crate::tx_msg::encode_message; +use ibc_proto::{ + google::protobuf::Any, + ibc::applications::fee::v1::{MsgRegisterCounterpartyPayee, MsgRegisterPayee}, +}; + +use crate::{ + applications::ics29_fee::error::Error, + core::ics24_host::identifier::{ChannelId, PortId}, + signer::Signer, + tx_msg::encode_message, +}; pub fn build_register_counterparty_payee_message( address: &Signer, diff --git a/crates/relayer-types/src/applications/ics29_fee/packet_fee.rs b/crates/relayer-types/src/applications/ics29_fee/packet_fee.rs index 366ecba740..d27ede7931 100644 --- a/crates/relayer-types/src/applications/ics29_fee/packet_fee.rs +++ b/crates/relayer-types/src/applications/ics29_fee/packet_fee.rs @@ -1,15 +1,19 @@ -use ibc_proto::cosmos::base::v1beta1::Coin as ProtoCoin; -use ibc_proto::ibc::applications::fee::v1::{ - Fee as ProtoFee, IdentifiedPacketFees as ProtoIdentifiedPacketFees, PacketFee as ProtoPacketFee, -}; use std::str::FromStr; -use super::error::Error; -use crate::applications::transfer::amount::Amount; -use crate::applications::transfer::coin::RawCoin; -use crate::core::ics04_channel::packet_id::PacketId; +use ibc_proto::{ + cosmos::base::v1beta1::Coin as ProtoCoin, + ibc::applications::fee::v1::{ + Fee as ProtoFee, IdentifiedPacketFees as ProtoIdentifiedPacketFees, + PacketFee as ProtoPacketFee, + }, +}; -use crate::signer::Signer; +use super::error::Error; +use crate::{ + applications::transfer::{amount::Amount, coin::RawCoin}, + core::ics04_channel::packet_id::PacketId, + signer::Signer, +}; /// The core type that encodes the different fees that are redeemable by relayers for relaying /// different types of packets. diff --git a/crates/relayer-types/src/applications/ics31_icq/error.rs b/crates/relayer-types/src/applications/ics31_icq/error.rs index 32251625af..3fe78b0ef9 100644 --- a/crates/relayer-types/src/applications/ics31_icq/error.rs +++ b/crates/relayer-types/src/applications/ics31_icq/error.rs @@ -1,7 +1,7 @@ -use crate::core::ics24_host::error::ValidationError as Ics24ValidationError; +use flex_error::define_error; use tendermint::error::Error as TendermintError; -use flex_error::define_error; +use crate::core::ics24_host::error::ValidationError as Ics24ValidationError; define_error! { Error { diff --git a/crates/relayer-types/src/applications/ics31_icq/events.rs b/crates/relayer-types/src/applications/ics31_icq/events.rs index 739fecedba..07c0f8ba94 100644 --- a/crates/relayer-types/src/applications/ics31_icq/events.rs +++ b/crates/relayer-types/src/applications/ics31_icq/events.rs @@ -1,13 +1,13 @@ -use std::collections::BTreeMap; -use std::str::FromStr; +use std::{collections::BTreeMap, str::FromStr}; use serde::{Deserialize, Serialize}; use tendermint::{abci, block::Height}; -use crate::core::ics24_host::identifier::{ChainId, ConnectionId}; -use crate::events::IbcEvent; - use super::error::Error; +use crate::{ + core::ics24_host::identifier::{ChainId, ConnectionId}, + events::IbcEvent, +}; const EVENT_TYPE_PREFIX: &str = "query_request"; diff --git a/crates/relayer-types/src/applications/ics31_icq/response.rs b/crates/relayer-types/src/applications/ics31_icq/response.rs index 98b45acf06..6abdaeb18a 100644 --- a/crates/relayer-types/src/applications/ics31_icq/response.rs +++ b/crates/relayer-types/src/applications/ics31_icq/response.rs @@ -1,11 +1,9 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::stride::interchainquery::v1::MsgSubmitQueryResponse; +use ibc_proto::{google::protobuf::Any, stride::interchainquery::v1::MsgSubmitQueryResponse}; use prost::Message; use tendermint::merkle::proof::ProofOps as TendermintProofOps; use tendermint_proto::crypto::{ProofOp, ProofOps}; -use crate::applications::ics31_icq::error::Error; -use crate::signer::Signer; +use crate::{applications::ics31_icq::error::Error, signer::Signer}; pub const TYPE_URL: &str = "/stride.interchainquery.v1.MsgSubmitQueryResponse"; diff --git a/crates/relayer-types/src/applications/transfer/amount.rs b/crates/relayer-types/src/applications/transfer/amount.rs index ff52510a8e..ce9446c511 100644 --- a/crates/relayer-types/src/applications/transfer/amount.rs +++ b/crates/relayer-types/src/applications/transfer/amount.rs @@ -1,8 +1,7 @@ +use std::{iter::Sum, ops::Add, str::FromStr}; + use derive_more::{Display, From, Into}; use serde::{Deserialize, Serialize}; -use std::iter::Sum; -use std::ops::Add; -use std::str::FromStr; use super::error::Error; use crate::bigint::U256; diff --git a/crates/relayer-types/src/applications/transfer/coin.rs b/crates/relayer-types/src/applications/transfer/coin.rs index 5319ea301a..90ef36df93 100644 --- a/crates/relayer-types/src/applications/transfer/coin.rs +++ b/crates/relayer-types/src/applications/transfer/coin.rs @@ -1,17 +1,19 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str::FromStr; +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, +}; +use ibc_proto::cosmos::base::v1beta1::Coin as ProtoCoin; use regex::Regex; use serde::{Deserialize, Serialize}; -use ibc_proto::cosmos::base::v1beta1::Coin as ProtoCoin; - +use super::{ + amount::Amount, + denom::{BaseDenom, PrefixedDenom}, + error::Error, +}; use crate::serializers::serde_string; -use super::amount::Amount; -use super::denom::{BaseDenom, PrefixedDenom}; -use super::error::Error; - /// A `Coin` type with fully qualified `PrefixedDenom`. pub type PrefixedCoin = Coin; diff --git a/crates/relayer-types/src/applications/transfer/denom.rs b/crates/relayer-types/src/applications/transfer/denom.rs index 35a5e572b1..d74701c048 100644 --- a/crates/relayer-types/src/applications/transfer/denom.rs +++ b/crates/relayer-types/src/applications/transfer/denom.rs @@ -1,13 +1,17 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str::FromStr; +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, +}; use derive_more::{Display, From}; use ibc_proto::ibc::applications::transfer::v1::DenomTrace as RawDenomTrace; use serde::{Deserialize, Serialize}; use super::error::Error; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::serializers::serde_string; +use crate::{ + core::ics24_host::identifier::{ChannelId, PortId}, + serializers::serde_string, +}; /// Base denomination type #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Serialize, Deserialize, Display)] diff --git a/crates/relayer-types/src/applications/transfer/error.rs b/crates/relayer-types/src/applications/transfer/error.rs index f0e52d946d..4e9fc8577e 100644 --- a/crates/relayer-types/src/applications/transfer/error.rs +++ b/crates/relayer-types/src/applications/transfer/error.rs @@ -1,18 +1,20 @@ -use std::convert::Infallible; -use std::str::Utf8Error; -use std::string::FromUtf8Error; +use std::{convert::Infallible, str::Utf8Error, string::FromUtf8Error}; use flex_error::{define_error, DisplayOnly, TraceError}; use subtle_encoding::Error as EncodingError; use tendermint_proto::Error as TendermintProtoError; use uint::FromDecStrErr; -use crate::core::ics04_channel::channel::Ordering; -use crate::core::ics04_channel::error as channel_error; -use crate::core::ics04_channel::version::Version; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::signer::SignerError; +use crate::{ + core::{ + ics04_channel::{channel::Ordering, error as channel_error, version::Version}, + ics24_host::{ + error::ValidationError, + identifier::{ChannelId, PortId}, + }, + }, + signer::SignerError, +}; define_error! { #[derive(Debug, PartialEq, Eq)] diff --git a/crates/relayer-types/src/applications/transfer/events.rs b/crates/relayer-types/src/applications/transfer/events.rs index 4f16e5297a..51a83a44b7 100644 --- a/crates/relayer-types/src/applications/transfer/events.rs +++ b/crates/relayer-types/src/applications/transfer/events.rs @@ -1,8 +1,10 @@ -use crate::applications::transfer::acknowledgement::Acknowledgement; -use crate::applications::transfer::{Amount, PrefixedDenom, MODULE_ID_STR}; -use crate::events::ModuleEvent; - -use crate::signer::Signer; +use crate::{ + applications::transfer::{ + acknowledgement::Acknowledgement, Amount, PrefixedDenom, MODULE_ID_STR, + }, + events::ModuleEvent, + signer::Signer, +}; const EVENT_TYPE_PACKET: &str = "fungible_token_packet"; const EVENT_TYPE_TIMEOUT: &str = "timeout"; diff --git a/crates/relayer-types/src/applications/transfer/msgs/mod.rs b/crates/relayer-types/src/applications/transfer/msgs/mod.rs index b3caa7e353..f621d83924 100644 --- a/crates/relayer-types/src/applications/transfer/msgs/mod.rs +++ b/crates/relayer-types/src/applications/transfer/msgs/mod.rs @@ -1,2 +1,4 @@ pub mod send; pub mod transfer; + +pub const ASTRIA_WITHDRAWAL_TYPE_URL: &str = "/astria.sequencer.v1alpha1.Ics20Withdrawal"; diff --git a/crates/relayer-types/src/applications/transfer/msgs/send.rs b/crates/relayer-types/src/applications/transfer/msgs/send.rs index 36e71dc66b..599e228aa1 100644 --- a/crates/relayer-types/src/applications/transfer/msgs/send.rs +++ b/crates/relayer-types/src/applications/transfer/msgs/send.rs @@ -1,16 +1,13 @@ -use std::fmt::Display; -use std::str::FromStr; +use std::{fmt::Display, str::FromStr}; -use ibc_proto::Protobuf; -use serde_derive::Deserialize; -use serde_derive::Serialize; +use ibc_proto::{cosmos::bank::v1beta1::MsgSend as RawMsgSend, Protobuf}; +use serde_derive::{Deserialize, Serialize}; -use ibc_proto::cosmos::bank::v1beta1::MsgSend as RawMsgSend; - -use crate::applications::transfer::error::Error; -use crate::applications::transfer::Coin; -use crate::core::ics24_host::error::ValidationError; -use crate::tx_msg::Msg; +use crate::{ + applications::transfer::{error::Error, Coin}, + core::ics24_host::error::ValidationError, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/cosmos.bank.v1beta1.MsgSend"; diff --git a/crates/relayer-types/src/applications/transfer/msgs/transfer.rs b/crates/relayer-types/src/applications/transfer/msgs/transfer.rs index 8bfc198b44..63ee23ad08 100644 --- a/crates/relayer-types/src/applications/transfer/msgs/transfer.rs +++ b/crates/relayer-types/src/applications/transfer/msgs/transfer.rs @@ -1,16 +1,20 @@ //! This is the definition of a transfer messages that an application submits to a chain. -use ibc_proto::cosmos::base::v1beta1::Coin; -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::applications::transfer::v1::MsgTransfer as RawMsgTransfer; -use ibc_proto::Protobuf; - -use crate::applications::transfer::error::Error; -use crate::core::ics04_channel::timeout::TimeoutHeight; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::signer::Signer; -use crate::timestamp::Timestamp; -use crate::tx_msg::Msg; +use ibc_proto::{ + cosmos::base::v1beta1::Coin, google::protobuf::Any, + ibc::applications::transfer::v1::MsgTransfer as RawMsgTransfer, Protobuf, +}; + +use crate::{ + applications::transfer::error::Error, + core::{ + ics04_channel::timeout::TimeoutHeight, + ics24_host::identifier::{ChannelId, PortId}, + }, + signer::Signer, + timestamp::Timestamp, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.applications.transfer.v1.MsgTransfer"; @@ -129,19 +133,20 @@ impl From for Any { #[cfg(test)] pub mod test_util { - use core::ops::Add; - use core::time::Duration; + use core::{ops::Add, time::Duration}; use super::MsgTransfer; - use crate::applications::transfer::packet::PacketData; - use crate::applications::transfer::Coin; - use crate::bigint::U256; - use crate::core::ics04_channel::packet::{Packet, Sequence}; - use crate::core::ics04_channel::timeout::TimeoutHeight; - use crate::signer::Signer; use crate::{ - applications::transfer::{BaseCoin, PrefixedCoin}, - core::ics24_host::identifier::{ChannelId, PortId}, + applications::transfer::{packet::PacketData, BaseCoin, Coin, PrefixedCoin}, + bigint::U256, + core::{ + ics04_channel::{ + packet::{Packet, Sequence}, + timeout::TimeoutHeight, + }, + ics24_host::identifier::{ChannelId, PortId}, + }, + signer::Signer, test_utils::get_dummy_bech32_account, timestamp::Timestamp, }; diff --git a/crates/relayer-types/src/applications/transfer/packet.rs b/crates/relayer-types/src/applications/transfer/packet.rs index 7b13d49b1e..ff93868dff 100644 --- a/crates/relayer-types/src/applications/transfer/packet.rs +++ b/crates/relayer-types/src/applications/transfer/packet.rs @@ -1,10 +1,13 @@ -use std::str::FromStr; +use std::{ + convert::TryFrom, + str::FromStr, + string::{String, ToString}, +}; use ibc_proto::ibc::applications::transfer::v2::FungibleTokenPacketData as RawPacketData; use serde::{Deserialize, Serialize}; -use super::error::Error; -use super::{Amount, PrefixedCoin, PrefixedDenom}; +use super::{error::Error, Amount, PrefixedCoin, PrefixedDenom}; use crate::signer::Signer; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] diff --git a/crates/relayer-types/src/clients/ics07_tendermint/client_state.rs b/crates/relayer-types/src/clients/ics07_tendermint/client_state.rs index 9e53f1e63f..2eeb46fadb 100644 --- a/crates/relayer-types/src/clients/ics07_tendermint/client_state.rs +++ b/crates/relayer-types/src/clients/ics07_tendermint/client_state.rs @@ -1,25 +1,33 @@ -use std::time::Duration; - +use std::{ + convert::{TryFrom, TryInto}, + time::Duration, +}; + +use ibc_proto::{ + google::protobuf::Any, + ibc::{ + core::client::v1::Height as RawHeight, + lightclients::tendermint::v1::ClientState as RawTmClientState, + }, + Protobuf, +}; use prost::Message; use serde::{Deserialize, Serialize}; - -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::core::client::v1::Height as RawHeight; -use ibc_proto::ibc::lightclients::tendermint::v1::ClientState as RawTmClientState; -use ibc_proto::Protobuf; - use tendermint_light_client_verifier::options::Options; -use crate::clients::ics07_tendermint::error::Error; -use crate::clients::ics07_tendermint::header::Header as TmHeader; -use crate::core::ics02_client::client_state::ClientState as Ics2ClientState; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::error::Error as Ics02Error; -use crate::core::ics02_client::trust_threshold::TrustThreshold; -use crate::core::ics23_commitment::specs::ProofSpecs; -use crate::core::ics24_host::identifier::ChainId; -use crate::timestamp::{Timestamp, ZERO_DURATION}; -use crate::Height; +use crate::{ + clients::ics07_tendermint::{error::Error, header::Header as TmHeader}, + core::{ + ics02_client::{ + client_state::ClientState as Ics2ClientState, client_type::ClientType, + error::Error as Ics02Error, trust_threshold::TrustThreshold, + }, + ics23_commitment::specs::ProofSpecs, + ics24_host::identifier::ChainId, + }, + timestamp::{Timestamp, ZERO_DURATION}, + Height, +}; pub const TENDERMINT_CLIENT_STATE_TYPE_URL: &str = "/ibc.lightclients.tendermint.v1.ClientState"; @@ -325,9 +333,10 @@ impl TryFrom for ClientState { type Error = Ics02Error; fn try_from(raw: Any) -> Result { - use bytes::Buf; use core::ops::Deref; + use bytes::Buf; + fn decode_client_state(buf: B) -> Result { RawTmClientState::decode(buf) .map_err(Error::decode)? @@ -358,19 +367,22 @@ impl From for Any { #[cfg(test)] mod tests { - use crate::Height; use core::time::Duration; - use test_log::test; use ibc_proto::ics23::ProofSpec as Ics23ProofSpec; use tendermint_rpc::endpoint::abci_query::AbciQuery; + use test_log::test; - use crate::clients::ics07_tendermint::client_state::{AllowUpdate, ClientState}; - use crate::core::ics02_client::trust_threshold::TrustThreshold; - use crate::core::ics23_commitment::specs::ProofSpecs; - use crate::core::ics24_host::identifier::ChainId; - use crate::test::test_serialization_roundtrip; - use crate::timestamp::{Timestamp, ZERO_DURATION}; + use crate::{ + clients::ics07_tendermint::client_state::{AllowUpdate, ClientState}, + core::{ + ics02_client::trust_threshold::TrustThreshold, ics23_commitment::specs::ProofSpecs, + ics24_host::identifier::ChainId, + }, + test::test_serialization_roundtrip, + timestamp::{Timestamp, ZERO_DURATION}, + Height, + }; #[derive(Clone, Debug, PartialEq)] struct ClientStateParams { @@ -666,9 +678,10 @@ pub mod test_util { use tendermint::block::Header; - use crate::clients::ics07_tendermint::client_state::{AllowUpdate, ClientState}; - use crate::core::ics02_client::height::Height; - use crate::core::ics24_host::identifier::ChainId; + use crate::{ + clients::ics07_tendermint::client_state::{AllowUpdate, ClientState}, + core::{ics02_client::height::Height, ics24_host::identifier::ChainId}, + }; pub fn get_dummy_tendermint_client_state(tm_header: Header) -> ClientState { ClientState::new( diff --git a/crates/relayer-types/src/clients/ics07_tendermint/consensus_state.rs b/crates/relayer-types/src/clients/ics07_tendermint/consensus_state.rs index 5cbd77732b..67087c5910 100644 --- a/crates/relayer-types/src/clients/ics07_tendermint/consensus_state.rs +++ b/crates/relayer-types/src/clients/ics07_tendermint/consensus_state.rs @@ -1,16 +1,19 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::lightclients::tendermint::v1::ConsensusState as RawConsensusState; -use ibc_proto::Protobuf; +use ibc_proto::{ + google::protobuf::Any, ibc::lightclients::tendermint::v1::ConsensusState as RawConsensusState, + Protobuf, +}; use serde::{Deserialize, Serialize}; use tendermint::{hash::Algorithm, time::Time, Hash}; use tendermint_proto::google::protobuf as tpb; -use crate::clients::ics07_tendermint::error::Error; -use crate::clients::ics07_tendermint::header::Header; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::error::Error as Ics02Error; -use crate::core::ics23_commitment::commitment::CommitmentRoot; -use crate::timestamp::Timestamp; +use crate::{ + clients::ics07_tendermint::{error::Error, header::Header}, + core::{ + ics02_client::{client_type::ClientType, error::Error as Ics02Error}, + ics23_commitment::commitment::CommitmentRoot, + }, + timestamp::Timestamp, +}; pub const TENDERMINT_CONSENSUS_STATE_TYPE_URL: &str = "/ibc.lightclients.tendermint.v1.ConsensusState"; @@ -100,8 +103,9 @@ impl TryFrom for ConsensusState { type Error = Ics02Error; fn try_from(raw: Any) -> Result { - use bytes::Buf; use core::ops::Deref; + + use bytes::Buf; use prost::Message; fn decode_consensus_state(buf: B) -> Result { diff --git a/crates/relayer-types/src/clients/ics07_tendermint/error.rs b/crates/relayer-types/src/clients/ics07_tendermint/error.rs index d56731a8b3..6cfb85a1bc 100644 --- a/crates/relayer-types/src/clients/ics07_tendermint/error.rs +++ b/crates/relayer-types/src/clients/ics07_tendermint/error.rs @@ -1,16 +1,16 @@ use flex_error::{define_error, TraceError}; - -use crate::core::ics02_client::error::Error as Ics02Error; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::ClientId; -use crate::timestamp::{Timestamp, TimestampOverflowError}; - -use crate::Height; -use tendermint::account::Id; -use tendermint::hash::Hash; -use tendermint::Error as TendermintError; +use tendermint::{account::Id, hash::Hash, Error as TendermintError}; use tendermint_light_client_verifier::errors::VerificationErrorDetail as LightClientErrorDetail; +use crate::{ + core::{ + ics02_client::error::Error as Ics02Error, + ics24_host::{error::ValidationError, identifier::ClientId}, + }, + timestamp::{Timestamp, TimestampOverflowError}, + Height, +}; + define_error! { #[derive(Debug, PartialEq, Eq)] Error { diff --git a/crates/relayer-types/src/clients/ics07_tendermint/header.rs b/crates/relayer-types/src/clients/ics07_tendermint/header.rs index 57b99db1e9..1734e7d56e 100644 --- a/crates/relayer-types/src/clients/ics07_tendermint/header.rs +++ b/crates/relayer-types/src/clients/ics07_tendermint/header.rs @@ -1,21 +1,23 @@ use std::fmt::{Display, Error as FmtError, Formatter}; use bytes::Buf; -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::lightclients::tendermint::v1::Header as RawHeader; -use ibc_proto::Protobuf; +use ibc_proto::{ + google::protobuf::Any, ibc::lightclients::tendermint::v1::Header as RawHeader, Protobuf, +}; use prost::Message; use serde_derive::{Deserialize, Serialize}; -use tendermint::block::signed_header::SignedHeader; -use tendermint::validator::Set as ValidatorSet; - -use crate::clients::ics07_tendermint::error::Error; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::error::Error as Ics02Error; -use crate::core::ics24_host::identifier::ChainId; -use crate::timestamp::Timestamp; -use crate::utils::pretty::{PrettySignedHeader, PrettyValidatorSet}; -use crate::Height; +use tendermint::{block::signed_header::SignedHeader, validator::Set as ValidatorSet}; + +use crate::{ + clients::ics07_tendermint::error::Error, + core::{ + ics02_client::{client_type::ClientType, error::Error as Ics02Error}, + ics24_host::identifier::ChainId, + }, + timestamp::Timestamp, + utils::pretty::{PrettySignedHeader, PrettyValidatorSet}, + Height, +}; pub const TENDERMINT_HEADER_TYPE_URL: &str = "/ibc.lightclients.tendermint.v1.Header"; @@ -151,13 +153,13 @@ impl From
for RawHeader { pub mod test_util { use subtle_encoding::hex; - use tendermint::block::signed_header::SignedHeader; - use tendermint::validator::Info as ValidatorInfo; - use tendermint::validator::Set as ValidatorSet; - use tendermint::PublicKey; + use tendermint::{ + block::signed_header::SignedHeader, + validator::{Info as ValidatorInfo, Set as ValidatorSet}, + PublicKey, + }; - use crate::clients::ics07_tendermint::header::Header; - use crate::Height; + use crate::{clients::ics07_tendermint::header::Header, Height}; pub fn get_dummy_tendermint_header() -> tendermint::block::Header { serde_json::from_str::(include_str!( diff --git a/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs b/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs index 1336e160bf..d01f3f33cc 100644 --- a/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs +++ b/crates/relayer-types/src/clients/ics07_tendermint/misbehaviour.rs @@ -1,12 +1,12 @@ -use ibc_proto::ibc::lightclients::tendermint::v1::Misbehaviour as RawMisbehaviour; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::lightclients::tendermint::v1::Misbehaviour as RawMisbehaviour, Protobuf}; use serde::{Deserialize, Serialize}; -use crate::clients::ics07_tendermint::error::Error; -use crate::clients::ics07_tendermint::header::Header; -use crate::core::ics24_host::identifier::ClientId; -use crate::tx_msg::Msg; -use crate::Height; +use crate::{ + clients::ics07_tendermint::{error::Error, header::Header}, + core::ics24_host::identifier::ClientId, + tx_msg::Msg, + Height, +}; pub const TENDERMINT_MISBEHAVIOR_TYPE_URL: &str = "/ibc.lightclients.tendermint.v1.Misbehaviour"; diff --git a/crates/relayer-types/src/core/ics02_client/client_state.rs b/crates/relayer-types/src/core/ics02_client/client_state.rs index bf2d7cb706..814922861b 100644 --- a/crates/relayer-types/src/core/ics02_client/client_state.rs +++ b/crates/relayer-types/src/core/ics02_client/client_state.rs @@ -1,10 +1,13 @@ use core::fmt::Debug; -use std::time::Duration; - -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics24_host::identifier::ChainId; - -use crate::Height; +use std::{ + marker::{Send, Sync}, + time::Duration, +}; + +use crate::{ + core::{ics02_client::client_type::ClientType, ics24_host::identifier::ChainId}, + Height, +}; pub trait ClientState: Clone + Debug + Send + Sync // Any: From, { diff --git a/crates/relayer-types/src/core/ics02_client/client_type.rs b/crates/relayer-types/src/core/ics02_client/client_type.rs index a35e44604d..67054ef349 100644 --- a/crates/relayer-types/src/core/ics02_client/client_type.rs +++ b/crates/relayer-types/src/core/ics02_client/client_type.rs @@ -1,6 +1,7 @@ -use serde_derive::{Deserialize, Serialize}; use std::fmt::{Display, Error as FmtError, Formatter}; +use serde_derive::{Deserialize, Serialize}; + use super::error::Error; /// Type of the client, depending on the specific consensus algorithm. @@ -53,6 +54,7 @@ impl core::str::FromStr for ClientType { #[cfg(test)] mod tests { use core::str::FromStr; + use test_log::test; use super::ClientType; diff --git a/crates/relayer-types/src/core/ics02_client/consensus_state.rs b/crates/relayer-types/src/core/ics02_client/consensus_state.rs index 196f486d7e..6211e442f9 100644 --- a/crates/relayer-types/src/core/ics02_client/consensus_state.rs +++ b/crates/relayer-types/src/core/ics02_client/consensus_state.rs @@ -1,8 +1,12 @@ -use core::fmt::Debug; +use core::{ + fmt::Debug, + marker::{Send, Sync}, +}; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics23_commitment::commitment::CommitmentRoot; -use crate::timestamp::Timestamp; +use crate::{ + core::{ics02_client::client_type::ClientType, ics23_commitment::commitment::CommitmentRoot}, + timestamp::Timestamp, +}; /// Abstract of consensus state information used by the validity predicate /// to verify new commits & state roots. diff --git a/crates/relayer-types/src/core/ics02_client/error.rs b/crates/relayer-types/src/core/ics02_client/error.rs index 094a883aa6..43fcc611ef 100644 --- a/crates/relayer-types/src/core/ics02_client/error.rs +++ b/crates/relayer-types/src/core/ics02_client/error.rs @@ -1,14 +1,16 @@ use flex_error::{define_error, TraceError}; use tendermint_proto::Error as TendermintProtoError; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::height::HeightError; -use crate::core::ics23_commitment::error::Error as Ics23Error; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::ClientId; -use crate::signer::SignerError; -use crate::timestamp::Timestamp; -use crate::Height; +use crate::{ + core::{ + ics02_client::{client_type::ClientType, height::HeightError}, + ics23_commitment::error::Error as Ics23Error, + ics24_host::{error::ValidationError, identifier::ClientId}, + }, + signer::SignerError, + timestamp::Timestamp, + Height, +}; define_error! { #[derive(Debug, PartialEq, Eq)] diff --git a/crates/relayer-types/src/core/ics02_client/events.rs b/crates/relayer-types/src/core/ics02_client/events.rs index 3abe9b7b8d..6605b2534a 100644 --- a/crates/relayer-types/src/core/ics02_client/events.rs +++ b/crates/relayer-types/src/core/ics02_client/events.rs @@ -1,15 +1,19 @@ //! Types for the IBC events emitted from Tendermint Websocket by the client module. -use serde_derive::{Deserialize, Serialize}; use std::fmt::{Display, Error as FmtError, Formatter}; + +use serde_derive::{Deserialize, Serialize}; use tendermint::abci; use tendermint_proto::Protobuf; use super::header::AnyHeader; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::height::Height; -use crate::core::ics24_host::identifier::ClientId; -use crate::events::{IbcEvent, IbcEventType}; +use crate::{ + core::{ + ics02_client::{client_type::ClientType, height::Height}, + ics24_host::identifier::ClientId, + }, + events::{IbcEvent, IbcEventType}, +}; /// The content of the `key` field for the attribute containing the client identifier. pub const CLIENT_ID_ATTRIBUTE_KEY: &str = "client_id"; diff --git a/crates/relayer-types/src/core/ics02_client/header.rs b/crates/relayer-types/src/core/ics02_client/header.rs index e238fe1d96..9692a5f8f4 100644 --- a/crates/relayer-types/src/core/ics02_client/header.rs +++ b/crates/relayer-types/src/core/ics02_client/header.rs @@ -1,17 +1,16 @@ use core::fmt::Debug; +use ibc_proto::{google::protobuf::Any, Protobuf}; use serde::{Deserialize, Serialize}; -use ibc_proto::google::protobuf::Any; -use ibc_proto::Protobuf; - -use crate::clients::ics07_tendermint::header::{ - decode_header as tm_decode_header, Header as TendermintHeader, TENDERMINT_HEADER_TYPE_URL, +use crate::{ + clients::ics07_tendermint::header::{ + decode_header as tm_decode_header, Header as TendermintHeader, TENDERMINT_HEADER_TYPE_URL, + }, + core::ics02_client::{client_type::ClientType, error::Error}, + timestamp::Timestamp, + Height, }; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::error::Error; -use crate::timestamp::Timestamp; -use crate::Height; /// Abstract of consensus state update information pub trait Header: Debug + Send + Sync // Any: From, diff --git a/crates/relayer-types/src/core/ics02_client/height.rs b/crates/relayer-types/src/core/ics02_client/height.rs index 4563333244..6fb3de355b 100644 --- a/crates/relayer-types/src/core/ics02_client/height.rs +++ b/crates/relayer-types/src/core/ics02_client/height.rs @@ -1,15 +1,10 @@ -use std::cmp::Ordering; -use std::num::ParseIntError; -use std::str::FromStr; +use std::{cmp::Ordering, num::ParseIntError, str::FromStr}; use flex_error::{define_error, TraceError}; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::core::client::v1::Height as RawHeight, Protobuf}; use serde_derive::{Deserialize, Serialize}; -use ibc_proto::ibc::core::client::v1::Height as RawHeight; - -use crate::core::ics02_client::error::Error; -use crate::core::ics24_host::identifier::ChainId; +use crate::core::{ics02_client::error::Error, ics24_host::identifier::ChainId}; #[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Height { diff --git a/crates/relayer-types/src/core/ics02_client/misbehaviour.rs b/crates/relayer-types/src/core/ics02_client/misbehaviour.rs index 21b296ec29..ca1d30711a 100644 --- a/crates/relayer-types/src/core/ics02_client/misbehaviour.rs +++ b/crates/relayer-types/src/core/ics02_client/misbehaviour.rs @@ -1,7 +1,6 @@ use core::fmt::Debug; -use crate::core::ics24_host::identifier::ClientId; -use crate::Height; +use crate::{core::ics24_host::identifier::ClientId, Height}; pub trait Misbehaviour: Clone + Debug + Send + Sync { /// The type of client (eg. Tendermint) diff --git a/crates/relayer-types/src/core/ics02_client/msgs.rs b/crates/relayer-types/src/core/ics02_client/msgs.rs index ac28763ee5..fc13f07445 100644 --- a/crates/relayer-types/src/core/ics02_client/msgs.rs +++ b/crates/relayer-types/src/core/ics02_client/msgs.rs @@ -4,10 +4,10 @@ //! subsequently calls into the chain-specific (e.g., ICS 07) client handler. See: //! . -use crate::core::ics02_client::msgs::create_client::MsgCreateClient; -use crate::core::ics02_client::msgs::misbehaviour::MsgSubmitMisbehaviour; -use crate::core::ics02_client::msgs::update_client::MsgUpdateClient; -use crate::core::ics02_client::msgs::upgrade_client::MsgUpgradeClient; +use crate::core::ics02_client::msgs::{ + create_client::MsgCreateClient, misbehaviour::MsgSubmitMisbehaviour, + update_client::MsgUpdateClient, upgrade_client::MsgUpgradeClient, +}; pub mod create_client; pub mod misbehaviour; diff --git a/crates/relayer-types/src/core/ics02_client/msgs/create_client.rs b/crates/relayer-types/src/core/ics02_client/msgs/create_client.rs index 078bce2d31..208ba6a7d2 100644 --- a/crates/relayer-types/src/core/ics02_client/msgs/create_client.rs +++ b/crates/relayer-types/src/core/ics02_client/msgs/create_client.rs @@ -1,12 +1,10 @@ //! Definition of domain type message `MsgCreateClient`. -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::core::client::v1::MsgCreateClient as RawMsgCreateClient; -use ibc_proto::Protobuf; +use ibc_proto::{ + google::protobuf::Any, ibc::core::client::v1::MsgCreateClient as RawMsgCreateClient, Protobuf, +}; -use crate::core::ics02_client::error::Error; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{core::ics02_client::error::Error, signer::Signer, tx_msg::Msg}; pub const TYPE_URL: &str = "/ibc.core.client.v1.MsgCreateClient"; @@ -76,15 +74,18 @@ impl From for RawMsgCreateClient { #[cfg(test)] mod tests { - use test_log::test; - use ibc_proto::ibc::core::client::v1::MsgCreateClient as RawMsgCreateClient; + use test_log::test; - use crate::clients::ics07_tendermint::client_state::test_util::get_dummy_tendermint_client_state; - use crate::clients::ics07_tendermint::consensus_state::ConsensusState as TmConsensusState; - use crate::clients::ics07_tendermint::header::test_util::get_dummy_tendermint_header; - use crate::core::ics02_client::msgs::create_client::MsgCreateClient; - use crate::test_utils::get_dummy_account_id; + use crate::{ + clients::ics07_tendermint::{ + client_state::test_util::get_dummy_tendermint_client_state, + consensus_state::ConsensusState as TmConsensusState, + header::test_util::get_dummy_tendermint_header, + }, + core::ics02_client::msgs::create_client::MsgCreateClient, + test_utils::get_dummy_account_id, + }; #[test] fn msg_create_client_serialization() { diff --git a/crates/relayer-types/src/core/ics02_client/msgs/misbehaviour.rs b/crates/relayer-types/src/core/ics02_client/msgs/misbehaviour.rs index ae7156a834..bd09549019 100644 --- a/crates/relayer-types/src/core/ics02_client/msgs/misbehaviour.rs +++ b/crates/relayer-types/src/core/ics02_client/msgs/misbehaviour.rs @@ -1,11 +1,13 @@ -use ibc_proto::google::protobuf::Any as ProtoAny; -use ibc_proto::ibc::core::client::v1::MsgSubmitMisbehaviour as RawMsgSubmitMisbehaviour; -use ibc_proto::Protobuf; +use ibc_proto::{ + google::protobuf::Any as ProtoAny, + ibc::core::client::v1::MsgSubmitMisbehaviour as RawMsgSubmitMisbehaviour, Protobuf, +}; -use crate::core::ics02_client::error::Error; -use crate::core::ics24_host::identifier::ClientId; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{ + core::{ics02_client::error::Error, ics24_host::identifier::ClientId}, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.client.v1.MsgSubmitMisbehaviour"; diff --git a/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs b/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs index e5966b7b7c..e8ad51e1ef 100644 --- a/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs +++ b/crates/relayer-types/src/core/ics02_client/msgs/update_client.rs @@ -1,14 +1,17 @@ //! Definition of domain type message `MsgUpdateAnyClient`. -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::core::client::v1::MsgUpdateClient as RawMsgUpdateClient; -use ibc_proto::Protobuf; - -use crate::core::ics02_client::error::Error; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::ClientId; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use ibc_proto::{ + google::protobuf::Any, ibc::core::client::v1::MsgUpdateClient as RawMsgUpdateClient, Protobuf, +}; + +use crate::{ + core::{ + ics02_client::error::Error, + ics24_host::{error::ValidationError, identifier::ClientId}, + }, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.client.v1.MsgUpdateClient"; @@ -73,14 +76,14 @@ impl From for RawMsgUpdateClient { #[cfg(test)] mod tests { - use test_log::test; - use ibc_proto::ibc::core::client::v1::MsgUpdateClient as RawMsgUpdateClient; + use test_log::test; - use crate::clients::ics07_tendermint::header::test_util::get_dummy_ics07_header; - use crate::core::ics02_client::msgs::MsgUpdateClient; - use crate::core::ics24_host::identifier::ClientId; - use crate::test_utils::get_dummy_account_id; + use crate::{ + clients::ics07_tendermint::header::test_util::get_dummy_ics07_header, + core::{ics02_client::msgs::MsgUpdateClient, ics24_host::identifier::ClientId}, + test_utils::get_dummy_account_id, + }; #[test] fn msg_update_client_serialization() { diff --git a/crates/relayer-types/src/core/ics02_client/msgs/upgrade_client.rs b/crates/relayer-types/src/core/ics02_client/msgs/upgrade_client.rs index 20fcf6ccc3..b0b50a0f0f 100644 --- a/crates/relayer-types/src/core/ics02_client/msgs/upgrade_client.rs +++ b/crates/relayer-types/src/core/ics02_client/msgs/upgrade_client.rs @@ -2,17 +2,24 @@ use std::str::FromStr; -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::core::client::v1::MsgUpgradeClient as RawMsgUpgradeClient; -use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof; -use ibc_proto::Protobuf; - -use crate::core::ics02_client::error::Error; -use crate::core::ics23_commitment::commitment::CommitmentProofBytes; -use crate::core::ics23_commitment::error::Error as Ics23Error; -use crate::core::ics24_host::identifier::ClientId; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use ibc_proto::{ + google::protobuf::Any, + ibc::core::{ + client::v1::MsgUpgradeClient as RawMsgUpgradeClient, + commitment::v1::MerkleProof as RawMerkleProof, + }, + Protobuf, +}; + +use crate::{ + core::{ + ics02_client::error::Error, + ics23_commitment::{commitment::CommitmentProofBytes, error::Error as Ics23Error}, + ics24_host::identifier::ClientId, + }, + signer::Signer, + tx_msg::Msg, +}; pub(crate) const TYPE_URL: &str = "/ibc.core.client.v1.MsgUpgradeClient"; @@ -117,6 +124,7 @@ impl TryFrom for MsgUpgradeClient { pub mod test_util { use ibc_proto::ibc::core::client::v1::MsgUpgradeClient as RawMsgUpgradeClient; + use super::MsgUpgradeClient; use crate::{ core::{ics02_client::height::Height, ics24_host::identifier::ClientId}, mock::{ @@ -125,8 +133,6 @@ pub mod test_util { test_utils::{get_dummy_bech32_account, get_dummy_proof}, }; - use super::MsgUpgradeClient; - /// Extends the implementation with additional helper methods. impl MsgUpgradeClient { /// Setter for `client_id`. Amenable to chaining, since it consumes the input message. diff --git a/crates/relayer-types/src/core/ics02_client/trust_threshold.rs b/crates/relayer-types/src/core/ics02_client/trust_threshold.rs index 55f095c4f7..682c8669a7 100644 --- a/crates/relayer-types/src/core/ics02_client/trust_threshold.rs +++ b/crates/relayer-types/src/core/ics02_client/trust_threshold.rs @@ -2,14 +2,15 @@ //! represented as a fraction with valid values in the //! range `[0, 1)`. -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str::FromStr; +use std::{ + convert::TryFrom, + fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, +}; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::lightclients::tendermint::v1::Fraction, Protobuf}; use num_rational::Ratio; use serde::{Deserialize, Serialize}; - -use ibc_proto::ibc::lightclients::tendermint::v1::Fraction; use tendermint::trust_threshold::TrustThresholdFraction; use crate::core::ics02_client::error::Error; @@ -160,9 +161,10 @@ impl<'de> Deserialize<'de> for TrustThreshold { where D: serde::Deserializer<'de>, { - use serde::de::{self, Visitor}; use std::fmt; + use serde::de::{self, Visitor}; + // This is a Visitor that forwards string types to T's `FromStr` impl and // forwards map types to T's `Deserialize` impl. The `PhantomData` is to // keep the compiler from complaining about T being an unused generic type @@ -212,9 +214,10 @@ fn string_or_int<'de, D>(deserializer: D) -> Result where D: serde::Deserializer<'de>, { - use serde::de::{self, Visitor}; use std::fmt; + use serde::de::{self, Visitor}; + struct StringOrInt; impl<'de> Visitor<'de> for StringOrInt { diff --git a/crates/relayer-types/src/core/ics03_connection/connection.rs b/crates/relayer-types/src/core/ics03_connection/connection.rs index d240eaf905..e6856efadc 100644 --- a/crates/relayer-types/src/core/ics03_connection/connection.rs +++ b/crates/relayer-types/src/core/ics03_connection/connection.rs @@ -1,26 +1,32 @@ -use std::str::FromStr; -use std::time::Duration; use std::{ fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, + time::Duration, u64, }; -use ibc_proto::Protobuf; +use ibc_proto::{ + ibc::core::connection::v1::{ + ConnectionEnd as RawConnectionEnd, Counterparty as RawCounterparty, + IdentifiedConnection as RawIdentifiedConnection, + }, + Protobuf, +}; use serde::{Deserialize, Serialize}; -use ibc_proto::ibc::core::connection::v1::{ - ConnectionEnd as RawConnectionEnd, Counterparty as RawCounterparty, - IdentifiedConnection as RawIdentifiedConnection, +use crate::{ + core::{ + ics02_client::error::Error as ClientError, + ics03_connection::{error::Error, version::Version}, + ics23_commitment::commitment::CommitmentPrefix, + ics24_host::{ + error::ValidationError, + identifier::{ClientId, ConnectionId}, + }, + }, + timestamp::ZERO_DURATION, }; -use crate::core::ics02_client::error::Error as ClientError; -use crate::core::ics03_connection::error::Error; -use crate::core::ics03_connection::version::Version; -use crate::core::ics23_commitment::commitment::CommitmentPrefix; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; -use crate::timestamp::ZERO_DURATION; - #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct IdentifiedConnectionEnd { pub connection_id: ConnectionId, diff --git a/crates/relayer-types/src/core/ics03_connection/error.rs b/crates/relayer-types/src/core/ics03_connection/error.rs index 068b3ee30a..f5bb0590a5 100644 --- a/crates/relayer-types/src/core/ics03_connection/error.rs +++ b/crates/relayer-types/src/core/ics03_connection/error.rs @@ -1,13 +1,19 @@ -use crate::core::ics02_client::error as client_error; -use crate::core::ics03_connection::version::Version; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; -use crate::proofs::ProofError; -use crate::signer::SignerError; -use crate::Height; - use flex_error::define_error; +use crate::{ + core::{ + ics02_client::error as client_error, + ics03_connection::version::Version, + ics24_host::{ + error::ValidationError, + identifier::{ClientId, ConnectionId}, + }, + }, + proofs::ProofError, + signer::SignerError, + Height, +}; + define_error! { #[derive(Debug, PartialEq, Eq)] Error { diff --git a/crates/relayer-types/src/core/ics03_connection/events.rs b/crates/relayer-types/src/core/ics03_connection/events.rs index 5fddc6cfad..06d5e21910 100644 --- a/crates/relayer-types/src/core/ics03_connection/events.rs +++ b/crates/relayer-types/src/core/ics03_connection/events.rs @@ -1,11 +1,14 @@ //! Types for the IBC events emitted from Tendermint Websocket by the connection module. -use serde_derive::{Deserialize, Serialize}; use std::fmt::{Display, Error as FmtError, Formatter}; + +use serde_derive::{Deserialize, Serialize}; use tendermint::abci; -use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; -use crate::events::{IbcEvent, IbcEventType}; +use crate::{ + core::ics24_host::identifier::{ClientId, ConnectionId}, + events::{IbcEvent, IbcEventType}, +}; /// The content of the `key` field for the attribute containing the connection identifier. pub const CONN_ID_ATTRIBUTE_KEY: &str = "connection_id"; diff --git a/crates/relayer-types/src/core/ics03_connection/msgs.rs b/crates/relayer-types/src/core/ics03_connection/msgs.rs index 74a6af44b9..c811278091 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs.rs @@ -12,10 +12,10 @@ //! Another difference to ICS3 specs is that each message comprises an additional field called //! `signer` which is specific to Cosmos-SDK. -use crate::core::ics03_connection::msgs::conn_open_ack::MsgConnectionOpenAck; -use crate::core::ics03_connection::msgs::conn_open_confirm::MsgConnectionOpenConfirm; -use crate::core::ics03_connection::msgs::conn_open_init::MsgConnectionOpenInit; -use crate::core::ics03_connection::msgs::conn_open_try::MsgConnectionOpenTry; +use crate::core::ics03_connection::msgs::{ + conn_open_ack::MsgConnectionOpenAck, conn_open_confirm::MsgConnectionOpenConfirm, + conn_open_init::MsgConnectionOpenInit, conn_open_try::MsgConnectionOpenTry, +}; pub mod conn_open_ack; pub mod conn_open_confirm; @@ -34,10 +34,11 @@ pub enum ConnectionMsg { #[cfg(test)] pub mod test_util { - use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; + use ibc_proto::ibc::core::{ + commitment::v1::MerklePrefix, connection::v1::Counterparty as RawCounterparty, + }; - use ibc_proto::ibc::core::commitment::v1::MerklePrefix; - use ibc_proto::ibc::core::connection::v1::Counterparty as RawCounterparty; + use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; pub fn get_dummy_raw_counterparty() -> RawCounterparty { RawCounterparty { diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs index ff8f03028b..2d602a7375 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_ack.rs @@ -1,15 +1,19 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck; -use ibc_proto::Protobuf; +use ibc_proto::{ + google::protobuf::Any, + ibc::core::connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck, Protobuf, +}; -use crate::core::ics03_connection::error::Error; -use crate::core::ics03_connection::version::Version; -use crate::core::ics23_commitment::commitment::CommitmentProofBytes; -use crate::core::ics24_host::identifier::ConnectionId; -use crate::proofs::{ConsensusProof, Proofs}; -use crate::signer::Signer; -use crate::tx_msg::Msg; -use crate::Height; +use crate::{ + core::{ + ics03_connection::{error::Error, version::Version}, + ics23_commitment::commitment::CommitmentProofBytes, + ics24_host::identifier::ConnectionId, + }, + proofs::{ConsensusProof, Proofs}, + signer::Signer, + tx_msg::Msg, + Height, +}; pub const TYPE_URL: &str = "/ibc.core.connection.v1.MsgConnectionOpenAck"; @@ -134,12 +138,14 @@ impl From for RawMsgConnectionOpenAck { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::client::v1::Height; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck; + use ibc_proto::ibc::core::{ + client::v1::Height, connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck, + }; - use crate::core::ics03_connection::version::Version; - use crate::core::ics24_host::identifier::ConnectionId; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; + use crate::{ + core::{ics03_connection::version::Version, ics24_host::identifier::ConnectionId}, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; pub fn get_dummy_raw_msg_conn_open_ack( proof_height: u64, @@ -170,13 +176,14 @@ pub mod test_util { #[cfg(test)] mod tests { + use ibc_proto::ibc::core::{ + client::v1::Height, connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck, + }; use test_log::test; - use ibc_proto::ibc::core::client::v1::Height; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck; - - use crate::core::ics03_connection::msgs::conn_open_ack::test_util::get_dummy_raw_msg_conn_open_ack; - use crate::core::ics03_connection::msgs::conn_open_ack::MsgConnectionOpenAck; + use crate::core::ics03_connection::msgs::conn_open_ack::{ + test_util::get_dummy_raw_msg_conn_open_ack, MsgConnectionOpenAck, + }; #[test] fn parse_connection_open_ack_msg() { diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs index c7b86b4b43..f6f98b2d18 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_confirm.rs @@ -1,12 +1,13 @@ -use ibc_proto::Protobuf; +use ibc_proto::{ + ibc::core::connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm, Protobuf, +}; -use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm; - -use crate::core::ics03_connection::error::Error; -use crate::core::ics24_host::identifier::ConnectionId; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{ + core::{ics03_connection::error::Error, ics24_host::identifier::ConnectionId}, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.connection.v1.MsgConnectionOpenConfirm"; @@ -77,8 +78,9 @@ impl From for RawMsgConnectionOpenConfirm { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::client::v1::Height; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm; + use ibc_proto::ibc::core::{ + client::v1::Height, connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm, + }; use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; @@ -98,13 +100,14 @@ pub mod test_util { #[cfg(test)] mod tests { + use ibc_proto::ibc::core::{ + client::v1::Height, connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm, + }; use test_log::test; - use ibc_proto::ibc::core::client::v1::Height; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenConfirm as RawMsgConnectionOpenConfirm; - - use crate::core::ics03_connection::msgs::conn_open_confirm::test_util::get_dummy_raw_msg_conn_open_confirm; - use crate::core::ics03_connection::msgs::conn_open_confirm::MsgConnectionOpenConfirm; + use crate::core::ics03_connection::msgs::conn_open_confirm::{ + test_util::get_dummy_raw_msg_conn_open_confirm, MsgConnectionOpenConfirm, + }; #[test] fn parse_connection_open_confirm_msg() { diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_init.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_init.rs index 4bdc6db6c2..6e069f4c0e 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_init.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_init.rs @@ -1,14 +1,17 @@ use std::time::Duration; -use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenInit as RawMsgConnectionOpenInit; -use ibc_proto::Protobuf; - -use crate::core::ics03_connection::connection::Counterparty; -use crate::core::ics03_connection::error::Error; -use crate::core::ics03_connection::version::Version; -use crate::core::ics24_host::identifier::ClientId; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use ibc_proto::{ + ibc::core::connection::v1::MsgConnectionOpenInit as RawMsgConnectionOpenInit, Protobuf, +}; + +use crate::{ + core::{ + ics03_connection::{connection::Counterparty, error::Error, version::Version}, + ics24_host::identifier::ClientId, + }, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.connection.v1.MsgConnectionOpenInit"; @@ -73,11 +76,18 @@ pub mod test_util { use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenInit as RawMsgConnectionOpenInit; - use crate::core::ics03_connection::msgs::conn_open_init::MsgConnectionOpenInit; - use crate::core::ics03_connection::msgs::test_util::get_dummy_raw_counterparty; - use crate::core::ics03_connection::version::Version; - use crate::core::ics24_host::identifier::ClientId; - use crate::test_utils::get_dummy_bech32_account; + use crate::{ + core::{ + ics03_connection::{ + msgs::{ + conn_open_init::MsgConnectionOpenInit, test_util::get_dummy_raw_counterparty, + }, + version::Version, + }, + ics24_host::identifier::ClientId, + }, + test_utils::get_dummy_bech32_account, + }; /// Extends the implementation with additional helper methods. impl MsgConnectionOpenInit { @@ -103,14 +113,16 @@ pub mod test_util { #[cfg(test)] mod tests { + use ibc_proto::ibc::core::connection::v1::{ + Counterparty as RawCounterparty, MsgConnectionOpenInit as RawMsgConnectionOpenInit, + }; use test_log::test; - use ibc_proto::ibc::core::connection::v1::Counterparty as RawCounterparty; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenInit as RawMsgConnectionOpenInit; - use super::MsgConnectionOpenInit; - use crate::core::ics03_connection::msgs::conn_open_init::test_util::get_dummy_raw_msg_conn_open_init; - use crate::core::ics03_connection::msgs::test_util::get_dummy_raw_counterparty; + use crate::core::ics03_connection::msgs::{ + conn_open_init::test_util::get_dummy_raw_msg_conn_open_init, + test_util::get_dummy_raw_counterparty, + }; #[test] fn parse_connection_open_init_msg() { diff --git a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs index bd7ce58751..58063aee72 100644 --- a/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs +++ b/crates/relayer-types/src/core/ics03_connection/msgs/conn_open_try.rs @@ -1,18 +1,21 @@ use std::{str::FromStr, time::Duration}; -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenTry as RawMsgConnectionOpenTry; -use ibc_proto::Protobuf; - -use crate::core::ics03_connection::connection::Counterparty; -use crate::core::ics03_connection::error::Error; -use crate::core::ics03_connection::version::Version; -use crate::core::ics23_commitment::commitment::CommitmentProofBytes; -use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; -use crate::proofs::{ConsensusProof, Proofs}; -use crate::signer::Signer; -use crate::tx_msg::Msg; -use crate::Height; +use ibc_proto::{ + google::protobuf::Any, + ibc::core::connection::v1::MsgConnectionOpenTry as RawMsgConnectionOpenTry, Protobuf, +}; + +use crate::{ + core::{ + ics03_connection::{connection::Counterparty, error::Error, version::Version}, + ics23_commitment::commitment::CommitmentProofBytes, + ics24_host::identifier::{ClientId, ConnectionId}, + }, + proofs::{ConsensusProof, Proofs}, + signer::Signer, + tx_msg::Msg, + Height, +}; pub const TYPE_URL: &str = "/ibc.core.connection.v1.MsgConnectionOpenTry"; @@ -166,14 +169,22 @@ impl From for RawMsgConnectionOpenTry { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::client::v1::Height; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenTry as RawMsgConnectionOpenTry; + use ibc_proto::ibc::core::{ + client::v1::Height, connection::v1::MsgConnectionOpenTry as RawMsgConnectionOpenTry, + }; - use crate::core::ics03_connection::msgs::conn_open_try::MsgConnectionOpenTry; - use crate::core::ics03_connection::msgs::test_util::get_dummy_raw_counterparty; - use crate::core::ics03_connection::version::get_compatible_versions; - use crate::core::ics24_host::identifier::{ClientId, ConnectionId}; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; + use crate::{ + core::{ + ics03_connection::{ + msgs::{ + conn_open_try::MsgConnectionOpenTry, test_util::get_dummy_raw_counterparty, + }, + version::get_compatible_versions, + }, + ics24_host::identifier::{ClientId, ConnectionId}, + }, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Testing-specific helper methods. impl MsgConnectionOpenTry { @@ -233,15 +244,18 @@ pub mod test_util { #[cfg(test)] mod tests { + use ibc_proto::ibc::core::{ + client::v1::Height, + connection::v1::{ + Counterparty as RawCounterparty, MsgConnectionOpenTry as RawMsgConnectionOpenTry, + }, + }; use test_log::test; - use ibc_proto::ibc::core::client::v1::Height; - use ibc_proto::ibc::core::connection::v1::Counterparty as RawCounterparty; - use ibc_proto::ibc::core::connection::v1::MsgConnectionOpenTry as RawMsgConnectionOpenTry; - - use crate::core::ics03_connection::msgs::conn_open_try::test_util::get_dummy_raw_msg_conn_open_try; - use crate::core::ics03_connection::msgs::conn_open_try::MsgConnectionOpenTry; - use crate::core::ics03_connection::msgs::test_util::get_dummy_raw_counterparty; + use crate::core::ics03_connection::msgs::{ + conn_open_try::{test_util::get_dummy_raw_msg_conn_open_try, MsgConnectionOpenTry}, + test_util::get_dummy_raw_counterparty, + }; #[test] fn parse_connection_open_try_msg() { diff --git a/crates/relayer-types/src/core/ics03_connection/version.rs b/crates/relayer-types/src/core/ics03_connection/version.rs index 108665d80e..c1bed7e360 100644 --- a/crates/relayer-types/src/core/ics03_connection/version.rs +++ b/crates/relayer-types/src/core/ics03_connection/version.rs @@ -1,13 +1,12 @@ use std::fmt::Display; -use crate::utils::pretty::PrettySlice; - -use ibc_proto::ibc::core::connection::v1::Version as RawVersion; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::core::connection::v1::Version as RawVersion, Protobuf}; use serde::{Deserialize, Serialize}; -use crate::core::ics03_connection::error::Error; -use crate::core::ics04_channel::channel::Ordering; +use crate::{ + core::{ics03_connection::error::Error, ics04_channel::channel::Ordering}, + utils::pretty::PrettySlice, +}; /// Stores the identifier and the features supported by a version #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -111,12 +110,13 @@ pub fn pick_version( #[cfg(test)] mod tests { - use test_log::test; - use ibc_proto::ibc::core::connection::v1::Version as RawVersion; + use test_log::test; - use crate::core::ics03_connection::error::Error; - use crate::core::ics03_connection::version::{get_compatible_versions, pick_version, Version}; + use crate::core::ics03_connection::{ + error::Error, + version::{get_compatible_versions, pick_version, Version}, + }; fn good_versions() -> Vec { vec![ diff --git a/crates/relayer-types/src/core/ics04_channel/channel.rs b/crates/relayer-types/src/core/ics04_channel/channel.rs index fa975a90e8..ed523d21a9 100644 --- a/crates/relayer-types/src/core/ics04_channel/channel.rs +++ b/crates/relayer-types/src/core/ics04_channel/channel.rs @@ -1,19 +1,25 @@ -use crate::utils::pretty::PrettySlice; - -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str::FromStr; +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, +}; -use ibc_proto::Protobuf; +use ibc_proto::{ + ibc::core::channel::v1::{ + Channel as RawChannel, Counterparty as RawCounterparty, + IdentifiedChannel as RawIdentifiedChannel, + }, + Protobuf, +}; use serde::{Deserialize, Serialize}; -use ibc_proto::ibc::core::channel::v1::{ - Channel as RawChannel, Counterparty as RawCounterparty, - IdentifiedChannel as RawIdentifiedChannel, +use crate::{ + core::{ + ics04_channel::{error::Error, version::Version}, + ics24_host::identifier::{ChannelId, ConnectionId, PortId}, + }, + utils::pretty::PrettySlice, }; -use crate::core::ics04_channel::{error::Error, version::Version}; -use crate::core::ics24_host::identifier::{ChannelId, ConnectionId, PortId}; - #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct IdentifiedChannelEnd { pub port_id: PortId, @@ -445,10 +451,11 @@ impl Display for State { #[cfg(test)] pub mod test_util { - use crate::core::ics24_host::identifier::{ChannelId, ConnectionId, PortId}; + use ibc_proto::ibc::core::channel::v1::{ + Channel as RawChannel, Counterparty as RawCounterparty, + }; - use ibc_proto::ibc::core::channel::v1::Channel as RawChannel; - use ibc_proto::ibc::core::channel::v1::Counterparty as RawCounterparty; + use crate::core::ics24_host::identifier::{ChannelId, ConnectionId, PortId}; /// Returns a dummy `RawCounterparty`, for testing only! /// Can be optionally parametrized with a specific channel identifier. @@ -476,12 +483,11 @@ pub mod test_util { mod tests { use core::str::FromStr; - use test_log::test; use ibc_proto::ibc::core::channel::v1::Channel as RawChannel; + use test_log::test; - use crate::core::ics04_channel::channel::test_util::get_dummy_raw_channel_end; - use crate::core::ics04_channel::channel::ChannelEnd; + use crate::core::ics04_channel::channel::{test_util::get_dummy_raw_channel_end, ChannelEnd}; #[test] fn channel_end_try_from_raw() { diff --git a/crates/relayer-types/src/core/ics04_channel/error.rs b/crates/relayer-types/src/core/ics04_channel/error.rs index 49fe8c77e9..2e65663f2f 100644 --- a/crates/relayer-types/src/core/ics04_channel/error.rs +++ b/crates/relayer-types/src/core/ics04_channel/error.rs @@ -1,19 +1,23 @@ -use super::packet::Sequence; -use super::timeout::TimeoutHeight; -use crate::core::ics02_client::error as client_error; -use crate::core::ics03_connection::error as connection_error; -use crate::core::ics04_channel::channel::State; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}; - -use crate::proofs::ProofError; -use crate::signer::SignerError; -use crate::timestamp::Timestamp; -use crate::Height; - use flex_error::{define_error, TraceError}; use tendermint_proto::Error as TendermintError; +use super::{packet::Sequence, timeout::TimeoutHeight}; +use crate::{ + core::{ + ics02_client::error as client_error, + ics03_connection::error as connection_error, + ics04_channel::channel::State, + ics24_host::{ + error::ValidationError, + identifier::{ChannelId, ClientId, ConnectionId, PortId}, + }, + }, + proofs::ProofError, + signer::SignerError, + timestamp::Timestamp, + Height, +}; + define_error! { #[derive(Debug, PartialEq, Eq)] Error { diff --git a/crates/relayer-types/src/core/ics04_channel/events.rs b/crates/relayer-types/src/core/ics04_channel/events.rs index 24dd66dceb..9471211b16 100644 --- a/crates/relayer-types/src/core/ics04_channel/events.rs +++ b/crates/relayer-types/src/core/ics04_channel/events.rs @@ -1,17 +1,21 @@ //! Types for the IBC events emitted from Tendermint Websocket by the channels module. -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str; +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + str, +}; use serde_derive::{Deserialize, Serialize}; use tendermint::abci; -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::packet::Packet; -use crate::core::ics24_host::identifier::{ChannelId, ConnectionId, PortId}; -use crate::events::{Error as EventError, IbcEvent, IbcEventType}; - -use crate::utils::pretty::PrettySlice; +use crate::{ + core::{ + ics04_channel::{error::Error, packet::Packet}, + ics24_host::identifier::{ChannelId, ConnectionId, PortId}, + }, + events::{Error as EventError, IbcEvent, IbcEventType}, + utils::pretty::PrettySlice, +}; /// Channel event attribute keys pub const CONNECTION_ID_ATTRIBUTE_KEY: &str = "connection_id"; diff --git a/crates/relayer-types/src/core/ics04_channel/msgs.rs b/crates/relayer-types/src/core/ics04_channel/msgs.rs index c69f2e267f..a4d0b97222 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs.rs @@ -1,16 +1,13 @@ //! Message definitions for all ICS4 domain types: channel open & close handshake datagrams, as well //! as packets. -use crate::core::ics04_channel::msgs::acknowledgement::MsgAcknowledgement; -use crate::core::ics04_channel::msgs::chan_close_confirm::MsgChannelCloseConfirm; -use crate::core::ics04_channel::msgs::chan_close_init::MsgChannelCloseInit; -use crate::core::ics04_channel::msgs::chan_open_ack::MsgChannelOpenAck; -use crate::core::ics04_channel::msgs::chan_open_confirm::MsgChannelOpenConfirm; -use crate::core::ics04_channel::msgs::chan_open_init::MsgChannelOpenInit; -use crate::core::ics04_channel::msgs::chan_open_try::MsgChannelOpenTry; -use crate::core::ics04_channel::msgs::recv_packet::MsgRecvPacket; -use crate::core::ics04_channel::msgs::timeout::MsgTimeout; -use crate::core::ics04_channel::msgs::timeout_on_close::MsgTimeoutOnClose; +use crate::core::ics04_channel::msgs::{ + acknowledgement::MsgAcknowledgement, chan_close_confirm::MsgChannelCloseConfirm, + chan_close_init::MsgChannelCloseInit, chan_open_ack::MsgChannelOpenAck, + chan_open_confirm::MsgChannelOpenConfirm, chan_open_init::MsgChannelOpenInit, + chan_open_try::MsgChannelOpenTry, recv_packet::MsgRecvPacket, timeout::MsgTimeout, + timeout_on_close::MsgTimeoutOnClose, +}; // Opening handshake messages. pub mod chan_open_ack; diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs b/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs index 421342837d..7d81455c33 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/acknowledgement.rs @@ -1,12 +1,12 @@ use derive_more::{From, Into}; -use ibc_proto::ibc::core::channel::v1::MsgAcknowledgement as RawMsgAcknowledgement; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::core::channel::v1::MsgAcknowledgement as RawMsgAcknowledgement, Protobuf}; -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::packet::Packet; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{ + core::ics04_channel::{error::Error, packet::Packet}, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgAcknowledgement"; @@ -122,12 +122,15 @@ impl From for RawMsgAcknowledgement { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgAcknowledgement as RawMsgAcknowledgement; - use ibc_proto::ibc::core::channel::v1::Packet as RawPacket; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; + use ibc_proto::ibc::core::{ + channel::v1::{MsgAcknowledgement as RawMsgAcknowledgement, Packet as RawPacket}, + client::v1::Height as RawHeight, + }; - use crate::core::ics04_channel::packet::test_utils::get_dummy_raw_packet; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; + use crate::{ + core::ics04_channel::packet::test_utils::get_dummy_raw_packet, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgAcknowledgement`, for testing only! /// The `height` parametrizes both the proof height as well as the timeout height. @@ -155,14 +158,18 @@ pub mod test_util { #[cfg(test)] mod test { - use test_log::test; - use ibc_proto::ibc::core::channel::v1::MsgAcknowledgement as RawMsgAcknowledgement; + use test_log::test; - use crate::core::ics04_channel::error::Error; - use crate::core::ics04_channel::msgs::acknowledgement::test_util::get_dummy_raw_msg_acknowledgement; - use crate::core::ics04_channel::msgs::acknowledgement::MsgAcknowledgement; - use crate::test_utils::get_dummy_bech32_account; + use crate::{ + core::ics04_channel::{ + error::Error, + msgs::acknowledgement::{ + test_util::get_dummy_raw_msg_acknowledgement, MsgAcknowledgement, + }, + }, + test_utils::get_dummy_bech32_account, + }; #[test] fn msg_acknowledgment_try_from_raw() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs index 33b4873899..672b6281c0 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_confirm.rs @@ -1,12 +1,16 @@ -use ibc_proto::Protobuf; - -use ibc_proto::ibc::core::channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm; - -use crate::core::ics04_channel::error::Error; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use ibc_proto::{ + ibc::core::channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm, Protobuf, +}; + +use crate::{ + core::{ + ics04_channel::error::Error, + ics24_host::identifier::{ChannelId, PortId}, + }, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgChannelCloseConfirm"; @@ -96,11 +100,14 @@ impl From for RawMsgChannelCloseConfirm { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm; - use ibc_proto::ibc::core::client::v1::Height; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm, client::v1::Height, + }; - use crate::core::ics24_host::identifier::{ChannelId, PortId}; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; + use crate::{ + core::ics24_host::identifier::{ChannelId, PortId}, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgChannelCloseConfirm`, for testing only! pub fn get_dummy_raw_msg_chan_close_confirm(proof_height: u64) -> RawMsgChannelCloseConfirm { @@ -121,11 +128,13 @@ pub mod test_util { #[cfg(test)] mod tests { - use ibc_proto::ibc::core::channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm; - use ibc_proto::ibc::core::client::v1::Height; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelCloseConfirm as RawMsgChannelCloseConfirm, client::v1::Height, + }; - use crate::core::ics04_channel::msgs::chan_close_confirm::test_util::get_dummy_raw_msg_chan_close_confirm; - use crate::core::ics04_channel::msgs::chan_close_confirm::MsgChannelCloseConfirm; + use crate::core::ics04_channel::msgs::chan_close_confirm::{ + test_util::get_dummy_raw_msg_chan_close_confirm, MsgChannelCloseConfirm, + }; #[test] fn parse_channel_close_confirm_msg() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_init.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_init.rs index 9e249d6137..f432e5d8fc 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_init.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_close_init.rs @@ -1,11 +1,13 @@ -use ibc_proto::Protobuf; +use ibc_proto::{ibc::core::channel::v1::MsgChannelCloseInit as RawMsgChannelCloseInit, Protobuf}; -use ibc_proto::ibc::core::channel::v1::MsgChannelCloseInit as RawMsgChannelCloseInit; - -use crate::core::ics04_channel::error::Error; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{ + core::{ + ics04_channel::error::Error, + ics24_host::identifier::{ChannelId, PortId}, + }, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgChannelCloseInit"; @@ -71,8 +73,10 @@ pub mod test_util { use ibc_proto::ibc::core::channel::v1::MsgChannelCloseInit as RawMsgChannelCloseInit; - use crate::core::ics24_host::identifier::{ChannelId, PortId}; - use crate::test_utils::get_dummy_bech32_account; + use crate::{ + core::ics24_host::identifier::{ChannelId, PortId}, + test_utils::get_dummy_bech32_account, + }; /// Returns a dummy `RawMsgChannelCloseInit`, for testing only! pub fn get_dummy_raw_msg_chan_close_init() -> RawMsgChannelCloseInit { @@ -87,12 +91,12 @@ pub mod test_util { #[cfg(test)] mod tests { - use test_log::test; - use ibc_proto::ibc::core::channel::v1::MsgChannelCloseInit as RawMsgChannelCloseInit; + use test_log::test; - use crate::core::ics04_channel::msgs::chan_close_init::test_util::get_dummy_raw_msg_chan_close_init; - use crate::core::ics04_channel::msgs::chan_close_init::MsgChannelCloseInit; + use crate::core::ics04_channel::msgs::chan_close_init::{ + test_util::get_dummy_raw_msg_chan_close_init, MsgChannelCloseInit, + }; #[test] fn parse_channel_close_init_msg() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs index 895ff7d204..e160657bd1 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_ack.rs @@ -1,13 +1,14 @@ -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::version::Version; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; +use ibc_proto::{ibc::core::channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck, Protobuf}; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; - -use ibc_proto::ibc::core::channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck; -use ibc_proto::Protobuf; +use crate::{ + core::{ + ics04_channel::{error::Error, version::Version}, + ics24_host::identifier::{ChannelId, PortId}, + }, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgChannelOpenAck"; @@ -107,11 +108,14 @@ impl From for RawMsgChannelOpenAck { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck, client::v1::Height, + }; - use crate::core::ics24_host::identifier::{ChannelId, PortId}; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; - use ibc_proto::ibc::core::client::v1::Height; + use crate::{ + core::ics24_host::identifier::{ChannelId, PortId}, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgChannelOpenAck`, for testing only! pub fn get_dummy_raw_msg_chan_open_ack(proof_height: u64) -> RawMsgChannelOpenAck { @@ -133,13 +137,14 @@ pub mod test_util { #[cfg(test)] mod tests { - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelOpenAck as RawMsgChannelOpenAck, client::v1::Height, + }; use test_log::test; - use crate::core::ics04_channel::msgs::chan_open_ack::test_util::get_dummy_raw_msg_chan_open_ack; - use crate::core::ics04_channel::msgs::chan_open_ack::MsgChannelOpenAck; - - use ibc_proto::ibc::core::client::v1::Height; + use crate::core::ics04_channel::msgs::chan_open_ack::{ + test_util::get_dummy_raw_msg_chan_open_ack, MsgChannelOpenAck, + }; #[test] fn parse_channel_open_ack_msg() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs index 627f320698..733a50808f 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_confirm.rs @@ -1,12 +1,16 @@ -use crate::core::ics04_channel::error::Error; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; - -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; - -use ibc_proto::ibc::core::channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm; -use ibc_proto::Protobuf; +use ibc_proto::{ + ibc::core::channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm, Protobuf, +}; + +use crate::{ + core::{ + ics04_channel::error::Error, + ics24_host::identifier::{ChannelId, PortId}, + }, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgChannelOpenConfirm"; @@ -89,11 +93,14 @@ impl From for RawMsgChannelOpenConfirm { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm, client::v1::Height, + }; - use crate::core::ics24_host::identifier::{ChannelId, PortId}; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; - use ibc_proto::ibc::core::client::v1::Height; + use crate::{ + core::ics24_host::identifier::{ChannelId, PortId}, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgChannelOpenConfirm`, for testing only! pub fn get_dummy_raw_msg_chan_open_confirm(proof_height: u64) -> RawMsgChannelOpenConfirm { @@ -113,13 +120,14 @@ pub mod test_util { #[cfg(test)] mod tests { - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelOpenConfirm as RawMsgChannelOpenConfirm, client::v1::Height, + }; use test_log::test; - use crate::core::ics04_channel::msgs::chan_open_confirm::test_util::get_dummy_raw_msg_chan_open_confirm; - use crate::core::ics04_channel::msgs::chan_open_confirm::MsgChannelOpenConfirm; - - use ibc_proto::ibc::core::client::v1::Height; + use crate::core::ics04_channel::msgs::chan_open_confirm::{ + test_util::get_dummy_raw_msg_chan_open_confirm, MsgChannelOpenConfirm, + }; #[test] fn parse_channel_open_confirm_msg() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_init.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_init.rs index 8128674f24..479152bba2 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_init.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_init.rs @@ -1,12 +1,13 @@ -use crate::core::ics04_channel::channel::ChannelEnd; -use crate::core::ics04_channel::error::Error; -use crate::core::ics24_host::identifier::PortId; +use ibc_proto::{ibc::core::channel::v1::MsgChannelOpenInit as RawMsgChannelOpenInit, Protobuf}; -use crate::signer::Signer; -use crate::tx_msg::Msg; - -use ibc_proto::ibc::core::channel::v1::MsgChannelOpenInit as RawMsgChannelOpenInit; -use ibc_proto::Protobuf; +use crate::{ + core::{ + ics04_channel::{channel::ChannelEnd, error::Error}, + ics24_host::identifier::PortId, + }, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgChannelOpenInit"; @@ -75,9 +76,13 @@ pub mod test_util { use ibc_proto::ibc::core::channel::v1::MsgChannelOpenInit as RawMsgChannelOpenInit; - use crate::core::ics04_channel::channel::test_util::get_dummy_raw_channel_end; - use crate::core::ics24_host::identifier::PortId; - use crate::test_utils::get_dummy_bech32_account; + use crate::{ + core::{ + ics04_channel::channel::test_util::get_dummy_raw_channel_end, + ics24_host::identifier::PortId, + }, + test_utils::get_dummy_bech32_account, + }; /// Returns a dummy `RawMsgChannelOpenInit`, for testing only! pub fn get_dummy_raw_msg_chan_open_init() -> RawMsgChannelOpenInit { @@ -91,12 +96,13 @@ pub mod test_util { #[cfg(test)] mod tests { - use crate::core::ics04_channel::msgs::chan_open_init::test_util::get_dummy_raw_msg_chan_open_init; - use crate::core::ics04_channel::msgs::chan_open_init::MsgChannelOpenInit; - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenInit as RawMsgChannelOpenInit; use test_log::test; + use crate::core::ics04_channel::msgs::chan_open_init::{ + test_util::get_dummy_raw_msg_chan_open_init, MsgChannelOpenInit, + }; + #[test] fn channel_open_init_from_raw() { struct Test { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs index 597204e5ec..db1d394a28 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/chan_open_try.rs @@ -1,17 +1,19 @@ -use crate::core::ics04_channel::channel::ChannelEnd; -use crate::core::ics04_channel::error::Error as ChannelError; -use crate::core::ics04_channel::version::Version; -use crate::core::ics24_host::error::ValidationError; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; - -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use core::str::FromStr; -use ibc_proto::ibc::core::channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::core::channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry, Protobuf}; -use core::str::FromStr; +use crate::{ + core::{ + ics04_channel::{channel::ChannelEnd, error::Error as ChannelError, version::Version}, + ics24_host::{ + error::ValidationError, + identifier::{ChannelId, PortId}, + }, + }, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgChannelOpenTry"; @@ -136,12 +138,17 @@ impl From for RawMsgChannelOpenTry { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry, client::v1::Height, + }; - use crate::core::ics04_channel::channel::test_util::get_dummy_raw_channel_end; - use crate::core::ics24_host::identifier::{ChannelId, PortId}; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; - use ibc_proto::ibc::core::client::v1::Height; + use crate::{ + core::{ + ics04_channel::channel::test_util::get_dummy_raw_channel_end, + ics24_host::identifier::{ChannelId, PortId}, + }, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgChannelOpenTry`, for testing only! #[allow(deprecated)] @@ -163,13 +170,15 @@ pub mod test_util { #[cfg(test)] mod tests { - use crate::core::ics04_channel::msgs::chan_open_try::test_util::get_dummy_raw_msg_chan_open_try; - use crate::core::ics04_channel::msgs::chan_open_try::MsgChannelOpenTry; - - use ibc_proto::ibc::core::channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry; - use ibc_proto::ibc::core::client::v1::Height; + use ibc_proto::ibc::core::{ + channel::v1::MsgChannelOpenTry as RawMsgChannelOpenTry, client::v1::Height, + }; use test_log::test; + use crate::core::ics04_channel::msgs::chan_open_try::{ + test_util::get_dummy_raw_msg_chan_open_try, MsgChannelOpenTry, + }; + #[test] #[allow(deprecated)] fn channel_open_try_from_raw() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs b/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs index 6d3472c4ef..e3b595cf76 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/recv_packet.rs @@ -1,12 +1,11 @@ -use ibc_proto::Protobuf; +use ibc_proto::{ibc::core::channel::v1::MsgRecvPacket as RawMsgRecvPacket, Protobuf}; -use ibc_proto::ibc::core::channel::v1::MsgRecvPacket as RawMsgRecvPacket; - -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::packet::Packet; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use crate::{ + core::ics04_channel::{error::Error, packet::Packet}, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgRecvPacket"; @@ -89,14 +88,17 @@ impl From for RawMsgRecvPacket { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgRecvPacket as RawMsgRecvPacket; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; + use core::{ops::Add, time::Duration}; + + use ibc_proto::ibc::core::{ + channel::v1::MsgRecvPacket as RawMsgRecvPacket, client::v1::Height as RawHeight, + }; - use crate::core::ics04_channel::packet::test_utils::get_dummy_raw_packet; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; - use crate::timestamp::Timestamp; - use core::ops::Add; - use core::time::Duration; + use crate::{ + core::ics04_channel::packet::test_utils::get_dummy_raw_packet, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + timestamp::Timestamp, + }; /// Returns a dummy `RawMsgRecvPacket`, for testing only! The `height` parametrizes both the /// proof height as well as the timeout height. @@ -120,14 +122,16 @@ pub mod test_util { #[cfg(test)] mod test { - use test_log::test; - use ibc_proto::ibc::core::channel::v1::MsgRecvPacket as RawMsgRecvPacket; + use test_log::test; - use crate::core::ics04_channel::error::Error; - use crate::core::ics04_channel::msgs::recv_packet::test_util::get_dummy_raw_msg_recv_packet; - use crate::core::ics04_channel::msgs::recv_packet::MsgRecvPacket; - use crate::test_utils::get_dummy_bech32_account; + use crate::{ + core::ics04_channel::{ + error::Error, + msgs::recv_packet::{test_util::get_dummy_raw_msg_recv_packet, MsgRecvPacket}, + }, + test_utils::get_dummy_bech32_account, + }; #[test] fn msg_recv_packet_try_from_raw() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs b/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs index 7407bb9908..56348b1f23 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/timeout.rs @@ -1,12 +1,14 @@ -use ibc_proto::Protobuf; - -use ibc_proto::ibc::core::channel::v1::MsgTimeout as RawMsgTimeout; - -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::packet::{Packet, Sequence}; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use ibc_proto::{ibc::core::channel::v1::MsgTimeout as RawMsgTimeout, Protobuf}; + +use crate::{ + core::ics04_channel::{ + error::Error, + packet::{Packet, Sequence}, + }, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgTimeout"; @@ -100,11 +102,14 @@ impl From for RawMsgTimeout { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgTimeout as RawMsgTimeout; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; + use ibc_proto::ibc::core::{ + channel::v1::MsgTimeout as RawMsgTimeout, client::v1::Height as RawHeight, + }; - use crate::core::ics04_channel::packet::test_utils::get_dummy_raw_packet; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; + use crate::{ + core::ics04_channel::packet::test_utils::get_dummy_raw_packet, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgTimeout`, for testing only! /// The `height` parametrizes both the proof height as well as the timeout height. @@ -129,14 +134,16 @@ pub mod test_util { #[cfg(test)] mod test { - use test_log::test; - use ibc_proto::ibc::core::channel::v1::MsgTimeout as RawMsgTimeout; + use test_log::test; - use crate::core::ics04_channel::error::Error; - use crate::core::ics04_channel::msgs::timeout::test_util::get_dummy_raw_msg_timeout; - use crate::core::ics04_channel::msgs::timeout::MsgTimeout; - use crate::test_utils::get_dummy_bech32_account; + use crate::{ + core::ics04_channel::{ + error::Error, + msgs::timeout::{test_util::get_dummy_raw_msg_timeout, MsgTimeout}, + }, + test_utils::get_dummy_bech32_account, + }; #[test] fn msg_timeout_try_from_raw() { diff --git a/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs b/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs index 57e1cdacae..9a76eb9270 100644 --- a/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs +++ b/crates/relayer-types/src/core/ics04_channel/msgs/timeout_on_close.rs @@ -1,11 +1,14 @@ -use ibc_proto::ibc::core::channel::v1::MsgTimeoutOnClose as RawMsgTimeoutOnClose; -use ibc_proto::Protobuf; - -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::packet::{Packet, Sequence}; -use crate::proofs::Proofs; -use crate::signer::Signer; -use crate::tx_msg::Msg; +use ibc_proto::{ibc::core::channel::v1::MsgTimeoutOnClose as RawMsgTimeoutOnClose, Protobuf}; + +use crate::{ + core::ics04_channel::{ + error::Error, + packet::{Packet, Sequence}, + }, + proofs::Proofs, + signer::Signer, + tx_msg::Msg, +}; pub const TYPE_URL: &str = "/ibc.core.channel.v1.MsgTimeoutOnClose"; @@ -116,8 +119,9 @@ mod tests { use ibc_proto::ibc::core::channel::v1::MsgTimeoutOnClose as RawMsgTimeoutOnClose; use test_log::test; - use crate::core::ics04_channel::msgs::timeout_on_close::test_util::get_dummy_raw_msg_timeout_on_close; - use crate::core::ics04_channel::msgs::timeout_on_close::MsgTimeoutOnClose; + use crate::core::ics04_channel::msgs::timeout_on_close::{ + test_util::get_dummy_raw_msg_timeout_on_close, MsgTimeoutOnClose, + }; #[test] fn msg_timeout_on_close_try_from_raw() { @@ -199,11 +203,14 @@ mod tests { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::channel::v1::MsgTimeoutOnClose as RawMsgTimeoutOnClose; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; - - use crate::core::ics04_channel::packet::test_utils::get_dummy_raw_packet; - use crate::test_utils::{get_dummy_bech32_account, get_dummy_proof}; + use ibc_proto::ibc::core::{ + channel::v1::MsgTimeoutOnClose as RawMsgTimeoutOnClose, client::v1::Height as RawHeight, + }; + + use crate::{ + core::ics04_channel::packet::test_utils::get_dummy_raw_packet, + test_utils::{get_dummy_bech32_account, get_dummy_proof}, + }; /// Returns a dummy `RawMsgTimeoutOnClose`, for testing only! /// The `height` parametrizes both the proof height as well as the timeout height. diff --git a/crates/relayer-types/src/core/ics04_channel/packet.rs b/crates/relayer-types/src/core/ics04_channel/packet.rs index 316227c08f..bb3fad0869 100644 --- a/crates/relayer-types/src/core/ics04_channel/packet.rs +++ b/crates/relayer-types/src/core/ics04_channel/packet.rs @@ -1,14 +1,17 @@ use std::str::FromStr; -use serde_derive::{Deserialize, Serialize}; - use ibc_proto::ibc::core::channel::v1::Packet as RawPacket; +use serde_derive::{Deserialize, Serialize}; use super::timeout::TimeoutHeight; -use crate::core::ics04_channel::error::Error; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; -use crate::timestamp::{Expiry::Expired, Timestamp}; -use crate::Height; +use crate::{ + core::{ + ics04_channel::error::Error, + ics24_host::identifier::{ChannelId, PortId}, + }, + timestamp::{Expiry::Expired, Timestamp}, + Height, +}; /// Enumeration of proof carrying ICS4 message, helper for relayer. #[derive(Clone, Debug, PartialEq, Eq)] @@ -273,8 +276,7 @@ impl From for RawPacket { #[cfg(test)] pub mod test_utils { - use ibc_proto::ibc::core::channel::v1::Packet as RawPacket; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; + use ibc_proto::ibc::core::{channel::v1::Packet as RawPacket, client::v1::Height as RawHeight}; use crate::core::ics24_host::identifier::{ChannelId, PortId}; @@ -299,13 +301,10 @@ pub mod test_utils { #[cfg(test)] mod tests { + use ibc_proto::ibc::core::{channel::v1::Packet as RawPacket, client::v1::Height as RawHeight}; use test_log::test; - use ibc_proto::ibc::core::channel::v1::Packet as RawPacket; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; - - use crate::core::ics04_channel::packet::test_utils::get_dummy_raw_packet; - use crate::core::ics04_channel::packet::Packet; + use crate::core::ics04_channel::packet::{test_utils::get_dummy_raw_packet, Packet}; #[test] fn packet_try_from_raw() { diff --git a/crates/relayer-types/src/core/ics04_channel/packet_id.rs b/crates/relayer-types/src/core/ics04_channel/packet_id.rs index f55d2aa2cc..e998811cdf 100644 --- a/crates/relayer-types/src/core/ics04_channel/packet_id.rs +++ b/crates/relayer-types/src/core/ics04_channel/packet_id.rs @@ -1,9 +1,11 @@ +use std::{convert::TryFrom, str::FromStr}; + use ibc_proto::ibc::core::channel::v1::PacketId as ProtoPacketId; -use std::str::FromStr; -use crate::core::ics04_channel::error::Error; -use crate::core::ics04_channel::packet::Sequence; -use crate::core::ics24_host::identifier::{ChannelId, PortId}; +use crate::core::{ + ics04_channel::{error::Error, packet::Sequence}, + ics24_host::identifier::{ChannelId, PortId}, +}; #[derive(Debug, Clone)] pub struct PacketId { diff --git a/crates/relayer-types/src/core/ics04_channel/timeout.rs b/crates/relayer-types/src/core/ics04_channel/timeout.rs index aa33ec23b1..d1579ca828 100644 --- a/crates/relayer-types/src/core/ics04_channel/timeout.rs +++ b/crates/relayer-types/src/core/ics04_channel/timeout.rs @@ -1,8 +1,7 @@ use std::fmt::{Display, Error as FmtError, Formatter}; -use serde::{Deserialize, Serialize}; - use ibc_proto::ibc::core::client::v1::Height as RawHeight; +use serde::{Deserialize, Serialize}; use crate::core::ics02_client::{error::Error as ICS2Error, height::Height}; diff --git a/crates/relayer-types/src/core/ics04_channel/version.rs b/crates/relayer-types/src/core/ics04_channel/version.rs index 4d15ae3d4b..e584f2bec9 100644 --- a/crates/relayer-types/src/core/ics04_channel/version.rs +++ b/crates/relayer-types/src/core/ics04_channel/version.rs @@ -2,11 +2,14 @@ //! version field of a channel end. //! +use std::{ + convert::Infallible, + fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, +}; + use serde_derive::{Deserialize, Serialize}; use serde_json as json; -use std::convert::Infallible; -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str::FromStr; use crate::applications::transfer; diff --git a/crates/relayer-types/src/core/ics23_commitment/commitment.rs b/crates/relayer-types/src/core/ics23_commitment/commitment.rs index 7a6cee11e9..9fe5d555e2 100644 --- a/crates/relayer-types/src/core/ics23_commitment/commitment.rs +++ b/crates/relayer-types/src/core/ics23_commitment/commitment.rs @@ -1,14 +1,11 @@ -use serde::{Deserialize, Serialize}; -use std::fmt; -use subtle_encoding::{Encoding, Hex}; +use std::{convert::TryFrom, fmt}; use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof; +use serde::{Deserialize, Serialize}; +use subtle_encoding::{Encoding, Hex}; -use crate::proofs::ProofError; -use crate::tx_msg::encode_message; - -use super::error::Error; -use super::merkle::MerkleProof; +use super::{error::Error, merkle::MerkleProof}; +use crate::{proofs::ProofError, tx_msg::encode_message}; #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(transparent)] @@ -173,8 +170,9 @@ impl Serialize for CommitmentPrefix { #[cfg(test)] pub mod test_util { - use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof; - use ibc_proto::ics23::CommitmentProof; + use ibc_proto::{ + ibc::core::commitment::v1::MerkleProof as RawMerkleProof, ics23::CommitmentProof, + }; /// Returns a dummy `RawMerkleProof`, for testing only! pub fn get_dummy_merkle_proof() -> RawMerkleProof { diff --git a/crates/relayer-types/src/core/ics23_commitment/merkle.rs b/crates/relayer-types/src/core/ics23_commitment/merkle.rs index 229c8c0c7b..0b34fa29a4 100644 --- a/crates/relayer-types/src/core/ics23_commitment/merkle.rs +++ b/crates/relayer-types/src/core/ics23_commitment/merkle.rs @@ -1,17 +1,15 @@ -use tendermint::merkle::proof::ProofOps as TendermintProof; - -use ibc_proto::ibc::core::commitment::v1::MerklePath; -use ibc_proto::ibc::core::commitment::v1::MerkleProof as RawMerkleProof; -use ibc_proto::ibc::core::commitment::v1::MerkleRoot; -use ics23::commitment_proof::Proof; +use ibc_proto::ibc::core::commitment::v1::{MerklePath, MerkleProof as RawMerkleProof, MerkleRoot}; use ics23::{ - calculate_existence_root, verify_membership, verify_non_membership, CommitmentProof, - NonExistenceProof, + calculate_existence_root, commitment_proof::Proof, verify_membership, verify_non_membership, + CommitmentProof, NonExistenceProof, }; +use tendermint::merkle::proof::ProofOps as TendermintProof; -use crate::core::ics23_commitment::commitment::{CommitmentPrefix, CommitmentRoot}; -use crate::core::ics23_commitment::error::Error; -use crate::core::ics23_commitment::specs::ProofSpecs; +use crate::core::ics23_commitment::{ + commitment::{CommitmentPrefix, CommitmentRoot}, + error::Error, + specs::ProofSpecs, +}; pub fn apply_prefix(prefix: &CommitmentPrefix, mut path: Vec) -> MerklePath { let mut key_path: Vec = vec![format!("{prefix:?}")]; diff --git a/crates/relayer-types/src/core/ics24_host/identifier.rs b/crates/relayer-types/src/core/ics24_host/identifier.rs index bba663db3f..e1ab7113d3 100644 --- a/crates/relayer-types/src/core/ics24_host/identifier.rs +++ b/crates/relayer-types/src/core/ics24_host/identifier.rs @@ -1,14 +1,14 @@ -use std::convert::Infallible; -use std::fmt::{Debug, Display, Error as FmtError, Formatter}; -use std::str::FromStr; +use std::{ + convert::{From, Infallible}, + fmt::{Debug, Display, Error as FmtError, Formatter}, + str::FromStr, +}; use regex::Regex; use serde::{Deserialize, Serialize}; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics24_host::error::ValidationError; - use super::validate::*; +use crate::core::{ics02_client::client_type::ClientType, ics24_host::error::ValidationError}; /// This type is subject to future changes. /// diff --git a/crates/relayer-types/src/core/ics24_host/path.rs b/crates/relayer-types/src/core/ics24_host/path.rs index 321549795f..492f9cd8d1 100644 --- a/crates/relayer-types/src/core/ics24_host/path.rs +++ b/crates/relayer-types/src/core/ics24_host/path.rs @@ -4,12 +4,14 @@ /// use std::str::FromStr; -use crate::core::ics04_channel::packet::Sequence; -use crate::core::ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}; - use derive_more::{Display, From}; use flex_error::define_error; +use crate::core::{ + ics04_channel::packet::Sequence, + ics24_host::identifier::{ChannelId, ClientId, ConnectionId, PortId}, +}; + /// ABCI Query path for the IBC sub-store pub const IBC_QUERY_PATH: &str = "store/ibc/key"; @@ -578,6 +580,8 @@ fn parse_upgrades(components: &[&str]) -> Option { #[cfg(test)] mod tests { + use core::str::FromStr; + use super::*; #[test] diff --git a/crates/relayer-types/src/core/ics24_host/validate.rs b/crates/relayer-types/src/core/ics24_host/validate.rs index 347bd379a9..8c8fc446ae 100644 --- a/crates/relayer-types/src/core/ics24_host/validate.rs +++ b/crates/relayer-types/src/core/ics24_host/validate.rs @@ -75,11 +75,12 @@ pub fn validate_channel_identifier(id: &str) -> Result<(), Error> { #[cfg(test)] mod tests { + use test_log::test; + use crate::core::ics24_host::validate::{ validate_channel_identifier, validate_client_identifier, validate_connection_identifier, validate_identifier, validate_port_identifier, }; - use test_log::test; #[test] fn parse_invalid_port_id_min() { diff --git a/crates/relayer-types/src/core/ics26_routing/error.rs b/crates/relayer-types/src/core/ics26_routing/error.rs index f51581b6e0..12020f405c 100644 --- a/crates/relayer-types/src/core/ics26_routing/error.rs +++ b/crates/relayer-types/src/core/ics26_routing/error.rs @@ -1,9 +1,9 @@ use flex_error::{define_error, TraceError}; -use crate::applications::transfer; -use crate::core::ics02_client; -use crate::core::ics03_connection; -use crate::core::ics04_channel; +use crate::{ + applications::transfer, + core::{ics02_client, ics03_connection, ics04_channel}, +}; define_error! { #[derive(Debug, PartialEq, Eq)] diff --git a/crates/relayer-types/src/core/ics26_routing/msgs.rs b/crates/relayer-types/src/core/ics26_routing/msgs.rs index 68864ce23e..71d7536c4a 100644 --- a/crates/relayer-types/src/core/ics26_routing/msgs.rs +++ b/crates/relayer-types/src/core/ics26_routing/msgs.rs @@ -1,15 +1,17 @@ -use ibc_proto::google::protobuf::Any; +use ibc_proto::{google::protobuf::Any, Protobuf}; -use crate::core::ics02_client::msgs::{create_client, update_client, upgrade_client, ClientMsg}; -use crate::core::ics03_connection::msgs::{ - conn_open_ack, conn_open_confirm, conn_open_init, conn_open_try, ConnectionMsg, +use crate::core::{ + ics02_client::msgs::{create_client, update_client, upgrade_client, ClientMsg}, + ics03_connection::msgs::{ + conn_open_ack, conn_open_confirm, conn_open_init, conn_open_try, ConnectionMsg, + }, + ics04_channel::msgs::{ + acknowledgement, chan_close_confirm, chan_close_init, chan_open_ack, chan_open_confirm, + chan_open_init, chan_open_try, recv_packet, timeout, timeout_on_close, ChannelMsg, + PacketMsg, + }, + ics26_routing::error::Error, }; -use crate::core::ics04_channel::msgs::{ - acknowledgement, chan_close_confirm, chan_close_init, chan_open_ack, chan_open_confirm, - chan_open_init, chan_open_try, recv_packet, timeout, timeout_on_close, ChannelMsg, PacketMsg, -}; -use crate::core::ics26_routing::error::Error; -use ibc_proto::Protobuf; /// Enumeration of all messages that the local ICS26 module is capable of routing. #[derive(Clone, Debug)] diff --git a/crates/relayer-types/src/events.rs b/crates/relayer-types/src/events.rs index 3ec1892eb1..2af92e7fa8 100644 --- a/crates/relayer-types/src/events.rs +++ b/crates/relayer-types/src/events.rs @@ -1,28 +1,37 @@ -use std::borrow::Cow; -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::str::FromStr; +use std::{ + borrow::Cow, + convert::TryFrom, + fmt::{Display, Error as FmtError, Formatter}, + str::FromStr, +}; use flex_error::{define_error, TraceError}; use serde_derive::{Deserialize, Serialize}; use tendermint::abci; -use crate::applications::ics29_fee::error::Error as FeeError; -use crate::applications::ics29_fee::events::{DistributeFeePacket, IncentivizedPacket}; -use crate::applications::ics31_icq::error::Error as QueryPacketError; -use crate::applications::ics31_icq::events::CrossChainQueryPacket; -use crate::core::ics02_client::error as client_error; -use crate::core::ics02_client::events as ClientEvents; -use crate::core::ics02_client::events::NewBlock; -use crate::core::ics03_connection::error as connection_error; -use crate::core::ics03_connection::events as ConnectionEvents; -use crate::core::ics03_connection::events::Attributes as ConnectionAttributes; -use crate::core::ics04_channel::error as channel_error; -use crate::core::ics04_channel::events as ChannelEvents; -use crate::core::ics04_channel::events::Attributes as ChannelAttributes; -use crate::core::ics04_channel::packet::Packet; -use crate::core::ics24_host::error::ValidationError; -use crate::timestamp::ParseTimestampError; -use crate::utils::pretty::PrettySlice; +use crate::{ + applications::{ + ics29_fee::{ + error::Error as FeeError, + events::{DistributeFeePacket, IncentivizedPacket}, + }, + ics31_icq::{error::Error as QueryPacketError, events::CrossChainQueryPacket}, + }, + core::{ + ics02_client::{error as client_error, events as ClientEvents, events::NewBlock}, + ics03_connection::{ + error as connection_error, events as ConnectionEvents, + events::Attributes as ConnectionAttributes, + }, + ics04_channel::{ + error as channel_error, events as ChannelEvents, + events::Attributes as ChannelAttributes, packet::Packet, + }, + ics24_host::error::ValidationError, + }, + timestamp::ParseTimestampError, + utils::pretty::PrettySlice, +}; define_error! { Error { diff --git a/crates/relayer-types/src/handler.rs b/crates/relayer-types/src/handler.rs index 781201912c..cc64b307e1 100644 --- a/crates/relayer-types/src/handler.rs +++ b/crates/relayer-types/src/handler.rs @@ -1,7 +1,7 @@ -use crate::events::IbcEvent; - use std::marker::PhantomData; +use crate::events::IbcEvent; + pub type HandlerResult = Result, E>; #[derive(Clone, Debug)] diff --git a/crates/relayer-types/src/mock/client_state.rs b/crates/relayer-types/src/mock/client_state.rs index 98917b0ef0..ea3f598da8 100644 --- a/crates/relayer-types/src/mock/client_state.rs +++ b/crates/relayer-types/src/mock/client_state.rs @@ -1,21 +1,16 @@ use std::time::Duration; +use ibc_proto::{google::protobuf::Any, ibc::mock::ClientState as RawMockClientState, Protobuf}; use serde::{Deserialize, Serialize}; -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::mock::ClientState as RawMockClientState; -use ibc_proto::Protobuf; - -use crate::core::ics02_client::client_state::ClientState; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::error::Error; - -use crate::core::ics24_host::identifier::ChainId; - -use crate::mock::consensus_state::MockConsensusState; -use crate::mock::header::MockHeader; - -use crate::Height; +use crate::{ + core::{ + ics02_client::{client_state::ClientState, client_type::ClientType, error::Error}, + ics24_host::identifier::ChainId, + }, + mock::{consensus_state::MockConsensusState, header::MockHeader}, + Height, +}; pub const MOCK_CLIENT_STATE_TYPE_URL: &str = "/ibc.mock.ClientState"; @@ -69,8 +64,9 @@ impl TryFrom for MockClientState { type Error = Error; fn try_from(raw: Any) -> Result { - use bytes::Buf; use core::ops::Deref; + + use bytes::Buf; use prost::Message; fn decode_client_state(buf: B) -> Result { diff --git a/crates/relayer-types/src/mock/consensus_state.rs b/crates/relayer-types/src/mock/consensus_state.rs index 0237d50074..cf3347338c 100644 --- a/crates/relayer-types/src/mock/consensus_state.rs +++ b/crates/relayer-types/src/mock/consensus_state.rs @@ -1,14 +1,16 @@ -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::mock::ConsensusState as RawMockConsensusState; -use ibc_proto::Protobuf; +use ibc_proto::{ + google::protobuf::Any, ibc::mock::ConsensusState as RawMockConsensusState, Protobuf, +}; use serde::{Deserialize, Serialize}; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::consensus_state::ConsensusState; -use crate::core::ics02_client::error::Error; -use crate::core::ics23_commitment::commitment::CommitmentRoot; -use crate::mock::header::MockHeader; -use crate::timestamp::Timestamp; +use crate::{ + core::{ + ics02_client::{client_type::ClientType, consensus_state::ConsensusState, error::Error}, + ics23_commitment::commitment::CommitmentRoot, + }, + mock::header::MockHeader, + timestamp::Timestamp, +}; pub const MOCK_CONSENSUS_STATE_TYPE_URL: &str = "/ibc.mock.ConsensusState"; @@ -63,8 +65,9 @@ impl TryFrom for MockConsensusState { type Error = Error; fn try_from(raw: Any) -> Result { - use bytes::Buf; use core::ops::Deref; + + use bytes::Buf; use prost::Message; fn decode_consensus_state(buf: B) -> Result { diff --git a/crates/relayer-types/src/mock/header.rs b/crates/relayer-types/src/mock/header.rs index cd53cd6a68..aac99e2154 100644 --- a/crates/relayer-types/src/mock/header.rs +++ b/crates/relayer-types/src/mock/header.rs @@ -1,15 +1,13 @@ use std::fmt::{Display, Error as FmtError, Formatter}; -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::mock::Header as RawMockHeader; -use ibc_proto::Protobuf; +use ibc_proto::{google::protobuf::Any, ibc::mock::Header as RawMockHeader, Protobuf}; use serde_derive::{Deserialize, Serialize}; -use crate::core::ics02_client::client_type::ClientType; -use crate::core::ics02_client::error::Error; -use crate::core::ics02_client::header::Header; -use crate::timestamp::Timestamp; -use crate::Height; +use crate::{ + core::ics02_client::{client_type::ClientType, error::Error, header::Header}, + timestamp::Timestamp, + Height, +}; pub const MOCK_HEADER_TYPE_URL: &str = "/ibc.mock.Header"; @@ -122,6 +120,7 @@ impl From for Any { #[cfg(test)] mod tests { use super::*; + use ibc_proto::Protobuf; #[test] fn encode_any() { diff --git a/crates/relayer-types/src/mock/misbehaviour.rs b/crates/relayer-types/src/mock/misbehaviour.rs index 17e303940c..b53cfd667d 100644 --- a/crates/relayer-types/src/mock/misbehaviour.rs +++ b/crates/relayer-types/src/mock/misbehaviour.rs @@ -1,11 +1,11 @@ -use ibc_proto::ibc::mock::Misbehaviour as RawMisbehaviour; -use ibc_proto::Protobuf; +use ibc_proto::{ibc::mock::Misbehaviour as RawMisbehaviour, Protobuf}; use serde::{Deserialize, Serialize}; -use crate::core::ics02_client::error::Error; -use crate::core::ics24_host::identifier::ClientId; -use crate::mock::header::MockHeader; -use crate::Height; +use crate::{ + core::{ics02_client::error::Error, ics24_host::identifier::ClientId}, + mock::header::MockHeader, + Height, +}; pub const MOCK_MISBEHAVIOUR_TYPE_URL: &str = "/ibc.mock.Misbehavior"; diff --git a/crates/relayer-types/src/proofs.rs b/crates/relayer-types/src/proofs.rs index 945cafbd6e..97a8795771 100644 --- a/crates/relayer-types/src/proofs.rs +++ b/crates/relayer-types/src/proofs.rs @@ -2,8 +2,7 @@ use flex_error::{define_error, TraceError}; use prost::EncodeError; use serde::Serialize; -use crate::core::ics23_commitment::commitment::CommitmentProofBytes; -use crate::Height; +use crate::{core::ics23_commitment::commitment::CommitmentProofBytes, Height}; define_error! { #[derive(Debug, PartialEq, Eq)] diff --git a/crates/relayer-types/src/serializers.rs b/crates/relayer-types/src/serializers.rs index da3cce68d1..e1eaea366c 100644 --- a/crates/relayer-types/src/serializers.rs +++ b/crates/relayer-types/src/serializers.rs @@ -12,8 +12,7 @@ where pub mod serde_string { - use core::fmt::Display; - use core::str::FromStr; + use core::{fmt::Display, str::FromStr}; use serde::{de, Deserialize, Deserializer, Serializer}; diff --git a/crates/relayer-types/src/test.rs b/crates/relayer-types/src/test.rs index b6a9cb1f34..373a052929 100644 --- a/crates/relayer-types/src/test.rs +++ b/crates/relayer-types/src/test.rs @@ -1,4 +1,5 @@ use core::fmt::Debug; + use serde::{de::DeserializeOwned, Serialize}; /// Test that a struct `T` can be: diff --git a/crates/relayer-types/src/timestamp.rs b/crates/relayer-types/src/timestamp.rs index 0b137368ff..a3f2950167 100644 --- a/crates/relayer-types/src/timestamp.rs +++ b/crates/relayer-types/src/timestamp.rs @@ -1,9 +1,11 @@ -use std::fmt::{Display, Error as FmtError, Formatter}; -use std::hash::Hash; -use std::num::ParseIntError; -use std::ops::{Add, Sub}; -use std::str::FromStr; -use std::time::Duration; +use std::{ + fmt::{Display, Error as FmtError, Formatter}, + hash::Hash, + num::ParseIntError, + ops::{Add, Sub}, + str::FromStr, + time::Duration, +}; use flex_error::{define_error, TraceError}; use serde_derive::{Deserialize, Serialize}; @@ -233,11 +235,11 @@ impl From