single_block_verifier.rs

Overview

This file implements the functionality for producing a single verification block within a blockchain environment. It defines a generic BlockVerifier trait and a concrete implementation, TVMBlockVerifier, which is responsible for generating a verification block from an existing block and its optimistic state. The verification process includes message preprocessing, validation of incoming messages, execution of slashing logic, and block construction using the TVM (TON Virtual Machine) configuration and runtime services.

The file integrates multiple components such as blockchain configuration, accounts repository, block state repository, and shared services to perform the verification step. It ensures the correctness and uniqueness of incoming messages, handles external inbound messages, and enforces execution time limits during verification.

Traits and Structures

BlockVerifier Trait

The BlockVerifier trait abstracts the behavior required to generate a verification block.

Associated Types

Methods

generate_verify_block
fn generate_verify_block<'a, I>(
    self,
    block: &AckiNackiBlock,
    initial_state: Self::OptimisticState,
    refs: I,
    message_db: MessageDurableStorage,
) -> anyhow::Result<(AckiNackiBlock, Self::OptimisticState)>
where
    I: Iterator<Item = &'a CrossThreadRefData> + Clone,
    CrossThreadRefData: 'a;

TVMBlockVerifier Struct

The TVMBlockVerifier is a concrete implementation of the BlockVerifier trait tailored for the TVM blockchain environment.

Fields

Methods

print_block_info
fn print_block_info(block: &tvm_block::Block);
generate_verify_block (Implementation)

Implementation Details and Algorithms

Interaction with Other System Components

Mermaid Diagram: Structure of single_block_verifier.rs

classDiagram
class BlockVerifier {
<<trait>>
+generate_verify_block()
}
class TVMBlockVerifier {
-blockchain_config: Arc<BlockchainConfig>
-node_config: Config
-epoch_block_keeper_data: Vec<BlockKeeperData>
-block_nack: Vec<Envelope<GoshBLS, NackData>>
-shared_services: SharedServices
-accounts_repository: AccountsRepository
-block_state_repository: BlockStateRepository
-metrics: Option<BlockProductionMetrics>
-wasm_cache: WasmNodeCache
+print_block_info()
+generate_verify_block()
}
BlockVerifier <|.. TVMBlockVerifier