Documentation ¶
Overview ¶
Code generated by MockGen. DO NOT EDIT. Source: ./interface.go
Generated by this command:
mockgen -typed -package=eligibility -destination=./mocks.go -source=./interface.go
Package eligibility is a generated GoMock package.
nolint
Index ¶
- Constants
- Variables
- func GenVRF(ctx context.Context, signer *signing.VRFSigner, beacon types.Beacon, ...) types.VrfSignature
- type MockRolacle
- func (m *MockRolacle) CalcEligibility(arg0 context.Context, arg1 types.LayerID, arg2 uint32, arg3 int, ...) (uint16, error)
- func (m *MockRolacle) EXPECT() *MockRolacleMockRecorder
- func (m *MockRolacle) IsIdentityActiveOnConsensusView(arg0 context.Context, arg1 types.NodeID, arg2 types.LayerID) (bool, error)
- func (m *MockRolacle) Proof(arg0 context.Context, arg1 *signing.VRFSigner, arg2 types.LayerID, arg3 uint32) (types.VrfSignature, error)
- func (m *MockRolacle) Validate(arg0 context.Context, arg1 types.LayerID, arg2 uint32, arg3 int, ...) (bool, error)
- type MockRolacleMockRecorder
- func (mr *MockRolacleMockRecorder) CalcEligibility(arg0, arg1, arg2, arg3, arg4, arg5 any) *RolacleCalcEligibilityCall
- func (mr *MockRolacleMockRecorder) IsIdentityActiveOnConsensusView(arg0, arg1, arg2 any) *RolacleIsIdentityActiveOnConsensusViewCall
- func (mr *MockRolacleMockRecorder) Proof(arg0, arg1, arg2, arg3 any) *RolacleProofCall
- func (mr *MockRolacleMockRecorder) Validate(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *RolacleValidateCall
- type MockactiveSetCache
- type MockactiveSetCacheMockRecorder
- type MockvrfVerifier
- type MockvrfVerifierMockRecorder
- type Oracle
- func (o *Oracle) ActiveSet(ctx context.Context, targetEpoch types.EpochID) ([]types.ATXID, error)
- func (o *Oracle) CalcEligibility(ctx context.Context, layer types.LayerID, round uint32, committeeSize int, ...) (uint16, error)
- func (o *Oracle) IsIdentityActiveOnConsensusView(ctx context.Context, edID types.NodeID, layer types.LayerID) (bool, error)
- func (o *Oracle) Proof(ctx context.Context, signer *signing.VRFSigner, layer types.LayerID, ...) (types.VrfSignature, error)
- func (o *Oracle) SetSync(sync system.SyncStateProvider)
- func (o *Oracle) UpdateActiveSet(epoch types.EpochID, activeSet []types.ATXID)
- func (o *Oracle) Validate(ctx context.Context, layer types.LayerID, round uint32, committeeSize int, ...) (bool, error)
- type Rolacle
- type RolacleCalcEligibilityCall
- type RolacleIsIdentityActiveOnConsensusViewCall
- func (c *RolacleIsIdentityActiveOnConsensusViewCall) Do(f func(context.Context, types.NodeID, types.LayerID) (bool, error)) *RolacleIsIdentityActiveOnConsensusViewCall
- func (c *RolacleIsIdentityActiveOnConsensusViewCall) DoAndReturn(f func(context.Context, types.NodeID, types.LayerID) (bool, error)) *RolacleIsIdentityActiveOnConsensusViewCall
- func (c *RolacleIsIdentityActiveOnConsensusViewCall) Return(arg0 bool, arg1 error) *RolacleIsIdentityActiveOnConsensusViewCall
- type RolacleProofCall
- type RolacleValidateCall
- type VrfMessage
Constants ¶
const ( // HarePreRound ... HarePreRound uint32 = math.MaxUint32 // CertifyRound is not part of the hare protocol, but it shares the same oracle for eligibility. CertifyRound uint32 = math.MaxUint32 >> 1 )
const ( // HareStatusRound ... HareStatusRound uint32 = iota // HareProposalRound ... HareProposalRound // HareCommitRound ... HareCommitRound // HareNotifyRound ... HareNotifyRound )
Variables ¶
var (
ErrNotActive = errors.New("oracle: miner is not active in epoch")
)
Functions ¶
Types ¶
type MockRolacle ¶ added in v1.3.0
type MockRolacle struct {
// contains filtered or unexported fields
}
MockRolacle is a mock of Rolacle interface.
func NewMockRolacle ¶ added in v1.3.0
func NewMockRolacle(ctrl *gomock.Controller) *MockRolacle
NewMockRolacle creates a new mock instance.
func (*MockRolacle) CalcEligibility ¶ added in v1.3.0
func (m *MockRolacle) CalcEligibility(arg0 context.Context, arg1 types.LayerID, arg2 uint32, arg3 int, arg4 types.NodeID, arg5 types.VrfSignature) (uint16, error)
CalcEligibility mocks base method.
func (*MockRolacle) EXPECT ¶ added in v1.3.0
func (m *MockRolacle) EXPECT() *MockRolacleMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRolacle) IsIdentityActiveOnConsensusView ¶ added in v1.3.0
func (m *MockRolacle) IsIdentityActiveOnConsensusView(arg0 context.Context, arg1 types.NodeID, arg2 types.LayerID) (bool, error)
IsIdentityActiveOnConsensusView mocks base method.
type MockRolacleMockRecorder ¶ added in v1.3.0
type MockRolacleMockRecorder struct {
// contains filtered or unexported fields
}
MockRolacleMockRecorder is the mock recorder for MockRolacle.
func (*MockRolacleMockRecorder) CalcEligibility ¶ added in v1.3.0
func (mr *MockRolacleMockRecorder) CalcEligibility(arg0, arg1, arg2, arg3, arg4, arg5 any) *RolacleCalcEligibilityCall
CalcEligibility indicates an expected call of CalcEligibility.
func (*MockRolacleMockRecorder) IsIdentityActiveOnConsensusView ¶ added in v1.3.0
func (mr *MockRolacleMockRecorder) IsIdentityActiveOnConsensusView(arg0, arg1, arg2 any) *RolacleIsIdentityActiveOnConsensusViewCall
IsIdentityActiveOnConsensusView indicates an expected call of IsIdentityActiveOnConsensusView.
func (*MockRolacleMockRecorder) Proof ¶ added in v1.3.0
func (mr *MockRolacleMockRecorder) Proof(arg0, arg1, arg2, arg3 any) *RolacleProofCall
Proof indicates an expected call of Proof.
func (*MockRolacleMockRecorder) Validate ¶ added in v1.3.0
func (mr *MockRolacleMockRecorder) Validate(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *RolacleValidateCall
Validate indicates an expected call of Validate.
type MockactiveSetCache ¶ added in v1.0.0
type MockactiveSetCache struct {
// contains filtered or unexported fields
}
MockactiveSetCache is a mock of activeSetCache interface.
func NewMockactiveSetCache ¶ added in v1.0.0
func NewMockactiveSetCache(ctrl *gomock.Controller) *MockactiveSetCache
NewMockactiveSetCache creates a new mock instance.
func (*MockactiveSetCache) Add ¶ added in v1.0.0
func (m *MockactiveSetCache) Add(key types.EpochID, value *cachedActiveSet) bool
Add mocks base method.
func (*MockactiveSetCache) EXPECT ¶ added in v1.0.0
func (m *MockactiveSetCache) EXPECT() *MockactiveSetCacheMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockactiveSetCacheMockRecorder ¶ added in v1.0.0
type MockactiveSetCacheMockRecorder struct {
// contains filtered or unexported fields
}
MockactiveSetCacheMockRecorder is the mock recorder for MockactiveSetCache.
func (*MockactiveSetCacheMockRecorder) Add ¶ added in v1.0.0
func (mr *MockactiveSetCacheMockRecorder) Add(key, value any) *activeSetCacheAddCall
Add indicates an expected call of Add.
func (*MockactiveSetCacheMockRecorder) Get ¶ added in v1.0.0
func (mr *MockactiveSetCacheMockRecorder) Get(key any) *activeSetCacheGetCall
Get indicates an expected call of Get.
type MockvrfVerifier ¶ added in v1.0.0
type MockvrfVerifier struct {
// contains filtered or unexported fields
}
MockvrfVerifier is a mock of vrfVerifier interface.
func NewMockvrfVerifier ¶ added in v1.0.0
func NewMockvrfVerifier(ctrl *gomock.Controller) *MockvrfVerifier
NewMockvrfVerifier creates a new mock instance.
func (*MockvrfVerifier) EXPECT ¶ added in v1.0.0
func (m *MockvrfVerifier) EXPECT() *MockvrfVerifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockvrfVerifier) Verify ¶ added in v1.0.0
func (m *MockvrfVerifier) Verify(nodeID types.NodeID, msg []byte, sig types.VrfSignature) bool
Verify mocks base method.
type MockvrfVerifierMockRecorder ¶ added in v1.0.0
type MockvrfVerifierMockRecorder struct {
// contains filtered or unexported fields
}
MockvrfVerifierMockRecorder is the mock recorder for MockvrfVerifier.
func (*MockvrfVerifierMockRecorder) Verify ¶ added in v1.0.0
func (mr *MockvrfVerifierMockRecorder) Verify(nodeID, msg, sig any) *vrfVerifierVerifyCall
Verify indicates an expected call of Verify.
type Oracle ¶
Oracle is the hare eligibility oracle.
func New ¶
func New( beacons system.BeaconGetter, db *datastore.CachedDB, vrfVerifier vrfVerifier, layersPerEpoch uint32, cfg config.Config, logger log.Log, ) *Oracle
New returns a new eligibility oracle instance.
func (*Oracle) CalcEligibility ¶ added in v1.0.0
func (o *Oracle) CalcEligibility( ctx context.Context, layer types.LayerID, round uint32, committeeSize int, id types.NodeID, vrfSig types.VrfSignature, ) (uint16, error)
CalcEligibility calculates the number of eligibilities of ID on the given Layer where msg is the VRF message, sig is the role proof and assuming commSize as the expected committee size.
func (*Oracle) IsIdentityActiveOnConsensusView ¶
func (o *Oracle) IsIdentityActiveOnConsensusView( ctx context.Context, edID types.NodeID, layer types.LayerID, ) (bool, error)
IsIdentityActiveOnConsensusView returns true if the provided identity is active on the consensus view derived from the specified layer, false otherwise.
func (*Oracle) Proof ¶
func (o *Oracle) Proof( ctx context.Context, signer *signing.VRFSigner, layer types.LayerID, round uint32, ) (types.VrfSignature, error)
Proof returns the role proof for the current Layer & Round.
func (*Oracle) SetSync ¶ added in v1.1.4
func (o *Oracle) SetSync(sync system.SyncStateProvider)
func (*Oracle) UpdateActiveSet ¶ added in v1.0.0
func (*Oracle) Validate ¶ added in v1.0.0
func (o *Oracle) Validate( ctx context.Context, layer types.LayerID, round uint32, committeeSize int, id types.NodeID, sig types.VrfSignature, eligibilityCount uint16, ) (bool, error)
Validate validates the number of eligibilities of ID on the given Layer where msg is the VRF message, sig is the role proof and assuming commSize as the expected committee size.
type Rolacle ¶ added in v1.3.0
type Rolacle interface { Validate(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature, uint16) (bool, error) CalcEligibility(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature) (uint16, error) Proof(context.Context, *signing.VRFSigner, types.LayerID, uint32) (types.VrfSignature, error) IsIdentityActiveOnConsensusView(context.Context, types.NodeID, types.LayerID) (bool, error) }
Rolacle is the roles oracle provider.
type RolacleCalcEligibilityCall ¶ added in v1.3.0
RolacleCalcEligibilityCall wrap *gomock.Call
func (*RolacleCalcEligibilityCall) Do ¶ added in v1.3.0
func (c *RolacleCalcEligibilityCall) Do(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature) (uint16, error)) *RolacleCalcEligibilityCall
Do rewrite *gomock.Call.Do
func (*RolacleCalcEligibilityCall) DoAndReturn ¶ added in v1.3.0
func (c *RolacleCalcEligibilityCall) DoAndReturn(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature) (uint16, error)) *RolacleCalcEligibilityCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*RolacleCalcEligibilityCall) Return ¶ added in v1.3.0
func (c *RolacleCalcEligibilityCall) Return(arg0 uint16, arg1 error) *RolacleCalcEligibilityCall
Return rewrite *gomock.Call.Return
type RolacleIsIdentityActiveOnConsensusViewCall ¶ added in v1.3.0
RolacleIsIdentityActiveOnConsensusViewCall wrap *gomock.Call
func (*RolacleIsIdentityActiveOnConsensusViewCall) Do ¶ added in v1.3.0
func (c *RolacleIsIdentityActiveOnConsensusViewCall) Do(f func(context.Context, types.NodeID, types.LayerID) (bool, error)) *RolacleIsIdentityActiveOnConsensusViewCall
Do rewrite *gomock.Call.Do
func (*RolacleIsIdentityActiveOnConsensusViewCall) DoAndReturn ¶ added in v1.3.0
func (c *RolacleIsIdentityActiveOnConsensusViewCall) DoAndReturn(f func(context.Context, types.NodeID, types.LayerID) (bool, error)) *RolacleIsIdentityActiveOnConsensusViewCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*RolacleIsIdentityActiveOnConsensusViewCall) Return ¶ added in v1.3.0
func (c *RolacleIsIdentityActiveOnConsensusViewCall) Return(arg0 bool, arg1 error) *RolacleIsIdentityActiveOnConsensusViewCall
Return rewrite *gomock.Call.Return
type RolacleProofCall ¶ added in v1.3.0
RolacleProofCall wrap *gomock.Call
func (*RolacleProofCall) Do ¶ added in v1.3.0
func (c *RolacleProofCall) Do(f func(context.Context, *signing.VRFSigner, types.LayerID, uint32) (types.VrfSignature, error)) *RolacleProofCall
Do rewrite *gomock.Call.Do
func (*RolacleProofCall) DoAndReturn ¶ added in v1.3.0
func (c *RolacleProofCall) DoAndReturn(f func(context.Context, *signing.VRFSigner, types.LayerID, uint32) (types.VrfSignature, error)) *RolacleProofCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*RolacleProofCall) Return ¶ added in v1.3.0
func (c *RolacleProofCall) Return(arg0 types.VrfSignature, arg1 error) *RolacleProofCall
Return rewrite *gomock.Call.Return
type RolacleValidateCall ¶ added in v1.3.0
RolacleValidateCall wrap *gomock.Call
func (*RolacleValidateCall) Do ¶ added in v1.3.0
func (c *RolacleValidateCall) Do(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature, uint16) (bool, error)) *RolacleValidateCall
Do rewrite *gomock.Call.Do
func (*RolacleValidateCall) DoAndReturn ¶ added in v1.3.0
func (c *RolacleValidateCall) DoAndReturn(f func(context.Context, types.LayerID, uint32, int, types.NodeID, types.VrfSignature, uint16) (bool, error)) *RolacleValidateCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*RolacleValidateCall) Return ¶ added in v1.3.0
func (c *RolacleValidateCall) Return(arg0 bool, arg1 error) *RolacleValidateCall
Return rewrite *gomock.Call.Return
type VrfMessage ¶ added in v1.0.0
type VrfMessage struct { Type types.EligibilityType // always types.EligibilityHare Beacon types.Beacon Round uint32 Layer types.LayerID }
VrfMessage is a verification message. It is also the payload for the signature in `types.HareEligibility`.
func (*VrfMessage) DecodeScale ¶ added in v1.0.0
func (t *VrfMessage) DecodeScale(dec *scale.Decoder) (total int, err error)
func (*VrfMessage) EncodeScale ¶ added in v1.0.0
func (t *VrfMessage) EncodeScale(enc *scale.Encoder) (total int, err error)