validators

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: BSD-3-Clause Imports: 17 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// MaxRecentlyAcceptedWindowSize is the maximum number of blocks that the
	// recommended minimum height will lag behind the last accepted block.
	MaxRecentlyAcceptedWindowSize = 64
	// MinRecentlyAcceptedWindowSize is the minimum number of blocks that the
	// recommended minimum height will lag behind the last accepted block.
	MinRecentlyAcceptedWindowSize = 0
	// RecentlyAcceptedWindowTTL is the amount of time after a block is accepted
	// to avoid recommending it as the minimum height. The size constraints take
	// precedence over this time constraint.
	RecentlyAcceptedWindowTTL = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager implements validators.State and additionally tracks recently accepted block IDs via OnAcceptedBlockID. TODO: Remove requirement for the P-chain's context lock to be held when calling exported functions.

func NewManager

func NewManager(
	cfg config.Internal,
	state *state.State,
	metrics metrics.Metrics,
	clk *mockable.Clock,
) *Manager

func (*Manager) GetCurrentHeight added in v1.14.2

func (m *Manager) GetCurrentHeight(ctx context.Context) (uint64, error)

func (*Manager) GetCurrentValidatorSet added in v1.14.2

func (m *Manager) GetCurrentValidatorSet(ctx context.Context, subnetID ids.ID) (map[ids.ID]*validators.GetCurrentValidatorOutput, uint64, error)

func (*Manager) GetMinimumHeight added in v1.14.2

func (m *Manager) GetMinimumHeight(ctx context.Context) (uint64, error)

GetMinimumHeight returns the height of the most recent block beyond the horizon of our recentlyAccepted window.

Because the time between blocks is arbitrary, we're only guaranteed that the window's configured TTL amount of time has passed once an element expires from the window.

To try to always return a block older than the window's TTL, we return the parent of the oldest element in the window (as an expired element is always guaranteed to be sufficiently stale). If we haven't expired an element yet in the case of a process restart, we default to the lastAccepted block's height which is likely (but not guaranteed) to also be older than the window's configured TTL.

If [UseCurrentHeight] is true, we override the block selection policy described above and we will always return the last accepted block height as the minimum.

func (*Manager) GetSubnetID added in v1.14.2

func (m *Manager) GetSubnetID(_ context.Context, chainID ids.ID) (ids.ID, error)

func (*Manager) GetValidatorSet added in v1.14.2

func (m *Manager) GetValidatorSet(
	ctx context.Context,
	targetHeight uint64,
	subnetID ids.ID,
) (map[ids.NodeID]*validators.GetValidatorOutput, error)

func (*Manager) GetWarpValidatorSets added in v1.14.2

func (m *Manager) GetWarpValidatorSets(
	ctx context.Context,
	targetHeight uint64,
) (map[ids.ID]validators.WarpSet, error)

func (*Manager) OnAcceptedBlockID

func (m *Manager) OnAcceptedBlockID(blkID ids.ID)

OnAcceptedBlockID registers the ID of the latest accepted block. It is used to update the recentlyAccepted sliding window.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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