pub fn load_last_l2_block<S: ReadStorage>(storage: StoragePtr<S>) -> Option<L2Block> {
    // Get block number and timestamp
    let current_l2_block_info_key = StorageKey::new(
        AccountTreeId::new(SYSTEM_CONTEXT_ADDRESS),
        SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION,
    );
    let mut storage_ptr = storage.borrow_mut();
    let current_l2_block_info = storage_ptr.read_value(&current_l2_block_info_key);
    let (block_number, block_timestamp) = unpack_block_info(h256_to_u256(current_l2_block_info));
    let block_number = block_number as u32;
    if block_number == 0 {
        // The block does not exist yet
        return None;
    }

    // Get previous block hash
    let position = get_l2_block_hash_key(block_number - 1);
    let prev_block_hash = storage_ptr.read_value(&position);

    // Get current tx rolling hash
    let position = StorageKey::new(
        AccountTreeId::new(SYSTEM_CONTEXT_ADDRESS),
        SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION,
    );
    let current_tx_rolling_hash = storage_ptr.read_value(&position);

    // Calculate current hash
    let current_block_hash = l2_block_hash(
        L2BlockNumber(block_number),
        block_timestamp,
        prev_block_hash,
        current_tx_rolling_hash,
    );

    Some(L2Block {
        number: block_number,
        timestamp: block_timestamp,
        hash: current_block_hash,
    })
}
Get last saved block from storage
core/lib/multivm/src/versions/vm_refunds_enhancement/utils/l2_blocks.rs