Enum near_chain::Block [−][src]
Expand description
Versioned Block data structure. For each next version, document what are the changes between versions.
Variants
Implementations
Returns genesis block for given genesis date and state root.
pub fn produce(
protocol_version: u32,
prev: &BlockHeader,
height: u64,
chunks: Vec<ShardChunkHeader, Global>,
epoch_id: EpochId,
next_epoch_id: EpochId,
approvals: Vec<Option<Signature>, Global>,
gas_price_adjustment_rate: Ratio<isize>,
min_gas_price: u128,
max_gas_price: u128,
minted_amount: Option<u128>,
challenges_result: Vec<SlashedValidator, Global>,
challenges: Vec<Challenge, Global>,
signer: &dyn ValidatorSigner,
next_bp_hash: CryptoHash,
block_merkle_root: CryptoHash
) -> Block
pub fn produce(
protocol_version: u32,
prev: &BlockHeader,
height: u64,
chunks: Vec<ShardChunkHeader, Global>,
epoch_id: EpochId,
next_epoch_id: EpochId,
approvals: Vec<Option<Signature>, Global>,
gas_price_adjustment_rate: Ratio<isize>,
min_gas_price: u128,
max_gas_price: u128,
minted_amount: Option<u128>,
challenges_result: Vec<SlashedValidator, Global>,
challenges: Vec<Challenge, Global>,
signer: &dyn ValidatorSigner,
next_bp_hash: CryptoHash,
block_merkle_root: CryptoHash
) -> Block
Produces new block from header of previous block, current state root and set of transactions.
pub fn verify_gas_price(
&self,
prev_gas_price: u128,
min_gas_price: u128,
max_gas_price: u128,
gas_price_adjustment_rate: Ratio<isize>
) -> bool
pub fn compute_new_gas_price(
prev_gas_price: u128,
gas_used: u64,
gas_limit: u64,
gas_price_adjustment_rate: Ratio<isize>,
min_gas_price: u128,
max_gas_price: u128
) -> u128
pub fn compute_state_root<'a, T>(chunks: T) -> CryptoHash where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn compute_chunk_receipts_root<'a, T>(chunks: T) -> CryptoHash where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn compute_chunk_headers_root<'a, T>(
chunks: T
) -> (CryptoHash, Vec<Vec<MerklePathItem, Global>, Global>) where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn compute_chunk_tx_root<'a, T>(chunks: T) -> CryptoHash where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn compute_outcome_root<'a, T>(chunks: T) -> CryptoHash where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn compute_gas_used<'a, T>(chunks: T, height: u64) -> u64 where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn compute_gas_limit<'a, T>(chunks: T, height: u64) -> u64 where
T: IntoIterator<Item = &'a ShardChunkHeader>,
pub fn validate_chunk_header_proof(
chunk: &ShardChunkHeader,
chunk_root: &CryptoHash,
merkle_path: &Vec<MerklePathItem, Global>
) -> bool
Checks that block content matches block hash, with the possible exception of chunk signatures
pub fn empty_with_epoch(
prev: &Block,
height: u64,
epoch_id: EpochId,
next_epoch_id: EpochId,
next_bp_hash: CryptoHash,
signer: &dyn ValidatorSigner,
block_merkle_tree: &mut PartialMerkleTree
) -> Block
pub fn empty_with_height_and_block_merkle_tree(
prev: &Block,
height: u64,
signer: &dyn ValidatorSigner,
block_merkle_tree: &mut PartialMerkleTree
) -> Block
pub fn empty_with_block_merkle_tree(
prev: &Block,
signer: &dyn ValidatorSigner,
block_merkle_tree: &mut PartialMerkleTree
) -> Block
This is not suppose to be used outside of chain tests, because this doesn’t refer to correct chunks. Done because chain tests don’t have a good way to store chunks right now.
Trait Implementations
impl BorshDeserialize for Block where
Box<BlockV1, Global>: BorshDeserialize,
Box<BlockV2, Global>: BorshDeserialize,
impl BorshDeserialize for Block where
Box<BlockV1, Global>: BorshDeserialize,
Box<BlockV2, Global>: BorshDeserialize,
impl BorshSerialize for Block where
Box<BlockV1, Global>: BorshSerialize,
Box<BlockV2, Global>: BorshSerialize,
impl BorshSerialize for Block where
Box<BlockV1, Global>: BorshSerialize,
Box<BlockV2, Global>: BorshSerialize,
Auto Trait Implementations
impl RefUnwindSafe for Block
impl UnwindSafe for Block
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more