Documentation
¶
Index ¶
- Variables
- func ClearChainSubnetMapping()
- func NewTestConsensusContext(t testing.TB) context.Context
- func NewTestConsensusContextWithChainID(t testing.TB, chainID ids.ID) context.Context
- func NewTestValidatorState() consensuscontext.ValidatorState
- func NewTestValidatorStateFromBase(baseState *validatorstest.State) consensuscontext.ValidatorState
- func SetChainSubnetMapping(chainID, subnetID ids.ID)
- type Key
Constants ¶
This section is empty.
Variables ¶
var SubnetEVMTestChainID = ids.GenerateTestID()
SubnetEVMTestChainID is a evm specific chain ID for testing
Functions ¶
func ClearChainSubnetMapping ¶ added in v0.8.8
func ClearChainSubnetMapping()
ClearChainSubnetMapping clears the chain to subnet mapping
func NewTestConsensusContext ¶ added in v0.8.6
NewTestConsensusContext returns a context.Context with validator state properly configured for testing. This wraps consensustest.Context and sets the validator state to avoid the missing GetValidatorSetF issue.
Usage example:
// Instead of: // consensusCtx := utilstest.NewTestConsensusContext(t, consensustest.CChainID) // validatorState := utils.NewTestValidatorState() // consensusCtx.ValidatorState = validatorState // Use: consensusCtx := utils.NewTestConsensusContext(t)
This function ensures that the consensus context has a properly configured validator state that includes the GetValidatorSetF function, which is required by many tests.
func NewTestConsensusContextWithChainID ¶ added in v0.8.6
NewTestConsensusContextWithChainID returns a context.Context with validator state properly configured for testing with a specific chain ID. This is provided for backward compatibility when a specific chain ID is needed.
func NewTestValidatorState ¶ added in v0.8.4
func NewTestValidatorState() consensuscontext.ValidatorState
@TODO: This should eventually be replaced by a more robust solution, or alternatively, the presence of nil validator states shouldn't be depended upon by tests
func NewTestValidatorStateFromBase ¶ added in v0.8.8
func NewTestValidatorStateFromBase(baseState *validatorstest.State) consensuscontext.ValidatorState
NewTestValidatorStateFromBase creates a testValidatorState that wraps an existing validatorstest.State This is useful when you need to use a specific validatorstest.State with custom functions but still implement the consensuscontext.ValidatorState interface.
func SetChainSubnetMapping ¶ added in v0.8.8
SetChainSubnetMapping registers a chain ID to subnet ID mapping for tests