Trait TestBlock
pub trait TestBlock: Blockwhere
Self::Header: TestHeader,{
// Required methods
fn body_mut(&mut self) -> &mut Self::Body;
fn header_mut(&mut self) -> &mut Self::Header;
fn set_header(&mut self, header: Self::Header);
// Provided methods
fn set_parent_hash(&mut self, hash: FixedBytes<32>) { ... }
fn set_block_number(&mut self, number: u64) { ... }
fn set_state_root(&mut self, state_root: FixedBytes<32>) { ... }
fn set_difficulty(&mut self, difficulty: Uint<256, 4>) { ... }
}
Available on (crate features
arbitrary
or test-utils
) and crate feature test-utils
only.Expand description
An extension trait for Block
s that allows for mutable access to the block’s internals.
This allows for modifying the block’s header and body for testing purposes.
Required Methods§
fn header_mut(&mut self) -> &mut Self::Header
fn header_mut(&mut self) -> &mut Self::Header
Returns mutable reference to block header.
fn set_header(&mut self, header: Self::Header)
fn set_header(&mut self, header: Self::Header)
Updates the block header.
Provided Methods§
fn set_parent_hash(&mut self, hash: FixedBytes<32>)
fn set_parent_hash(&mut self, hash: FixedBytes<32>)
Updates the parent block hash.
fn set_block_number(&mut self, number: u64)
fn set_block_number(&mut self, number: u64)
Updates the block number.
fn set_state_root(&mut self, state_root: FixedBytes<32>)
fn set_state_root(&mut self, state_root: FixedBytes<32>)
Updates the block state root.
fn set_difficulty(&mut self, difficulty: Uint<256, 4>)
fn set_difficulty(&mut self, difficulty: Uint<256, 4>)
Updates the block difficulty.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.