pub struct Id {
pub hash: Hash,
pub part_set_header: Header,
}
Expand description
Block identifiers which contain two distinct Merkle roots of the block, as well as the number of parts in the block.
Default implementation is an empty Id as defined by the Go implementation in https://github.com/tendermint/tendermint/blob/1635d1339c73ae6a82e062cd2dc7191b029efa14/types/block.go#L1204.
If the Hash is empty in BlockId, the BlockId should be empty (encoded to None). This is implemented outside of this struct. Use the Default trait to check for an empty BlockId. See: https://github.com/informalsystems/tendermint-rs/issues/663
Fields§
§hash: Hash
The block’s main hash is the Merkle root of all the fields in the block header.
part_set_header: Header
Parts header (if available) is used for secure gossipping of the block during consensus. It is the Merkle root of the complete serialized block cut into parts.
PartSet is used to split a byteslice of data into parts (pieces) for transmission. By splitting data into smaller parts and computing a Merkle root hash on the list, you can verify that a part is legitimately part of the complete data, and the part can be forwarded to other peers before all the parts are known. In short, it’s a fast way to propagate a large file over a gossip network.
https://github.com/tendermint/tendermint/wiki/Block-Structure#partset
PartSetHeader in protobuf is defined as never nil using the gogoproto annotations. This does not translate to Rust, but we can indicate this in the domain type.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Id
impl<'de> Deserialize<'de> for Id
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for Id
impl Ord for Id
Source§impl PartialOrd for Id
impl PartialOrd for Id
Source§impl Protobuf<BlockId> for Id
impl Protobuf<BlockId> for Id
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
§fn encode_vec(self) -> Vec<u8> ⓘ
fn encode_vec(self) -> Vec<u8> ⓘ
Vec<u8>
.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
(or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
Vec<u8>
Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
or equivalent.Source§impl Protobuf<BlockId> for Id
impl Protobuf<BlockId> for Id
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
§fn encode_vec(self) -> Vec<u8> ⓘ
fn encode_vec(self) -> Vec<u8> ⓘ
Vec<u8>
.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
(or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
Vec<u8>
Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
or equivalent.Source§impl Protobuf<BlockId> for Id
impl Protobuf<BlockId> for Id
§fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
fn encode_length_delimited<B>(self, buf: &mut B) -> Result<(), Error>where
B: BufMut,
§fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
fn decode_length_delimited<B>(buf: B) -> Result<Self, Error>where
B: Buf,
§fn encoded_len(self) -> usize
fn encoded_len(self) -> usize
§fn encode_vec(self) -> Vec<u8> ⓘ
fn encode_vec(self) -> Vec<u8> ⓘ
Vec<u8>
.§fn decode_vec(v: &[u8]) -> Result<Self, Error>
fn decode_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
(or equivalent).§fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
fn encode_length_delimited_vec(self) -> Vec<u8> ⓘ
Vec<u8>
Protobuf-encoded message.§fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
fn decode_length_delimited_vec(v: &[u8]) -> Result<Self, Error>
Vec<u8>
or equivalent.