Struct diem_types::block_metadata::BlockMetadata
source · pub struct BlockMetadata { /* private fields */ }
Expand description
Struct that will be persisted on chain to store the information of the current block.
The flow will look like following:
- The executor will pass this struct to VM at the end of a block proposal.
- The VM will use this struct to create a special system transaction that will emit an event represents the information of the current block. This transaction can’t be emitted by regular users and is generated by each of the validators on the fly. Such transaction will be executed before all of the user-submitted transactions in the blocks.
- Once that special resource is modified, the other user transactions can read the consensus info by calling into the read method of that resource, which would thus give users the information such as the current leader.
Implementations§
source§impl BlockMetadata
impl BlockMetadata
pub fn new( id: HashValue, round: u64, timestamp_usecs: u64, previous_block_votes: Vec<AccountAddress>, proposer: AccountAddress ) -> Self
pub fn id(&self) -> HashValue
pub fn into_inner(self) -> (u64, u64, Vec<AccountAddress>, AccountAddress)
pub fn timestamp_usec(&self) -> u64
pub fn proposer(&self) -> AccountAddress
Trait Implementations§
source§impl Arbitrary for BlockMetadata
impl Arbitrary for BlockMetadata
§type Parameters = SizeRange
type Parameters = SizeRange
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.source§fn arbitrary_with(num_validators_range: Self::Parameters) -> Self::Strategy
fn arbitrary_with(num_validators_range: Self::Parameters) -> Self::Strategy
§type Strategy = BoxedStrategy<BlockMetadata>
type Strategy = BoxedStrategy<BlockMetadata>
The type of
Strategy
used to generate values of type Self
.source§impl Clone for BlockMetadata
impl Clone for BlockMetadata
source§fn clone(&self) -> BlockMetadata
fn clone(&self) -> BlockMetadata
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for BlockMetadata
impl Debug for BlockMetadata
source§impl<'de> Deserialize<'de> for BlockMetadata
impl<'de> Deserialize<'de> for BlockMetadata
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<BlockMetadata> for BlockMetadata
impl PartialEq<BlockMetadata> for BlockMetadata
source§fn eq(&self, other: &BlockMetadata) -> bool
fn eq(&self, other: &BlockMetadata) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for BlockMetadata
impl Serialize for BlockMetadata
impl Eq for BlockMetadata
impl StructuralEq for BlockMetadata
impl StructuralPartialEq for BlockMetadata
Auto Trait Implementations§
impl RefUnwindSafe for BlockMetadata
impl Send for BlockMetadata
impl Sync for BlockMetadata
impl Unpin for BlockMetadata
impl UnwindSafe for BlockMetadata
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
source§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.