diff --git a/.changelog/unreleased/features/113-ccv-protos.md b/.changelog/unreleased/features/113-ccv-protos.md new file mode 100644 index 00000000..f6893293 --- /dev/null +++ b/.changelog/unreleased/features/113-ccv-protos.md @@ -0,0 +1,2 @@ +- Update CCV provider protos to include misbehaviour-related messages + ([\#113](https://github.com/cosmos/ibc-proto-rs/issues/113)) \ No newline at end of file diff --git a/scripts/sync-protobuf.sh b/scripts/sync-protobuf.sh index cddfff1a..a7fe7268 100755 --- a/scripts/sync-protobuf.sh +++ b/scripts/sync-protobuf.sh @@ -29,17 +29,17 @@ COSMOS_ICS_GIT="${COSMOS_ICS_GIT:-$CACHE_PATH/cosmos/interchain-security.git}" COSMOS_SDK_COMMIT="$(cat src/COSMOS_SDK_COMMIT)" IBC_GO_COMMIT="$(cat src/IBC_GO_COMMIT)" -COSMOS_ICS_COMMIT="$(cat src/COSMOS_ICS_COMMIT)" +INTERCHAIN_SECURITY_COMMIT="$(cat src/INTERCHAIN_SECURITY_COMMIT)" echo "COSMOS_SDK_COMMIT: $COSMOS_SDK_COMMIT" echo "IBC_GO_COMMIT: $IBC_GO_COMMIT" -echo "COSMOS_ICS_COMMIT: $COSMOS_ICS_COMMIT" +echo "INTERCHAIN_SECURITY_COMMIT: $INTERCHAIN_SECURITY_COMMIT" # Use either --ics-commit flag for commit ID, # or --ics-tag for git tag. Because we can't modify # proto-compiler to have smart detection on that. -if [[ "$COSMOS_ICS_COMMIT" =~ ^[a-zA-Z0-9]{40}$ ]] +if [[ "$INTERCHAIN_SECURITY_COMMIT" =~ ^[a-zA-Z0-9]{40}$ ]] then ICS_COMMIT_OPTION="--ics-commit" else @@ -111,7 +111,7 @@ COSMOS_ICS_DIR=$(mktemp -d /tmp/interchain-security-XXXXXXXX) pushd "$COSMOS_ICS_DIR" git clone "$COSMOS_ICS_GIT" . -git checkout -b "$COSMOS_ICS_COMMIT" "$COSMOS_ICS_COMMIT" +git checkout -b "$INTERCHAIN_SECURITY_COMMIT" "$INTERCHAIN_SECURITY_COMMIT" cd proto buf mod update @@ -163,13 +163,13 @@ mkdir -p src/prost cd tools/proto-compiler -cargo build --locked +cargo build # Run the proto-compiler twice, # once for std version with --build-tonic set to true # and once for no-std version with --build-tonic set to false -cargo run --locked -- compile \ +cargo run -- compile \ --ics "$COSMOS_ICS_DIR/proto-include" \ --sdk "$COSMOS_SDK_DIR/proto-include" \ --ibc "$IBC_GO_DIR/proto-include" \ diff --git a/src/COSMOS_ICS_COMMIT b/src/COSMOS_ICS_COMMIT deleted file mode 100644 index b193de85..00000000 --- a/src/COSMOS_ICS_COMMIT +++ /dev/null @@ -1 +0,0 @@ -512753529b7fea6f825c1bfdb1242dd4207b2366 diff --git a/src/INTERCHAIN_SECURITY_COMMIT b/src/INTERCHAIN_SECURITY_COMMIT new file mode 100644 index 00000000..53a649c6 --- /dev/null +++ b/src/INTERCHAIN_SECURITY_COMMIT @@ -0,0 +1 @@ +ea545b490b53b8e6f422492b4fb2820ab0bc140b diff --git a/src/lib.rs b/src/lib.rs index cc189020..8f89272a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,6 +31,9 @@ pub const COSMOS_SDK_COMMIT: &str = include_str!("COSMOS_SDK_COMMIT"); /// The version (commit hash) of IBC Go used when generating this library. pub const IBC_GO_COMMIT: &str = include_str!("IBC_GO_COMMIT"); +/// The version (commit hash) of Interchain Security used when generating this library. +pub const INTERCHAIN_SECURITY_COMMIT: &str = include_str!("INTERCHAIN_SECURITY_COMMIT"); + /// File descriptor set of compiled proto. #[cfg(feature = "proto-descriptor")] pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("prost/proto_descriptor.bin"); @@ -63,11 +66,6 @@ pub mod cosmos { } } } - pub mod evidence { - pub mod v1beta1 { - include_proto!("cosmos.evidence.v1beta1.rs"); - } - } pub mod staking { pub mod v1beta1 { include_proto!("cosmos.staking.v1beta1.rs"); diff --git a/src/prost/cosmos.evidence.v1beta1.rs b/src/prost/cosmos.evidence.v1beta1.rs deleted file mode 100644 index 66ee4789..00000000 --- a/src/prost/cosmos.evidence.v1beta1.rs +++ /dev/null @@ -1,18 +0,0 @@ -/// Equivocation implements the Evidence interface and defines evidence of double -/// signing misbehavior. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Equivocation { - /// height is the equivocation height. - #[prost(int64, tag = "1")] - pub height: i64, - /// time is the equivocation time. - #[prost(message, optional, tag = "2")] - pub time: ::core::option::Option, - /// power is the equivocation validator power. - #[prost(int64, tag = "3")] - pub power: i64, - /// consensus_address is the equivocation validator consensus address. - #[prost(string, tag = "4")] - pub consensus_address: ::prost::alloc::string::String, -} diff --git a/src/prost/interchain_security.ccv.consumer.v1.rs b/src/prost/interchain_security.ccv.consumer.v1.rs index beae55bc..53f9f670 100644 --- a/src/prost/interchain_security.ccv.consumer.v1.rs +++ b/src/prost/interchain_security.ccv.consumer.v1.rs @@ -1,76 +1,9 @@ -/// Params defines the parameters for CCV consumer module -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Params { - /// TODO: Remove enabled flag and find a better way to setup integration tests - /// See: - #[prost(bool, tag = "1")] - pub enabled: bool, - /// ///////////////////// - /// Distribution Params - /// Number of blocks between ibc-token-transfers from the consumer chain to - /// the provider chain. Note that at this transmission event a fraction of - /// the accumulated tokens are divided and sent consumer redistribution - /// address. - #[prost(int64, tag = "2")] - pub blocks_per_distribution_transmission: i64, - /// Channel, and provider-chain receiving address to send distribution token - /// transfers over. These parameters is auto-set during the consumer <-> - /// provider handshake procedure. - #[prost(string, tag = "3")] - pub distribution_transmission_channel: ::prost::alloc::string::String, - #[prost(string, tag = "4")] - pub provider_fee_pool_addr_str: ::prost::alloc::string::String, - /// Sent CCV related IBC packets will timeout after this duration - #[prost(message, optional, tag = "5")] - pub ccv_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, - >, - /// Sent transfer related IBC packets will timeout after this duration - #[prost(message, optional, tag = "6")] - pub transfer_timeout_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, - >, - /// The fraction of tokens allocated to the consumer redistribution address - /// during distribution events. The fraction is a string representing a - /// decimal number. For example "0.75" would represent 75%. - #[prost(string, tag = "7")] - pub consumer_redistribution_fraction: ::prost::alloc::string::String, - /// The number of historical info entries to persist in store. - /// This param is a part of the cosmos sdk staking module. In the case of - /// a ccv enabled consumer chain, the ccv module acts as the staking module. - #[prost(int64, tag = "8")] - pub historical_entries: i64, - /// Unbonding period for the consumer, - /// which should be smaller than that of the provider in general. - #[prost(message, optional, tag = "9")] - pub unbonding_period: ::core::option::Option< - super::super::super::super::google::protobuf::Duration, - >, - /// The threshold for the percentage of validators at the bottom of the set who - /// can opt out of running the consumer chain without being punished. For - /// example, a value of 0.05 means that the validators in the bottom 5% of the - /// set can opt out - #[prost(string, tag = "10")] - pub soft_opt_out_threshold: ::prost::alloc::string::String, - /// Reward denoms. These are the denominations which are allowed to be sent to - /// the provider as rewards. - #[prost(string, repeated, tag = "11")] - pub reward_denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, - /// Provider-originated reward denoms. These are denoms coming from the - /// provider which are allowed to be used as rewards. e.g. "uatom" - #[prost(string, repeated, tag = "12")] - pub provider_reward_denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, -} -/// LastTransmissionBlockHeight is the last time validator holding -/// pools were transmitted to the provider chain -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct LastTransmissionBlockHeight { - #[prost(int64, tag = "1")] - pub height: i64, -} -/// CrossChainValidator defines the validators for CCV consumer module +/// CrossChainValidator defines the type used to store validator information internal +/// to the consumer CCV module. Note one cross chain validator entry is persisted for +/// each consumer validator, where incoming VSC packets update this data, which is eventually +/// forwarded to comet for consumer chain consensus. +/// +/// Note this type is only used internally to the consumer CCV module. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CrossChainValidator { @@ -84,88 +17,20 @@ pub struct CrossChainValidator { super::super::super::super::google::protobuf::Any, >, } -/// MaturingVSCPacket contains the maturing time of a received VSCPacket +/// A record storing the state of a slash packet sent to the provider chain +/// which may bounce back and forth until handled by the provider. +/// +/// Note this type is only used internally to the consumer CCV module. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MaturingVscPacket { - #[prost(uint64, tag = "1")] - pub vsc_id: u64, +pub struct SlashRecord { + #[prost(bool, tag = "1")] + pub waiting_on_reply: bool, #[prost(message, optional, tag = "2")] - pub maturity_time: ::core::option::Option< + pub send_time: ::core::option::Option< super::super::super::super::google::protobuf::Timestamp, >, } -/// GenesisState defines the CCV consumer chain genesis state -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct GenesisState { - #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, - /// empty for a new chain, filled in on restart. - #[prost(string, tag = "2")] - pub provider_client_id: ::prost::alloc::string::String, - /// empty for a new chain, filled in on restart. - #[prost(string, tag = "3")] - pub provider_channel_id: ::prost::alloc::string::String, - /// true for new chain GenesisState, false for chain restart. - #[prost(bool, tag = "4")] - pub new_chain: bool, - /// ProviderClientState filled in on new chain, nil on restart. - #[prost(message, optional, tag = "5")] - pub provider_client_state: ::core::option::Option< - super::super::super::super::ibc::lightclients::tendermint::v1::ClientState, - >, - /// ProviderConsensusState filled in on new chain, nil on restart. - #[prost(message, optional, tag = "6")] - pub provider_consensus_state: ::core::option::Option< - super::super::super::super::ibc::lightclients::tendermint::v1::ConsensusState, - >, - /// MaturingPackets nil on new chain, filled in on restart. - #[prost(message, repeated, tag = "7")] - pub maturing_packets: ::prost::alloc::vec::Vec, - /// InitialValset filled in on new chain and on restart. - #[prost(message, repeated, tag = "8")] - pub initial_val_set: ::prost::alloc::vec::Vec< - ::tendermint_proto::abci::ValidatorUpdate, - >, - /// HeightToValsetUpdateId nil on new chain, filled in on restart. - #[prost(message, repeated, tag = "9")] - pub height_to_valset_update_id: ::prost::alloc::vec::Vec, - /// OutstandingDowntimes nil on new chain, filled in on restart. - #[prost(message, repeated, tag = "10")] - pub outstanding_downtime_slashing: ::prost::alloc::vec::Vec, - /// PendingConsumerPackets nil on new chain, filled in on restart. - #[prost(message, optional, tag = "11")] - pub pending_consumer_packets: ::core::option::Option< - super::super::v1::ConsumerPacketDataList, - >, - /// LastTransmissionBlockHeight nil on new chain, filled in on restart. - #[prost(message, optional, tag = "12")] - pub last_transmission_block_height: ::core::option::Option< - LastTransmissionBlockHeight, - >, - /// flag indicating whether the consumer CCV module starts in - #[prost(bool, tag = "13")] - pub pre_ccv: bool, -} -/// HeightValsetUpdateID defines the genesis information for the mapping -/// of each block height to a valset update id -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct HeightToValsetUpdateId { - #[prost(uint64, tag = "1")] - pub height: u64, - #[prost(uint64, tag = "2")] - pub valset_update_id: u64, -} -/// OutstandingDowntime defines the genesis information for each validator -/// flagged with an outstanding downtime slashing. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct OutstandingDowntime { - #[prost(string, tag = "1")] - pub validator_consensus_address: ::prost::alloc::string::String, -} /// NextFeeDistributionEstimate holds information about next fee distribution #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -210,7 +75,30 @@ pub struct QueryParamsRequest {} pub struct QueryParamsResponse { /// params holds all the parameters of this module. #[prost(message, optional, tag = "1")] - pub params: ::core::option::Option, + pub params: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProviderInfoRequest {} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct QueryProviderInfoResponse { + #[prost(message, optional, tag = "1")] + pub consumer: ::core::option::Option, + #[prost(message, optional, tag = "2")] + pub provider: ::core::option::Option, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ChainInfo { + #[prost(string, tag = "1")] + pub chain_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub client_id: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub connection_id: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub channel_id: ::prost::alloc::string::String, } /// Generated client implementations. #[cfg(feature = "client")] @@ -363,6 +251,36 @@ pub mod query_client { ); self.inner.unary(req, path, codec).await } + pub async fn query_provider_info( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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( + "/interchain_security.ccv.consumer.v1.Query/QueryProviderInfo", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "interchain_security.ccv.consumer.v1.Query", + "QueryProviderInfo", + ), + ); + self.inner.unary(req, path, codec).await + } } } /// Generated server implementations. @@ -390,6 +308,13 @@ pub mod query_server { tonic::Response, tonic::Status, >; + async fn query_provider_info( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } #[derive(Debug)] pub struct QueryServer { @@ -564,6 +489,52 @@ pub mod query_server { }; Box::pin(fut) } + "/interchain_security.ccv.consumer.v1.Query/QueryProviderInfo" => { + #[allow(non_camel_case_types)] + struct QueryProviderInfoSvc(pub Arc); + impl< + T: Query, + > tonic::server::UnaryService + for QueryProviderInfoSvc { + type Response = super::QueryProviderInfoResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::query_provider_info(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = QueryProviderInfoSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } _ => { Box::pin(async move { Ok( diff --git a/src/prost/interchain_security.ccv.provider.v1.rs b/src/prost/interchain_security.ccv.provider.v1.rs index 97c2ed77..2f65ca07 100644 --- a/src/prost/interchain_security.ccv.provider.v1.rs +++ b/src/prost/interchain_security.ccv.provider.v1.rs @@ -16,22 +16,45 @@ pub struct MsgAssignConsumerKey { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct MsgAssignConsumerKeyResponse {} -/// MsgRegisterConsumerRewardDenom allows an account to register -/// a consumer reward denom, i.e., add it to the list of denoms -/// accepted by the provider as rewards. +/// MsgSubmitConsumerMisbehaviour defines a message that reports a light client attack, +/// also known as a misbehaviour, observed on a consumer chain #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgRegisterConsumerRewardDenom { +pub struct MsgSubmitConsumerMisbehaviour { #[prost(string, tag = "1")] - pub denom: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub depositor: ::prost::alloc::string::String, + pub submitter: ::prost::alloc::string::String, + /// The Misbehaviour of the consumer chain wrapping + /// two conflicting IBC headers + #[prost(message, optional, tag = "2")] + pub misbehaviour: ::core::option::Option< + super::super::super::super::ibc::lightclients::tendermint::v1::Misbehaviour, + >, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitConsumerMisbehaviourResponse {} +/// MsgSubmitConsumerDoubleVoting defines a message that reports +/// a double signing infraction observed on a consumer chain +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MsgSubmitConsumerDoubleVoting { + #[prost(string, tag = "1")] + pub submitter: ::prost::alloc::string::String, + /// The equivocation of the consumer chain wrapping + /// an evidence of a validator that signed two conflicting votes + #[prost(message, optional, tag = "2")] + pub duplicate_vote_evidence: ::core::option::Option< + ::tendermint_proto::types::DuplicateVoteEvidence, + >, + /// The light client header of the infraction block + #[prost(message, optional, tag = "3")] + pub infraction_block_header: ::core::option::Option< + super::super::super::super::ibc::lightclients::tendermint::v1::Header, + >, } -/// MsgRegisterConsumerRewardDenomResponse defines the -/// Msg/RegisterConsumerRewardDenom response type. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct MsgRegisterConsumerRewardDenomResponse {} +pub struct MsgSubmitConsumerDoubleVotingResponse {} /// Generated client implementations. #[cfg(feature = "client")] pub mod msg_client { @@ -149,11 +172,11 @@ pub mod msg_client { ); self.inner.unary(req, path, codec).await } - pub async fn register_consumer_reward_denom( + pub async fn submit_consumer_misbehaviour( &mut self, - request: impl tonic::IntoRequest, + request: impl tonic::IntoRequest, ) -> std::result::Result< - tonic::Response, + tonic::Response, tonic::Status, > { self.inner @@ -167,14 +190,44 @@ pub mod msg_client { })?; let codec = tonic::codec::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( - "/interchain_security.ccv.provider.v1.Msg/RegisterConsumerRewardDenom", + "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerMisbehaviour", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new( "interchain_security.ccv.provider.v1.Msg", - "RegisterConsumerRewardDenom", + "SubmitConsumerMisbehaviour", + ), + ); + self.inner.unary(req, path, codec).await + } + pub async fn submit_consumer_double_voting( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + 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( + "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerDoubleVoting", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new( + "interchain_security.ccv.provider.v1.Msg", + "SubmitConsumerDoubleVoting", ), ); self.inner.unary(req, path, codec).await @@ -196,11 +249,18 @@ pub mod msg_server { tonic::Response, tonic::Status, >; - async fn register_consumer_reward_denom( + async fn submit_consumer_misbehaviour( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; + async fn submit_consumer_double_voting( &self, - request: tonic::Request, + request: tonic::Request, ) -> std::result::Result< - tonic::Response, + tonic::Response, tonic::Status, >; } @@ -328,27 +388,25 @@ pub mod msg_server { }; Box::pin(fut) } - "/interchain_security.ccv.provider.v1.Msg/RegisterConsumerRewardDenom" => { + "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerMisbehaviour" => { #[allow(non_camel_case_types)] - struct RegisterConsumerRewardDenomSvc(pub Arc); + struct SubmitConsumerMisbehaviourSvc(pub Arc); impl< T: Msg, - > tonic::server::UnaryService - for RegisterConsumerRewardDenomSvc { - type Response = super::MsgRegisterConsumerRewardDenomResponse; + > tonic::server::UnaryService + for SubmitConsumerMisbehaviourSvc { + type Response = super::MsgSubmitConsumerMisbehaviourResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, - request: tonic::Request< - super::MsgRegisterConsumerRewardDenom, - >, + request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { - ::register_consumer_reward_denom(&inner, request) + ::submit_consumer_misbehaviour(&inner, request) .await }; Box::pin(fut) @@ -361,7 +419,54 @@ pub mod msg_server { let inner = self.inner.clone(); let fut = async move { let inner = inner.0; - let method = RegisterConsumerRewardDenomSvc(inner); + let method = SubmitConsumerMisbehaviourSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } + "/interchain_security.ccv.provider.v1.Msg/SubmitConsumerDoubleVoting" => { + #[allow(non_camel_case_types)] + struct SubmitConsumerDoubleVotingSvc(pub Arc); + impl< + T: Msg, + > tonic::server::UnaryService + for SubmitConsumerDoubleVotingSvc { + type Response = super::MsgSubmitConsumerDoubleVotingResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::submit_consumer_double_voting(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = SubmitConsumerDoubleVotingSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( @@ -524,20 +629,23 @@ pub struct ConsumerRemovalProposal { super::super::super::super::google::protobuf::Timestamp, >, } +/// ChangeRewardDenomsProposal is a governance proposal on the provider chain to +/// mutate the set of denoms accepted by the provider as rewards. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct EquivocationProposal { +pub struct ChangeRewardDenomsProposal { /// the title of the proposal #[prost(string, tag = "1")] pub title: ::prost::alloc::string::String, /// the description of the proposal #[prost(string, tag = "2")] pub description: ::prost::alloc::string::String, - /// the list of equivocations that will be processed - #[prost(message, repeated, tag = "3")] - pub equivocations: ::prost::alloc::vec::Vec< - super::super::super::super::cosmos::evidence::v1beta1::Equivocation, - >, + /// the list of consumer reward denoms to add + #[prost(string, repeated, tag = "3")] + pub denoms_to_add: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// the list of consumer reward denoms to remove + #[prost(string, repeated, tag = "4")] + pub denoms_to_remove: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } /// A persisted queue entry indicating that a slash packet data instance needs to /// be handled. This type belongs in the "global" queue, to coordinate slash @@ -617,16 +725,8 @@ pub struct Params { super::super::super::super::cosmos::base::v1beta1::Coin, >, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct HandshakeMetadata { - #[prost(string, tag = "1")] - pub provider_fee_pool_addr: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub version: ::prost::alloc::string::String, -} /// SlashAcks contains cons addresses of consumer chain validators -/// successfully slashed on the provider chain +/// successfully slashed on the provider chain. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SlashAcks { @@ -707,6 +807,30 @@ pub struct VscSendTimestamp { super::super::super::super::google::protobuf::Timestamp, >, } +/// ValidatorSetChangePackets is a pb list of ccv.ValidatorSetChangePacketData. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ValidatorSetChangePackets { + #[prost(message, repeated, tag = "1")] + pub list: ::prost::alloc::vec::Vec, +} +/// MaturedUnbondingOps defines a list of ids corresponding to ids of matured +/// unbonding operations. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MaturedUnbondingOps { + #[prost(uint64, repeated, tag = "1")] + pub ids: ::prost::alloc::vec::Vec, +} +/// ExportedVscSendTimestamps is VscSendTimestamp with chainID info for exporting to genesis +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ExportedVscSendTimestamp { + #[prost(string, tag = "1")] + pub chain_id: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "2")] + pub vsc_send_timestamps: ::prost::alloc::vec::Vec, +} #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyAssignmentReplacement { @@ -765,7 +889,7 @@ pub struct QueryConsumerGenesisRequest { #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryConsumerGenesisResponse { #[prost(message, optional, tag = "1")] - pub genesis_state: ::core::option::Option, + pub genesis_state: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1962,9 +2086,7 @@ pub struct GenesisState { pub unbonding_ops: ::prost::alloc::vec::Vec, /// empty for a new chain #[prost(message, optional, tag = "4")] - pub mature_unbonding_ops: ::core::option::Option< - super::super::v1::MaturedUnbondingOps, - >, + pub mature_unbonding_ops: ::core::option::Option, /// empty for a new chain #[prost(message, repeated, tag = "5")] pub valset_update_id_to_height: ::prost::alloc::vec::Vec, @@ -1985,8 +2107,14 @@ pub struct GenesisState { /// empty for a new chain #[prost(message, repeated, tag = "11")] pub consumer_addrs_to_prune: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "12")] + pub init_timeout_timestamps: ::prost::alloc::vec::Vec, + #[prost(message, repeated, tag = "13")] + pub exported_vsc_send_timestamps: ::prost::alloc::vec::Vec, } -/// consumer chain +/// The provider CCV module's knowledge of consumer state. +/// +/// Note this type is only used internally to the provider CCV module. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct ConsumerState { @@ -2004,9 +2132,7 @@ pub struct ConsumerState { pub initial_height: u64, /// ConsumerGenesis defines the initial consumer chain genesis states #[prost(message, optional, tag = "5")] - pub consumer_genesis: ::core::option::Option< - super::super::consumer::v1::GenesisState, - >, + pub consumer_genesis: ::core::option::Option, /// PendingValsetChanges defines the pending validator set changes for the /// consumer chain #[prost(message, repeated, tag = "6")] diff --git a/src/prost/interchain_security.ccv.v1.rs b/src/prost/interchain_security.ccv.v1.rs index 4ffc3a50..1ded3981 100644 --- a/src/prost/interchain_security.ccv.v1.rs +++ b/src/prost/interchain_security.ccv.v1.rs @@ -17,13 +17,6 @@ pub struct ValidatorSetChangePacketData { #[prost(string, repeated, tag = "3")] pub slash_acks: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } -/// List of ccv.ValidatorSetChangePacketData. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct ValidatorSetChangePackets { - #[prost(message, repeated, tag = "1")] - pub list: ::prost::alloc::vec::Vec, -} /// This packet is sent from the consumer chain to the provider chain /// to notify that a VSC packet reached maturity on the consumer chain. #[allow(clippy::derive_partial_eq_without_eq)] @@ -51,14 +44,6 @@ pub struct SlashPacketData { )] pub infraction: i32, } -/// MaturedUnbondingOps defines a list of ids corresponding to ids of matured -/// unbonding operations. -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct MaturedUnbondingOps { - #[prost(uint64, repeated, tag = "1")] - pub ids: ::prost::alloc::vec::Vec, -} /// ConsumerPacketData contains a consumer packet data and a type tag #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -79,12 +64,14 @@ pub mod consumer_packet_data { VscMaturedPacketData(super::VscMaturedPacketData), } } -/// ConsumerPacketDataList is a list of consumer packet data packets. +/// Note this type is used during IBC handshake methods for both the consumer and provider #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ConsumerPacketDataList { - #[prost(message, repeated, tag = "1")] - pub list: ::prost::alloc::vec::Vec, +pub struct HandshakeMetadata { + #[prost(string, tag = "1")] + pub provider_fee_pool_addr: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub version: ::prost::alloc::string::String, } /// ConsumerPacketData contains a consumer packet data and a type tag /// that is compatible with ICS v1 and v2 over the wire. It is not used for internal storage. @@ -161,7 +148,7 @@ impl ConsumerPacketDataType { } } /// InfractionType indicates the infraction type a validator commited. -/// NOTE: ccv.InfractionType to maintain compatibility between ICS versions +/// Note ccv.InfractionType to maintain compatibility between ICS versions /// using different versions of the cosmos-sdk and ibc-go modules. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] @@ -195,3 +182,179 @@ impl InfractionType { } } } +/// ConsumerParams defines the parameters for CCV consumer module. +/// +/// Note this type is referenced in both the consumer and provider CCV modules, +/// and persisted on the provider, see MakeConsumerGenesis and SetConsumerGenesis. +/// +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsumerParams { + /// TODO: Remove enabled flag and find a better way to setup integration tests + /// See: + #[prost(bool, tag = "1")] + pub enabled: bool, + /// ///////////////////// + /// Distribution Params + /// Number of blocks between ibc-token-transfers from the consumer chain to + /// the provider chain. Note that at this transmission event a fraction of + /// the accumulated tokens are divided and sent consumer redistribution + /// address. + #[prost(int64, tag = "2")] + pub blocks_per_distribution_transmission: i64, + /// Channel, and provider-chain receiving address to send distribution token + /// transfers over. These parameters is auto-set during the consumer <-> + /// provider handshake procedure. + #[prost(string, tag = "3")] + pub distribution_transmission_channel: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub provider_fee_pool_addr_str: ::prost::alloc::string::String, + /// Sent CCV related IBC packets will timeout after this duration + #[prost(message, optional, tag = "5")] + pub ccv_timeout_period: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// Sent transfer related IBC packets will timeout after this duration + #[prost(message, optional, tag = "6")] + pub transfer_timeout_period: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// The fraction of tokens allocated to the consumer redistribution address + /// during distribution events. The fraction is a string representing a + /// decimal number. For example "0.75" would represent 75%. + #[prost(string, tag = "7")] + pub consumer_redistribution_fraction: ::prost::alloc::string::String, + /// The number of historical info entries to persist in store. + /// This param is a part of the cosmos sdk staking module. In the case of + /// a ccv enabled consumer chain, the ccv module acts as the staking module. + #[prost(int64, tag = "8")] + pub historical_entries: i64, + /// Unbonding period for the consumer, + /// which should be smaller than that of the provider in general. + #[prost(message, optional, tag = "9")] + pub unbonding_period: ::core::option::Option< + super::super::super::google::protobuf::Duration, + >, + /// The threshold for the percentage of validators at the bottom of the set who + /// can opt out of running the consumer chain without being punished. For + /// example, a value of 0.05 means that the validators in the bottom 5% of the + /// set can opt out + #[prost(string, tag = "10")] + pub soft_opt_out_threshold: ::prost::alloc::string::String, + /// Reward denoms. These are the denominations which are allowed to be sent to + /// the provider as rewards. + #[prost(string, repeated, tag = "11")] + pub reward_denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Provider-originated reward denoms. These are denoms coming from the + /// provider which are allowed to be used as rewards. e.g. "uatom" + #[prost(string, repeated, tag = "12")] + pub provider_reward_denoms: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// ConsumerGenesisState defines the CCV consumer chain genesis state. +/// +/// Note this type is referenced in both the consumer and provider CCV modules, +/// and persisted on the provider, see MakeConsumerGenesis and SetConsumerGenesis. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsumerGenesisState { + #[prost(message, optional, tag = "1")] + pub params: ::core::option::Option, + /// empty for a new chain, filled in on restart. + #[prost(string, tag = "2")] + pub provider_client_id: ::prost::alloc::string::String, + /// empty for a new chain, filled in on restart. + #[prost(string, tag = "3")] + pub provider_channel_id: ::prost::alloc::string::String, + /// true for new chain, false for chain restart. + #[prost(bool, tag = "4")] + pub new_chain: bool, + /// ProviderClientState filled in on new chain, nil on restart. + #[prost(message, optional, tag = "5")] + pub provider_client_state: ::core::option::Option< + super::super::super::ibc::lightclients::tendermint::v1::ClientState, + >, + /// ProviderConsensusState filled in on new chain, nil on restart. + #[prost(message, optional, tag = "6")] + pub provider_consensus_state: ::core::option::Option< + super::super::super::ibc::lightclients::tendermint::v1::ConsensusState, + >, + /// MaturingPackets nil on new chain, filled in on restart. + #[prost(message, repeated, tag = "7")] + pub maturing_packets: ::prost::alloc::vec::Vec, + /// InitialValset filled in on new chain and on restart. + #[prost(message, repeated, tag = "8")] + pub initial_val_set: ::prost::alloc::vec::Vec< + ::tendermint_proto::abci::ValidatorUpdate, + >, + /// HeightToValsetUpdateId nil on new chain, filled in on restart. + #[prost(message, repeated, tag = "9")] + pub height_to_valset_update_id: ::prost::alloc::vec::Vec, + /// OutstandingDowntimes nil on new chain, filled in on restart. + #[prost(message, repeated, tag = "10")] + pub outstanding_downtime_slashing: ::prost::alloc::vec::Vec, + /// PendingConsumerPackets nil on new chain, filled in on restart. + #[prost(message, optional, tag = "11")] + pub pending_consumer_packets: ::core::option::Option, + /// LastTransmissionBlockHeight nil on new chain, filled in on restart. + #[prost(message, optional, tag = "12")] + pub last_transmission_block_height: ::core::option::Option< + LastTransmissionBlockHeight, + >, + /// flag indicating whether the consumer CCV module starts in + #[prost(bool, tag = "13")] + pub pre_ccv: bool, +} +/// HeightValsetUpdateID represents a mapping internal to the consumer CCV module +/// AND used in shared consumer genesis state, which links a block height to each recv valset update id. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct HeightToValsetUpdateId { + #[prost(uint64, tag = "1")] + pub height: u64, + #[prost(uint64, tag = "2")] + pub valset_update_id: u64, +} +/// OutstandingDowntime defines the type used internally to the consumer CCV module, +/// AND used in shared consumer genesis state, in order to not send multiple slashing +/// requests for the same downtime infraction. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct OutstandingDowntime { + #[prost(string, tag = "1")] + pub validator_consensus_address: ::prost::alloc::string::String, +} +/// LastTransmissionBlockHeight is the last time validator holding +/// pools were transmitted to the provider chain. This type is used internally +/// to the consumer CCV module AND used in shared consumer genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct LastTransmissionBlockHeight { + #[prost(int64, tag = "1")] + pub height: i64, +} +/// MaturingVSCPacket represents a vsc packet that is maturing internal to the +/// consumer CCV module, where the consumer has not yet relayed a VSCMatured packet +/// back to the provider. This type is used internally to the consumer CCV module +/// AND used in shared consumer genesis state. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct MaturingVscPacket { + #[prost(uint64, tag = "1")] + pub vsc_id: u64, + #[prost(message, optional, tag = "2")] + pub maturity_time: ::core::option::Option< + super::super::super::google::protobuf::Timestamp, + >, +} +/// ConsumerPacketDataList is a list of consumer packet data packets. +/// +/// Note this type is is used internally to the consumer CCV module +/// for exporting / importing state in InitGenesis and ExportGenesis, +/// AND included in the consumer genesis type (reffed by provider and consumer modules), +/// hence this is a shared type. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ConsumerPacketDataList { + #[prost(message, repeated, tag = "1")] + pub list: ::prost::alloc::vec::Vec, +} diff --git a/src/prost/proto_descriptor.bin b/src/prost/proto_descriptor.bin index 66fa458c..d8d01bf0 100644 Binary files a/src/prost/proto_descriptor.bin and b/src/prost/proto_descriptor.bin differ