Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to CometBFT 0.38.0 release #1365

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- `[tendermint-proto]` Update `v0_38` bindings to CometFBT release 0.38.0
([\#1365](https://github.com/informalsystems/tendermint-rs/pull/1365)).
- `[tendermint]` Add fields to `abci::request::ExtendVote` to represent
the fields added to the `abci.RequestExtendVote` protobuf message since
the 0.38.0-rc3 release
([\#1365](https://github.com/informalsystems/tendermint-rs/pull/1365)).
16 changes: 15 additions & 1 deletion proto/src/prost/v0_38/tendermint.abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,26 @@ pub struct RequestProcessProposal {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestExtendVote {
/// the hash of the block that this vote may be referring to
/// the hash of the block that this vote may be referring to
#[prost(bytes = "bytes", tag = "1")]
pub hash: ::prost::bytes::Bytes,
/// the height of the extended vote
#[prost(int64, tag = "2")]
pub height: i64,
/// info of the block that this vote may be referring to
#[prost(message, optional, tag = "3")]
pub time: ::core::option::Option<crate::google::protobuf::Timestamp>,
#[prost(bytes = "bytes", repeated, tag = "4")]
pub txs: ::prost::alloc::vec::Vec<::prost::bytes::Bytes>,
#[prost(message, optional, tag = "5")]
pub proposed_last_commit: ::core::option::Option<CommitInfo>,
#[prost(message, repeated, tag = "6")]
pub misbehavior: ::prost::alloc::vec::Vec<Misbehavior>,
#[prost(bytes = "bytes", tag = "7")]
pub next_validators_hash: ::prost::bytes::Bytes,
/// address of the public key of the original proposer of the block.
#[prost(bytes = "bytes", tag = "8")]
pub proposer_address: ::prost::bytes::Bytes,
}
/// Verify the vote extension
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
2 changes: 1 addition & 1 deletion proto/src/tendermint/v0_38.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ pub mod version {

pub mod meta {
pub const REPOSITORY: &str = "https://github.com/cometbft/cometbft";
pub const COMMITISH: &str = "v0.38.0-rc3";
pub const COMMITISH: &str = "v0.38.0";
}
41 changes: 39 additions & 2 deletions tendermint/src/abci/request/extend_vote.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
use crate::{block, Hash};
use bytes::Bytes;

use crate::abci::types::{CommitInfo, Misbehavior};
use crate::prelude::*;
use crate::{account, block, Hash, Time};

#[doc = include_str!("../doc/request-extendvote.md")]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct ExtendVote {
pub hash: Hash,
pub height: block::Height,
pub time: Time,
pub txs: Vec<Bytes>,
pub proposed_last_commit: Option<CommitInfo>,
pub misbehavior: Vec<Misbehavior>,
pub next_validators_hash: Hash,
pub proposer_address: account::Id,
}

// =============================================================================
Expand All @@ -13,6 +23,7 @@ pub struct ExtendVote {

mod v0_38 {
use super::ExtendVote;
use crate::{prelude::*, Error};
use tendermint_proto::v0_38 as pb;
use tendermint_proto::Protobuf;

Expand All @@ -21,17 +32,43 @@ mod v0_38 {
Self {
hash: extend_vote.hash.into(),
height: extend_vote.height.into(),
time: Some(extend_vote.time.into()),
txs: extend_vote.txs,
proposed_last_commit: extend_vote.proposed_last_commit.map(Into::into),
misbehavior: extend_vote
.misbehavior
.into_iter()
.map(Into::into)
.collect(),
next_validators_hash: extend_vote.next_validators_hash.into(),
proposer_address: extend_vote.proposer_address.into(),
}
}
}

impl TryFrom<pb::abci::RequestExtendVote> for ExtendVote {
type Error = crate::Error;
type Error = Error;

fn try_from(message: pb::abci::RequestExtendVote) -> Result<Self, Self::Error> {
Ok(Self {
hash: message.hash.try_into()?,
height: message.height.try_into()?,
time: message
.time
.ok_or_else(Error::missing_timestamp)?
.try_into()?,
txs: message.txs,
proposed_last_commit: message
.proposed_last_commit
.map(TryInto::try_into)
.transpose()?,
misbehavior: message
.misbehavior
.into_iter()
.map(TryInto::try_into)
.collect::<Result<Vec<_>, _>>()?,
next_validators_hash: message.next_validators_hash.try_into()?,
proposer_address: message.proposer_address.try_into()?,
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/proto-compiler/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const TENDERMINT_VERSIONS: &[TendermintVersion] = &[
TendermintVersion {
repo: "https://github.com/cometbft/cometbft",
ident: "v0_38",
commitish: "v0.38.0-rc3",
commitish: "v0.38.0",
},
];

Expand Down