diff --git a/proto/src/prost/v0_34/tendermint.abci.rs b/proto/src/prost/v0_34/tendermint.abci.rs index 2c32a1d46..f4891c912 100644 --- a/proto/src/prost/v0_34/tendermint.abci.rs +++ b/proto/src/prost/v0_34/tendermint.abci.rs @@ -54,6 +54,17 @@ pub struct RequestEcho { } #[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct RequestFlush {} +#[derive(::serde::Deserialize, ::serde::Serialize)] +#[serde(default)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct TimeoutsInfo { + #[prost(message, optional, tag = "1")] + #[serde(with = "crate::serializers::optional_protobuf_duration")] + pub timeout_propose: ::core::option::Option, + #[prost(message, optional, tag = "2")] + #[serde(with = "crate::serializers::optional_protobuf_duration")] + pub timeout_commit: ::core::option::Option, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestInfo { #[prost(string, tag = "1")] @@ -139,6 +150,9 @@ pub struct RequestOfferSnapshot { /// light client-verified app hash for snapshot height #[prost(bytes = "bytes", tag = "2")] pub app_hash: ::prost::bytes::Bytes, + /// The application version at which the snapshot was taken + #[prost(uint64, tag = "3")] + pub app_version: u64, } /// loads a snapshot chunk #[derive(Clone, Copy, PartialEq, ::prost::Message)] @@ -162,14 +176,25 @@ pub struct RequestApplySnapshotChunk { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestPrepareProposal { - /// block_data is an array of transactions that will be included in a block, - /// sent to the app for possible modifications. - /// applications can not exceed the size of the data passed to it. + /// BlockData is a slice of candidate transactions that may be included in a + /// block. BlockData is sent to the application so that the application can + /// filter and re-arrange the slice of candidate transactions. #[prost(message, optional, tag = "1")] pub block_data: ::core::option::Option, - /// If an application decides to populate block_data with extra information, they can not exceed this value. + /// BlockDataSize is the maximum size (in bytes) that BlockData should be. #[prost(int64, tag = "2")] pub block_data_size: i64, + /// chain_id is a unique identifier for the blockchain network this proposal + /// belongs to (e.g. mocha-1). + #[prost(string, tag = "3")] + pub chain_id: ::prost::alloc::string::String, + /// height is the height of the proposal block + #[prost(int64, tag = "4")] + pub height: i64, + /// time is the time that will end up in the header. This is the voting power + /// weighted median of the last commit. + #[prost(message, optional, tag = "5")] + pub time: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct RequestProcessProposal { @@ -260,6 +285,8 @@ pub struct ResponseInfo { #[serde(default)] #[serde(skip_serializing_if = "bytes::Bytes::is_empty")] pub last_block_app_hash: ::prost::bytes::Bytes, + #[prost(message, optional, tag = "6")] + pub timeouts: ::core::option::Option, } /// nondeterministic #[derive(Clone, PartialEq, ::prost::Message)] @@ -280,6 +307,8 @@ pub struct ResponseInitChain { pub validators: ::prost::alloc::vec::Vec, #[prost(bytes = "bytes", tag = "3")] pub app_hash: ::prost::bytes::Bytes, + #[prost(message, optional, tag = "4")] + pub timeouts: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseQuery { @@ -370,6 +399,8 @@ pub struct ResponseEndBlock { pub consensus_param_updates: ::core::option::Option, #[prost(message, repeated, tag = "3")] pub events: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "4")] + pub timeouts: ::core::option::Option, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ResponseCommit { diff --git a/proto/src/prost/v0_34/tendermint.crypto.rs b/proto/src/prost/v0_34/tendermint.crypto.rs index a5c696e7a..121d27974 100644 --- a/proto/src/prost/v0_34/tendermint.crypto.rs +++ b/proto/src/prost/v0_34/tendermint.crypto.rs @@ -1,30 +1,4 @@ // This file is @generated by prost-build. -/// PublicKey defines the keys available for use with Validators -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PublicKey { - #[prost(oneof = "public_key::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `PublicKey`. -pub mod public_key { - #[derive(::serde::Deserialize, ::serde::Serialize)] - #[serde(tag = "type", content = "value")] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Sum { - #[prost(bytes, tag = "1")] - #[serde( - rename = "tendermint/PubKeyEd25519", - with = "crate::serializers::bytes::base64string" - )] - Ed25519(::prost::alloc::vec::Vec), - #[prost(bytes, tag = "2")] - #[serde( - rename = "tendermint/PubKeySecp256k1", - with = "crate::serializers::bytes::base64string" - )] - Secp256k1(::prost::alloc::vec::Vec), - } -} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Proof { @@ -75,3 +49,29 @@ pub struct ProofOps { #[prost(message, repeated, tag = "1")] pub ops: ::prost::alloc::vec::Vec, } +/// PublicKey defines the keys available for use with Validators +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PublicKey { + #[prost(oneof = "public_key::Sum", tags = "1, 2")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `PublicKey`. +pub mod public_key { + #[derive(::serde::Deserialize, ::serde::Serialize)] + #[serde(tag = "type", content = "value")] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(bytes, tag = "1")] + #[serde( + rename = "tendermint/PubKeyEd25519", + with = "crate::serializers::bytes::base64string" + )] + Ed25519(::prost::alloc::vec::Vec), + #[prost(bytes, tag = "2")] + #[serde( + rename = "tendermint/PubKeySecp256k1", + with = "crate::serializers::bytes::base64string" + )] + Secp256k1(::prost::alloc::vec::Vec), + } +} diff --git a/proto/src/prost/v0_34/tendermint.p2p.rs b/proto/src/prost/v0_34/tendermint.p2p.rs index 8a1816319..502037a75 100644 --- a/proto/src/prost/v0_34/tendermint.p2p.rs +++ b/proto/src/prost/v0_34/tendermint.p2p.rs @@ -1,4 +1,41 @@ // This file is @generated by prost-build. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PacketPing {} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PacketPong {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PacketMsg { + #[prost(int32, tag = "1")] + pub channel_id: i32, + #[prost(bool, tag = "2")] + pub eof: bool, + #[prost(bytes = "vec", tag = "3")] + pub data: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Packet { + #[prost(oneof = "packet::Sum", tags = "1, 2, 3")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Packet`. +pub mod packet { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag = "1")] + PacketPing(super::PacketPing), + #[prost(message, tag = "2")] + PacketPong(super::PacketPong), + #[prost(message, tag = "3")] + PacketMsg(super::PacketMsg), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuthSigMessage { + #[prost(message, optional, tag = "1")] + pub pub_key: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub sig: ::prost::alloc::vec::Vec, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct NetAddress { #[prost(string, tag = "1")] @@ -65,40 +102,3 @@ pub mod message { PexAddrs(super::PexAddrs), } } -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct PacketPing {} -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct PacketPong {} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketMsg { - #[prost(int32, tag = "1")] - pub channel_id: i32, - #[prost(bool, tag = "2")] - pub eof: bool, - #[prost(bytes = "vec", tag = "3")] - pub data: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Packet { - #[prost(oneof = "packet::Sum", tags = "1, 2, 3")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Packet`. -pub mod packet { - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Sum { - #[prost(message, tag = "1")] - PacketPing(super::PacketPing), - #[prost(message, tag = "2")] - PacketPong(super::PacketPong), - #[prost(message, tag = "3")] - PacketMsg(super::PacketMsg), - } -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuthSigMessage { - #[prost(message, optional, tag = "1")] - pub pub_key: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - pub sig: ::prost::alloc::vec::Vec, -} diff --git a/proto/src/prost/v0_34/tendermint.state.rs b/proto/src/prost/v0_34/tendermint.state.rs index 1d6377824..fe2ad78f2 100644 --- a/proto/src/prost/v0_34/tendermint.state.rs +++ b/proto/src/prost/v0_34/tendermint.state.rs @@ -83,4 +83,7 @@ pub struct State { /// the latest AppHash we've received from calling abci.Commit() #[prost(bytes = "vec", tag = "13")] pub app_hash: ::prost::alloc::vec::Vec, + /// timeouts to be used for the next block height + #[prost(message, optional, tag = "15")] + pub timeouts: ::core::option::Option, } diff --git a/proto/src/prost/v0_34/tendermint.store.rs b/proto/src/prost/v0_34/tendermint.store.rs index 20bb53d37..9c5972454 100644 --- a/proto/src/prost/v0_34/tendermint.store.rs +++ b/proto/src/prost/v0_34/tendermint.store.rs @@ -6,3 +6,19 @@ pub struct BlockStoreState { #[prost(int64, tag = "2")] pub height: i64, } +/// TxInfo describes the location of a tx inside a committed block +/// as well as the result of executing the transaction and the error log output. +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct TxInfo { + #[prost(int64, tag = "1")] + pub height: i64, + #[prost(uint32, tag = "2")] + pub index: u32, + /// The response code of executing the tx. 0 means + /// successfully executed, all others are error codes. + #[prost(uint32, tag = "3")] + pub code: u32, + /// The error log output generated if the transaction execution fails. + #[prost(string, tag = "4")] + pub error: ::prost::alloc::string::String, +} diff --git a/proto/src/prost/v0_34/tendermint.types.rs b/proto/src/prost/v0_34/tendermint.types.rs index 81f09980b..beee209f9 100644 --- a/proto/src/prost/v0_34/tendermint.types.rs +++ b/proto/src/prost/v0_34/tendermint.types.rs @@ -590,15 +590,6 @@ pub struct EvidenceList { #[serde(with = "crate::serializers::nullable")] pub evidence: ::prost::alloc::vec::Vec, } -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventDataRoundState { - #[prost(int64, tag = "1")] - pub height: i64, - #[prost(int32, tag = "2")] - pub round: i32, - #[prost(string, tag = "3")] - pub step: ::prost::alloc::string::String, -} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { @@ -611,6 +602,15 @@ pub struct Block { #[prost(message, optional, tag = "4")] pub last_commit: ::core::option::Option, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventDataRoundState { + #[prost(int64, tag = "1")] + pub height: i64, + #[prost(int32, tag = "2")] + pub round: i32, + #[prost(string, tag = "3")] + pub step: ::prost::alloc::string::String, +} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CanonicalBlockId { diff --git a/proto/src/prost/v0_37/tendermint.crypto.rs b/proto/src/prost/v0_37/tendermint.crypto.rs index a5c696e7a..121d27974 100644 --- a/proto/src/prost/v0_37/tendermint.crypto.rs +++ b/proto/src/prost/v0_37/tendermint.crypto.rs @@ -1,30 +1,4 @@ // This file is @generated by prost-build. -/// PublicKey defines the keys available for use with Validators -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PublicKey { - #[prost(oneof = "public_key::Sum", tags = "1, 2")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `PublicKey`. -pub mod public_key { - #[derive(::serde::Deserialize, ::serde::Serialize)] - #[serde(tag = "type", content = "value")] - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Sum { - #[prost(bytes, tag = "1")] - #[serde( - rename = "tendermint/PubKeyEd25519", - with = "crate::serializers::bytes::base64string" - )] - Ed25519(::prost::alloc::vec::Vec), - #[prost(bytes, tag = "2")] - #[serde( - rename = "tendermint/PubKeySecp256k1", - with = "crate::serializers::bytes::base64string" - )] - Secp256k1(::prost::alloc::vec::Vec), - } -} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Proof { @@ -75,3 +49,29 @@ pub struct ProofOps { #[prost(message, repeated, tag = "1")] pub ops: ::prost::alloc::vec::Vec, } +/// PublicKey defines the keys available for use with Validators +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PublicKey { + #[prost(oneof = "public_key::Sum", tags = "1, 2")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `PublicKey`. +pub mod public_key { + #[derive(::serde::Deserialize, ::serde::Serialize)] + #[serde(tag = "type", content = "value")] + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(bytes, tag = "1")] + #[serde( + rename = "tendermint/PubKeyEd25519", + with = "crate::serializers::bytes::base64string" + )] + Ed25519(::prost::alloc::vec::Vec), + #[prost(bytes, tag = "2")] + #[serde( + rename = "tendermint/PubKeySecp256k1", + with = "crate::serializers::bytes::base64string" + )] + Secp256k1(::prost::alloc::vec::Vec), + } +} diff --git a/proto/src/prost/v0_37/tendermint.p2p.rs b/proto/src/prost/v0_37/tendermint.p2p.rs index 8a1816319..502037a75 100644 --- a/proto/src/prost/v0_37/tendermint.p2p.rs +++ b/proto/src/prost/v0_37/tendermint.p2p.rs @@ -1,4 +1,41 @@ // This file is @generated by prost-build. +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PacketPing {} +#[derive(Clone, Copy, PartialEq, ::prost::Message)] +pub struct PacketPong {} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct PacketMsg { + #[prost(int32, tag = "1")] + pub channel_id: i32, + #[prost(bool, tag = "2")] + pub eof: bool, + #[prost(bytes = "vec", tag = "3")] + pub data: ::prost::alloc::vec::Vec, +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Packet { + #[prost(oneof = "packet::Sum", tags = "1, 2, 3")] + pub sum: ::core::option::Option, +} +/// Nested message and enum types in `Packet`. +pub mod packet { + #[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Sum { + #[prost(message, tag = "1")] + PacketPing(super::PacketPing), + #[prost(message, tag = "2")] + PacketPong(super::PacketPong), + #[prost(message, tag = "3")] + PacketMsg(super::PacketMsg), + } +} +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct AuthSigMessage { + #[prost(message, optional, tag = "1")] + pub pub_key: ::core::option::Option, + #[prost(bytes = "vec", tag = "2")] + pub sig: ::prost::alloc::vec::Vec, +} #[derive(Clone, PartialEq, ::prost::Message)] pub struct NetAddress { #[prost(string, tag = "1")] @@ -65,40 +102,3 @@ pub mod message { PexAddrs(super::PexAddrs), } } -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct PacketPing {} -#[derive(Clone, Copy, PartialEq, ::prost::Message)] -pub struct PacketPong {} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct PacketMsg { - #[prost(int32, tag = "1")] - pub channel_id: i32, - #[prost(bool, tag = "2")] - pub eof: bool, - #[prost(bytes = "vec", tag = "3")] - pub data: ::prost::alloc::vec::Vec, -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct Packet { - #[prost(oneof = "packet::Sum", tags = "1, 2, 3")] - pub sum: ::core::option::Option, -} -/// Nested message and enum types in `Packet`. -pub mod packet { - #[derive(Clone, PartialEq, ::prost::Oneof)] - pub enum Sum { - #[prost(message, tag = "1")] - PacketPing(super::PacketPing), - #[prost(message, tag = "2")] - PacketPong(super::PacketPong), - #[prost(message, tag = "3")] - PacketMsg(super::PacketMsg), - } -} -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct AuthSigMessage { - #[prost(message, optional, tag = "1")] - pub pub_key: ::core::option::Option, - #[prost(bytes = "vec", tag = "2")] - pub sig: ::prost::alloc::vec::Vec, -} diff --git a/proto/src/prost/v0_37/tendermint.types.rs b/proto/src/prost/v0_37/tendermint.types.rs index 0aaab6ea5..cfef402d4 100644 --- a/proto/src/prost/v0_37/tendermint.types.rs +++ b/proto/src/prost/v0_37/tendermint.types.rs @@ -456,15 +456,6 @@ pub struct EvidenceList { #[serde(with = "crate::serializers::nullable")] pub evidence: ::prost::alloc::vec::Vec, } -#[derive(Clone, PartialEq, ::prost::Message)] -pub struct EventDataRoundState { - #[prost(int64, tag = "1")] - pub height: i64, - #[prost(int32, tag = "2")] - pub round: i32, - #[prost(string, tag = "3")] - pub step: ::prost::alloc::string::String, -} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { @@ -477,6 +468,15 @@ pub struct Block { #[prost(message, optional, tag = "4")] pub last_commit: ::core::option::Option, } +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct EventDataRoundState { + #[prost(int64, tag = "1")] + pub height: i64, + #[prost(int32, tag = "2")] + pub round: i32, + #[prost(string, tag = "3")] + pub step: ::prost::alloc::string::String, +} #[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct CanonicalBlockId { diff --git a/proto/src/serializers.rs b/proto/src/serializers.rs index ff5cefbdb..ff8889411 100644 --- a/proto/src/serializers.rs +++ b/proto/src/serializers.rs @@ -61,6 +61,7 @@ pub mod from_str; pub mod nullable; pub mod optional; pub mod optional_from_str; +pub mod optional_protobuf_duration; pub mod part_set_header_total; pub mod public_key; pub mod time_duration; diff --git a/proto/src/serializers/optional_protobuf_duration.rs b/proto/src/serializers/optional_protobuf_duration.rs new file mode 100644 index 000000000..eb7594a79 --- /dev/null +++ b/proto/src/serializers/optional_protobuf_duration.rs @@ -0,0 +1,59 @@ +//! [`serde`] serializer for optional [`Duration`]. + +use crate::google::protobuf::Duration; +use crate::serializers::cow_str::CowStr; +use alloc::string::ToString; +use serde::de::Error as _; +use serde::ser::Error as _; +use serde::{Deserialize, Deserializer, Serialize, Serializer}; + +/// Deserialize [`Option`]. +pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + let Some(s) = Option::::deserialize(deserializer)? else { + return Ok(None); + }; + + let ns = s + .parse::() + .map_err(|e| D::Error::custom(e.to_string()))?; + + let dur = core::time::Duration::from_nanos(ns); + + let seconds: i64 = dur + .as_secs() + .try_into() + .map_err(|_| D::Error::custom("Duration.seconds overflow".to_string()))?; + let nanos: i32 = dur + .subsec_nanos() + .try_into() + .map_err(|_| D::Error::custom("Duration.nanos overflow".to_string()))?; + + Ok(Some(Duration { seconds, nanos })) +} + +/// Serialize [`Option`]. +pub fn serialize(value: &Option, serializer: S) -> Result +where + S: Serializer, +{ + match value { + Some(value) => { + let seconds: u64 = value + .seconds + .try_into() + .map_err(|_| S::Error::custom("negative Duration.seconds".to_string()))?; + let nanos: u32 = value + .nanos + .try_into() + .map_err(|_| S::Error::custom("negative Duration.nanos".to_string()))?; + + let dur = core::time::Duration::new(seconds, nanos); + + dur.as_nanos().to_string().serialize(serializer) + }, + None => serializer.serialize_none(), + } +} diff --git a/proto/src/tendermint/v0_34.rs b/proto/src/tendermint/v0_34.rs index 3f1e3f16f..feb43ede9 100644 --- a/proto/src/tendermint/v0_34.rs +++ b/proto/src/tendermint/v0_34.rs @@ -62,5 +62,5 @@ pub mod version { pub mod meta { pub const REPOSITORY: &str = "https://github.com/celestiaorg/celestia-core"; - pub const COMMITISH: &str = "a1b07a1e6c77595466da9c61b37c83b4769b47e7"; + pub const COMMITISH: &str = "v0.34.x-celestia"; } diff --git a/tendermint/Cargo.toml b/tendermint/Cargo.toml index 3c1a20276..43a6eff4f 100644 --- a/tendermint/Cargo.toml +++ b/tendermint/Cargo.toml @@ -48,7 +48,7 @@ serde_repr = { version = "0.1", default-features = false } signature = { version = "2", default-features = false, features = ["alloc"] } subtle = { version = "2", default-features = false } subtle-encoding = { version = "0.5", default-features = false, features = ["bech32-preview"] } -time = { version = "0.3", default-features = false, features = ["macros", "parsing"] } +time = { version = "0.3.35", default-features = false, features = ["macros", "parsing"] } zeroize = { version = "1.1", default-features = false, features = ["zeroize_derive", "alloc"] } flex-error = { version = "0.4.4", default-features = false } ed25519-consensus = { version = "2", optional = true, default-features = false } diff --git a/tendermint/src/abci/request/offer_snapshot.rs b/tendermint/src/abci/request/offer_snapshot.rs index af50c0c75..04e56b86d 100644 --- a/tendermint/src/abci/request/offer_snapshot.rs +++ b/tendermint/src/abci/request/offer_snapshot.rs @@ -11,20 +11,25 @@ pub struct OfferSnapshot { pub snapshot: Snapshot, /// The light client verified app hash for this height. pub app_hash: AppHash, + /// The app version for this height. + pub app_version: Option, } // ============================================================================= // Protobuf conversions // ============================================================================= -tendermint_pb_modules! { +mod v0_34 { use super::OfferSnapshot; + use celestia_tendermint_proto::v0_34 as pb; + use celestia_tendermint_proto::Protobuf; impl From for pb::abci::RequestOfferSnapshot { fn from(offer_snapshot: OfferSnapshot) -> Self { Self { snapshot: Some(offer_snapshot.snapshot.into()), app_hash: offer_snapshot.app_hash.into(), + app_version: offer_snapshot.app_version.unwrap_or_default(), } } } @@ -39,6 +44,43 @@ tendermint_pb_modules! { .ok_or_else(crate::Error::missing_data)? .try_into()?, app_hash: offer_snapshot.app_hash.try_into()?, + app_version: if offer_snapshot.app_version == 0 { + None + } else { + Some(offer_snapshot.app_version) + }, + }) + } + } + + impl Protobuf for OfferSnapshot {} +} + +mod v0_37 { + use super::OfferSnapshot; + use celestia_tendermint_proto::v0_37 as pb; + use celestia_tendermint_proto::Protobuf; + + impl From for pb::abci::RequestOfferSnapshot { + fn from(offer_snapshot: OfferSnapshot) -> Self { + Self { + snapshot: Some(offer_snapshot.snapshot.into()), + app_hash: offer_snapshot.app_hash.into(), + } + } + } + + impl TryFrom for OfferSnapshot { + type Error = crate::Error; + + fn try_from(offer_snapshot: pb::abci::RequestOfferSnapshot) -> Result { + Ok(Self { + snapshot: offer_snapshot + .snapshot + .ok_or_else(crate::Error::missing_data)? + .try_into()?, + app_hash: offer_snapshot.app_hash.try_into()?, + app_version: None, }) } } diff --git a/tendermint/src/abci/request/prepare_proposal.rs b/tendermint/src/abci/request/prepare_proposal.rs index 3eb6b981a..cd2925c25 100644 --- a/tendermint/src/abci/request/prepare_proposal.rs +++ b/tendermint/src/abci/request/prepare_proposal.rs @@ -1,11 +1,17 @@ use crate::block::Data; +use crate::block::Height; +use crate::chain::id::Id; use crate::prelude::*; +use crate::time::Time; #[doc = include_str!("../doc/request-prepareproposal.md")] #[derive(Clone, Debug, PartialEq, Eq)] pub struct PrepareProposal { pub block_data: Data, pub block_data_size: i64, + pub chain_id: Option, + pub height: Option, + pub time: Option