tmdriver

package
v0.0.0-...-506a26f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Overview

Package tmdriver contains types for the driver to interact with the consensus engine. The driver could be considered as the "application" to the consensus engine, but we use the term driver here because this is a low-level interface to the engine and it clearly disambiguates from the userspace application that is likely interacting with another layer such as the Cosmos SDK.

While other packages are focused on other primitives that the driver must be aware of, this package focuses specifically and directly on the engine-driver interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FinalizeBlockRequest

type FinalizeBlockRequest struct {
	Header tmconsensus.Header
	Round  uint32

	Resp chan FinalizeBlockResponse
}

FinalizeBlockRequest is sent from the state machine to the driver, notifying the driver that the given header represents the block that is to be committed.

The driver must evaluate the block corresponding to the header and return the validators to set as NextValidators on the subsequent block; and it must return the resulting app state hash, to be used as PrevAppStateHash in the subsequent block.

Consumers of this value may assume that Resp is buffered and sends will not block.

type FinalizeBlockResponse

type FinalizeBlockResponse struct {
	// For an unambiguous indicator of the block the driver finalized.
	Height    uint64
	Round     uint32
	BlockHash []byte

	// The resulting validators after evaluating the block.
	// If we are finalizing the block at height H,
	// this value will be used as the NextValidators field in block at height H+1,
	// thereby becoming the current validators at height H+2.
	Validators []tmconsensus.Validator

	// The app state after evaluating the block.
	AppStateHash []byte
}

FinalizeBlockResponse is sent by the driver in response to a FinalizeBlockRequest.

type InitChainRequest

type InitChainRequest struct {
	Genesis tmconsensus.ExternalGenesis

	Resp chan InitChainResponse
}

InitChainRequest is sent from the engine to the driver, ensuring that the consensus store is in an appropriate initial state.

InitChainRequest does not have an associated context like the other request types, because it is not associated with the lifecycle of a single step or round.

type InitChainResponse

type InitChainResponse struct {
	// The app state hash to use in the first proposed block's PrevAppStateHash field.
	AppStateHash []byte

	// The validators for the consensus engine to use in the first proposed block.
	// If nil, the engine will use the GenesisValidators from the request.
	Validators []tmconsensus.Validator
}

InitChainResponse is sent by the driver in response to an InitChainRequest.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL