Documentation ¶
Index ¶
- type Mirror
- func (m *Mirror) CommittingView(ctx context.Context, v *tmconsensus.VersionedRoundView) error
- func (m *Mirror) HandlePrecommitProofs(ctx context.Context, p tmconsensus.PrecommitSparseProof) tmconsensus.HandleVoteProofsResult
- func (m *Mirror) HandlePrevoteProofs(ctx context.Context, p tmconsensus.PrevoteSparseProof) tmconsensus.HandleVoteProofsResult
- func (m *Mirror) HandleProposedHeader(ctx context.Context, ph tmconsensus.ProposedHeader) tmconsensus.HandleProposedHeaderResult
- func (m *Mirror) VotingView(ctx context.Context, v *tmconsensus.VersionedRoundView) error
- func (m *Mirror) Wait()
- type MirrorConfig
- type NetworkHeightRound
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 ¶
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) HandlePrecommitProofs ¶
func (m *Mirror) HandlePrecommitProofs(ctx context.Context, p tmconsensus.PrecommitSparseProof) tmconsensus.HandleVoteProofsResult
func (*Mirror) HandlePrevoteProofs ¶
func (m *Mirror) HandlePrevoteProofs(ctx context.Context, p tmconsensus.PrevoteSparseProof) tmconsensus.HandleVoteProofsResult
func (*Mirror) HandleProposedHeader ¶
func (m *Mirror) HandleProposedHeader(ctx context.Context, ph tmconsensus.ProposedHeader) tmconsensus.HandleProposedHeaderResult
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.
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.