Files
zeekay 1a114b8eb9 validators: add warp accessor methods to State interface
Add GetWarpValidatorSets() and GetWarpValidatorSet() methods to the
validators.State interface for accessing BLS-enabled validator sets
required for Warp message signing.

Changes:
- Add WarpValidator and WarpSet types to represent Warp-capable validators
- Add GetWarpValidatorSets(ctx, heights, netIDs) for batch lookups
- Add GetWarpValidatorSet(ctx, height, netID) for single lookups
- Regenerate mocks with new interface methods
- Add comprehensive test coverage for Warp accessor methods
- Update mockState in validators_test.go to implement new methods

All tests passing: 5/5 new tests, all existing tests still pass.
2025-11-11 06:01:08 -08:00

119 lines
4.3 KiB
Go

// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/luxfi/consensus/validator (interfaces: State)
//
// Generated by this command:
//
// mockgen -package=validatorsmock -destination=validatorsmock/state.go -mock_names=State=State . State
//
// Package validatorsmock is a generated GoMock package.
package validatorsmock
import (
context "context"
reflect "reflect"
validators "github.com/luxfi/consensus/validator"
ids "github.com/luxfi/ids"
gomock "go.uber.org/mock/gomock"
)
// State is a mock of State interface.
type State struct {
ctrl *gomock.Controller
recorder *StateMockRecorder
isgomock struct{}
}
// StateMockRecorder is the mock recorder for State.
type StateMockRecorder struct {
mock *State
}
// NewState creates a new mock instance.
func NewState(ctrl *gomock.Controller) *State {
mock := &State{ctrl: ctrl}
mock.recorder = &StateMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *State) EXPECT() *StateMockRecorder {
return m.recorder
}
// GetCurrentHeight mocks base method.
func (m *State) GetCurrentHeight(ctx context.Context) (uint64, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetCurrentHeight", ctx)
ret0, _ := ret[0].(uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetCurrentHeight indicates an expected call of GetCurrentHeight.
func (mr *StateMockRecorder) GetCurrentHeight(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentHeight", reflect.TypeOf((*State)(nil).GetCurrentHeight), ctx)
}
// GetCurrentValidators mocks base method.
func (m *State) GetCurrentValidators(ctx context.Context, height uint64, netID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetCurrentValidators", ctx, height, netID)
ret0, _ := ret[0].(map[ids.NodeID]*validators.GetValidatorOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetCurrentValidators indicates an expected call of GetCurrentValidators.
func (mr *StateMockRecorder) GetCurrentValidators(ctx, height, netID any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCurrentValidators", reflect.TypeOf((*State)(nil).GetCurrentValidators), ctx, height, netID)
}
// GetValidatorSet mocks base method.
func (m *State) GetValidatorSet(ctx context.Context, height uint64, netID ids.ID) (map[ids.NodeID]*validators.GetValidatorOutput, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetValidatorSet", ctx, height, netID)
ret0, _ := ret[0].(map[ids.NodeID]*validators.GetValidatorOutput)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetValidatorSet indicates an expected call of GetValidatorSet.
func (mr *StateMockRecorder) GetValidatorSet(ctx, height, netID any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetValidatorSet", reflect.TypeOf((*State)(nil).GetValidatorSet), ctx, height, netID)
}
// GetWarpValidatorSet mocks base method.
func (m *State) GetWarpValidatorSet(ctx context.Context, height uint64, netID ids.ID) (*validators.WarpSet, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetWarpValidatorSet", ctx, height, netID)
ret0, _ := ret[0].(*validators.WarpSet)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetWarpValidatorSet indicates an expected call of GetWarpValidatorSet.
func (mr *StateMockRecorder) GetWarpValidatorSet(ctx, height, netID any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWarpValidatorSet", reflect.TypeOf((*State)(nil).GetWarpValidatorSet), ctx, height, netID)
}
// GetWarpValidatorSets mocks base method.
func (m *State) GetWarpValidatorSets(ctx context.Context, heights []uint64, netIDs []ids.ID) (map[ids.ID]map[uint64]*validators.WarpSet, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetWarpValidatorSets", ctx, heights, netIDs)
ret0, _ := ret[0].(map[ids.ID]map[uint64]*validators.WarpSet)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetWarpValidatorSets indicates an expected call of GetWarpValidatorSets.
func (mr *StateMockRecorder) GetWarpValidatorSets(ctx, heights, netIDs any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWarpValidatorSets", reflect.TypeOf((*State)(nil).GetWarpValidatorSets), ctx, heights, netIDs)
}