Skip to content

Commit

Permalink
Update CCV protos to include provider messages
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Jun 19, 2023
1 parent ad769cc commit 370f916
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ICS_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1afe31f573c8dcde08a572572565d43a35eab642
68e69a417685f670177940e143bcf1627e4b5202
104 changes: 104 additions & 0 deletions src/prost/interchain_security.ccv.provider.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,27 @@ pub struct MsgSubmitConsumerMisbehaviour {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSubmitConsumerMisbehaviourResponse {}
/// MsgSubmitConsumerDoubleVoting defines a message that reports a equivocation
/// 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 signed two conflicting votes
#[prost(message, optional, tag = "2")]
pub duplicate_vote_evidence: ::core::option::Option<
::tendermint_proto::types::DuplicateVoteEvidence,
>,
#[prost(message, optional, tag = "3")]
pub infraction_block_header: ::core::option::Option<
super::super::super::super::ibc::lightclients::tendermint::v1::Header,
>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MsgSubmitConsumerDoubleVotingResponse {}
/// Generated client implementations.
#[cfg(feature = "client")]
pub mod msg_client {
Expand Down Expand Up @@ -180,6 +201,36 @@ pub mod msg_client {
);
self.inner.unary(req, path, codec).await
}
pub async fn submit_consumer_double_voting(
&mut self,
request: impl tonic::IntoRequest<super::MsgSubmitConsumerDoubleVoting>,
) -> std::result::Result<
tonic::Response<super::MsgSubmitConsumerDoubleVotingResponse>,
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
}
}
}
/// Generated server implementations.
Expand All @@ -204,6 +255,13 @@ pub mod msg_server {
tonic::Response<super::MsgSubmitConsumerMisbehaviourResponse>,
tonic::Status,
>;
async fn submit_consumer_double_voting(
&self,
request: tonic::Request<super::MsgSubmitConsumerDoubleVoting>,
) -> std::result::Result<
tonic::Response<super::MsgSubmitConsumerDoubleVotingResponse>,
tonic::Status,
>;
}
/// Msg defines the Msg service.
#[derive(Debug)]
Expand Down Expand Up @@ -375,6 +433,52 @@ pub mod msg_server {
};
Box::pin(fut)
}
"/interchain_security.ccv.provider.v1.Msg/SubmitConsumerDoubleVoting" => {
#[allow(non_camel_case_types)]
struct SubmitConsumerDoubleVotingSvc<T: Msg>(pub Arc<T>);
impl<
T: Msg,
> tonic::server::UnaryService<super::MsgSubmitConsumerDoubleVoting>
for SubmitConsumerDoubleVotingSvc<T> {
type Response = super::MsgSubmitConsumerDoubleVotingResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MsgSubmitConsumerDoubleVoting>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
(*inner).submit_consumer_double_voting(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(
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(
Expand Down
4 changes: 4 additions & 0 deletions tools/proto-compiler/src/cmd/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ impl CompileCmd {
.type_attribute(".cosmos.base.v1beta1", attrs_serde)
.type_attribute(".cosmos.base.query.v1beta1", attrs_serde)
.type_attribute(".cosmos.upgrade.v1beta1", attrs_serde)
// FIXME: Cannot derive serde for the CCV protos until `tendermint_proto::abci::ValidatorUpdate` also does
// .type_attribute(".interchain_security.ccv.v1", attrs_serde)
// .type_attribute(".interchain_security.ccv.consumer.v1", attrs_serde)
// .type_attribute(".interchain_security.ccv.provider.v1", attrs_serde)
.compile(&protos, &includes)?;

println!("[info ] Protos compiled successfully");
Expand Down

0 comments on commit 370f916

Please sign in to comment.