From a3303c3e84933e3a3f863cfb763411863cf43ff6 Mon Sep 17 00:00:00 2001 From: Andy Nogueira Date: Tue, 24 Nov 2020 05:53:11 -0500 Subject: [PATCH] Implemented 'keys add' and 'keys list' commmands (#408) * Added logic to generate GRPC client from cosmos.auth proto (#337) * Adding logic to use GRPC client (#337) * Grpc client connection retrieves account sequence (#337) * Removed the account sequence flag from the tx raw commands (#337) * Removed instructions to query and specify account sequence from tx raw command (#337) * Logic to fetch GRPC endpoint address from config (#337) * Fixing tests (#361) * Logic to use the address from the key seed (#337) * Added boilerplate code for a keys add command to the relayer (#363) * Removing key flag from tx cmds * Adding logic to get key specified in the config * Logic to get the key specified in the config (#363) * Removed the -k flag from the tx raw commands (#363) * More logic to add key command (#363) * key add command for memory store working (#363) * Added logic to persist key seed in 'home' folder (#363) * Changes implemented (#363): - Added a new test keyring backend to support adding keys to file system (under home folder) - Refactored logic to add key to be part of the keystore and not the command - Switched the keybase on a chain to use the test keyring - Key seed file is saved in the test keystore default folder (/home/andy/.rrly) * Logic to use the key_name parameter from the config to add key. Removed name parameter from keys add cmd (#363) * Changed the logic to get the key from the test keyring file store (#363) * Implemented changes: (#363) - Clean up remaining key_seed flag for tx cmds - Refactored keybase to include chain config - Refactoring keyring methods to use chain config - Logic to use configured key to sign tx * Updated the README instructions (#363) * Disable the 'keys restore' command for now (#363) * Added 'keys list' command to show key added on a chain (#363) * Added entry for issue #363 (PR #408) * Refactored the bound variables to use the full name per comment suggestion (#408) * Move key retrieval, memo and timeout height inside send_tx Co-authored-by: Anca Zamfir --- CHANGELOG.md | 2 + proto/src/prost/cosmos.auth.v1beta1.rs | 112 +++++- proto/src/prost/cosmos.base.abci.v1beta1.rs | 70 ++-- proto/src/prost/cosmos.base.kv.v1beta1.rs | 6 +- proto/src/prost/cosmos.base.query.v1beta1.rs | 12 +- .../prost/cosmos.base.reflection.v1beta1.rs | 9 +- .../src/prost/cosmos.base.simulate.v1beta1.rs | 6 +- .../prost/cosmos.base.snapshots.v1beta1.rs | 12 +- proto/src/prost/cosmos.base.store.v1beta1.rs | 28 +- proto/src/prost/cosmos.base.v1beta1.rs | 12 +- .../prost/cosmos.crypto.multisig.v1beta1.rs | 6 +- proto/src/prost/cosmos.tx.signing.v1beta1.rs | 26 +- proto/src/prost/cosmos.tx.v1beta1.rs | 63 +-- proto/src/prost/cosmos_proto.rs | 1 + proto/src/prost/gogoproto.rs | 1 + proto/src/prost/google.api.rs | 30 +- proto/src/prost/google.protobuf.rs | 1 + .../src/prost/ibc.applications.transfer.v1.rs | 76 ++-- proto/src/prost/ibc.core.channel.v1.rs | 371 ++++++++++-------- proto/src/prost/ibc.core.client.v1.rs | 208 +++++----- proto/src/prost/ibc.core.commitment.v1.rs | 14 +- proto/src/prost/ibc.core.connection.v1.rs | 177 +++++---- proto/src/prost/ibc.core.types.v1.rs | 6 +- .../prost/ibc.lightclients.localhost.v1.rs | 7 +- .../prost/ibc.lightclients.solomachine.v1.rs | 88 +++-- .../prost/ibc.lightclients.tendermint.v1.rs | 50 +-- proto/src/prost/ibc.mock.rs | 6 +- proto/src/prost/ics23.rs | 94 ++--- relayer-cli/README.md | 32 +- relayer-cli/src/commands/keys.rs | 15 +- relayer-cli/src/commands/keys/add.rs | 65 +++ relayer-cli/src/commands/keys/list.rs | 55 +++ relayer-cli/src/commands/query/channel.rs | 2 +- relayer-cli/src/commands/query/client.rs | 4 +- relayer-cli/src/commands/query/connection.rs | 2 +- relayer-cli/src/commands/tx/channel.rs | 88 ++--- relayer-cli/src/commands/tx/client.rs | 27 +- relayer-cli/src/commands/tx/connection.rs | 44 --- .../conf | 4 - .../db | Bin 96 -> 0 bytes .../conf | 4 - .../db | Bin 524287 -> 0 bytes .../snap.0000000000000060 | Bin 69 -> 0 bytes relayer-cli/tests/fixtures/two_chains.toml | 5 +- relayer/Cargo.toml | 1 + relayer/src/chain.rs | 20 +- relayer/src/chain/cosmos.rs | 81 ++-- relayer/src/chain/handle.rs | 24 +- relayer/src/chain/handle/prod.rs | 22 +- relayer/src/chain/runtime.rs | 35 +- relayer/src/keyring/errors.rs | 8 +- relayer/src/keyring/store.rs | 174 ++++++-- relayer/src/keys.rs | 2 + relayer/src/keys/add.rs | 46 +++ relayer/src/keys/list.rs | 32 ++ relayer/src/keys/restore.rs | 14 +- relayer/src/tx/channel.rs | 155 ++++---- relayer/src/tx/client.rs | 34 +- relayer/src/tx/connection.rs | 53 +-- 59 files changed, 1460 insertions(+), 1082 deletions(-) create mode 100644 relayer-cli/src/commands/keys/add.rs create mode 100644 relayer-cli/src/commands/keys/list.rs delete mode 100644 relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/conf delete mode 100644 relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/db delete mode 100644 relayer-cli/store/DB4DC6BFFDA6D20BAF6EF8CFA23B79C367CC0F58/conf delete mode 100644 relayer-cli/store/DB4DC6BFFDA6D20BAF6EF8CFA23B79C367CC0F58/db delete mode 100644 relayer-cli/store/DB4DC6BFFDA6D20BAF6EF8CFA23B79C367CC0F58/snap.0000000000000060 create mode 100644 relayer/src/keys/add.rs create mode 100644 relayer/src/keys/list.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 93218c0d16..fbe1d80670 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Special thanks to external contributors for this release: @CharlyCst ([#347]). - CLI for client update message ([#277]) - Implement the relayer CLI for connection handshake messages ([#358], [#359], [#360]) - Implement the relayer CLI for channel handshake messages ([#371], [#372], [#373], [#374]) + - Implement commands to add and list keys for a chain ([#363]) - [proto-compiler] - Refactor and allow specifying a commit at which the Cosmos SDK should be checked out ([#366]) - Add a `--tag` option to the `clone-sdk` command to check out a tag instead of a commit ([#369]) @@ -38,6 +39,7 @@ Special thanks to external contributors for this release: @CharlyCst ([#347]). [#358]: https://github.com/informalsystems/ibc-rs/issues/358 [#358]: https://github.com/informalsystems/ibc-rs/issues/359 [#358]: https://github.com/informalsystems/ibc-rs/issues/360 +[#363]: https://github.com/informalsystems/ibc-rs/issues/363 [#366]: https://github.com/informalsystems/ibc-rs/issues/366 [#368]: https://github.com/informalsystems/ibc-rs/issues/368 [#369]: https://github.com/informalsystems/ibc-rs/pulls/369 diff --git a/proto/src/prost/cosmos.auth.v1beta1.rs b/proto/src/prost/cosmos.auth.v1beta1.rs index b2ae47787f..2ab4edc90e 100644 --- a/proto/src/prost/cosmos.auth.v1beta1.rs +++ b/proto/src/prost/cosmos.auth.v1beta1.rs @@ -3,62 +3,138 @@ /// type for additional functionality (e.g. vesting). #[derive(Clone, PartialEq, ::prost::Message)] pub struct BaseAccount { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub address: std::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub pub_key: ::std::option::Option<::prost_types::Any>, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub account_number: u64, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub sequence: u64, } /// ModuleAccount defines an account for modules that holds coins on a pool. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ModuleAccount { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub base_account: ::std::option::Option, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub name: std::string::String, - #[prost(string, repeated, tag="3")] + #[prost(string, repeated, tag = "3")] pub permissions: ::std::vec::Vec, } /// Params defines the parameters for the auth module. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Params { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub max_memo_characters: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub tx_sig_limit: u64, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub tx_size_cost_per_byte: u64, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub sig_verify_cost_ed25519: u64, - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub sig_verify_cost_secp256k1: u64, } /// QueryAccountRequest is the request type for the Query/Account RPC method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAccountRequest { /// address defines the address to query for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub address: std::string::String, } /// QueryAccountResponse is the response type for the Query/Account RPC method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryAccountResponse { /// account defines the account of the corresponding address. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub account: ::std::option::Option<::prost_types::Any>, } /// QueryParamsRequest is the request type for the Query/Params RPC method. #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest { -} +pub struct QueryParamsRequest {} /// QueryParamsResponse is the response type for the Query/Params RPC method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// params defines the parameters of the module. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub params: ::std::option::Option, } -# [doc = r" Generated client implementations."] pub mod query_client { # ! [allow (unused_variables , dead_code , missing_docs)] use tonic :: codegen :: * ; # [doc = " Query defines the gRPC querier service."] pub struct QueryClient < T > { inner : tonic :: client :: Grpc < T > , } impl QueryClient < tonic :: transport :: Channel > { # [doc = r" Attempt to create a new client by connecting to a given endpoint."] pub async fn connect < D > (dst : D) -> Result < Self , tonic :: transport :: Error > where D : std :: convert :: TryInto < tonic :: transport :: Endpoint > , D :: Error : Into < StdError > , { let conn = tonic :: transport :: Endpoint :: new (dst) ? . connect () . await ? ; Ok (Self :: new (conn)) } } impl < T > QueryClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + HttpBody + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as HttpBody > :: Error : Into < StdError > + Send , { pub fn new (inner : T) -> Self { let inner = tonic :: client :: Grpc :: new (inner) ; Self { inner } } pub fn with_interceptor (inner : T , interceptor : impl Into < tonic :: Interceptor >) -> Self { let inner = tonic :: client :: Grpc :: with_interceptor (inner , interceptor) ; Self { inner } } # [doc = " Account returns account details based on address."] pub async fn account (& mut self , request : impl tonic :: IntoRequest < super :: QueryAccountRequest > ,) -> Result < tonic :: Response < super :: QueryAccountResponse > , tonic :: Status > { self . inner . ready () . await . map_err (| e | { tonic :: Status :: new (tonic :: Code :: Unknown , format ! ("Service was not ready: {}" , e . into ())) }) ? ; let codec = tonic :: codec :: ProstCodec :: default () ; let path = http :: uri :: PathAndQuery :: from_static ("/cosmos.auth.v1beta1.Query/Account") ; self . inner . unary (request . into_request () , path , codec) . await } # [doc = " Params queries all parameters."] pub async fn params (& mut self , request : impl tonic :: IntoRequest < super :: QueryParamsRequest > ,) -> Result < tonic :: Response < super :: QueryParamsResponse > , tonic :: Status > { self . inner . ready () . await . map_err (| e | { tonic :: Status :: new (tonic :: Code :: Unknown , format ! ("Service was not ready: {}" , e . into ())) }) ? ; let codec = tonic :: codec :: ProstCodec :: default () ; let path = http :: uri :: PathAndQuery :: from_static ("/cosmos.auth.v1beta1.Query/Params") ; self . inner . unary (request . into_request () , path , codec) . await } } impl < T : Clone > Clone for QueryClient < T > { fn clone (& self) -> Self { Self { inner : self . inner . clone () , } } } impl < T > std :: fmt :: Debug for QueryClient < T > { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { write ! (f , "QueryClient {{ ... }}") } } } \ No newline at end of file +#[doc = r" Generated client implementations."] +pub mod query_client { + #![allow(unused_variables, dead_code, missing_docs)] + use tonic::codegen::*; + #[doc = " Query defines the gRPC querier service."] + pub struct QueryClient { + inner: tonic::client::Grpc, + } + impl QueryClient { + #[doc = r" Attempt to create a new client by connecting to a given endpoint."] + pub async fn connect(dst: D) -> Result + where + D: std::convert::TryInto, + D::Error: Into, + { + let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; + Ok(Self::new(conn)) + } + } + impl QueryClient + where + T: tonic::client::GrpcService, + T::ResponseBody: Body + HttpBody + Send + 'static, + T::Error: Into, + ::Error: Into + Send, + { + pub fn new(inner: T) -> Self { + let inner = tonic::client::Grpc::new(inner); + Self { inner } + } + pub fn with_interceptor(inner: T, interceptor: impl Into) -> Self { + let inner = tonic::client::Grpc::with_interceptor(inner, interceptor); + Self { inner } + } + #[doc = " Account returns account details based on address."] + pub async fn account( + &mut self, + request: impl tonic::IntoRequest, + ) -> Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/cosmos.auth.v1beta1.Query/Account"); + self.inner.unary(request.into_request(), path, codec).await + } + #[doc = " Params queries all parameters."] + pub async fn params( + &mut self, + request: impl tonic::IntoRequest, + ) -> Result, tonic::Status> { + self.inner.ready().await.map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static("/cosmos.auth.v1beta1.Query/Params"); + self.inner.unary(request.into_request(), path, codec).await + } + } + impl Clone for QueryClient { + fn clone(&self) -> Self { + Self { + inner: self.inner.clone(), + } + } + } + impl std::fmt::Debug for QueryClient { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "QueryClient {{ ... }}") + } + } +} diff --git a/proto/src/prost/cosmos.base.abci.v1beta1.rs b/proto/src/prost/cosmos.base.abci.v1beta1.rs index 8e40baced6..5333cb2e83 100644 --- a/proto/src/prost/cosmos.base.abci.v1beta1.rs +++ b/proto/src/prost/cosmos.base.abci.v1beta1.rs @@ -3,83 +3,83 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct TxResponse { /// The block height - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub height: i64, /// The transaction hash. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub txhash: std::string::String, /// Namespace for the Code - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub codespace: std::string::String, /// Response code. - #[prost(uint32, tag="4")] + #[prost(uint32, tag = "4")] pub code: u32, /// Result bytes, if any. - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub data: std::string::String, /// The output of the application's logger (raw string). May be /// non-deterministic. - #[prost(string, tag="6")] + #[prost(string, tag = "6")] pub raw_log: std::string::String, /// The output of the application's logger (typed). May be non-deterministic. - #[prost(message, repeated, tag="7")] + #[prost(message, repeated, tag = "7")] pub logs: ::std::vec::Vec, /// Additional information. May be non-deterministic. - #[prost(string, tag="8")] + #[prost(string, tag = "8")] pub info: std::string::String, /// Amount of gas requested for transaction. - #[prost(int64, tag="9")] + #[prost(int64, tag = "9")] pub gas_wanted: i64, /// Amount of gas consumed by transaction. - #[prost(int64, tag="10")] + #[prost(int64, tag = "10")] pub gas_used: i64, /// The request transaction bytes. - #[prost(message, optional, tag="11")] + #[prost(message, optional, tag = "11")] pub tx: ::std::option::Option<::prost_types::Any>, /// Time of the previous block. For heights > 1, it's the weighted median of /// the timestamps of the valid votes in the block.LastCommit. For height == 1, /// it's genesis time. - #[prost(string, tag="12")] + #[prost(string, tag = "12")] pub timestamp: std::string::String, } /// ABCIMessageLog defines a structure containing an indexed tx ABCI message log. #[derive(Clone, PartialEq, ::prost::Message)] pub struct AbciMessageLog { - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub msg_index: u32, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub log: std::string::String, /// Events contains a slice of Event objects that were emitted during some /// execution. - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub events: ::std::vec::Vec, } /// StringEvent defines en Event object wrapper where all the attributes /// contain key/value pairs that are strings instead of raw bytes. #[derive(Clone, PartialEq, ::prost::Message)] pub struct StringEvent { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub r#type: std::string::String, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub attributes: ::std::vec::Vec, } /// Attribute defines an attribute wrapper where the key and value are /// strings instead of raw bytes. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Attribute { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub key: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub value: std::string::String, } /// GasInfo defines tx execution gas context. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GasInfo { /// GasWanted is the maximum units of work we allow this tx to perform. - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub gas_wanted: u64, /// GasUsed is the amount of gas actually consumed. - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub gas_used: u64, } /// Result is the union of ResponseFormat and ResponseCheckTx. @@ -87,60 +87,60 @@ pub struct GasInfo { pub struct Result { /// Data is any data returned from message or handler execution. It MUST be /// length prefixed in order to separate data from multiple message executions. - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub data: std::vec::Vec, /// Log contains the log information from message or handler execution. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub log: std::string::String, /// Events contains a slice of Event objects that were emitted during message /// or handler execution. - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub events: ::std::vec::Vec<::tendermint_proto::abci::Event>, } /// SimulationResponse defines the response generated when a transaction is /// successfully simulated. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SimulationResponse { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub gas_info: ::std::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub result: ::std::option::Option, } /// MsgData defines the data returned in a Result object during message /// execution. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgData { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub msg_type: std::string::String, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub data: std::vec::Vec, } /// TxMsgData defines a list of MsgData. A transaction will have a MsgData object /// for each message. #[derive(Clone, PartialEq, ::prost::Message)] pub struct TxMsgData { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub data: ::std::vec::Vec, } /// SearchTxsResult defines a structure for querying txs pageable #[derive(Clone, PartialEq, ::prost::Message)] pub struct SearchTxsResult { /// Count of all txs - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub total_count: u64, /// Count of txs in current page - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub count: u64, /// Index of current page, start from 1 - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub page_number: u64, /// Count of total pages - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub page_total: u64, /// Max count txs per page - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub limit: u64, /// List of txs in current page - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub txs: ::std::vec::Vec, } diff --git a/proto/src/prost/cosmos.base.kv.v1beta1.rs b/proto/src/prost/cosmos.base.kv.v1beta1.rs index ce80a8609f..aeb5e067f0 100644 --- a/proto/src/prost/cosmos.base.kv.v1beta1.rs +++ b/proto/src/prost/cosmos.base.kv.v1beta1.rs @@ -1,14 +1,14 @@ /// Pairs defines a repeated slice of Pair objects. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Pairs { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub pairs: ::std::vec::Vec, } /// Pair defines a key/value bytes tuple. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Pair { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub value: std::vec::Vec, } diff --git a/proto/src/prost/cosmos.base.query.v1beta1.rs b/proto/src/prost/cosmos.base.query.v1beta1.rs index dc782f4683..27fd8277b5 100644 --- a/proto/src/prost/cosmos.base.query.v1beta1.rs +++ b/proto/src/prost/cosmos.base.query.v1beta1.rs @@ -10,22 +10,22 @@ pub struct PageRequest { /// key is a value returned in PageResponse.next_key to begin /// querying the next page most efficiently. Only one of offset or key /// should be set. - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, /// offset is a numeric offset that can be used when key is unavailable. /// It is less efficient than using key. Only one of offset or key should /// be set. - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub offset: u64, /// limit is the total number of results to be returned in the result page. /// If left empty it will default to a value to be set by each app. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub limit: u64, /// count_total is set to true to indicate that the result set should include /// a count of the total number of items available for pagination in UIs. /// count_total is only respected when offset is used. It is ignored when key /// is set. - #[prost(bool, tag="4")] + #[prost(bool, tag = "4")] pub count_total: bool, } /// PageResponse is to be embedded in gRPC response messages where the @@ -39,10 +39,10 @@ pub struct PageRequest { pub struct PageResponse { /// next_key is the key to be passed to PageRequest.key to /// query the next page most efficiently - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub next_key: std::vec::Vec, /// total is total number of results available if PageRequest.count_total /// was set, its value is undefined otherwise - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub total: u64, } diff --git a/proto/src/prost/cosmos.base.reflection.v1beta1.rs b/proto/src/prost/cosmos.base.reflection.v1beta1.rs index 876de47b3e..ddb76118dd 100644 --- a/proto/src/prost/cosmos.base.reflection.v1beta1.rs +++ b/proto/src/prost/cosmos.base.reflection.v1beta1.rs @@ -1,12 +1,11 @@ /// ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ListAllInterfacesRequest { -} +pub struct ListAllInterfacesRequest {} /// ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListAllInterfacesResponse { /// interface_names is an array of all the registered interfaces. - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub interface_names: ::std::vec::Vec, } /// ListImplementationsRequest is the request type of the ListImplementations @@ -14,13 +13,13 @@ pub struct ListAllInterfacesResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListImplementationsRequest { /// interface_name defines the interface to query the implementations for. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub interface_name: std::string::String, } /// ListImplementationsResponse is the response type of the ListImplementations /// RPC. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListImplementationsResponse { - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub implementation_message_names: ::std::vec::Vec, } diff --git a/proto/src/prost/cosmos.base.simulate.v1beta1.rs b/proto/src/prost/cosmos.base.simulate.v1beta1.rs index 470ea90ee8..3304be1aa0 100644 --- a/proto/src/prost/cosmos.base.simulate.v1beta1.rs +++ b/proto/src/prost/cosmos.base.simulate.v1beta1.rs @@ -3,7 +3,7 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct SimulateRequest { /// tx is the transaction to simulate. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub tx: ::std::option::Option, } /// SimulateResponse is the response type for the @@ -11,9 +11,9 @@ pub struct SimulateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct SimulateResponse { /// gas_info is the information about gas used in the simulation. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub gas_info: ::std::option::Option, /// result is the result of the simulation. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub result: ::std::option::Option, } diff --git a/proto/src/prost/cosmos.base.snapshots.v1beta1.rs b/proto/src/prost/cosmos.base.snapshots.v1beta1.rs index 08d3600334..3f20e08b3d 100644 --- a/proto/src/prost/cosmos.base.snapshots.v1beta1.rs +++ b/proto/src/prost/cosmos.base.snapshots.v1beta1.rs @@ -1,21 +1,21 @@ /// Snapshot contains Tendermint state sync snapshot info. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Snapshot { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub height: u64, - #[prost(uint32, tag="2")] + #[prost(uint32, tag = "2")] pub format: u32, - #[prost(uint32, tag="3")] + #[prost(uint32, tag = "3")] pub chunks: u32, - #[prost(bytes, tag="4")] + #[prost(bytes, tag = "4")] pub hash: std::vec::Vec, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub metadata: ::std::option::Option, } /// Metadata contains SDK-specific snapshot metadata. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Metadata { /// SHA-256 chunk hashes - #[prost(bytes, repeated, tag="1")] + #[prost(bytes, repeated, tag = "1")] pub chunk_hashes: ::std::vec::Vec>, } diff --git a/proto/src/prost/cosmos.base.store.v1beta1.rs b/proto/src/prost/cosmos.base.store.v1beta1.rs index 0021d3b1a0..e97e64beee 100644 --- a/proto/src/prost/cosmos.base.store.v1beta1.rs +++ b/proto/src/prost/cosmos.base.store.v1beta1.rs @@ -2,61 +2,61 @@ /// a version/height. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommitInfo { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub version: i64, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub store_infos: ::std::vec::Vec, } /// StoreInfo defines store-specific commit information. It contains a reference /// between a store name and the commit ID. #[derive(Clone, PartialEq, ::prost::Message)] pub struct StoreInfo { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: std::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub commit_id: ::std::option::Option, } /// CommitID defines the committment information when a specific store is /// committed. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommitId { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub version: i64, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub hash: std::vec::Vec, } /// SnapshotItem is an item contained in a rootmulti.Store snapshot. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotItem { /// item is the specific type of snapshot item. - #[prost(oneof="snapshot_item::Item", tags="1, 2")] + #[prost(oneof = "snapshot_item::Item", tags = "1, 2")] pub item: ::std::option::Option, } pub mod snapshot_item { /// item is the specific type of snapshot item. #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Item { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Store(super::SnapshotStoreItem), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Iavl(super::SnapshotIavlItem), } } /// SnapshotStoreItem contains metadata about a snapshotted store. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotStoreItem { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub name: std::string::String, } /// SnapshotIAVLItem is an exported IAVL node. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SnapshotIavlItem { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub value: std::vec::Vec, - #[prost(int64, tag="3")] + #[prost(int64, tag = "3")] pub version: i64, - #[prost(int32, tag="4")] + #[prost(int32, tag = "4")] pub height: i32, } diff --git a/proto/src/prost/cosmos.base.v1beta1.rs b/proto/src/prost/cosmos.base.v1beta1.rs index 0ac7a85e3d..6f1878f214 100644 --- a/proto/src/prost/cosmos.base.v1beta1.rs +++ b/proto/src/prost/cosmos.base.v1beta1.rs @@ -4,9 +4,9 @@ /// signatures required by gogoproto. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Coin { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub denom: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub amount: std::string::String, } /// DecCoin defines a token with a denomination and a decimal amount. @@ -15,20 +15,20 @@ pub struct Coin { /// signatures required by gogoproto. #[derive(Clone, PartialEq, ::prost::Message)] pub struct DecCoin { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub denom: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub amount: std::string::String, } /// IntProto defines a Protobuf wrapper around an Int object. #[derive(Clone, PartialEq, ::prost::Message)] pub struct IntProto { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub int: std::string::String, } /// DecProto defines a Protobuf wrapper around a Dec object. #[derive(Clone, PartialEq, ::prost::Message)] pub struct DecProto { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub dec: std::string::String, } diff --git a/proto/src/prost/cosmos.crypto.multisig.v1beta1.rs b/proto/src/prost/cosmos.crypto.multisig.v1beta1.rs index b5eda4c450..cc7a89f22f 100644 --- a/proto/src/prost/cosmos.crypto.multisig.v1beta1.rs +++ b/proto/src/prost/cosmos.crypto.multisig.v1beta1.rs @@ -3,7 +3,7 @@ /// signed and with which modes. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MultiSignature { - #[prost(bytes, repeated, tag="1")] + #[prost(bytes, repeated, tag = "1")] pub signatures: ::std::vec::Vec>, } /// CompactBitArray is an implementation of a space efficient bit array. @@ -12,8 +12,8 @@ pub struct MultiSignature { /// This is not thread safe, and is not intended for concurrent usage. #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompactBitArray { - #[prost(uint32, tag="1")] + #[prost(uint32, tag = "1")] pub extra_bits_stored: u32, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub elems: std::vec::Vec, } diff --git a/proto/src/prost/cosmos.tx.signing.v1beta1.rs b/proto/src/prost/cosmos.tx.signing.v1beta1.rs index 23bede8409..0dfe5178b2 100644 --- a/proto/src/prost/cosmos.tx.signing.v1beta1.rs +++ b/proto/src/prost/cosmos.tx.signing.v1beta1.rs @@ -2,7 +2,7 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignatureDescriptors { /// signatures are the signature descriptors - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub signatures: ::std::vec::Vec, } /// SignatureDescriptor is a convenience type which represents the full data for @@ -12,14 +12,14 @@ pub struct SignatureDescriptors { #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignatureDescriptor { /// public_key is the public key of the signer - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub public_key: ::std::option::Option<::prost_types::Any>, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub data: ::std::option::Option, /// sequence is the sequence of the account, which describes the /// number of committed transactions signed by a given address. It is used to prevent /// replay attacks. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, } pub mod signature_descriptor { @@ -27,7 +27,7 @@ pub mod signature_descriptor { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Data { /// sum is the oneof that specifies whether this represents single or multi-signature data - #[prost(oneof="data::Sum", tags="1, 2")] + #[prost(oneof = "data::Sum", tags = "1, 2")] pub sum: ::std::option::Option, } pub mod data { @@ -35,30 +35,32 @@ pub mod signature_descriptor { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Single { /// mode is the signing mode of the single signer - #[prost(enumeration="super::super::SignMode", tag="1")] + #[prost(enumeration = "super::super::SignMode", tag = "1")] pub mode: i32, /// signature is the raw signature bytes - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub signature: std::vec::Vec, } /// Multi is the signature data for a multisig public key #[derive(Clone, PartialEq, ::prost::Message)] pub struct Multi { /// bitarray specifies which keys within the multisig are signing - #[prost(message, optional, tag="1")] - pub bitarray: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub bitarray: ::std::option::Option< + super::super::super::super::super::crypto::multisig::v1beta1::CompactBitArray, + >, /// signatures is the signatures of the multi-signature - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub signatures: ::std::vec::Vec, } /// sum is the oneof that specifies whether this represents single or multi-signature data #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { /// single represents a single signer - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Single(Single), /// multi represents a multisig signer - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Multi(Multi), } } diff --git a/proto/src/prost/cosmos.tx.v1beta1.rs b/proto/src/prost/cosmos.tx.v1beta1.rs index 83285433a7..0623b87016 100644 --- a/proto/src/prost/cosmos.tx.v1beta1.rs +++ b/proto/src/prost/cosmos.tx.v1beta1.rs @@ -2,16 +2,16 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct Tx { /// body is the processable content of the transaction - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub body: ::std::option::Option, /// auth_info is the authorization related content of the transaction, /// specifically signers, signer modes and fee - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub auth_info: ::std::option::Option, /// signatures is a list of signatures that matches the length and order of /// AuthInfo's signer_infos to allow connecting signature meta information like /// public key and signing mode by position. - #[prost(bytes, repeated, tag="3")] + #[prost(bytes, repeated, tag = "3")] pub signatures: ::std::vec::Vec>, } /// TxRaw is a variant of Tx that pins the signer's exact binary representation @@ -23,16 +23,16 @@ pub struct Tx { pub struct TxRaw { /// body_bytes is a protobuf serialization of a TxBody that matches the /// representation in SignDoc. - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub body_bytes: std::vec::Vec, /// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the /// representation in SignDoc. - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub auth_info_bytes: std::vec::Vec, /// signatures is a list of signatures that matches the length and order of /// AuthInfo's signer_infos to allow connecting signature meta information like /// public key and signing mode by position. - #[prost(bytes, repeated, tag="3")] + #[prost(bytes, repeated, tag = "3")] pub signatures: ::std::vec::Vec>, } /// SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. @@ -40,19 +40,19 @@ pub struct TxRaw { pub struct SignDoc { /// body_bytes is protobuf serialization of a TxBody that matches the /// representation in TxRaw. - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub body_bytes: std::vec::Vec, /// auth_info_bytes is a protobuf serialization of an AuthInfo that matches the /// representation in TxRaw. - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub auth_info_bytes: std::vec::Vec, /// chain_id is the unique identifier of the chain this transaction targets. /// It prevents signed transactions from being used on another chain by an /// attacker - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub chain_id: std::string::String, /// account_number is the account number of the account in state - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub account_number: u64, } /// TxBody is the body of a transaction that all signers sign over. @@ -66,24 +66,24 @@ pub struct TxBody { /// By convention, the first required signer (usually from the first message) /// is referred to as the primary signer and pays the fee for the whole /// transaction. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub messages: ::std::vec::Vec<::prost_types::Any>, /// memo is any arbitrary memo to be added to the transaction - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub memo: std::string::String, /// timeout is the block height after which this transaction will not /// be processed by the chain - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub timeout_height: u64, /// extension_options are arbitrary options that can be added by chains /// when the default options are not sufficient. If any of these are present /// and can't be handled, the transaction will be rejected - #[prost(message, repeated, tag="1023")] + #[prost(message, repeated, tag = "1023")] pub extension_options: ::std::vec::Vec<::prost_types::Any>, /// extension_options are arbitrary options that can be added by chains /// when the default options are not sufficient. If any of these are present /// and can't be handled, they will be ignored - #[prost(message, repeated, tag="2047")] + #[prost(message, repeated, tag = "2047")] pub non_critical_extension_options: ::std::vec::Vec<::prost_types::Any>, } /// AuthInfo describes the fee and signer modes that are used to sign a @@ -94,13 +94,13 @@ pub struct AuthInfo { /// and order of elements must match the required signers from TxBody's /// messages. The first element is the primary signer and the one which pays /// the fee. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub signer_infos: ::std::vec::Vec, /// Fee is the fee and gas limit for the transaction. The first signer is the /// primary signer and the one which pays the fee. The fee can be calculated /// based on the cost of evaluating the body and doing signature verification /// of the signers. This can be estimated via simulation. - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub fee: ::std::option::Option, } /// SignerInfo describes the public key and signing mode of a single top-level @@ -110,16 +110,16 @@ pub struct SignerInfo { /// public_key is the public key of the signer. It is optional for accounts /// that already exist in state. If unset, the verifier can use the required \ /// signer address for this position and lookup the public key. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub public_key: ::std::option::Option<::prost_types::Any>, /// mode_info describes the signing mode of the signer and is a nested /// structure to support nested multisig pubkey's - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub mode_info: ::std::option::Option, /// sequence is the sequence of the account, which describes the /// number of committed transactions signed by a given address. It is used to /// prevent replay attacks. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, } /// ModeInfo describes the signing mode of a single or nested multisig signer. @@ -127,7 +127,7 @@ pub struct SignerInfo { pub struct ModeInfo { /// sum is the oneof that specifies whether this represents a single or nested /// multisig signer - #[prost(oneof="mode_info::Sum", tags="1, 2")] + #[prost(oneof = "mode_info::Sum", tags = "1, 2")] pub sum: ::std::option::Option, } pub mod mode_info { @@ -137,18 +137,19 @@ pub mod mode_info { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Single { /// mode is the signing mode of the single signer - #[prost(enumeration="super::super::signing::v1beta1::SignMode", tag="1")] + #[prost(enumeration = "super::super::signing::v1beta1::SignMode", tag = "1")] pub mode: i32, } /// Multi is the mode info for a multisig public key #[derive(Clone, PartialEq, ::prost::Message)] pub struct Multi { /// bitarray specifies which keys within the multisig are signing - #[prost(message, optional, tag="1")] - pub bitarray: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub bitarray: + ::std::option::Option, /// mode_infos is the corresponding modes of the signers of the multisig /// which could include nested multisig public keys - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub mode_infos: ::std::vec::Vec, } /// sum is the oneof that specifies whether this represents a single or nested @@ -156,10 +157,10 @@ pub mod mode_info { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { /// single represents a single signer - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Single(Single), /// multi represents a nested multisig signer - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Multi(Multi), } } @@ -169,20 +170,20 @@ pub mod mode_info { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Fee { /// amount is the amount of coins to be paid as a fee - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub amount: ::std::vec::Vec, /// gas_limit is the maximum gas that can be used in transaction processing /// before an out of gas error occurs - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub gas_limit: u64, /// if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. /// the payer must be a tx signer (and thus have signed this field in AuthInfo). /// setting this field does *not* change the ordering of required signers for the transaction. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub payer: std::string::String, /// if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used /// to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does /// not support fee grants, this will fail - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub granter: std::string::String, } diff --git a/proto/src/prost/cosmos_proto.rs b/proto/src/prost/cosmos_proto.rs index e69de29bb2..8b13789179 100644 --- a/proto/src/prost/cosmos_proto.rs +++ b/proto/src/prost/cosmos_proto.rs @@ -0,0 +1 @@ + diff --git a/proto/src/prost/gogoproto.rs b/proto/src/prost/gogoproto.rs index e69de29bb2..8b13789179 100644 --- a/proto/src/prost/gogoproto.rs +++ b/proto/src/prost/gogoproto.rs @@ -0,0 +1 @@ + diff --git a/proto/src/prost/google.api.rs b/proto/src/prost/google.api.rs index aceb08699a..e0b5f05870 100644 --- a/proto/src/prost/google.api.rs +++ b/proto/src/prost/google.api.rs @@ -6,7 +6,7 @@ pub struct Http { /// A list of HTTP configuration rules that apply to individual API methods. /// /// **NOTE:** All service configuration rules follow "last one wins" order. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub rules: ::std::vec::Vec, /// When set to true, URL path parmeters will be fully URI-decoded except in /// cases of single segment matches in reserved expansion, where "%2F" will be @@ -14,7 +14,7 @@ pub struct Http { /// /// The default behavior is to not decode RFC 6570 reserved characters in multi /// segment matches. - #[prost(bool, tag="2")] + #[prost(bool, tag = "2")] pub fully_decode_reserved_expansion: bool, } /// `HttpRule` defines the mapping of an RPC method to one or more HTTP @@ -239,28 +239,28 @@ pub struct HttpRule { /// Selects methods to which this rule applies. /// /// Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub selector: std::string::String, /// The name of the request field whose value is mapped to the HTTP body, or /// `*` for mapping all fields not captured by the path pattern to the HTTP /// body. NOTE: the referred field must not be a repeated field and must be /// present at the top-level of request message type. - #[prost(string, tag="7")] + #[prost(string, tag = "7")] pub body: std::string::String, /// Optional. The name of the response field whose value is mapped to the HTTP /// body of response. Other response fields are ignored. When /// not set, the response message will be used as HTTP body of response. - #[prost(string, tag="12")] + #[prost(string, tag = "12")] pub response_body: std::string::String, /// Additional HTTP bindings for the selector. Nested bindings must /// not contain an `additional_bindings` field themselves (that is, /// the nesting may only be one level deep). - #[prost(message, repeated, tag="11")] + #[prost(message, repeated, tag = "11")] pub additional_bindings: ::std::vec::Vec, /// Determines the URL pattern is matched by this rules. This pattern can be /// used with any of the {get|put|post|delete|patch} methods. A custom method /// can be defined using the 'custom' field. - #[prost(oneof="http_rule::Pattern", tags="2, 3, 4, 5, 6, 8")] + #[prost(oneof = "http_rule::Pattern", tags = "2, 3, 4, 5, 6, 8")] pub pattern: ::std::option::Option, } pub mod http_rule { @@ -270,25 +270,25 @@ pub mod http_rule { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Pattern { /// Used for listing and getting information about resources. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] Get(std::string::String), /// Used for updating a resource. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] Put(std::string::String), /// Used for creating a resource. - #[prost(string, tag="4")] + #[prost(string, tag = "4")] Post(std::string::String), /// Used for deleting a resource. - #[prost(string, tag="5")] + #[prost(string, tag = "5")] Delete(std::string::String), /// Used for updating a resource. - #[prost(string, tag="6")] + #[prost(string, tag = "6")] Patch(std::string::String), /// The custom pattern is used for specifying an HTTP method that is not /// included in the `pattern` field, such as HEAD, or "*" to leave the /// HTTP method unspecified for this rule. The wild-card rule is useful /// for services that provide content to Web (HTML) clients. - #[prost(message, tag="8")] + #[prost(message, tag = "8")] Custom(super::CustomHttpPattern), } } @@ -296,9 +296,9 @@ pub mod http_rule { #[derive(Clone, PartialEq, ::prost::Message)] pub struct CustomHttpPattern { /// The name of this custom HTTP verb. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub kind: std::string::String, /// The path matched by this custom verb. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub path: std::string::String, } diff --git a/proto/src/prost/google.protobuf.rs b/proto/src/prost/google.protobuf.rs index e69de29bb2..8b13789179 100644 --- a/proto/src/prost/google.protobuf.rs +++ b/proto/src/prost/google.protobuf.rs @@ -0,0 +1 @@ + diff --git a/proto/src/prost/ibc.applications.transfer.v1.rs b/proto/src/prost/ibc.applications.transfer.v1.rs index 6ab1a8b8bd..9b063f165d 100644 --- a/proto/src/prost/ibc.applications.transfer.v1.rs +++ b/proto/src/prost/ibc.applications.transfer.v1.rs @@ -4,45 +4,48 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgTransfer { /// the port on which the packet will be sent - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub source_port: std::string::String, /// the channel by which the packet will be sent - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub source_channel: std::string::String, /// the tokens to be transferred - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub token: ::std::option::Option, /// the sender address - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub sender: std::string::String, /// the recipient address on the destination chain - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub receiver: std::string::String, /// Timeout height relative to the current block height. /// The timeout is disabled when set to 0. - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub timeout_height: ::std::option::Option, /// Timeout timestamp (in nanoseconds) relative to the current block timestamp. /// The timeout is disabled when set to 0. - #[prost(uint64, tag="7")] + #[prost(uint64, tag = "7")] pub timeout_timestamp: u64, } +/// MsgTransferResponse defines the Msg/Transfer response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTransferResponse {} /// FungibleTokenPacketData defines a struct for the packet payload /// See FungibleTokenPacketData spec: /// https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures #[derive(Clone, PartialEq, ::prost::Message)] pub struct FungibleTokenPacketData { /// the token denomination to be transferred - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub denom: std::string::String, /// the token amount to be transferred - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub amount: u64, /// the sender address - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub sender: std::string::String, /// the recipient address on the destination chain - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub receiver: std::string::String, } /// DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -51,10 +54,10 @@ pub struct FungibleTokenPacketData { pub struct DenomTrace { /// path defines the chain of port/channel identifiers used for tracing the /// source of the fungible token. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub path: std::string::String, /// base denomination of the relayed fungible token. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub base_denom: std::string::String, } /// Params defines the set of IBC transfer parameters. @@ -65,19 +68,29 @@ pub struct DenomTrace { pub struct Params { /// send_enabled enables or disables all cross-chain token transfers from this /// chain. - #[prost(bool, tag="1")] + #[prost(bool, tag = "1")] pub send_enabled: bool, /// receive_enabled enables or disables all cross-chain token transfers to this /// chain. - #[prost(bool, tag="2")] + #[prost(bool, tag = "2")] pub receive_enabled: bool, } +/// GenesisState defines the ibc-transfer genesis state +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GenesisState { + #[prost(string, tag = "1")] + pub port_id: std::string::String, + #[prost(message, repeated, tag = "2")] + pub denom_traces: ::std::vec::Vec, + #[prost(message, optional, tag = "3")] + pub params: ::std::option::Option, +} /// QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC /// method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomTraceRequest { /// hash (in hex format) of the denomination trace information. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub hash: std::string::String, } /// QueryDenomTraceResponse is the response type for the Query/DenomTrace RPC @@ -85,7 +98,7 @@ pub struct QueryDenomTraceRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomTraceResponse { /// denom_trace returns the requested denomination trace information. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub denom_trace: ::std::option::Option, } /// QueryConnectionsRequest is the request type for the Query/DenomTraces RPC @@ -93,38 +106,31 @@ pub struct QueryDenomTraceResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomTracesRequest { /// pagination defines an optional pagination for the request. - #[prost(message, optional, tag="1")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryConnectionsResponse is the response type for the Query/DenomTraces RPC /// method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryDenomTracesResponse { /// denom_traces returns all denominations trace information. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub denom_traces: ::std::vec::Vec, /// pagination defines the pagination in the response. - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryParamsRequest is the request type for the Query/Params RPC method. #[derive(Clone, PartialEq, ::prost::Message)] -pub struct QueryParamsRequest { -} +pub struct QueryParamsRequest {} /// QueryParamsResponse is the response type for the Query/Params RPC method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryParamsResponse { /// params defines the parameters of the module. - #[prost(message, optional, tag="1")] - pub params: ::std::option::Option, -} -/// GenesisState defines the ibc-transfer genesis state -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GenesisState { - #[prost(string, tag="1")] - pub port_id: std::string::String, - #[prost(message, repeated, tag="2")] - pub denom_traces: ::std::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "1")] pub params: ::std::option::Option, } diff --git a/proto/src/prost/ibc.core.channel.v1.rs b/proto/src/prost/ibc.core.channel.v1.rs index 5a45dfbd44..38bd149ba8 100644 --- a/proto/src/prost/ibc.core.channel.v1.rs +++ b/proto/src/prost/ibc.core.channel.v1.rs @@ -2,172 +2,202 @@ /// is called by a relayer on Chain A. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChannelOpenInit { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub channel: ::std::option::Option, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub signer: std::string::String, } -/// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel +/// MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChannelOpenInitResponse {} +/// MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel /// on Chain B. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChannelOpenTry { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub desired_channel_id: std::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub counterparty_chosen_channel_id: std::string::String, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub channel: ::std::option::Option, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub counterparty_version: std::string::String, - #[prost(bytes, tag="6")] + #[prost(bytes, tag = "6")] pub proof_init: std::vec::Vec, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub proof_height: ::std::option::Option, - #[prost(string, tag="8")] + #[prost(string, tag = "8")] pub signer: std::string::String, } +/// MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChannelOpenTryResponse {} /// MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge /// the change of channel state to TRYOPEN on Chain B. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChannelOpenAck { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub counterparty_channel_id: std::string::String, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub counterparty_version: std::string::String, - #[prost(bytes, tag="5")] + #[prost(bytes, tag = "5")] pub proof_try: std::vec::Vec, - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub proof_height: ::std::option::Option, - #[prost(string, tag="7")] + #[prost(string, tag = "7")] pub signer: std::string::String, } +/// MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChannelOpenAckResponse {} /// MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to /// acknowledge the change of channel state to OPEN on Chain A. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChannelOpenConfirm { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub proof_ack: std::vec::Vec, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub signer: std::string::String, } +/// MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChannelOpenConfirmResponse {} /// MsgChannelCloseInit defines a msg sent by a Relayer to Chain A /// to close a channel with Chain B. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChannelCloseInit { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub signer: std::string::String, } +/// MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChannelCloseInitResponse {} /// MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B /// to acknowledge the change of channel state to CLOSED on Chain A. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgChannelCloseConfirm { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub proof_init: std::vec::Vec, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub signer: std::string::String, } +/// MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgChannelCloseConfirmResponse {} /// MsgRecvPacket receives incoming IBC packet #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgRecvPacket { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub packet: ::std::option::Option, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub proof_height: ::std::option::Option, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub signer: std::string::String, } +/// MsgRecvPacketResponse defines the Msg/RecvPacket response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgRecvPacketResponse {} /// MsgTimeout receives timed-out packet #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgTimeout { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub packet: ::std::option::Option, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub proof_height: ::std::option::Option, - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub next_sequence_recv: u64, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub signer: std::string::String, } +/// MsgTimeoutResponse defines the Msg/Timeout response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTimeoutResponse {} /// MsgTimeoutOnClose timed-out packet upon counterparty channel closure. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgTimeoutOnClose { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub packet: ::std::option::Option, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub proof_close: std::vec::Vec, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, - #[prost(uint64, tag="5")] + #[prost(uint64, tag = "5")] pub next_sequence_recv: u64, - #[prost(string, tag="6")] + #[prost(string, tag = "6")] pub signer: std::string::String, } +/// MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgTimeoutOnCloseResponse {} /// MsgAcknowledgement receives incoming IBC acknowledgement #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgAcknowledgement { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub packet: ::std::option::Option, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub acknowledgement: std::vec::Vec, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub proof: std::vec::Vec, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub signer: std::string::String, } +/// MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgAcknowledgementResponse {} /// Channel defines pipeline for exactly-once packet delivery between specific /// modules on separate blockchains, which has at least one end capable of /// sending packets and one end capable of receiving packets. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Channel { /// current state of the channel end - #[prost(enumeration="State", tag="1")] + #[prost(enumeration = "State", tag = "1")] pub state: i32, /// whether the channel is ordered or unordered - #[prost(enumeration="Order", tag="2")] + #[prost(enumeration = "Order", tag = "2")] pub ordering: i32, /// counterparty channel end - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub counterparty: ::std::option::Option, /// list of connection identifiers, in order, along which packets sent on /// this channel will travel - #[prost(string, repeated, tag="4")] + #[prost(string, repeated, tag = "4")] pub connection_hops: ::std::vec::Vec, /// opaque channel version, which is agreed upon during the handshake - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub version: std::string::String, } /// IdentifiedChannel defines a channel with additional port and channel @@ -175,36 +205,36 @@ pub struct Channel { #[derive(Clone, PartialEq, ::prost::Message)] pub struct IdentifiedChannel { /// current state of the channel end - #[prost(enumeration="State", tag="1")] + #[prost(enumeration = "State", tag = "1")] pub state: i32, /// whether the channel is ordered or unordered - #[prost(enumeration="Order", tag="2")] + #[prost(enumeration = "Order", tag = "2")] pub ordering: i32, /// counterparty channel end - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub counterparty: ::std::option::Option, /// list of connection identifiers, in order, along which packets sent on /// this channel will travel - #[prost(string, repeated, tag="4")] + #[prost(string, repeated, tag = "4")] pub connection_hops: ::std::vec::Vec, /// opaque channel version, which is agreed upon during the handshake - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub version: std::string::String, /// port identifier - #[prost(string, tag="6")] + #[prost(string, tag = "6")] pub port_id: std::string::String, /// channel identifier - #[prost(string, tag="7")] + #[prost(string, tag = "7")] pub channel_id: std::string::String, } /// Counterparty defines a channel end counterparty #[derive(Clone, PartialEq, ::prost::Message)] pub struct Counterparty { /// port on the counterparty chain which owns the other end of the channel. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel end on the counterparty chain - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, } /// Packet defines a type that carries data across different chains through IBC @@ -213,28 +243,28 @@ pub struct Packet { /// number corresponds to the order of sends and receives, where a Packet /// with an earlier sequence number must be sent and received before a Packet /// with a later sequence number. - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub sequence: u64, /// identifies the port on the sending chain. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub source_port: std::string::String, /// identifies the channel end on the sending chain. - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub source_channel: std::string::String, /// identifies the port on the receiving chain. - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub destination_port: std::string::String, /// identifies the channel end on the receiving chain. - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub destination_channel: std::string::String, /// actual opaque bytes transferred directly to the application module - #[prost(bytes, tag="6")] + #[prost(bytes, tag = "6")] pub data: std::vec::Vec, /// block height after which the packet times out - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub timeout_height: ::std::option::Option, /// block timestamp (in nanoseconds) after which the packet times out - #[prost(uint64, tag="8")] + #[prost(uint64, tag = "8")] pub timeout_timestamp: u64, } /// PacketAckCommitment defines the genesis type necessary to retrieve and store @@ -242,16 +272,16 @@ pub struct Packet { #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketAckCommitment { /// channel port identifier. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// packet sequence. - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, /// packet commitment hash. - #[prost(bytes, tag="4")] + #[prost(bytes, tag = "4")] pub hash: std::vec::Vec, } /// Acknowledgement is the recommended acknowledgement format to be used by @@ -264,16 +294,16 @@ pub struct PacketAckCommitment { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Acknowledgement { /// response contains either a result or an error and must be non-empty - #[prost(oneof="acknowledgement::Response", tags="21, 22")] + #[prost(oneof = "acknowledgement::Response", tags = "21, 22")] pub response: ::std::option::Option, } pub mod acknowledgement { /// response contains either a result or an error and must be non-empty #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Response { - #[prost(bytes, tag="21")] + #[prost(bytes, tag = "21")] Result(std::vec::Vec), - #[prost(string, tag="22")] + #[prost(string, tag = "22")] Error(std::string::String), } } @@ -310,38 +340,38 @@ pub enum Order { /// GenesisState defines the ibc channel submodule's genesis state. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub channels: ::std::vec::Vec, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub acknowledgements: ::std::vec::Vec, - #[prost(message, repeated, tag="3")] + #[prost(message, repeated, tag = "3")] pub commitments: ::std::vec::Vec, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub send_sequences: ::std::vec::Vec, - #[prost(message, repeated, tag="5")] + #[prost(message, repeated, tag = "5")] pub recv_sequences: ::std::vec::Vec, - #[prost(message, repeated, tag="6")] + #[prost(message, repeated, tag = "6")] pub ack_sequences: ::std::vec::Vec, } /// PacketSequence defines the genesis type necessary to retrieve and store /// next send and receive sequences. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketSequence { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, } /// QueryChannelRequest is the request type for the Query/Channel RPC method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, } /// QueryChannelResponse is the response type for the Query/Channel RPC method. @@ -350,36 +380,40 @@ pub struct QueryChannelRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelResponse { /// channel associated with the request identifiers - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub channel: ::std::option::Option, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryChannelsRequest is the request type for the Query/Channels RPC method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelsRequest { /// pagination request - #[prost(message, optional, tag="1")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryChannelsResponse is the response type for the Query/Channels RPC method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelsResponse { /// list of stored channels of the chain. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub channels: ::std::vec::Vec, /// pagination response - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, /// query block height - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub height: ::std::option::Option, } /// QueryConnectionChannelsRequest is the request type for the @@ -387,24 +421,28 @@ pub struct QueryChannelsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionChannelsRequest { /// connection unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub connection: std::string::String, /// pagination request - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryConnectionChannelsResponse is the Response type for the /// Query/QueryConnectionChannels RPC method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionChannelsResponse { /// list of channels associated with a connection. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub channels: ::std::vec::Vec, /// pagination response - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, /// query block height - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub height: ::std::option::Option, } /// QueryChannelClientStateRequest is the request type for the Query/ClientState @@ -412,10 +450,10 @@ pub struct QueryConnectionChannelsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelClientStateRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, } /// QueryChannelClientStateResponse is the Response type for the @@ -423,16 +461,17 @@ pub struct QueryChannelClientStateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelClientStateResponse { /// client state associated with the channel - #[prost(message, optional, tag="1")] - pub identified_client_state: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub identified_client_state: + ::std::option::Option, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryChannelConsensusStateRequest is the request type for the @@ -440,16 +479,16 @@ pub struct QueryChannelClientStateResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelConsensusStateRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// version number of the consensus state - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub version_number: u64, /// version height of the consensus state - #[prost(uint64, tag="4")] + #[prost(uint64, tag = "4")] pub version_height: u64, } /// QueryChannelClientStateResponse is the Response type for the @@ -457,19 +496,19 @@ pub struct QueryChannelConsensusStateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryChannelConsensusStateResponse { /// consensus state associated with the channel - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub consensus_state: ::std::option::Option<::prost_types::Any>, /// client ID associated with the consensus state - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub client_id: std::string::String, /// merkle proof of existence - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub proof_height: ::std::option::Option, } /// QueryPacketCommitmentRequest is the request type for the @@ -477,13 +516,13 @@ pub struct QueryChannelConsensusStateResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPacketCommitmentRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// packet sequence - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, } /// QueryPacketCommitmentResponse defines the client query response for a packet @@ -492,16 +531,16 @@ pub struct QueryPacketCommitmentRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPacketCommitmentResponse { /// packet associated with the request fields - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub commitment: std::vec::Vec, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryPacketCommitmentsRequest is the request type for the @@ -509,26 +548,30 @@ pub struct QueryPacketCommitmentResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPacketCommitmentsRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// pagination request - #[prost(message, optional, tag="3")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "3")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryPacketCommitmentsResponse is the request type for the /// Query/QueryPacketCommitments RPC method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPacketCommitmentsResponse { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub commitments: ::std::vec::Vec, /// pagination response - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, /// query block height - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub height: ::std::option::Option, } /// QueryPacketAcknowledgementRequest is the request type for the @@ -536,13 +579,13 @@ pub struct QueryPacketCommitmentsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPacketAcknowledgementRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// packet sequence - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub sequence: u64, } /// QueryPacketAcknowledgementResponse defines the client query response for a @@ -551,16 +594,16 @@ pub struct QueryPacketAcknowledgementRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryPacketAcknowledgementResponse { /// packet associated with the request fields - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub acknowledgement: std::vec::Vec, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryUnreceivedPacketsRequest is the request type for the @@ -568,13 +611,13 @@ pub struct QueryPacketAcknowledgementResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryUnreceivedPacketsRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// list of packet sequences - #[prost(uint64, repeated, tag="3")] + #[prost(uint64, repeated, tag = "3")] pub packet_commitment_sequences: ::std::vec::Vec, } /// QueryUnreceivedPacketsResponse is the response type for the @@ -582,10 +625,10 @@ pub struct QueryUnreceivedPacketsRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryUnreceivedPacketsResponse { /// list of unreceived packet sequences - #[prost(uint64, repeated, tag="1")] + #[prost(uint64, repeated, tag = "1")] pub sequences: ::std::vec::Vec, /// query block height - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub height: ::std::option::Option, } /// QueryUnrelayedAcksRequest is the request type for the @@ -593,13 +636,13 @@ pub struct QueryUnreceivedPacketsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryUnrelayedAcksRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, /// list of commitment sequences - #[prost(uint64, repeated, tag="3")] + #[prost(uint64, repeated, tag = "3")] pub packet_commitment_sequences: ::std::vec::Vec, } /// QueryUnrelayedAcksResponse is the response type for the @@ -607,10 +650,10 @@ pub struct QueryUnrelayedAcksRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryUnrelayedAcksResponse { /// list of unrelayed acknowledgement sequences - #[prost(uint64, repeated, tag="1")] + #[prost(uint64, repeated, tag = "1")] pub sequences: ::std::vec::Vec, /// query block height - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub height: ::std::option::Option, } /// QueryNextSequenceReceiveRequest is the request type for the @@ -618,10 +661,10 @@ pub struct QueryUnrelayedAcksResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryNextSequenceReceiveRequest { /// port unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub port_id: std::string::String, /// channel unique identifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub channel_id: std::string::String, } /// QuerySequenceResponse is the request type for the @@ -629,15 +672,15 @@ pub struct QueryNextSequenceReceiveRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryNextSequenceReceiveResponse { /// next sequence receive number - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub next_sequence_receive: u64, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } diff --git a/proto/src/prost/ibc.core.client.v1.rs b/proto/src/prost/ibc.core.client.v1.rs index 152b208f47..e8387ff497 100644 --- a/proto/src/prost/ibc.core.client.v1.rs +++ b/proto/src/prost/ibc.core.client.v1.rs @@ -1,117 +1,129 @@ -/// IdentifiedClientState defines a client state with an additional client -/// identifier field. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct IdentifiedClientState { - /// client identifier - #[prost(string, tag="1")] - pub client_id: std::string::String, - /// client state - #[prost(message, optional, tag="2")] - pub client_state: ::std::option::Option<::prost_types::Any>, -} -/// ConsensusStateWithHeight defines a consensus state with an additional height field. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ConsensusStateWithHeight { - /// consensus state height - #[prost(message, optional, tag="1")] - pub height: ::std::option::Option, - /// consensus state - #[prost(message, optional, tag="2")] - pub consensus_state: ::std::option::Option<::prost_types::Any>, -} -/// ClientConsensusStates defines all the stored consensus states for a given -/// client. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ClientConsensusStates { - /// client identifier - #[prost(string, tag="1")] - pub client_id: std::string::String, - /// consensus states and their heights associated with the client - #[prost(message, repeated, tag="2")] - pub consensus_states: ::std::vec::Vec, -} -/// ClientUpdateProposal is a governance proposal. If it passes, the client is -/// updated with the provided header. The update may fail if the header is not -/// valid given certain conditions specified by the client implementation. -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ClientUpdateProposal { - /// the title of the update proposal - #[prost(string, tag="1")] - pub title: std::string::String, - /// the description of the proposal - #[prost(string, tag="2")] - pub description: std::string::String, - /// the client identifier for the client to be updated if the proposal passes - #[prost(string, tag="3")] - pub client_id: std::string::String, - /// the header used to update the client if the proposal passes - #[prost(message, optional, tag="4")] - pub header: ::std::option::Option<::prost_types::Any>, -} /// MsgCreateClient defines a message to create an IBC client #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgCreateClient { /// client unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// light client state - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub client_state: ::std::option::Option<::prost_types::Any>, /// consensus state associated with the client that corresponds to a given /// height. - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub consensus_state: ::std::option::Option<::prost_types::Any>, /// signer address - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub signer: std::string::String, } +/// MsgCreateClientResponse defines the Msg/CreateClient response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgCreateClientResponse {} /// MsgUpdateClient defines an sdk.Msg to update a IBC client state using /// the given header. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUpdateClient { /// client unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// header to update the light client - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub header: ::std::option::Option<::prost_types::Any>, /// signer address - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub signer: std::string::String, } +/// MsgUpdateClientResponse defines the Msg/UpdateClient response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpdateClientResponse {} /// MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgUpgradeClient { /// client unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// upgraded client state - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub client_state: ::std::option::Option<::prost_types::Any>, /// height at which old chain halts and upgrades (i.e last block executed) - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub upgrade_height: ::std::option::Option, /// proof that old chain committed to new client - #[prost(bytes, tag="4")] + #[prost(bytes, tag = "4")] pub proof_upgrade: std::vec::Vec, /// signer address - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub signer: std::string::String, } +/// MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgUpgradeClientResponse {} /// MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for /// light client misbehaviour. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgSubmitMisbehaviour { /// client unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// misbehaviour used for freezing the light client - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub misbehaviour: ::std::option::Option<::prost_types::Any>, /// signer address - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub signer: std::string::String, } +/// MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitMisbehaviourResponse {} +/// IdentifiedClientState defines a client state with an additional client +/// identifier field. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct IdentifiedClientState { + /// client identifier + #[prost(string, tag = "1")] + pub client_id: std::string::String, + /// client state + #[prost(message, optional, tag = "2")] + pub client_state: ::std::option::Option<::prost_types::Any>, +} +/// ConsensusStateWithHeight defines a consensus state with an additional height field. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsensusStateWithHeight { + /// consensus state height + #[prost(message, optional, tag = "1")] + pub height: ::std::option::Option, + /// consensus state + #[prost(message, optional, tag = "2")] + pub consensus_state: ::std::option::Option<::prost_types::Any>, +} +/// ClientConsensusStates defines all the stored consensus states for a given +/// client. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClientConsensusStates { + /// client identifier + #[prost(string, tag = "1")] + pub client_id: std::string::String, + /// consensus states and their heights associated with the client + #[prost(message, repeated, tag = "2")] + pub consensus_states: ::std::vec::Vec, +} +/// ClientUpdateProposal is a governance proposal. If it passes, the client is +/// updated with the provided header. The update may fail if the header is not +/// valid given certain conditions specified by the client implementation. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ClientUpdateProposal { + /// the title of the update proposal + #[prost(string, tag = "1")] + pub title: std::string::String, + /// the description of the proposal + #[prost(string, tag = "2")] + pub description: std::string::String, + /// the client identifier for the client to be updated if the proposal passes + #[prost(string, tag = "3")] + pub client_id: std::string::String, + /// the header used to update the client if the proposal passes + #[prost(message, optional, tag = "4")] + pub header: ::std::option::Option<::prost_types::Any>, +} /// Height is a monotonically increasing data type /// that can be compared against another Height for the purposes of updating and /// freezing clients @@ -124,23 +136,23 @@ pub struct MsgSubmitMisbehaviour { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Height { /// the version that the client is currently on - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub version_number: u64, /// the height within the given version - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub version_height: u64, } /// GenesisState defines the ibc client submodule's genesis state. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { /// client states with their corresponding identifiers - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub clients: ::std::vec::Vec, /// consensus states from each client - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub clients_consensus: ::std::vec::Vec, /// create localhost on initialization - #[prost(bool, tag="3")] + #[prost(bool, tag = "3")] pub create_localhost: bool, } /// QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -148,7 +160,7 @@ pub struct GenesisState { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryClientStateRequest { /// client state unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, } /// QueryClientStateResponse is the response type for the Query/ClientState RPC @@ -157,16 +169,16 @@ pub struct QueryClientStateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryClientStateResponse { /// client state associated with the request identifier - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub client_state: ::std::option::Option<::prost_types::Any>, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryClientStatesRequest is the request type for the Query/ClientStates RPC @@ -174,19 +186,23 @@ pub struct QueryClientStateResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryClientStatesRequest { /// pagination request - #[prost(message, optional, tag="1")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryClientStatesResponse is the response type for the Query/ClientStates RPC /// method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryClientStatesResponse { /// list of stored ClientStates of the chain. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub client_states: ::std::vec::Vec, /// pagination response - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, } /// QueryConsensusStateRequest is the request type for the Query/ConsensusState /// RPC method. Besides the consensus state, it includes a proof and the height @@ -194,17 +210,17 @@ pub struct QueryClientStatesResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConsensusStateRequest { /// client identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// consensus state version number - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub version_number: u64, /// consensus state version height - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub version_height: u64, /// latest_height overrrides the height field and queries the latest stored /// ConsensusState - #[prost(bool, tag="4")] + #[prost(bool, tag = "4")] pub latest_height: bool, } /// QueryConsensusStateResponse is the response type for the Query/ConsensusState @@ -212,16 +228,16 @@ pub struct QueryConsensusStateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConsensusStateResponse { /// consensus state associated with the client identifier at the given height - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub consensus_state: ::std::option::Option<::prost_types::Any>, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryConsensusStatesRequest is the request type for the Query/ConsensusStates @@ -229,20 +245,24 @@ pub struct QueryConsensusStateResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConsensusStatesRequest { /// client identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// pagination request - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryConsensusStatesResponse is the response type for the /// Query/ConsensusStates RPC method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConsensusStatesResponse { /// consensus states associated with the identifier - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub consensus_states: ::std::vec::Vec, /// pagination response - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, } diff --git a/proto/src/prost/ibc.core.commitment.v1.rs b/proto/src/prost/ibc.core.commitment.v1.rs index 138b8e4697..5e80b0a2a5 100644 --- a/proto/src/prost/ibc.core.commitment.v1.rs +++ b/proto/src/prost/ibc.core.commitment.v1.rs @@ -2,7 +2,7 @@ /// In the Cosmos SDK, the AppHash of a block header becomes the root. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MerkleRoot { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub hash: std::vec::Vec, } /// MerklePrefix is merkle path prefixed to the key. @@ -10,14 +10,14 @@ pub struct MerkleRoot { /// append(Path.KeyPrefix, key...)) #[derive(Clone, PartialEq, ::prost::Message)] pub struct MerklePrefix { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key_prefix: std::vec::Vec, } /// MerklePath is the path used to verify commitment proofs, which can be an /// arbitrary structured object (defined by a commitment type). #[derive(Clone, PartialEq, ::prost::Message)] pub struct MerklePath { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub key_path: ::std::option::Option, } /// MerkleProof is a wrapper type that contains a merkle proof. @@ -26,21 +26,21 @@ pub struct MerklePath { /// should be succinct. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MerkleProof { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub proof: ::std::option::Option<::tendermint_proto::crypto::ProofOps>, } /// KeyPath defines a slice of keys #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyPath { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub keys: ::std::vec::Vec, } /// Key defines a proof Key #[derive(Clone, PartialEq, ::prost::Message)] pub struct Key { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub name: std::vec::Vec, - #[prost(enumeration="KeyEncoding", tag="2")] + #[prost(enumeration = "KeyEncoding", tag = "2")] pub enc: i32, } /// KeyEncoding defines the encoding format of a key's bytes. diff --git a/proto/src/prost/ibc.core.connection.v1.rs b/proto/src/prost/ibc.core.connection.v1.rs index 543c837457..f33be0d680 100644 --- a/proto/src/prost/ibc.core.connection.v1.rs +++ b/proto/src/prost/ibc.core.connection.v1.rs @@ -2,93 +2,105 @@ /// initialize a connection with Chain B. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgConnectionOpenInit { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub connection_id: std::string::String, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub counterparty: ::std::option::Option, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub version: std::string::String, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub signer: std::string::String, } +/// MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgConnectionOpenInitResponse {} /// MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a /// connection on Chain B. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgConnectionOpenTry { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub desired_connection_id: std::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub counterparty_chosen_connection_id: std::string::String, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub client_state: ::std::option::Option<::prost_types::Any>, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub counterparty: ::std::option::Option, - #[prost(string, repeated, tag="6")] + #[prost(string, repeated, tag = "6")] pub counterparty_versions: ::std::vec::Vec, - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub proof_height: ::std::option::Option, /// proof of the initialization the connection on Chain A: `UNITIALIZED -> /// INIT` - #[prost(bytes, tag="8")] + #[prost(bytes, tag = "8")] pub proof_init: std::vec::Vec, /// proof of client state included in message - #[prost(bytes, tag="9")] + #[prost(bytes, tag = "9")] pub proof_client: std::vec::Vec, /// proof of client consensus state - #[prost(bytes, tag="10")] + #[prost(bytes, tag = "10")] pub proof_consensus: std::vec::Vec, - #[prost(message, optional, tag="11")] + #[prost(message, optional, tag = "11")] pub consensus_height: ::std::option::Option, - #[prost(string, tag="12")] + #[prost(string, tag = "12")] pub signer: std::string::String, } +/// MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgConnectionOpenTryResponse {} /// MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to /// acknowledge the change of connection state to TRYOPEN on Chain B. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgConnectionOpenAck { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub connection_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub counterparty_connection_id: std::string::String, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub version: std::string::String, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub client_state: ::std::option::Option<::prost_types::Any>, - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub proof_height: ::std::option::Option, /// proof of the initialization the connection on Chain B: `UNITIALIZED -> /// TRYOPEN` - #[prost(bytes, tag="6")] + #[prost(bytes, tag = "6")] pub proof_try: std::vec::Vec, /// proof of client state included in message - #[prost(bytes, tag="7")] + #[prost(bytes, tag = "7")] pub proof_client: std::vec::Vec, /// proof of client consensus state - #[prost(bytes, tag="8")] + #[prost(bytes, tag = "8")] pub proof_consensus: std::vec::Vec, - #[prost(message, optional, tag="9")] + #[prost(message, optional, tag = "9")] pub consensus_height: ::std::option::Option, - #[prost(string, tag="10")] + #[prost(string, tag = "10")] pub signer: std::string::String, } +/// MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgConnectionOpenAckResponse {} /// MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to /// acknowledge the change of connection state to OPEN on Chain A. #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgConnectionOpenConfirm { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub connection_id: std::string::String, /// proof for the change of the connection state on Chain A: `INIT -> OPEN` - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof_ack: std::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub proof_height: ::std::option::Option, - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub signer: std::string::String, } +/// MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm response type. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgConnectionOpenConfirmResponse {} // ICS03 - Connection Data Structures as defined in // https://github.com/cosmos/ics/tree/master/spec/ics-003-connection-semantics#data-structures @@ -98,17 +110,17 @@ pub struct MsgConnectionOpenConfirm { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConnectionEnd { /// client associated with this connection. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// IBC version which can be utilised to determine encodings or protocols for /// channels or packets utilising this connection - #[prost(string, repeated, tag="2")] + #[prost(string, repeated, tag = "2")] pub versions: ::std::vec::Vec, /// current state of the connection end. - #[prost(enumeration="State", tag="3")] + #[prost(enumeration = "State", tag = "3")] pub state: i32, /// counterparty chain associated with this connection. - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub counterparty: ::std::option::Option, } /// IdentifiedConnection defines a connection with additional connection @@ -116,20 +128,20 @@ pub struct ConnectionEnd { #[derive(Clone, PartialEq, ::prost::Message)] pub struct IdentifiedConnection { /// connection identifier. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub id: std::string::String, /// client associated with this connection. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub client_id: std::string::String, /// IBC version which can be utilised to determine encodings or protocols for /// channels or packets utilising this connection - #[prost(string, repeated, tag="3")] + #[prost(string, repeated, tag = "3")] pub versions: ::std::vec::Vec, /// current state of the connection end. - #[prost(enumeration="State", tag="4")] + #[prost(enumeration = "State", tag = "4")] pub state: i32, /// counterparty chain associated with this connection. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub counterparty: ::std::option::Option, } /// Counterparty defines the counterparty chain associated with a connection end. @@ -137,31 +149,31 @@ pub struct IdentifiedConnection { pub struct Counterparty { /// identifies the client on the counterparty chain associated with a given /// connection. - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// identifies the connection end on the counterparty chain associated with a /// given connection. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub connection_id: std::string::String, /// commitment merkle prefix of the counterparty chain - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub prefix: ::std::option::Option, } /// ClientPaths define all the connection paths for a client state. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientPaths { /// list of connection paths - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub paths: ::std::vec::Vec, } /// ConnectionPaths define all the connection paths for a given client state. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConnectionPaths { /// client state unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, /// list of connection paths - #[prost(string, repeated, tag="2")] + #[prost(string, repeated, tag = "2")] pub paths: ::std::vec::Vec, } /// Version defines the versioning scheme used to negotiate the IBC verison in @@ -169,10 +181,10 @@ pub struct ConnectionPaths { #[derive(Clone, PartialEq, ::prost::Message)] pub struct Version { /// unique version identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub identifier: std::string::String, /// list of features compatible with the specified identifier - #[prost(string, repeated, tag="2")] + #[prost(string, repeated, tag = "2")] pub features: ::std::vec::Vec, } /// State defines if a connection is in one of the following states: @@ -193,9 +205,9 @@ pub enum State { /// GenesisState defines the ibc connection submodule's genesis state. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub connections: ::std::vec::Vec, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub client_connection_paths: ::std::vec::Vec, } /// QueryConnectionRequest is the request type for the Query/Connection RPC @@ -203,7 +215,7 @@ pub struct GenesisState { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionRequest { /// connection unique identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub connection_id: std::string::String, } /// QueryConnectionResponse is the response type for the Query/Connection RPC @@ -212,37 +224,41 @@ pub struct QueryConnectionRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionResponse { /// connection associated with the request identifier - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub connection: ::std::option::Option, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryConnectionsRequest is the request type for the Query/Connections RPC /// method #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionsRequest { - #[prost(message, optional, tag="1")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageRequest, + >, } /// QueryConnectionsResponse is the response type for the Query/Connections RPC /// method. #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionsResponse { /// list of stored connections of the chain. - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub connections: ::std::vec::Vec, /// pagination response - #[prost(message, optional, tag="2")] - pub pagination: ::std::option::Option, + #[prost(message, optional, tag = "2")] + pub pagination: ::std::option::Option< + super::super::super::super::cosmos::base::query::v1beta1::PageResponse, + >, /// query block height - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub height: ::std::option::Option, } /// QueryClientConnectionsRequest is the request type for the @@ -250,7 +266,7 @@ pub struct QueryConnectionsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryClientConnectionsRequest { /// client identifier associated with a connection - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, } /// QueryClientConnectionsResponse is the response type for the @@ -258,16 +274,16 @@ pub struct QueryClientConnectionsRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryClientConnectionsResponse { /// slice of all the connection paths associated with a client. - #[prost(string, repeated, tag="1")] + #[prost(string, repeated, tag = "1")] pub connection_paths: ::std::vec::Vec, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was generated - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryConnectionClientStateRequest is the request type for the @@ -275,7 +291,7 @@ pub struct QueryClientConnectionsResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionClientStateRequest { /// connection identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub connection_id: std::string::String, } /// QueryConnectionClientStateResponse is the response type for the @@ -283,16 +299,17 @@ pub struct QueryConnectionClientStateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionClientStateResponse { /// client state associated with the channel - #[prost(message, optional, tag="1")] - pub identified_client_state: ::std::option::Option, + #[prost(message, optional, tag = "1")] + pub identified_client_state: + ::std::option::Option, /// merkle proof of existence - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub proof_height: ::std::option::Option, } /// QueryConnectionConsensusStateRequest is the request type for the @@ -300,11 +317,11 @@ pub struct QueryConnectionClientStateResponse { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionConsensusStateRequest { /// connection identifier - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub connection_id: std::string::String, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub version_number: u64, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub version_height: u64, } /// QueryConnectionConsensusStateResponse is the response type for the @@ -312,18 +329,18 @@ pub struct QueryConnectionConsensusStateRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConnectionConsensusStateResponse { /// consensus state associated with the channel - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub consensus_state: ::std::option::Option<::prost_types::Any>, /// client ID associated with the consensus state - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub client_id: std::string::String, /// merkle proof of existence - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub proof: std::vec::Vec, /// merkle proof path - #[prost(string, tag="4")] + #[prost(string, tag = "4")] pub proof_path: std::string::String, /// height at which the proof was retrieved - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub proof_height: ::std::option::Option, } diff --git a/proto/src/prost/ibc.core.types.v1.rs b/proto/src/prost/ibc.core.types.v1.rs index 5ea152fba6..8bdda2c728 100644 --- a/proto/src/prost/ibc.core.types.v1.rs +++ b/proto/src/prost/ibc.core.types.v1.rs @@ -2,12 +2,12 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenesisState { /// ICS002 - Clients genesis state - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub client_genesis: ::std::option::Option, /// ICS003 - Connections genesis state - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub connection_genesis: ::std::option::Option, /// ICS004 - Channel genesis state - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub channel_genesis: ::std::option::Option, } diff --git a/proto/src/prost/ibc.lightclients.localhost.v1.rs b/proto/src/prost/ibc.lightclients.localhost.v1.rs index 77464895d7..53869e04fc 100644 --- a/proto/src/prost/ibc.lightclients.localhost.v1.rs +++ b/proto/src/prost/ibc.lightclients.localhost.v1.rs @@ -2,13 +2,10 @@ /// access to keys outside the client prefix. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientState { - /// client id - #[prost(string, tag="1")] - pub id: std::string::String, /// self chain ID - #[prost(string, tag="2")] + #[prost(string, tag = "1")] pub chain_id: std::string::String, /// self latest block height - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "2")] pub height: ::std::option::Option, } diff --git a/proto/src/prost/ibc.lightclients.solomachine.v1.rs b/proto/src/prost/ibc.lightclients.solomachine.v1.rs index cc74d9a0e4..302bbd6bea 100644 --- a/proto/src/prost/ibc.lightclients.solomachine.v1.rs +++ b/proto/src/prost/ibc.lightclients.solomachine.v1.rs @@ -3,16 +3,16 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientState { /// latest sequence of the client state - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub sequence: u64, /// frozen sequence of the solo machine - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub frozen_sequence: u64, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub consensus_state: ::std::option::Option, /// when set to true, will allow governance to update a solo machine client. /// The client will be unfrozen if it is frozen. - #[prost(bool, tag="4")] + #[prost(bool, tag = "4")] pub allow_update_after_proposal: bool, } /// ConsensusState defines a solo machine consensus state. The sequence of a consensus state @@ -20,156 +20,158 @@ pub struct ClientState { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConsensusState { /// public key of the solo machine - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub public_key: ::std::option::Option<::prost_types::Any>, /// diversifier allows the same public key to be re-used across different solo machine clients /// (potentially on different chains) without being considered misbehaviour. - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub diversifier: std::string::String, - #[prost(uint64, tag="3")] + #[prost(uint64, tag = "3")] pub timestamp: u64, } /// Header defines a solo machine consensus header #[derive(Clone, PartialEq, ::prost::Message)] pub struct Header { /// sequence to update solo machine public key at - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub sequence: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub timestamp: u64, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub signature: std::vec::Vec, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub new_public_key: ::std::option::Option<::prost_types::Any>, - #[prost(string, tag="5")] + #[prost(string, tag = "5")] pub new_diversifier: std::string::String, } /// Misbehaviour defines misbehaviour for a solo machine which consists /// of a sequence and two signatures over different messages at that sequence. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Misbehaviour { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub sequence: u64, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub signature_one: ::std::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub signature_two: ::std::option::Option, } /// SignatureAndData contains a signature and the data signed over to create that /// signature. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignatureAndData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub signature: std::vec::Vec, - #[prost(enumeration="DataType", tag="2")] + #[prost(enumeration = "DataType", tag = "2")] pub data_type: i32, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub data: std::vec::Vec, + #[prost(uint64, tag = "4")] + pub timestamp: u64, } /// TimestampedSignatureData contains the signature data and the timestamp of the /// signature. #[derive(Clone, PartialEq, ::prost::Message)] pub struct TimestampedSignatureData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub signature_data: std::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub timestamp: u64, } /// SignBytes defines the signed bytes used for signature verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignBytes { - #[prost(uint64, tag="1")] + #[prost(uint64, tag = "1")] pub sequence: u64, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub timestamp: u64, - #[prost(string, tag="3")] + #[prost(string, tag = "3")] pub diversifier: std::string::String, /// type of the data used - #[prost(enumeration="DataType", tag="4")] + #[prost(enumeration = "DataType", tag = "4")] pub data_type: i32, /// marshaled data - #[prost(bytes, tag="5")] + #[prost(bytes, tag = "5")] pub data: std::vec::Vec, } /// HeaderData returns the SignBytes data for update verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct HeaderData { /// header public key - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub new_pub_key: ::std::option::Option<::prost_types::Any>, /// header diversifier - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub new_diversifier: std::string::String, } /// ClientStateData returns the SignBytes data for client state verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientStateData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub client_state: ::std::option::Option<::prost_types::Any>, } /// ConsensusStateData returns the SignBytes data for consensus state /// verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConsensusStateData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub consensus_state: ::std::option::Option<::prost_types::Any>, } /// ConnectionStateData returns the SignBytes data for connection state /// verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConnectionStateData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub connection: ::std::option::Option, } /// ChannelStateData returns the SignBytes data for channel state /// verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ChannelStateData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub channel: ::std::option::Option, } /// PacketCommitmentData returns the SignBytes data for packet commitment /// verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketCommitmentData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub commitment: std::vec::Vec, } /// PacketAcknowledgementData returns the SignBytes data for acknowledgement /// verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketAcknowledgementData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub acknowledgement: std::vec::Vec, } /// PacketReceiptAbsenceData returns the SignBytes data for /// packet receipt absence verification. #[derive(Clone, PartialEq, ::prost::Message)] pub struct PacketReceiptAbsenceData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, } /// NextSequenceRecvData returns the SignBytes data for verification of the next /// sequence to be received. #[derive(Clone, PartialEq, ::prost::Message)] pub struct NextSequenceRecvData { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub path: std::vec::Vec, - #[prost(uint64, tag="2")] + #[prost(uint64, tag = "2")] pub next_seq_recv: u64, } /// DataType defines the type of solo machine proof being created. This is done to preserve uniqueness of different diff --git a/proto/src/prost/ibc.lightclients.tendermint.v1.rs b/proto/src/prost/ibc.lightclients.tendermint.v1.rs index 10f02e8e73..c83072ba0b 100644 --- a/proto/src/prost/ibc.lightclients.tendermint.v1.rs +++ b/proto/src/prost/ibc.lightclients.tendermint.v1.rs @@ -2,42 +2,42 @@ /// and a possible frozen height. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientState { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub chain_id: std::string::String, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub trust_level: ::std::option::Option, /// duration of the period since the LastestTimestamp during which the /// submitted headers are valid for upgrade - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub trusting_period: ::std::option::Option<::prost_types::Duration>, /// duration of the staking unbonding period - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub unbonding_period: ::std::option::Option<::prost_types::Duration>, /// defines how much new (untrusted) header's Time can drift into the future. - #[prost(message, optional, tag="5")] + #[prost(message, optional, tag = "5")] pub max_clock_drift: ::std::option::Option<::prost_types::Duration>, /// Block height when the client was frozen due to a misbehaviour - #[prost(message, optional, tag="6")] + #[prost(message, optional, tag = "6")] pub frozen_height: ::std::option::Option, /// Latest height the client was updated to - #[prost(message, optional, tag="7")] + #[prost(message, optional, tag = "7")] pub latest_height: ::std::option::Option, /// Consensus params of the chain - #[prost(message, optional, tag="8")] + #[prost(message, optional, tag = "8")] pub consensus_params: ::std::option::Option<::tendermint_proto::abci::ConsensusParams>, /// Proof specifications used in verifying counterparty state - #[prost(message, repeated, tag="9")] + #[prost(message, repeated, tag = "9")] pub proof_specs: ::std::vec::Vec, /// Path at which next upgraded client will be committed - #[prost(string, tag="10")] + #[prost(string, tag = "10")] pub upgrade_path: std::string::String, /// This flag, when set to true, will allow governance to recover a client /// which has expired - #[prost(bool, tag="11")] + #[prost(bool, tag = "11")] pub allow_update_after_expiry: bool, /// This flag, when set to true, will allow governance to unfreeze a client /// whose chain has experienced a misbehaviour event - #[prost(bool, tag="12")] + #[prost(bool, tag = "12")] pub allow_update_after_misbehaviour: bool, } /// ConsensusState defines the consensus state from Tendermint. @@ -45,25 +45,25 @@ pub struct ClientState { pub struct ConsensusState { /// timestamp that corresponds to the block height in which the ConsensusState /// was stored. - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub timestamp: ::std::option::Option<::prost_types::Timestamp>, /// commitment root (i.e app hash) - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub root: ::std::option::Option, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub next_validators_hash: std::vec::Vec, } /// Misbehaviour is a wrapper over two conflicting Headers /// that implements Misbehaviour interface expected by ICS-02 #[derive(Clone, PartialEq, ::prost::Message)] pub struct Misbehaviour { - #[prost(string, tag="1")] + #[prost(string, tag = "1")] pub client_id: std::string::String, - #[prost(string, tag="2")] + #[prost(string, tag = "2")] pub chain_id: std::string::String, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub header_1: ::std::option::Option
, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub header_2: ::std::option::Option
, } /// Header defines the Tendermint client consensus Header. @@ -80,20 +80,20 @@ pub struct Misbehaviour { /// trusted validator set at the TrustedHeight. #[derive(Clone, PartialEq, ::prost::Message)] pub struct Header { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub signed_header: ::std::option::Option<::tendermint_proto::types::SignedHeader>, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub validator_set: ::std::option::Option<::tendermint_proto::types::ValidatorSet>, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub trusted_height: ::std::option::Option, - #[prost(message, optional, tag="4")] + #[prost(message, optional, tag = "4")] pub trusted_validators: ::std::option::Option<::tendermint_proto::types::ValidatorSet>, } /// Fraction defines the protobuf message type for tmmath.Fraction #[derive(Clone, PartialEq, ::prost::Message)] pub struct Fraction { - #[prost(int64, tag="1")] + #[prost(int64, tag = "1")] pub numerator: i64, - #[prost(int64, tag="2")] + #[prost(int64, tag = "2")] pub denominator: i64, } diff --git a/proto/src/prost/ibc.mock.rs b/proto/src/prost/ibc.mock.rs index 706fc6b5bd..f17e0779c6 100644 --- a/proto/src/prost/ibc.mock.rs +++ b/proto/src/prost/ibc.mock.rs @@ -1,15 +1,15 @@ #[derive(Clone, PartialEq, ::prost::Message)] pub struct Header { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub height: ::std::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ClientState { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub header: ::std::option::Option
, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConsensusState { - #[prost(message, optional, tag="1")] + #[prost(message, optional, tag = "1")] pub header: ::std::option::Option
, } diff --git a/proto/src/prost/ics23.rs b/proto/src/prost/ics23.rs index c6886a02b2..15d489810f 100644 --- a/proto/src/prost/ics23.rs +++ b/proto/src/prost/ics23.rs @@ -20,13 +20,13 @@ ///length-prefix the data before hashing it. #[derive(Clone, PartialEq, ::prost::Message)] pub struct ExistenceProof { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub value: std::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub leaf: ::std::option::Option, - #[prost(message, repeated, tag="4")] + #[prost(message, repeated, tag = "4")] pub path: ::std::vec::Vec, } /// @@ -36,30 +36,30 @@ pub struct ExistenceProof { #[derive(Clone, PartialEq, ::prost::Message)] pub struct NonExistenceProof { /// TODO: remove this as unnecessary??? we prove a range - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub left: ::std::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub right: ::std::option::Option, } /// ///CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages #[derive(Clone, PartialEq, ::prost::Message)] pub struct CommitmentProof { - #[prost(oneof="commitment_proof::Proof", tags="1, 2, 3, 4")] + #[prost(oneof = "commitment_proof::Proof", tags = "1, 2, 3, 4")] pub proof: ::std::option::Option, } pub mod commitment_proof { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Proof { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Exist(super::ExistenceProof), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Nonexist(super::NonExistenceProof), - #[prost(message, tag="3")] + #[prost(message, tag = "3")] Batch(super::BatchProof), - #[prost(message, tag="4")] + #[prost(message, tag = "4")] Compressed(super::CompressedBatchProof), } } @@ -80,17 +80,17 @@ pub mod commitment_proof { ///output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) #[derive(Clone, PartialEq, ::prost::Message)] pub struct LeafOp { - #[prost(enumeration="HashOp", tag="1")] + #[prost(enumeration = "HashOp", tag = "1")] pub hash: i32, - #[prost(enumeration="HashOp", tag="2")] + #[prost(enumeration = "HashOp", tag = "2")] pub prehash_key: i32, - #[prost(enumeration="HashOp", tag="3")] + #[prost(enumeration = "HashOp", tag = "3")] pub prehash_value: i32, - #[prost(enumeration="LengthOp", tag="4")] + #[prost(enumeration = "LengthOp", tag = "4")] pub length: i32, /// prefix is a fixed bytes that may optionally be included at the beginning to differentiate /// a leaf node from an inner node. - #[prost(bytes, tag="5")] + #[prost(bytes, tag = "5")] pub prefix: std::vec::Vec, } ///* @@ -111,11 +111,11 @@ pub struct LeafOp { ///If either of prefix or suffix is empty, we just treat it as an empty string #[derive(Clone, PartialEq, ::prost::Message)] pub struct InnerOp { - #[prost(enumeration="HashOp", tag="1")] + #[prost(enumeration = "HashOp", tag = "1")] pub hash: i32, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub prefix: std::vec::Vec, - #[prost(bytes, tag="3")] + #[prost(bytes, tag = "3")] pub suffix: std::vec::Vec, } ///* @@ -132,16 +132,16 @@ pub struct InnerOp { #[derive(Clone, PartialEq, ::prost::Message)] pub struct ProofSpec { /// any field in the ExistenceProof must be the same as in this spec. - /// except Prefix, which is just the first bytes of prefix (spec can be longer) - #[prost(message, optional, tag="1")] + /// except Prefix, which is just the first bytes of prefix (spec can be longer) + #[prost(message, optional, tag = "1")] pub leaf_spec: ::std::option::Option, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub inner_spec: ::std::option::Option, /// max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) - #[prost(int32, tag="3")] + #[prost(int32, tag = "3")] pub max_depth: i32, /// min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) - #[prost(int32, tag="4")] + #[prost(int32, tag = "4")] pub min_depth: i32, } /// @@ -158,40 +158,40 @@ pub struct InnerSpec { /// Child order is the ordering of the children node, must count from 0 /// iavl tree is [0, 1] (left then right) /// merk is [0, 2, 1] (left, right, here) - #[prost(int32, repeated, tag="1")] + #[prost(int32, repeated, tag = "1")] pub child_order: ::std::vec::Vec, - #[prost(int32, tag="2")] + #[prost(int32, tag = "2")] pub child_size: i32, - #[prost(int32, tag="3")] + #[prost(int32, tag = "3")] pub min_prefix_length: i32, - #[prost(int32, tag="4")] + #[prost(int32, tag = "4")] pub max_prefix_length: i32, /// empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) - #[prost(bytes, tag="5")] + #[prost(bytes, tag = "5")] pub empty_child: std::vec::Vec, /// hash is the algorithm that must be used for each InnerOp - #[prost(enumeration="HashOp", tag="6")] + #[prost(enumeration = "HashOp", tag = "6")] pub hash: i32, } /// ///BatchProof is a group of multiple proof types than can be compressed #[derive(Clone, PartialEq, ::prost::Message)] pub struct BatchProof { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub entries: ::std::vec::Vec, } /// Use BatchEntry not CommitmentProof, to avoid recursion #[derive(Clone, PartialEq, ::prost::Message)] pub struct BatchEntry { - #[prost(oneof="batch_entry::Proof", tags="1, 2")] + #[prost(oneof = "batch_entry::Proof", tags = "1, 2")] pub proof: ::std::option::Option, } pub mod batch_entry { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Proof { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Exist(super::ExistenceProof), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Nonexist(super::NonExistenceProof), } } @@ -199,46 +199,46 @@ pub mod batch_entry { #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompressedBatchProof { - #[prost(message, repeated, tag="1")] + #[prost(message, repeated, tag = "1")] pub entries: ::std::vec::Vec, - #[prost(message, repeated, tag="2")] + #[prost(message, repeated, tag = "2")] pub lookup_inners: ::std::vec::Vec, } /// Use BatchEntry not CommitmentProof, to avoid recursion #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompressedBatchEntry { - #[prost(oneof="compressed_batch_entry::Proof", tags="1, 2")] + #[prost(oneof = "compressed_batch_entry::Proof", tags = "1, 2")] pub proof: ::std::option::Option, } pub mod compressed_batch_entry { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Proof { - #[prost(message, tag="1")] + #[prost(message, tag = "1")] Exist(super::CompressedExistenceProof), - #[prost(message, tag="2")] + #[prost(message, tag = "2")] Nonexist(super::CompressedNonExistenceProof), } } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompressedExistenceProof { - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, - #[prost(bytes, tag="2")] + #[prost(bytes, tag = "2")] pub value: std::vec::Vec, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub leaf: ::std::option::Option, /// these are indexes into the lookup_inners table in CompressedBatchProof - #[prost(int32, repeated, tag="4")] + #[prost(int32, repeated, tag = "4")] pub path: ::std::vec::Vec, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct CompressedNonExistenceProof { /// TODO: remove this as unnecessary??? we prove a range - #[prost(bytes, tag="1")] + #[prost(bytes, tag = "1")] pub key: std::vec::Vec, - #[prost(message, optional, tag="2")] + #[prost(message, optional, tag = "2")] pub left: ::std::option::Option, - #[prost(message, optional, tag="3")] + #[prost(message, optional, tag = "3")] pub right: ::std::option::Option, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] diff --git a/relayer-cli/README.md b/relayer-cli/README.md index 72d0a5e302..ea50e8dc1e 100644 --- a/relayer-cli/README.md +++ b/relayer-cli/README.md @@ -13,27 +13,21 @@ In order to run the Relayer please ensure you have [Rust installed on your machi There are a few `tx raw` commands that build IBC datagrams and submit them to the chains (`dest_chain_id` below). ```shell script -relayer-cli -c config.toml tx raw create-client dest_chain_id src_chain_id dest_client_id -k seed_file.json +relayer-cli -c config.toml tx raw create-client dest_chain_id src_chain_id dest_client_id -relayer-cli -c config.toml tx raw create-client dest_chain_id src_chain_id dest_client_id -k seed_file.json +relayer-cli -c config.toml tx raw create-client dest_chain_id src_chain_id dest_client_id relayer-cli -c config.toml tx raw conn-init dest_chain_id src_chain_id dest_client_id src_client_id dest_connection_id -d src_connection_id - -k seed_file.json relayer-cli -c config.toml tx raw conn-try dest_chain_id src_chain_id dest_client_id src_client_id dest_connection_id src_connection_id - -k seed_file.json ``` - -Note: This is work in progress, more commands will be implemented and tested with gaia stargate-4 chains. -As shown above the tx commands currently require specifying a seed file: - -* **seed_file** (-k) -> specify a key file (name and location) that will be used by the signer. This key seed file must include a mnemonic (seed phrase) that can be used to retrieve the private key (BIP-39) used to sign the transaction. +Note: This is work in progress, more commands will be implemented and tested with gaia `cosmos-test-stargate` chains. #### Steps to testing the transactions: -* Start two chains using the `dev-env` script from the [ovrclk/relayer](https://github.com/ovrclk/relayer) (make sure to checkout stargate-4 version) -* After you run the script, the Go relayer will create a `data` folder for the chains. Copy the key seed file `./data/ibc1/key_seed.json` for chain `ibc-1` to a convenient location. +* Start two chains using the `/scripts/two-chainz` script from the [cosmos/relayer](https://github.com/cosmos/relayer) (make sure to checkout the latest release, currently 0.6.1) +* After you run the script, the Go relayer will create a `data` folder for the chains. Add the key seed file (shown below) `[GO RELAYER DATA FOLDER]/data/ibc-1/key_seed.json` for chain `ibc-1` to the relayer config folder ($HOME/.rrly) using the `keys add` command below { "name":"user", @@ -43,9 +37,17 @@ As shown above the tx commands currently require specifying a seed file: "mnemonic":"[MNEMONIC WORDS"} } -* Run the transaction command. In this example, it will try to initialize an `ibczeroconn2` connection on chain `ibc1` +* Add the key using the `relayer-clie keys add` command. The key file will be added exactly the above (json format and unencrypted). Later when we have a proper keyring the key file will be safely stored but for now just ensure you're using this on non-production systems. + + `$ cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml keys add ibc-1 [GO RELAYER DATA FOLDER]/data/ibc-1/key_seed.json` + +* After you add the key, you can check if they were properly added using the command: + + `$ cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml keys list ibc-1` + +* Run the transaction command. In this example, it will try to initialize an `ibczeroconn2` connection on chain `ibc-1` - `$ cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml tx raw conn-init ibc1 ibc0 ibczeroclient ibconeclient ibczeroconn2 -d ibconeconn -k key_seed.json` + `$ cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml tx raw conn-init ibc-1 ibc-0 ibczeroclient ibconeclient ibczeroconn2 -d ibconeconn` If you get an empty response it means the tx worked @@ -53,7 +55,7 @@ As shown above the tx commands currently require specifying a seed file: * Check if the connection was created on `ibc-1`: - `$ cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml query connection end ibc1 ibczeroconn2 | jq .` + `$ cargo run --bin relayer -- -c ./relayer-cli/tests/fixtures/two_chains.toml query connection end ibc-1 ibczeroconn2 | jq .` If you see an entry in the JSON file that points to the `ibczeroconn2` connection with state `STATE_INIT` it confirms that the transaction worked: @@ -73,4 +75,4 @@ As shown above the tx commands currently require specifying a seed file: } } }, - \ No newline at end of file + diff --git a/relayer-cli/src/commands/keys.rs b/relayer-cli/src/commands/keys.rs index 001dad462c..56c81174bb 100644 --- a/relayer-cli/src/commands/keys.rs +++ b/relayer-cli/src/commands/keys.rs @@ -1,6 +1,8 @@ //! `keys` subcommand use abscissa_core::{Command, Help, Options, Runnable}; +mod add; +mod list; mod restore; /// `keys` subcommand @@ -10,7 +12,14 @@ pub enum KeysCmd { #[options(help = "get usage information")] Help(Help), - /// The `keys restore` subcommand - #[options(help = "keys restore")] - Restore(restore::KeyRestoreCmd), + /// The `keys add` subcommand + #[options(help = "adds a key to a configured chain")] + Add(add::KeysAddCmd), + + /// The `keys list` subcommand + #[options(help = "list keys configured on a chain")] + List(list::KeysListCmd), + ///// The `keys restore` subcommand + // #[options(help = "restore a key to a configured chain using a mnemonic")] + // Restore(restore::KeyRestoreCmd), } diff --git a/relayer-cli/src/commands/keys/add.rs b/relayer-cli/src/commands/keys/add.rs new file mode 100644 index 0000000000..f70b612a00 --- /dev/null +++ b/relayer-cli/src/commands/keys/add.rs @@ -0,0 +1,65 @@ +use crate::application::app_config; +use abscissa_core::{Command, Options, Runnable}; +use relayer::config::Config; + +use crate::error::{Error, Kind}; +use crate::prelude::*; +use relayer::keys::add::{add_key, KeysAddOptions}; + +#[derive(Clone, Command, Debug, Options)] +pub struct KeysAddCmd { + #[options(free, help = "identifier of the chain")] + chain_id: Option, + + #[options(free, help = "the key path and filename")] + file: Option, +} + +impl KeysAddCmd { + fn validate_options(&self, config: &Config) -> Result { + let chain_id = self + .chain_id + .clone() + .ok_or_else(|| "missing chain identifier".to_string())?; + + let chain_config = config + .chains + .iter() + .find(|c| c.id == chain_id.parse().unwrap()) + .ok_or_else(|| { + "Invalid chain identifier. Cannot retrieve the chain configuration".to_string() + })?; + + let key_filename = self + .file + .clone() + .ok_or_else(|| "missing signer key file".to_string())?; + + Ok(KeysAddOptions { + name: chain_config.key_name.clone(), + file: key_filename, + chain_config: chain_config.clone(), + }) + } +} + +impl Runnable for KeysAddCmd { + fn run(&self) { + let config = app_config(); + + let opts = match self.validate_options(&config) { + Err(err) => { + status_err!("invalid options: {}", err); + return; + } + Ok(result) => result, + }; + + let res: Result = add_key(opts).map_err(|e| Kind::Keys.context(e).into()); + + match res { + Ok(r) => status_info!("key add result: ", "{:?}", r), + Err(e) => status_info!("key add failed: ", "{}", e), + } + } +} diff --git a/relayer-cli/src/commands/keys/list.rs b/relayer-cli/src/commands/keys/list.rs new file mode 100644 index 0000000000..aa282d8c4f --- /dev/null +++ b/relayer-cli/src/commands/keys/list.rs @@ -0,0 +1,55 @@ +use crate::application::app_config; +use abscissa_core::{Command, Options, Runnable}; +use relayer::config::Config; + +use crate::error::{Error, Kind}; +use crate::prelude::*; +use relayer::keys::list::{list_keys, KeysListOptions}; + +#[derive(Clone, Command, Debug, Options)] +pub struct KeysListCmd { + #[options(free, help = "identifier of the chain")] + chain_id: Option, +} + +impl KeysListCmd { + fn validate_options(&self, config: &Config) -> Result { + let chain_id = self + .chain_id + .clone() + .ok_or_else(|| "missing chain identifier".to_string())?; + + let chain_config = config + .chains + .iter() + .find(|c| c.id == chain_id.parse().unwrap()) + .ok_or_else(|| { + "Invalid chain identifier. Cannot retrieve the chain configuration".to_string() + })?; + + Ok(KeysListOptions { + chain_config: chain_config.clone(), + }) + } +} + +impl Runnable for KeysListCmd { + fn run(&self) { + let config = app_config(); + + let opts = match self.validate_options(&config) { + Err(err) => { + status_err!("invalid options: {}", err); + return; + } + Ok(result) => result, + }; + + let res: Result = list_keys(opts).map_err(|e| Kind::Keys.context(e).into()); + + match res { + Ok(r) => status_info!("keys list result: ", "{:?}", r), + Err(e) => status_info!("keys list failed: ", "{}", e), + } + } +} diff --git a/relayer-cli/src/commands/query/channel.rs b/relayer-cli/src/commands/query/channel.rs index d35f085263..55cbe3bb62 100644 --- a/relayer-cli/src/commands/query/channel.rs +++ b/relayer-cli/src/commands/query/channel.rs @@ -128,7 +128,7 @@ mod tests { #[test] fn parse_channel_query_end_parameters() { let default_params = QueryChannelEndCmd { - chain_id: Some("ibc0".to_string().parse().unwrap()), + chain_id: Some("ibc-0".to_string().parse().unwrap()), port_id: Some("transfer".to_string().parse().unwrap()), channel_id: Some("testchannel".to_string().parse().unwrap()), height: None, diff --git a/relayer-cli/src/commands/query/client.rs b/relayer-cli/src/commands/query/client.rs index 50f509ac4d..e59a6bc53e 100644 --- a/relayer-cli/src/commands/query/client.rs +++ b/relayer-cli/src/commands/query/client.rs @@ -312,7 +312,7 @@ mod tests { #[test] fn parse_query_state_parameters() { let default_params = QueryClientStateCmd { - chain_id: Some("ibc0".to_string().parse().unwrap()), + chain_id: Some("ibc-0".to_string().parse().unwrap()), client_id: Some("ibconeclient".to_string().parse().unwrap()), height: None, proof: None, @@ -398,7 +398,7 @@ mod tests { #[test] fn parse_query_client_connections_parameters() { let default_params = QueryClientConnectionsCmd { - chain_id: Some("ibc0".to_string().parse().unwrap()), + chain_id: Some("ibc-0".to_string().parse().unwrap()), client_id: Some("clientidone".to_string().parse().unwrap()), height: Some(4), }; diff --git a/relayer-cli/src/commands/query/connection.rs b/relayer-cli/src/commands/query/connection.rs index fafd81b14e..2e80e65781 100644 --- a/relayer-cli/src/commands/query/connection.rs +++ b/relayer-cli/src/commands/query/connection.rs @@ -106,7 +106,7 @@ mod tests { #[test] fn parse_connection_query_end_parameters() { let default_params = QueryConnectionEndCmd { - chain_id: Some("ibc0".to_string().parse().unwrap()), + chain_id: Some("ibc-0".to_string().parse().unwrap()), connection_id: Some("ibconeconnection".to_string().parse().unwrap()), height: None, proof: None, diff --git a/relayer-cli/src/commands/tx/channel.rs b/relayer-cli/src/commands/tx/channel.rs index ae43bcecec..81afbfeee5 100644 --- a/relayer-cli/src/commands/tx/channel.rs +++ b/relayer-cli/src/commands/tx/channel.rs @@ -15,42 +15,36 @@ use relayer::tx::channel::{ #[derive(Clone, Command, Debug, Options)] pub struct TxRawChanInitCmd { #[options(free, help = "identifier of the destination chain")] - dest_chain_id: String, + dst_chain_id: String, #[options(free, help = "identifier of the source chain")] src_chain_id: String, #[options(free, help = "identifier of the destination connection")] - dest_connection_id: ConnectionId, + dst_connection_id: ConnectionId, #[options(free, help = "identifier of the destination port")] - dest_port_id: PortId, + dst_port_id: PortId, #[options(free, help = "identifier of the source port")] src_port_id: PortId, #[options(free, help = "identifier of the destination channel")] - dest_channel_id: ChannelId, + dst_channel_id: ChannelId, #[options(help = "identifier of the source channel", short = "s")] src_channel_id: Option, #[options(help = "the channel order", short = "o")] ordering: Order, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawChanInitCmd { fn validate_options(&self, config: &Config) -> Result { - let dest_chain_config = config + let dst_chain_config = config .chains .iter() - .find(|c| c.id == self.dest_chain_id.parse().unwrap()) + .find(|c| c.id == self.dst_chain_id.parse().unwrap()) .ok_or_else(|| "missing destination chain configuration".to_string())?; let src_chain_config = config @@ -59,24 +53,19 @@ impl TxRawChanInitCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ChannelOpenInitOptions { - dest_chain_config: dest_chain_config.clone(), + dst_chain_config: dst_chain_config.clone(), src_chain_config: src_chain_config.clone(), - dest_connection_id: self.dest_connection_id.clone(), + dst_connection_id: self.dst_connection_id.clone(), - dest_port_id: self.dest_port_id.clone(), + dst_port_id: self.dst_port_id.clone(), src_port_id: self.src_port_id.clone(), - dest_channel_id: self.dest_channel_id.clone(), + dst_channel_id: self.dst_channel_id.clone(), src_channel_id: self.src_channel_id.clone(), ordering: self.ordering, - signer_seed, }; Ok(opts) @@ -131,12 +120,6 @@ pub struct TxRawChanTryCmd { #[options(help = "the channel order", short = "o")] ordering: Order, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawChanTryCmd { @@ -153,24 +136,19 @@ impl TxRawChanTryCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ChannelOpenOptions { - dest_chain_config: dest_chain_config.clone(), + dst_chain_config: dest_chain_config.clone(), src_chain_config: src_chain_config.clone(), - dest_connection_id: self.dest_connection_id.clone(), + dst_connection_id: self.dest_connection_id.clone(), - dest_port_id: self.dest_port_id.clone(), + dst_port_id: self.dest_port_id.clone(), src_port_id: self.src_port_id.clone(), - dest_channel_id: self.dest_channel_id.clone(), + dst_channel_id: self.dest_channel_id.clone(), src_channel_id: self.src_channel_id.clone(), ordering: self.ordering, - signer_seed, }; Ok(opts) @@ -225,12 +203,6 @@ pub struct TxRawChanAckCmd { #[options(help = "the channel order", short = "o")] ordering: Order, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawChanAckCmd { @@ -247,24 +219,19 @@ impl TxRawChanAckCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ChannelOpenOptions { - dest_chain_config: dest_chain_config.clone(), + dst_chain_config: dest_chain_config.clone(), src_chain_config: src_chain_config.clone(), - dest_connection_id: self.dest_connection_id.clone(), + dst_connection_id: self.dest_connection_id.clone(), - dest_port_id: self.dest_port_id.clone(), + dst_port_id: self.dest_port_id.clone(), src_port_id: self.src_port_id.clone(), - dest_channel_id: self.dest_channel_id.clone(), + dst_channel_id: self.dest_channel_id.clone(), src_channel_id: self.src_channel_id.clone(), ordering: self.ordering, - signer_seed, }; Ok(opts) @@ -319,12 +286,6 @@ pub struct TxRawChanConfirmCmd { #[options(help = "the channel order", short = "o")] ordering: Order, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawChanConfirmCmd { @@ -341,24 +302,19 @@ impl TxRawChanConfirmCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ChannelOpenOptions { - dest_chain_config: dest_chain_config.clone(), + dst_chain_config: dest_chain_config.clone(), src_chain_config: src_chain_config.clone(), - dest_connection_id: self.dest_connection_id.clone(), + dst_connection_id: self.dest_connection_id.clone(), - dest_port_id: self.dest_port_id.clone(), + dst_port_id: self.dest_port_id.clone(), src_port_id: self.src_port_id.clone(), - dest_channel_id: self.dest_channel_id.clone(), + dst_channel_id: self.dest_channel_id.clone(), src_channel_id: self.src_channel_id.clone(), ordering: self.ordering, - signer_seed, }; Ok(opts) diff --git a/relayer-cli/src/commands/tx/client.rs b/relayer-cli/src/commands/tx/client.rs index eb7bafaeb9..cbce5b8a5a 100644 --- a/relayer-cli/src/commands/tx/client.rs +++ b/relayer-cli/src/commands/tx/client.rs @@ -23,12 +23,6 @@ pub struct TxCreateClientCmd { help = "identifier of the client to be created on destination chain" )] dst_client_id: ClientId, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl Runnable for TxCreateClientCmd { @@ -37,7 +31,6 @@ impl Runnable for TxCreateClientCmd { &self.dst_chain_id, &self.src_chain_id, &self.dst_client_id, - &self.seed_file, ) { Err(err) => { status_err!("invalid options: {}", err); @@ -70,22 +63,12 @@ pub struct TxUpdateClientCmd { help = "identifier of the client to be updated on destination chain" )] dst_client_id: ClientId, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl Runnable for TxUpdateClientCmd { fn run(&self) { - let opts = validate_common_options( - &self.dst_chain_id, - &self.src_chain_id, - &self.dst_client_id, - &self.seed_file, - ); + let opts = + validate_common_options(&self.dst_chain_id, &self.src_chain_id, &self.dst_client_id); let opts = match opts { Ok(result) => result, @@ -111,7 +94,6 @@ fn validate_common_options( dst_chain_id: &str, src_chain_id: &str, dst_client_id: &ClientId, - seed_file: &str, ) -> Result { let config = app_config(); @@ -137,14 +119,9 @@ fn validate_common_options( .find(|c| c.id == src_chain_id) .ok_or_else(|| "missing source chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - Ok(ClientOptions { dst_client_id: dst_client_id.clone(), dst_chain_config: dst_chain_config.clone(), src_chain_config: src_chain_config.clone(), - signer_seed, }) } diff --git a/relayer-cli/src/commands/tx/connection.rs b/relayer-cli/src/commands/tx/connection.rs index 51ca12d49c..d498f73791 100644 --- a/relayer-cli/src/commands/tx/connection.rs +++ b/relayer-cli/src/commands/tx/connection.rs @@ -31,12 +31,6 @@ pub struct TxRawConnInitCmd { #[options(help = "identifier of the source connection", short = "s")] src_connection_id: Option, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawConnInitCmd { @@ -53,10 +47,6 @@ impl TxRawConnInitCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ConnectionOpenInitOptions { dst_chain_config: dst_chain_config.clone(), src_chain_config: src_chain_config.clone(), @@ -64,7 +54,6 @@ impl TxRawConnInitCmd { src_client_id: self.src_client_id.clone(), dst_connection_id: self.dst_connection_id.clone(), src_connection_id: self.src_connection_id.clone(), - signer_seed, }; Ok(opts) @@ -112,12 +101,6 @@ pub struct TxRawConnTryCmd { #[options(free, help = "identifier of the source connection")] src_connection_id: ConnectionId, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawConnTryCmd { @@ -134,10 +117,6 @@ impl TxRawConnTryCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ConnectionOpenOptions { src_chain_config: src_chain_config.clone(), dst_chain_config: dst_chain_config.clone(), @@ -145,7 +124,6 @@ impl TxRawConnTryCmd { dst_client_id: self.dst_client_id.clone(), src_connection_id: self.src_connection_id.clone(), dst_connection_id: self.dst_connection_id.clone(), - signer_seed, }; Ok(opts) @@ -194,12 +172,6 @@ pub struct TxRawConnAckCmd { #[options(free, help = "identifier of the source connection")] src_connection_id: ConnectionId, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawConnAckCmd { @@ -216,10 +188,6 @@ impl TxRawConnAckCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ConnectionOpenOptions { src_chain_config: src_chain_config.clone(), dst_chain_config: dst_chain_config.clone(), @@ -227,7 +195,6 @@ impl TxRawConnAckCmd { dst_client_id: self.dst_client_id.clone(), src_connection_id: self.src_connection_id.clone(), dst_connection_id: self.dst_connection_id.clone(), - signer_seed, }; Ok(opts) @@ -276,12 +243,6 @@ pub struct TxRawConnConfirmCmd { #[options(free, help = "identifier of the source connection")] src_connection_id: ConnectionId, - - #[options( - help = "json key file for the signer, must include mnemonic", - short = "k" - )] - seed_file: String, } impl TxRawConnConfirmCmd { @@ -298,10 +259,6 @@ impl TxRawConnConfirmCmd { .find(|c| c.id == self.src_chain_id.parse().unwrap()) .ok_or_else(|| "missing src chain configuration".to_string())?; - let signer_seed = std::fs::read_to_string(&self.seed_file).map_err(|e| { - anomaly::Context::new("invalid signer seed file", Some(e.into())).to_string() - })?; - let opts = ConnectionOpenOptions { src_chain_config: src_chain_config.clone(), dst_chain_config: dst_chain_config.clone(), @@ -309,7 +266,6 @@ impl TxRawConnConfirmCmd { dst_client_id: self.dst_client_id.clone(), src_connection_id: self.src_connection_id.clone(), dst_connection_id: self.dst_connection_id.clone(), - signer_seed, }; Ok(opts) diff --git a/relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/conf b/relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/conf deleted file mode 100644 index 4154d7c458..0000000000 --- a/relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/conf +++ /dev/null @@ -1,4 +0,0 @@ -segment_size: 524288 -use_compression: false -version: 0.34 -vQ� \ No newline at end of file diff --git a/relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/db b/relayer-cli/store/7CC0F58DB4DC6BFFDA6D20BAF6EF8CFA23B79C36/db deleted file mode 100644 index 03cab51e3623cec460294de8760063899e7041de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 96 zcmeyr>p1^^2&iX(fCl^e3%}Wb?7~IIDp(mA7#UtGHZSDhU|@nOVECw1oX^3+H9iDcCxuW)6c#*o!7l2lDLod$1ID^w-AqUJ &ChainConfig; + /// Returns the chain's keybase + fn keybase(&self) -> &KeyRing; + /// Get a low-level RPC client for this chain /// TODO - Should this be part of the Chain trait? fn rpc_client(&self) -> &Self::RpcClient; @@ -77,16 +80,11 @@ pub trait Chain { fn query(&self, data: Path, height: ICSHeight, prove: bool) -> Result; /// Send a transaction with `msgs` to chain. - fn send_tx( - &self, - proto_msgs: Vec, - key: KeyEntry, - memo: String, - timeout_height: u64, - ) -> Result; - - /// Get the key and account Id - temporary solution - fn key_and_signer(&mut self, key_file_contents: &str) -> Result<(KeyEntry, AccountId), Error>; + fn send_tx(&self, proto_msgs: Vec) -> Result; + + fn get_signer(&mut self) -> Result; + + fn get_key(&mut self) -> Result; // Build states fn build_client_state(&self, height: ICSHeight) -> Result; diff --git a/relayer/src/chain/cosmos.rs b/relayer/src/chain/cosmos.rs index 4d37f4ee3b..f040b31151 100644 --- a/relayer/src/chain/cosmos.rs +++ b/relayer/src/chain/cosmos.rs @@ -21,14 +21,10 @@ use tendermint_light_client::types::{LightBlock as TMLightBlock, ValidatorSet}; use tendermint_rpc::Client; use tendermint_rpc::HttpClient; -// Support for GRPC - -use ibc_proto::cosmos::auth::v1beta1::{BaseAccount, QueryAccountRequest}; use ibc_proto::cosmos::base::v1beta1::Coin; use ibc_proto::cosmos::tx::v1beta1::mode_info::{Single, Sum}; use ibc_proto::cosmos::tx::v1beta1::{AuthInfo, Fee, ModeInfo, SignDoc, SignerInfo, TxBody, TxRaw}; -use tonic::codegen::http::Uri; use ibc::downcast; use ibc::ics02_client::client_def::{AnyClientState, AnyConsensusState}; @@ -52,11 +48,15 @@ use crate::config::ChainConfig; use crate::error::{Error, Kind}; use crate::keyring::store::{KeyEntry, KeyRing, KeyRingOperations, StoreBackend}; +// Support for GRPC +use ibc_proto::cosmos::auth::v1beta1::{BaseAccount, QueryAccountRequest}; +use tonic::codegen::http::Uri; + pub struct CosmosSDKChain { config: ChainConfig, rpc_client: HttpClient, - key_ring: KeyRing, rt: Arc, + keybase: KeyRing, } impl CosmosSDKChain { @@ -68,20 +68,18 @@ impl CosmosSDKChain { let rpc_client = HttpClient::new(primary.address.clone()).map_err(|e| Kind::Rpc.context(e))?; - let key_store = KeyRing::init(StoreBackend::Memory); + // Initialize key store and load key + let key_store = KeyRing::init(StoreBackend::Test, config.clone()) + .map_err(|e| Kind::KeyBase.context(e))?; Ok(Self { rt, config, - key_ring: key_store, + keybase: key_store, rpc_client, }) } - pub fn key_ring(&mut self) -> &mut KeyRing { - &mut self.key_ring - } - /// The unbonding period of this chain pub fn unbonding_period(&self) -> Result { // TODO - generalize this @@ -165,18 +163,16 @@ impl Chain for CosmosSDKChain { /// Send a transaction that includes the specified messages /// TODO - split the messages in multiple Tx-es such that they don't exceed some max size - fn send_tx( - &self, - proto_msgs: Vec, - key: KeyEntry, - memo: String, - timeout_height: u64, - ) -> Result { + fn send_tx(&self, proto_msgs: Vec) -> Result { + let key = self + .keybase() + .get_key() + .map_err(|e| Kind::KeyBase.context(e))?; // Create TxBody let body = TxBody { messages: proto_msgs.to_vec(), - memo, - timeout_height, + memo: "".to_string(), + timeout_height: 0_u64, extension_options: Vec::::new(), non_critical_extension_options: Vec::::new(), }; @@ -242,7 +238,7 @@ impl Chain for CosmosSDKChain { prost::Message::encode(&sign_doc, &mut signdoc_buf).unwrap(); // Sign doc and broadcast - let signed = self.key_ring.sign(key.address, signdoc_buf); + let signed = self.keybase.sign_msg(signdoc_buf); let tx_raw = TxRaw { body_bytes: body_buf, @@ -261,20 +257,6 @@ impl Chain for CosmosSDKChain { Ok(response) } - /// Get the key and account Id - temporary solution - fn key_and_signer(&mut self, key_file_contents: &str) -> Result<(KeyEntry, AccountId), Error> { - // Get the key from key seed file - let key = self - .key_ring - .key_from_seed_file(key_file_contents) - .map_err(|e| Kind::KeyBase.context(e))?; - - let signer: AccountId = - AccountId::from_str(&key.address.to_hex()).map_err(|e| Kind::KeyBase.context(e))?; - - Ok((key, signer)) - } - /// Query the latest height the chain is at via a RPC query fn query_latest_height(&self) -> Result { let status = self @@ -400,6 +382,35 @@ impl Chain for CosmosSDKChain { trusted_validator_set: fix_validator_set(&trusted_light_block)?, }) } + + fn keybase(&self) -> &KeyRing { + &self.keybase + } + + /// Get the account for the signer + fn get_signer(&mut self) -> Result { + // Get the key from key seed file + let key = self + .keybase() + .get_key() + .map_err(|e| Kind::KeyBase.context(e))?; + + let signer: AccountId = + AccountId::from_str(&key.address.to_hex()).map_err(|e| Kind::KeyBase.context(e))?; + + Ok(signer) + } + + /// Get the signing key + fn get_key(&mut self) -> Result { + // Get the key from key seed file + let key = self + .keybase() + .get_key() + .map_err(|e| Kind::KeyBase.context(e))?; + + Ok(key) + } } fn fix_validator_set(light_block: &TMLightBlock) -> Result { diff --git a/relayer/src/chain/handle.rs b/relayer/src/chain/handle.rs index c4141fba35..39ba51b04a 100644 --- a/relayer/src/chain/handle.rs +++ b/relayer/src/chain/handle.rs @@ -58,9 +58,6 @@ pub enum HandleInput { SendTx { proto_msgs: Vec, - key: Box, - memo: String, - timeout_height: u64, reply_to: ReplyTo, }, @@ -78,9 +75,12 @@ pub enum HandleInput { // transaction: EncodedTransaction, // reply_to: ReplyTo<()>, // }, - KeyAndSigner { - key_file_contents: String, - reply_to: ReplyTo<(KeyEntry, AccountId)>, + Signer { + reply_to: ReplyTo, + }, + + Key { + reply_to: ReplyTo, }, ModuleVersion { @@ -182,13 +182,7 @@ pub trait ChainHandle: Clone + Send + Sync { fn subscribe(&self, chain_id: ChainId) -> Result; /// Send a transaction with `msgs` to chain. - fn send_tx( - &self, - proto_msgs: Vec, - key: KeyEntry, - memo: String, - timeout_height: u64, - ) -> Result; + fn send_tx(&self, proto_msgs: Vec) -> Result; // Inclusion proofs // It might be good to include an inclusion proof method which abstracts over the light client @@ -198,7 +192,9 @@ pub trait ChainHandle: Clone + Send + Sync { fn get_minimal_set(&self, from: Height, to: Height) -> Result, Error>; - fn key_and_signer(&self, key_file_contents: &str) -> Result<(KeyEntry, AccountId), Error>; + fn get_signer(&self) -> Result; + + fn get_key(&self) -> Result; // fn submit(&self, transaction: EncodedTransaction) -> Result<(), Error>; diff --git a/relayer/src/chain/handle/prod.rs b/relayer/src/chain/handle/prod.rs index 1361afedaf..4876bca612 100644 --- a/relayer/src/chain/handle/prod.rs +++ b/relayer/src/chain/handle/prod.rs @@ -77,18 +77,9 @@ impl ChainHandle for ProdChainHandle { }) } - fn send_tx( - &self, - proto_msgs: Vec, - key: KeyEntry, - memo: String, - timeout_height: u64, - ) -> Result { + fn send_tx(&self, proto_msgs: Vec) -> Result { self.send(|reply_to| HandleInput::SendTx { proto_msgs, - key: Box::new(key), - memo, - timeout_height, reply_to, }) } @@ -101,11 +92,12 @@ impl ChainHandle for ProdChainHandle { self.send(|reply_to| HandleInput::GetMinimalSet { from, to, reply_to }) } - fn key_and_signer(&self, key_file_contents: &str) -> Result<(KeyEntry, AccountId), Error> { - self.send(|reply_to| HandleInput::KeyAndSigner { - key_file_contents: key_file_contents.to_string(), - reply_to, - }) + fn get_signer(&self) -> Result { + self.send(|reply_to| HandleInput::Signer { reply_to }) + } + + fn get_key(&self) -> Result { + self.send(|reply_to| HandleInput::Key { reply_to }) } fn module_version(&self, port_id: &PortId) -> Result { diff --git a/relayer/src/chain/runtime.rs b/relayer/src/chain/runtime.rs index d9641af4d5..47dad8ea58 100644 --- a/relayer/src/chain/runtime.rs +++ b/relayer/src/chain/runtime.rs @@ -164,8 +164,8 @@ impl ChainRuntime { self.query(path, height, prove, reply_to)? }, - Ok(HandleInput::SendTx { proto_msgs, key, memo, timeout_height, reply_to }) => { - self.send_tx(proto_msgs, *key, memo, timeout_height, reply_to)? + Ok(HandleInput::SendTx { proto_msgs, reply_to }) => { + self.send_tx(proto_msgs, reply_to)? }, Ok(HandleInput::GetMinimalSet { from, to, reply_to }) => { @@ -184,8 +184,12 @@ impl ChainRuntime { // self.create_packet(event, reply_to)? // } - Ok(HandleInput::KeyAndSigner { key_file_contents, reply_to }) => { - self.key_and_signer(key_file_contents, reply_to)? + Ok(HandleInput::Signer { reply_to }) => { + self.get_signer(reply_to)? + } + + Ok(HandleInput::Key { reply_to }) => { + self.get_key(reply_to)? } Ok(HandleInput::ModuleVersion { port_id, reply_to }) => { @@ -294,12 +298,9 @@ impl ChainRuntime { fn send_tx( &self, proto_msgs: Vec, - key: KeyEntry, - memo: String, - timeout_height: u64, reply_to: ReplyTo, ) -> Result<(), Error> { - let result = self.chain.send_tx(proto_msgs, key, memo, timeout_height); + let result = self.chain.send_tx(proto_msgs); reply_to .send(result) @@ -346,12 +347,18 @@ impl ChainRuntime { // todo!() // } - fn key_and_signer( - &mut self, - key_file_contents: String, - reply_to: ReplyTo<(KeyEntry, AccountId)>, - ) -> Result<(), Error> { - let result = self.chain.key_and_signer(&key_file_contents); + fn get_signer(&mut self, reply_to: ReplyTo) -> Result<(), Error> { + let result = self.chain.get_signer(); + + reply_to + .send(result) + .map_err(|e| Kind::Channel.context(e))?; + + Ok(()) + } + + fn get_key(&mut self, reply_to: ReplyTo) -> Result<(), Error> { + let result = self.chain.get_key(); reply_to .send(result) diff --git a/relayer/src/keyring/errors.rs b/relayer/src/keyring/errors.rs index 71482459cc..73239aaee4 100644 --- a/relayer/src/keyring/errors.rs +++ b/relayer/src/keyring/errors.rs @@ -5,9 +5,12 @@ pub type Error = anomaly::Error; #[derive(Clone, Debug, Error)] pub enum Kind { - #[error("cannot retrieve key for address")] + #[error("invalid key")] InvalidKey, + #[error("key already exists")] + ExistingKey, + #[error("invalid mnemonic")] InvalidMnemonic, @@ -16,6 +19,9 @@ pub enum Kind { #[error("cannot generate bech32 account")] Bech32Account, + + #[error("key store error")] + KeyStoreOperation, } impl Kind { diff --git a/relayer/src/keyring/store.rs b/relayer/src/keyring/store.rs index a5528abb30..17611f7535 100644 --- a/relayer/src/keyring/store.rs +++ b/relayer/src/keyring/store.rs @@ -1,3 +1,4 @@ +use crate::config::ChainConfig; use crate::keyring::errors::{Error, Kind}; use bech32::ToBase32; @@ -13,25 +14,42 @@ use k256::ecdsa::{signature::Signer, Signature, SigningKey}; use serde_json::Value; use std::collections::BTreeMap; use std::convert::TryFrom; +use std::fs; +use std::fs::File; +use std::io::{Read, Write}; +use std::path::{Path, PathBuf}; + use tendermint::account::Id as AccountId; +pub const KEYSTORE_DEFAULT_FOLDER: &str = ".rrly/keys/"; +pub const KEYSTORE_TEST_BACKEND: &str = "keyring-test"; +pub const KEYSTORE_FILE_EXTENSION: &str = "json"; + pub type Address = Vec; pub enum KeyRing { - MemoryKeyStore { store: BTreeMap }, + MemoryKeyStore { + store: BTreeMap, + chain_config: ChainConfig, + }, + TestKeyStore { + store: Box, + chain_config: ChainConfig, + }, } pub enum StoreBackend { Memory, + Test, } pub trait KeyRingOperations: Sized { - fn init(backend: StoreBackend) -> KeyRing; - fn key_from_seed_file(&mut self, key_file_content: &str) -> Result; - fn add_from_mnemonic(&mut self, mnemonic_words: &str) -> Result; - fn get(&self, address: Vec) -> Result<&KeyEntry, Error>; - fn insert(&mut self, addr: Vec, key: KeyEntry) -> Option; - fn sign(&self, signer: Vec, msg: Vec) -> Vec; + fn init(backend: StoreBackend, chain_config: ChainConfig) -> Result; + fn key_from_seed_file(&self, key_file_content: &str) -> Result; + fn key_from_mnemonic(&self, mnemonic_words: &str) -> Result; + fn get_key(&self) -> Result; + fn add_key(&self, key_contents: &str) -> Result<(), Error>; + fn sign_msg(&self, msg: Vec) -> Vec; } /// Key entry stores the Private Key and Public Key as well the address @@ -52,17 +70,34 @@ pub struct KeyEntry { impl KeyRingOperations for KeyRing { /// Initialize a in memory key entry store - fn init(backend: StoreBackend) -> KeyRing { + fn init(backend: StoreBackend, chain_config: ChainConfig) -> Result { match backend { StoreBackend::Memory => { - let store: BTreeMap = BTreeMap::new(); - KeyRing::MemoryKeyStore { store } + let store: BTreeMap = BTreeMap::new(); + Ok(KeyRing::MemoryKeyStore { + store, + chain_config, + }) + } + StoreBackend::Test => { + // Create keys folder if it does not exist + let keys_folder = get_test_backend_folder(&chain_config).map_err(|e| { + Kind::KeyStoreOperation + .context(format!("failed to create keys folder: {:?}", e)) + })?; + fs::create_dir_all(keys_folder.clone()) + .map_err(|_| Kind::KeyStoreOperation.context("error creating keys folder"))?; + + Ok(KeyRing::TestKeyStore { + store: Box::::from(keys_folder), + chain_config, + }) } } } /// Get key from seed file - fn key_from_seed_file(&mut self, key_file_content: &str) -> Result { + fn key_from_seed_file(&self, key_file_content: &str) -> Result { let key_json: Value = serde_json::from_str(key_file_content).map_err(|e| Kind::InvalidKey.context(e))?; @@ -77,7 +112,7 @@ impl KeyRingOperations for KeyRing { match mnemonic { Some(v) => { key = self - .add_from_mnemonic(v) + .key_from_mnemonic(v) .map_err(|e| Kind::InvalidMnemonic.context(e))?; Ok(key) } @@ -93,7 +128,7 @@ impl KeyRingOperations for KeyRing { } /// Add a key entry in the store using a mnemonic. - fn add_from_mnemonic(&mut self, mnemonic_words: &str) -> Result { + fn key_from_mnemonic(&self, mnemonic_words: &str) -> Result { // Generate seed from mnemonic let mnemonic = Mnemonic::from_str(mnemonic_words).map_err(|e| Kind::InvalidMnemonic.context(e))?; @@ -122,38 +157,111 @@ impl KeyRingOperations for KeyRing { account, }; - self.insert(key.clone().address, key.clone()); - Ok(key) } /// Return a key entry from a key name - fn get(&self, address: Vec) -> Result<&KeyEntry, Error> { + fn get_key(&self) -> Result { match &self { - KeyRing::MemoryKeyStore { store: s } => { - if !s.contains_key(&address) { + KeyRing::MemoryKeyStore { + store, + chain_config, + } => { + if !store.contains_key(chain_config.key_name.clone().as_str()) { Err(Kind::InvalidKey.into()) } else { - let key = s.get(&address); - match key { - Some(k) => Ok(k), + let key_content = store.get(chain_config.key_name.as_str()); + match key_content { + Some(k) => { + let key_entry = self.key_from_seed_file(k).map_err(|_| { + Kind::KeyStoreOperation.context("failed to get key entry") + })?; + Ok(key_entry) + } None => Err(Kind::InvalidKey.into()), } } } + KeyRing::TestKeyStore { + store: _store, + chain_config, + } => { + // Fetch key from test folder and return key entry + let keys_folder = get_test_backend_folder(chain_config).map_err(|e| { + Kind::KeyStoreOperation + .context(format!("failed to retrieve keys folder: {:?}", e)) + })?; + + let mut filename = + Path::new(keys_folder.as_os_str()).join(chain_config.key_name.clone()); + filename.set_extension(KEYSTORE_FILE_EXTENSION); + + if Path::exists(filename.as_path()) { + let mut file = File::open(filename) + .map_err(|_| Kind::KeyStoreOperation.context("cannot open key file"))?; + let mut file_contents = String::new(); + file.read_to_string(&mut file_contents) + .map_err(|_| Kind::KeyStoreOperation.context("cannot ready key file"))?; + let key_entry = + self.key_from_seed_file(file_contents.as_str()) + .map_err(|_| { + Kind::KeyStoreOperation.context("error getting key from file") + })?; + Ok(key_entry) + } else { + Err(Kind::KeyStoreOperation + .context("cannot find key file") + .into()) + } + } } } /// Insert an entry in the key store - fn insert(&mut self, addr: Vec, key: KeyEntry) -> Option { + fn add_key(&self, key_contents: &str) -> Result<(), Error> { match self { - KeyRing::MemoryKeyStore { store: s } => s.insert(addr, key), + KeyRing::MemoryKeyStore { + store, + chain_config, + } => match store.get(chain_config.key_name.clone().as_str()) { + Some(_s) => Err(Kind::ExistingKey + .context("key already exists".to_string()) + .into()), + None => { + store + .clone() + .insert(chain_config.key_name.to_string(), key_contents.to_string()); + Ok(()) + } + }, + KeyRing::TestKeyStore { + store: _store, + chain_config, + } => { + // Save file to appropriate location in the keys folder + let keys_folder = get_test_backend_folder(chain_config).map_err(|e| { + Kind::KeyStoreOperation + .context(format!("failed to retrieve keys folder: {:?}", e)) + })?; + + let mut filename = + Path::new(keys_folder.as_os_str()).join(chain_config.key_name.clone()); + filename.set_extension(KEYSTORE_FILE_EXTENSION); + + let mut file = File::create(filename) + .map_err(|_| Kind::KeyStoreOperation.context("error creating the key file"))?; + + file.write_all(&key_contents.as_bytes()) + .map_err(|_| Kind::KeyStoreOperation.context("error writing the key file"))?; + + Ok(()) + } } } /// Sign a message - fn sign(&self, signer: Vec, msg: Vec) -> Vec { - let key = self.get(signer).unwrap(); + fn sign_msg(&self, msg: Vec) -> Vec { + let key = self.get_key().unwrap(); let private_key_bytes = key.private_key.private_key.to_bytes(); let signing_key = SigningKey::new(private_key_bytes.as_slice()).unwrap(); let signature: Signature = signing_key.sign(&msg); @@ -177,3 +285,19 @@ fn get_address(pk: ExtendedPubKey) -> Vec { hash.result(&mut acct); acct.to_vec() } + +fn get_test_backend_folder(chain_config: &ChainConfig) -> Result { + let home = dirs::home_dir(); + match home { + Some(h) => { + let folder = Path::new(h.as_path()) + .join(KEYSTORE_DEFAULT_FOLDER) + .join(chain_config.id.as_str()) + .join(KEYSTORE_TEST_BACKEND); + Ok(folder) + } + None => Err(Into::::into( + Kind::KeyStoreOperation.context("cannot retrieve home folder location"), + )), + } +} diff --git a/relayer/src/keys.rs b/relayer/src/keys.rs index a5e662a058..628017c3fe 100644 --- a/relayer/src/keys.rs +++ b/relayer/src/keys.rs @@ -1 +1,3 @@ +pub mod add; +pub mod list; pub mod restore; diff --git a/relayer/src/keys/add.rs b/relayer/src/keys/add.rs new file mode 100644 index 0000000000..9339e08636 --- /dev/null +++ b/relayer/src/keys/add.rs @@ -0,0 +1,46 @@ +use std::sync::Arc; + +use tokio::runtime::Runtime as TokioRuntime; + +use crate::chain::{Chain, CosmosSDKChain}; +use crate::config::ChainConfig; +use crate::error; +use crate::error::{Error, Kind}; +use crate::keyring::store::KeyRingOperations; +use std::fs; + +#[derive(Clone, Debug)] +pub struct KeysAddOptions { + pub name: String, + pub file: String, + pub chain_config: ChainConfig, +} + +pub fn add_key(opts: KeysAddOptions) -> Result { + let rt = TokioRuntime::new().unwrap(); + + // Get the destination chain + let chain = CosmosSDKChain::from_config(opts.clone().chain_config, Arc::new(rt))?; + + let key_contents = fs::read_to_string(&opts.file) + .map_err(|_| Kind::KeyBase.context("error reading the key file"))?; + + //Check if it's a valid Key seed file + let key_entry = chain.keybase().key_from_seed_file(&key_contents); + + match key_entry { + Ok(k) => { + chain + .keybase() + .add_key(key_contents.as_str()) + .map_err(|e| error::Kind::KeyBase.context(e))?; + Ok(format!( + "Added key {} ({}) on {} chain", + opts.name.as_str(), + k.account.as_str(), + chain.config().id.clone() + )) + } + Err(e) => Err(Kind::KeyBase.context(e).into()), + } +} diff --git a/relayer/src/keys/list.rs b/relayer/src/keys/list.rs new file mode 100644 index 0000000000..15512ef4fa --- /dev/null +++ b/relayer/src/keys/list.rs @@ -0,0 +1,32 @@ +use std::sync::Arc; + +use tokio::runtime::Runtime as TokioRuntime; + +use crate::chain::{Chain, CosmosSDKChain}; +use crate::config::ChainConfig; +use crate::error::{Error, Kind}; +use crate::keyring::store::KeyRingOperations; + +#[derive(Clone, Debug)] +pub struct KeysListOptions { + pub chain_config: ChainConfig, +} + +pub fn list_keys(opts: KeysListOptions) -> Result { + let rt = TokioRuntime::new().unwrap(); + + // Get the destination chain + let chain = CosmosSDKChain::from_config(opts.chain_config, Arc::new(rt))?; + + let key_entry = chain.keybase().get_key(); + + match key_entry { + Ok(k) => Ok(format!( + "chain: {} -> {} ({})", + chain.config().id.clone(), + chain.config().key_name.clone(), + k.account.as_str(), + )), + Err(e) => Err(Kind::KeyBase.context(e).into()), + } +} diff --git a/relayer/src/keys/restore.rs b/relayer/src/keys/restore.rs index 30ffdc3fef..c24d9d4b1d 100644 --- a/relayer/src/keys/restore.rs +++ b/relayer/src/keys/restore.rs @@ -1,12 +1,7 @@ -use std::sync::Arc; - -use tokio::runtime::Runtime as TokioRuntime; - -use crate::chain::CosmosSDKChain; +use crate::chain::{handle::ChainHandle, runtime::ChainRuntime}; use crate::config::ChainConfig; use crate::error; use crate::error::Error; -use crate::keyring::store::KeyRingOperations; #[derive(Clone, Debug)] pub struct KeysRestoreOptions { @@ -16,14 +11,11 @@ pub struct KeysRestoreOptions { } pub fn restore_key(opts: KeysRestoreOptions) -> Result, Error> { - let rt = TokioRuntime::new().unwrap(); - // Get the destination chain - let mut chain = CosmosSDKChain::from_config(opts.clone().chain_config, Arc::new(rt))?; + let (chain, _) = ChainRuntime::spawn(opts.chain_config)?; let address = chain - .key_ring() - .add_from_mnemonic(&opts.mnemonic) + .get_key() .map_err(|e| error::Kind::KeyBase.context(e))?; Ok(address.account.as_bytes().to_vec()) diff --git a/relayer/src/tx/channel.rs b/relayer/src/tx/channel.rs index c012f97e15..c9011528a0 100644 --- a/relayer/src/tx/channel.rs +++ b/relayer/src/tx/channel.rs @@ -29,40 +29,40 @@ pub enum ChannelMsgType { #[derive(Clone, Debug)] pub struct ChannelOpenInitOptions { - pub dest_chain_config: ChainConfig, + pub dst_chain_config: ChainConfig, pub src_chain_config: ChainConfig, - pub dest_connection_id: ConnectionId, - pub dest_port_id: PortId, + pub dst_connection_id: ConnectionId, + pub dst_port_id: PortId, pub src_port_id: PortId, - pub dest_channel_id: ChannelId, + pub dst_channel_id: ChannelId, pub src_channel_id: Option, pub ordering: Order, - pub signer_seed: String, } pub fn build_chan_init( - dest_chain: impl ChainHandle, + dst_chain: impl ChainHandle, _src_chain: impl ChainHandle, opts: &ChannelOpenInitOptions, ) -> Result, Error> { // Check that the destination chain will accept the message, i.e. it does not have the channel - if dest_chain + if dst_chain .query_channel( - &opts.dest_port_id, - &opts.dest_channel_id, + &opts.dst_port_id, + &opts.dst_channel_id, ICSHeight::default(), ) .is_ok() { return Err(Kind::ChanOpenInit( - opts.dest_channel_id.clone(), + opts.dst_channel_id.clone(), "channel already exist".into(), ) .into()); } - // Get the signer from key seed file - let (_, signer) = dest_chain.key_and_signer(&opts.signer_seed)?; + let signer = dst_chain + .get_signer() + .map_err(|e| Kind::KeyBase.context(e))?; let counterparty = Counterparty::new(opts.src_port_id.clone(), opts.src_channel_id.clone()); @@ -70,14 +70,14 @@ pub fn build_chan_init( State::Init, opts.ordering, counterparty, - vec![opts.dest_connection_id.clone()], - dest_chain.module_version(&opts.dest_port_id)?, + vec![opts.dst_connection_id.clone()], + dst_chain.module_version(&opts.dst_port_id)?, ); // Build the domain type message let new_msg = MsgChannelOpenInit { - port_id: opts.dest_port_id.clone(), - channel_id: opts.dest_channel_id.clone(), + port_id: opts.dst_port_id.clone(), + channel_id: opts.dst_channel_id.clone(), channel, signer, }; @@ -88,25 +88,23 @@ pub fn build_chan_init( pub fn build_chan_init_and_send(opts: &ChannelOpenInitOptions) -> Result { // Get the source and destination chains. let (src_chain, _) = ChainRuntime::spawn(opts.clone().src_chain_config)?; - let (dest_chain, _) = ChainRuntime::spawn(opts.clone().dest_chain_config)?; + let (dst_chain, _) = ChainRuntime::spawn(opts.clone().dst_chain_config)?; - let new_msgs = build_chan_init(dest_chain.clone(), src_chain, opts)?; - let (key, _) = dest_chain.key_and_signer(&opts.signer_seed)?; + let new_msgs = build_chan_init(dst_chain.clone(), src_chain, opts)?; - Ok(dest_chain.send_tx(new_msgs, key, "".to_string(), 0)?) + Ok(dst_chain.send_tx(new_msgs)?) } #[derive(Clone, Debug)] pub struct ChannelOpenOptions { - pub dest_chain_config: ChainConfig, + pub dst_chain_config: ChainConfig, pub src_chain_config: ChainConfig, - pub dest_port_id: PortId, + pub dst_port_id: PortId, pub src_port_id: PortId, - pub dest_channel_id: ChannelId, + pub dst_channel_id: ChannelId, pub src_channel_id: ChannelId, - pub dest_connection_id: ConnectionId, + pub dst_connection_id: ConnectionId, pub ordering: Order, - pub signer_seed: String, } fn check_destination_channel_state( @@ -141,7 +139,7 @@ fn check_destination_channel_state( /// built from the message type (`msg_type`) and options (`opts`). /// If the expected and the destination channels are compatible, it returns the expected channel fn validated_expected_channel( - dest_chain: impl ChainHandle, + dst_chain: impl ChainHandle, _src_chain: impl ChainHandle, msg_type: ChannelMsgType, opts: &ChannelOpenOptions, @@ -163,14 +161,14 @@ fn validated_expected_channel( highest_state, opts.ordering, counterparty, - vec![opts.dest_connection_id.clone()], - dest_chain.module_version(&opts.dest_port_id)?, + vec![opts.dst_connection_id.clone()], + dst_chain.module_version(&opts.dst_port_id)?, ); // Retrieve existing channel if any - let dest_channel = dest_chain.query_channel( - &opts.dest_port_id, - &opts.dest_channel_id, + let dest_channel = dst_chain.query_channel( + &opts.dst_port_id, + &opts.dst_channel_id, ICSHeight::default(), ); @@ -193,7 +191,7 @@ fn validated_expected_channel( } check_destination_channel_state( - opts.dest_channel_id.clone(), + opts.dst_channel_id.clone(), dest_channel?, dest_expected_channel.clone(), )?; @@ -202,13 +200,13 @@ fn validated_expected_channel( } pub fn build_chan_try( - dest_chain: impl ChainHandle, + dst_chain: impl ChainHandle, src_chain: impl ChainHandle, opts: &ChannelOpenOptions, ) -> Result, Error> { // Check that the destination chain will accept the message, i.e. it does not have the channel let _dest_expected_channel = validated_expected_channel( - dest_chain.clone(), + dst_chain.clone(), src_chain.clone(), ChannelMsgType::OpenTry, opts, @@ -229,7 +227,7 @@ pub fn build_chan_try( ) .map_err(|e| { Kind::ChanOpenTry( - opts.dest_channel_id.clone(), + opts.dst_channel_id.clone(), "channel does not exist on source".into(), ) .context(e) @@ -237,17 +235,16 @@ pub fn build_chan_try( // Retrieve the connection let dest_connection = - dest_chain.query_connection(&opts.dest_connection_id.clone(), ICSHeight::default())?; + dst_chain.query_connection(&opts.dst_connection_id.clone(), ICSHeight::default())?; let ics_target_height = src_chain.query_latest_height()?; // Build message to update client on destination let mut msgs = build_update_client( - dest_chain.clone(), + dst_chain.clone(), src_chain.clone(), dest_connection.client_id().clone(), ics_target_height, - &opts.signer_seed, )?; let counterparty = @@ -257,14 +254,19 @@ pub fn build_chan_try( State::Init, opts.ordering, counterparty, - vec![opts.dest_connection_id.clone()], - dest_chain.module_version(&opts.dest_port_id)?, + vec![opts.dst_connection_id.clone()], + dst_chain.module_version(&opts.dst_port_id)?, ); + // Get signer + let signer = dst_chain + .get_signer() + .map_err(|e| Kind::KeyBase.context(e))?; + // Build the domain type message let new_msg = MsgChannelOpenTry { - port_id: opts.dest_port_id.clone(), - channel_id: opts.dest_channel_id.clone(), + port_id: opts.dst_port_id.clone(), + channel_id: opts.dst_channel_id.clone(), counterparty_chosen_channel_id: src_channel.counterparty().channel_id, channel, counterparty_version: src_chain.module_version(&opts.src_port_id)?, @@ -273,7 +275,7 @@ pub fn build_chan_try( &opts.src_channel_id, ics_target_height, )?, - signer: dest_chain.key_and_signer(&opts.signer_seed)?.1, + signer, }; let mut new_msgs = vec![new_msg.to_any::()]; @@ -286,22 +288,21 @@ pub fn build_chan_try( pub fn build_chan_try_and_send(opts: &ChannelOpenOptions) -> Result { // Get the source and destination chains. let (src_chain, _) = ChainRuntime::spawn(opts.clone().src_chain_config)?; - let (dest_chain, _) = ChainRuntime::spawn(opts.clone().dest_chain_config)?; + let (dst_chain, _) = ChainRuntime::spawn(opts.clone().dst_chain_config)?; - let new_msgs = build_chan_try(dest_chain.clone(), src_chain, opts)?; - let (key, _) = dest_chain.key_and_signer(&opts.signer_seed)?; + let new_msgs = build_chan_try(dst_chain.clone(), src_chain, opts)?; - Ok(dest_chain.send_tx(new_msgs, key, "".to_string(), 0)?) + Ok(dst_chain.send_tx(new_msgs)?) } pub fn build_chan_ack( - dest_chain: impl ChainHandle, + dst_chain: impl ChainHandle, src_chain: impl ChainHandle, opts: &ChannelOpenOptions, ) -> Result, Error> { // Check that the destination chain will accept the message let _dest_expected_channel = validated_expected_channel( - dest_chain.clone(), + dst_chain.clone(), src_chain.clone(), ChannelMsgType::OpenAck, opts, @@ -322,7 +323,7 @@ pub fn build_chan_ack( ) .map_err(|e| { Kind::ChanOpenAck( - opts.dest_channel_id.clone(), + opts.dst_channel_id.clone(), "channel does not exist on source".into(), ) .context(e) @@ -330,31 +331,35 @@ pub fn build_chan_ack( // Retrieve the connection let dest_connection = - dest_chain.query_connection(&opts.dest_connection_id.clone(), ICSHeight::default())?; + dst_chain.query_connection(&opts.dst_connection_id.clone(), ICSHeight::default())?; let ics_target_height = src_chain.query_latest_height()?; // Build message to update client on destination let mut msgs = build_update_client( - dest_chain.clone(), + dst_chain.clone(), src_chain.clone(), dest_connection.client_id().clone(), ics_target_height, - &opts.signer_seed, )?; + // Get signer + let signer = dst_chain + .get_signer() + .map_err(|e| Kind::KeyBase.context(e))?; + // Build the domain type message let new_msg = MsgChannelOpenAck { - port_id: opts.dest_port_id.clone(), - channel_id: opts.dest_channel_id.clone(), + port_id: opts.dst_port_id.clone(), + channel_id: opts.dst_channel_id.clone(), counterparty_channel_id: opts.src_channel_id.clone(), - counterparty_version: src_chain.module_version(&opts.dest_port_id)?, + counterparty_version: src_chain.module_version(&opts.dst_port_id)?, proofs: src_chain.build_channel_proofs( &opts.src_port_id, &opts.src_channel_id, ics_target_height, )?, - signer: dest_chain.key_and_signer(&opts.signer_seed)?.1, + signer, }; let mut new_msgs = vec![new_msg.to_any::()]; @@ -367,22 +372,21 @@ pub fn build_chan_ack( pub fn build_chan_ack_and_send(opts: &ChannelOpenOptions) -> Result { // Get the source and destination chains. let (src_chain, _) = ChainRuntime::spawn(opts.clone().src_chain_config)?; - let (dest_chain, _) = ChainRuntime::spawn(opts.clone().dest_chain_config)?; + let (dst_chain, _) = ChainRuntime::spawn(opts.clone().dst_chain_config)?; - let new_msgs = build_chan_ack(dest_chain.clone(), src_chain, opts)?; - let (key, _) = dest_chain.key_and_signer(&opts.signer_seed)?; + let new_msgs = build_chan_ack(dst_chain.clone(), src_chain, opts)?; - Ok(dest_chain.send_tx(new_msgs, key, "".to_string(), 0)?) + Ok(dst_chain.send_tx(new_msgs)?) } pub fn build_chan_confirm( - dest_chain: impl ChainHandle, + dst_chain: impl ChainHandle, src_chain: impl ChainHandle, opts: &ChannelOpenOptions, ) -> Result, Error> { // Check that the destination chain will accept the message let _dest_expected_channel = validated_expected_channel( - dest_chain.clone(), + dst_chain.clone(), src_chain.clone(), ChannelMsgType::OpenConfirm, opts, @@ -403,7 +407,7 @@ pub fn build_chan_confirm( ) .map_err(|e| { Kind::ChanOpenConfirm( - opts.dest_channel_id.clone(), + opts.dst_channel_id.clone(), "channel does not exist on source".into(), ) .context(e) @@ -411,29 +415,33 @@ pub fn build_chan_confirm( // Retrieve the connection let dest_connection = - dest_chain.query_connection(&opts.dest_connection_id.clone(), ICSHeight::default())?; + dst_chain.query_connection(&opts.dst_connection_id.clone(), ICSHeight::default())?; let ics_target_height = src_chain.query_latest_height()?; // Build message to update client on destination let mut msgs = build_update_client( - dest_chain.clone(), + dst_chain.clone(), src_chain.clone(), dest_connection.client_id().clone(), ics_target_height, - &opts.signer_seed, )?; + // Get signer + let signer = dst_chain + .get_signer() + .map_err(|e| Kind::KeyBase.context(e))?; + // Build the domain type message let new_msg = MsgChannelOpenConfirm { - port_id: opts.dest_port_id.clone(), - channel_id: opts.dest_channel_id.clone(), + port_id: opts.dst_port_id.clone(), + channel_id: opts.dst_channel_id.clone(), proofs: src_chain.build_channel_proofs( &opts.src_port_id, &opts.src_channel_id, ics_target_height, )?, - signer: dest_chain.key_and_signer(&opts.signer_seed)?.1, + signer, }; let mut new_msgs = vec![new_msg.to_any::()]; @@ -446,10 +454,9 @@ pub fn build_chan_confirm( pub fn build_chan_confirm_and_send(opts: &ChannelOpenOptions) -> Result { // Get the source and destination chains. let (src_chain, _) = ChainRuntime::spawn(opts.clone().src_chain_config)?; - let (dest_chain, _) = ChainRuntime::spawn(opts.clone().dest_chain_config)?; + let (dst_chain, _) = ChainRuntime::spawn(opts.clone().dst_chain_config)?; - let new_msgs = build_chan_confirm(dest_chain.clone(), src_chain, opts)?; - let (key, _) = dest_chain.key_and_signer(&opts.signer_seed)?; + let new_msgs = build_chan_confirm(dst_chain.clone(), src_chain, opts)?; - Ok(dest_chain.send_tx(new_msgs, key, "".to_string(), 0)?) + Ok(dst_chain.send_tx(new_msgs)?) } diff --git a/relayer/src/tx/client.rs b/relayer/src/tx/client.rs index a2b32e5b7e..545d402eaa 100644 --- a/relayer/src/tx/client.rs +++ b/relayer/src/tx/client.rs @@ -23,14 +23,12 @@ pub struct ClientOptions { pub dst_client_id: ClientId, pub dst_chain_config: ChainConfig, pub src_chain_config: ChainConfig, - pub signer_seed: String, } pub fn build_create_client( dst_chain: impl ChainHandle, src_chain: impl ChainHandle, dst_client_id: ClientId, - signer_seed: &str, ) -> Result { // Verify that the client has not been created already, i.e the destination chain does not // have a state for this client. @@ -42,8 +40,10 @@ pub fn build_create_client( ))); } - // Get the signer from key seed file - let (_, signer) = dst_chain.key_and_signer(signer_seed)?; + // Get signer + let signer = dst_chain + .get_signer() + .map_err(|e| Kind::KeyBase.context(e))?; // Build client create message with the data from source chain at latest height. let latest_height = src_chain.query_latest_height()?; @@ -63,21 +63,9 @@ pub fn build_create_client_and_send(opts: ClientOptions) -> Result()], - key, - "".to_string(), - 0, - )?) + Ok(dst_chain.send_tx(vec![new_msg.to_any::()])?) } pub fn build_update_client( @@ -85,20 +73,17 @@ pub fn build_update_client( src_chain: impl ChainHandle, dst_client_id: ClientId, target_height: Height, - signer_seed: &str, ) -> Result, Error> { // Get the latest trusted height from the client state on destination. let trusted_height = dst_chain .query_client_state(&dst_client_id, Height::default())? .latest_height(); - // Get the signer from key seed file. - let (_, signer) = dst_chain.key_and_signer(signer_seed)?; - let header = src_chain .build_header(trusted_height, target_height)? .wrap_any(); + let signer = dst_chain.get_signer()?; let new_msg = MsgUpdateAnyClient { client_id: dst_client_id, header, @@ -119,10 +104,7 @@ pub fn build_update_client_and_send(opts: ClientOptions) -> Result, - pub signer_seed: String, } /// Enumeration of proof carrying ICS3 message, helper for relayer. @@ -55,8 +54,10 @@ pub fn build_conn_init( .into()); } - // Get the signer from key seed file - let (_, signer) = dst_chain.key_and_signer(&opts.signer_seed.clone())?; + // Get signer + let signer = dst_chain + .get_signer() + .map_err(|e| Kind::KeyBase.context(e))?; let prefix = src_chain.query_commitment_prefix()?; @@ -83,10 +84,9 @@ pub fn build_conn_init_and_send(opts: &ConnectionOpenInitOptions) -> Result Result Result Result