tmmirror

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: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mirror

type Mirror struct {
	// contains filtered or unexported fields
}

Mirror maintains a read-only view of the chain state, based on inputs from the network.

func NewMirror

func NewMirror(
	ctx context.Context,
	log *slog.Logger,
	cfg MirrorConfig,
) (*Mirror, error)

NewMirror returns a new Mirror based on the given MirrorConfig.

The Mirror runs background goroutines associated with ctx. The Mirror can be stopped by canceling the context and calling its Wait method.

func (*Mirror) CommittingView

func (m *Mirror) CommittingView(ctx context.Context, v *tmconsensus.VersionedRoundView) error

CommittingView overwrites v with the current state of the mirror's committing view. Existing slices in v will be truncated and appended, so that repeated requests should be able to minimize garbage creation.

func (*Mirror) HandleProposedHeader

HandleProposedHeader satisfies the tmconsensus.ConsensusHandler interface.

The [tmengine.Engine] also has a HandleProposedHeader method with a matching signature; calling that method on the Engine just delegates to the engine's mirror, i.e. this method.

This method first makes a "check proposed header" request to the kernel to do some very lightweight validation determining whether the proposed header may be applied. If that lightweight validation passes, this method does a more thorough check, confirming correct signatures, before requesting that the kernel actually adds the proposed header. This minimizes time spent in the kernel's main loop, by spending the time in this method instead.

func (*Mirror) VotingView

func (m *Mirror) VotingView(ctx context.Context, v *tmconsensus.VersionedRoundView) error

VotingView overwrites v with the current state of the mirror's voting view. Existing slices in v will be truncated and appended, so that repeated requests should be able to minimize garbage creation.

func (*Mirror) Wait

func (m *Mirror) Wait()

type MirrorConfig

type MirrorConfig struct {
	Store                tmstore.MirrorStore
	CommittedHeaderStore tmstore.CommittedHeaderStore
	RoundStore           tmstore.RoundStore
	ValidatorStore       tmstore.ValidatorStore

	InitialHeight       uint64
	InitialValidatorSet tmconsensus.ValidatorSet

	HashScheme                        tmconsensus.HashScheme
	SignatureScheme                   tmconsensus.SignatureScheme
	CommonMessageSignatureProofScheme gcrypto.CommonMessageSignatureProofScheme

	ProposedHeaderFetcher tmelink.ProposedHeaderFetcher

	ReplayedHeadersIn <-chan tmelink.ReplayedHeaderRequest
	GossipStrategyOut chan<- tmelink.NetworkViewUpdate
	LagStateOut       chan<- tmelink.LagState

	StateMachineRoundEntranceIn <-chan tmeil.StateMachineRoundEntrance
	StateMachineRoundViewOut    chan<- tmeil.StateMachineRoundView

	MetricsCollector *tmemetrics.Collector

	Watchdog *gwatchdog.Watchdog

	AssertEnv gassert.Env
}

MirrorConfig holds the configuration required to start a Mirror.

type NetworkHeightRound

type NetworkHeightRound = tmi.NetworkHeightRound

NetworkHeightRound is an alias into the internal package. TBD if this is worth keeping; if so it may be better to duplicate the type, as navigating to an internal package to find a definition is usually a poor, clunky experience.

Directories

Path Synopsis
internal
tmi
Package tmi is the internal package for tmmirror.
Package tmi is the internal package for tmmirror.

Jump to

Keyboard shortcuts

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