pub struct BlockV2 { /* private fields */ }
Expand description
A block after execution, with the resulting global state root hash. This is the core component of the Casper linear blockchain. Version 2.
Implementations§
Source§impl BlockV2
impl BlockV2
Sourcepub fn header(&self) -> &BlockHeaderV2
pub fn header(&self) -> &BlockHeaderV2
Returns the block’s header.
Sourcepub fn take_header(self) -> BlockHeaderV2
pub fn take_header(self) -> BlockHeaderV2
Returns the block’s header, consuming self
.
Sourcepub fn body(&self) -> &BlockBodyV2
pub fn body(&self) -> &BlockBodyV2
Returns the block’s body.
Sourcepub fn take_body(self) -> BlockBodyV2
pub fn take_body(self) -> BlockBodyV2
Returns the block’s body, consuming self
.
Sourcepub fn parent_hash(&self) -> &BlockHash
pub fn parent_hash(&self) -> &BlockHash
Returns the parent block’s hash.
Sourcepub fn state_root_hash(&self) -> &Digest
pub fn state_root_hash(&self) -> &Digest
Returns the root hash of global state after the deploys in this block have been executed.
Sourcepub fn random_bit(&self) -> bool
pub fn random_bit(&self) -> bool
Returns a random bit needed for initializing a future era.
Sourcepub fn accumulated_seed(&self) -> &Digest
pub fn accumulated_seed(&self) -> &Digest
Returns a seed needed for initializing a future era.
Sourcepub fn era_end(&self) -> Option<&EraEndV2>
pub fn era_end(&self) -> Option<&EraEndV2>
Returns the EraEnd
of a block if it is a switch block.
Sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Returns the protocol version of the network from when this block was created.
Sourcepub fn is_switch_block(&self) -> bool
pub fn is_switch_block(&self) -> bool
Returns true
if this block is the last one in the current era.
Sourcepub fn is_genesis(&self) -> bool
pub fn is_genesis(&self) -> bool
Returns true
if this block is the Genesis block, i.e. has height 0 and era 0.
Sourcepub fn proposer(&self) -> &PublicKey
pub fn proposer(&self) -> &PublicKey
Returns the public key of the validator which proposed the block.
Sourcepub fn rewarded_signatures(&self) -> &RewardedSignatures
pub fn rewarded_signatures(&self) -> &RewardedSignatures
List of identifiers for finality signatures for a particular past block.
Sourcepub fn mint(&self) -> impl Iterator<Item = TransactionHash>
pub fn mint(&self) -> impl Iterator<Item = TransactionHash>
Returns the hashes of the transfer transactions within the block.
Sourcepub fn auction(&self) -> impl Iterator<Item = TransactionHash>
pub fn auction(&self) -> impl Iterator<Item = TransactionHash>
Returns the hashes of the non-transfer, native transactions within the block.
Sourcepub fn install_upgrade(&self) -> impl Iterator<Item = TransactionHash>
pub fn install_upgrade(&self) -> impl Iterator<Item = TransactionHash>
Returns the hashes of the install/upgrade wasm transactions within the block.
Sourcepub fn transactions_by_lane_id(
&self,
lane_id: u8,
) -> impl Iterator<Item = TransactionHash>
pub fn transactions_by_lane_id( &self, lane_id: u8, ) -> impl Iterator<Item = TransactionHash>
Returns the hashes of the transactions filtered by lane id within the block.
Sourcepub fn all_transactions(&self) -> impl Iterator<Item = &TransactionHash>
pub fn all_transactions(&self) -> impl Iterator<Item = &TransactionHash>
Returns all of the transaction hashes in the order in which they were executed.
Sourcepub fn transactions(&self) -> &BTreeMap<u8, Vec<TransactionHash>>
pub fn transactions(&self) -> &BTreeMap<u8, Vec<TransactionHash>>
Returns a reference to the collection of mapped transactions.
Sourcepub fn last_switch_block_hash(&self) -> Option<BlockHash>
pub fn last_switch_block_hash(&self) -> Option<BlockHash>
Returns the last relevant switch block hash.
Sourcepub fn verify(&self) -> Result<(), BlockValidationError>
pub fn verify(&self) -> Result<(), BlockValidationError>
Returns Ok
if and only if the block’s provided block hash and body hash are identical to
those generated by hashing the appropriate input data.
Sourcepub fn make_invalid(self, rng: &mut TestRng) -> Self
Available on crate features std
and testing
only.
pub fn make_invalid(self, rng: &mut TestRng) -> Self
std
and testing
only.Makes the block invalid, for testing purpose.
Trait Implementations§
Source§impl DataSize for BlockV2
impl DataSize for BlockV2
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl<'de> Deserialize<'de> for BlockV2
impl<'de> Deserialize<'de> for BlockV2
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 JsonSchema for BlockV2
impl JsonSchema for BlockV2
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl ToBytes for BlockV2
impl ToBytes for BlockV2
Source§fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>
fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>
&self
into a mutable writer
.Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Eq for BlockV2
impl StructuralPartialEq for BlockV2
Auto Trait Implementations§
impl !Freeze for BlockV2
impl RefUnwindSafe for BlockV2
impl Send for BlockV2
impl Sync for BlockV2
impl Unpin for BlockV2
impl UnwindSafe for BlockV2
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more