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
- 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) GenVRF(ctx context.Context, signer *signing.VRFSigner, beacon types.Beacon, ...) types.VrfSignature
- func (o *Oracle) IsIdentityActiveOnConsensusView(ctx context.Context, edID types.NodeID, layer types.LayerID) (bool, error)
- func (o *Oracle) Proof(ctx context.Context, layer types.LayerID, round uint32) (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 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 ¶
This section is empty.
Types ¶
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, vrfSigner *signing.VRFSigner, 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) GenVRF ¶ added in v1.2.2
func (o *Oracle) GenVRF(ctx context.Context, signer *signing.VRFSigner, beacon types.Beacon, layer types.LayerID, round uint32) types.VrfSignature
GenVRF generates vrf for hare eligibility.
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, 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 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)