Help us shape the future of Go! Take the 2026 Go Developer Survey

validatorstest

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State = TestState

State is an alias for TestState for backward compatibility

type TestState

type TestState struct {

	// Function fields for test customization
	GetCurrentHeightF     func(context.Context) (uint64, error)
	GetValidatorSetF      func(context.Context, uint64, ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error)
	GetWarpValidatorSetF  func(context.Context, uint64, ids.ID) (*validators.WarpSet, error)
	GetWarpValidatorSetsF func(context.Context, []uint64, []ids.ID) (map[ids.ID]map[uint64]*validators.WarpSet, error)
	// contains filtered or unexported fields
}

TestState is a test implementation of validators.State

func NewTestState

func NewTestState() *TestState

NewTestState creates a new test state

func (*TestState) GetChainID

func (s *TestState) GetChainID(netID ids.ID) (ids.ID, error)

GetChainID returns the chain ID for a given network ID

func (*TestState) GetCurrentHeight

func (s *TestState) GetCurrentHeight(ctx context.Context) (uint64, error)

GetCurrentHeight returns the current height

func (*TestState) GetCurrentValidators

func (s *TestState) GetCurrentValidators(ctx context.Context, height uint64, netID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error)

GetCurrentValidators returns current validators

func (*TestState) GetMinimumHeight

func (s *TestState) GetMinimumHeight(ctx context.Context) (uint64, error)

GetMinimumHeight returns the minimum acceptable height

func (*TestState) GetNetworkID

func (s *TestState) GetNetworkID(chainID ids.ID) (ids.ID, error)

GetNetworkID returns the network ID for a given chain ID

func (*TestState) GetValidatorSet

func (s *TestState) GetValidatorSet(ctx context.Context, height uint64, netID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error)

GetValidatorSet returns a validator set

func (*TestState) GetWarpValidatorSet

func (s *TestState) GetWarpValidatorSet(ctx context.Context, height uint64, netID ids.ID) (*validators.WarpSet, error)

GetWarpValidatorSet returns the Warp validator set for a specific height and netID

func (*TestState) GetWarpValidatorSets

func (s *TestState) GetWarpValidatorSets(ctx context.Context, heights []uint64, netIDs []ids.ID) (map[ids.ID]map[uint64]*validators.WarpSet, error)

GetWarpValidatorSets returns Warp validator sets for the requested heights and netIDs

Jump to

Keyboard shortcuts

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