block_info.rs

Overview

This file defines the BlockInfo struct, which acts as a transparent wrapper around the tvm_block::BlkPrevInfo type, providing serialization and deserialization support using custom formatting. It also implements dereferencing traits to allow seamless access to the inner BlkPrevInfo instance. Additionally, the file introduces the BlockEndLT struct, a simple wrapper around a u64 value with derived traits for ordering, equality, and serialization.

The primary role of this file is to facilitate the handling, serialization, and deserialization of block-related metadata, especially previous block information, in a format suitable for external representation or storage.


Structs and Implementations

BlockInfo

pub struct BlockInfo {
    inner: tvm_block::BlkPrevInfo,
}
use tvm_block::BlkPrevInfo;

let blk_prev_info = BlkPrevInfo::default();
let block_info = BlockInfo::from(blk_prev_info);

// Access inner fields/methods transparently
let some_field = block_info.some_field();

BlockEndLT

pub struct BlockEndLT(pub u64);
let block_end_lt = BlockEndLT(123456789);

Implementation Details


Interaction with Other System Components


Visual Diagram

classDiagram
class BlockInfo {
-inner: BlkPrevInfo
+deref() : &BlkPrevInfo
+deref_mut() : &mut BlkPrevInfo
+from(BlkPrevInfo) : BlockInfo
}
class BlkPrevInfoFormat
class tvm_block::BlkPrevInfo
class BlockEndLT {
+u64
}
BlockInfo o-- tvm_block::BlkPrevInfo : wraps
BlockInfo ..> BlkPrevInfoFormat : uses for serialization

References