Documentation ¶
Overview ¶
Package eligibility is a generated GoMock package.
nolint
Index ¶
- Constants
- type Mockcache
- type MockcacheMockRecorder
- type MocknonceFetcher
- type MocknonceFetcherMockRecorder
- type MockvrfVerifier
- type MockvrfVerifierMockRecorder
- type Opt
- type Oracle
- 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, nonce types.VRFPostIndex, layer types.LayerID, ...) ([]byte, error)
- 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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mockcache ¶
type Mockcache struct {
// contains filtered or unexported fields
}
Mockcache is a mock of cache interface.
func NewMockcache ¶
func NewMockcache(ctrl *gomock.Controller) *Mockcache
NewMockcache creates a new mock instance.
func (*Mockcache) EXPECT ¶
func (m *Mockcache) EXPECT() *MockcacheMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockcacheMockRecorder ¶
type MockcacheMockRecorder struct {
// contains filtered or unexported fields
}
MockcacheMockRecorder is the mock recorder for Mockcache.
func (*MockcacheMockRecorder) Add ¶
func (mr *MockcacheMockRecorder) Add(key, value interface{}) *gomock.Call
Add indicates an expected call of Add.
func (*MockcacheMockRecorder) Get ¶
func (mr *MockcacheMockRecorder) Get(key interface{}) *gomock.Call
Get indicates an expected call of Get.
type MocknonceFetcher ¶
type MocknonceFetcher struct {
// contains filtered or unexported fields
}
MocknonceFetcher is a mock of nonceFetcher interface.
func NewMocknonceFetcher ¶
func NewMocknonceFetcher(ctrl *gomock.Controller) *MocknonceFetcher
NewMocknonceFetcher creates a new mock instance.
func (*MocknonceFetcher) EXPECT ¶
func (m *MocknonceFetcher) EXPECT() *MocknonceFetcherMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MocknonceFetcher) VRFNonce ¶
func (m *MocknonceFetcher) VRFNonce(arg0 types.NodeID, arg1 types.EpochID) (types.VRFPostIndex, error)
VRFNonce mocks base method.
type MocknonceFetcherMockRecorder ¶
type MocknonceFetcherMockRecorder struct {
// contains filtered or unexported fields
}
MocknonceFetcherMockRecorder is the mock recorder for MocknonceFetcher.
func (*MocknonceFetcherMockRecorder) VRFNonce ¶
func (mr *MocknonceFetcherMockRecorder) VRFNonce(arg0, arg1 interface{}) *gomock.Call
VRFNonce indicates an expected call of VRFNonce.
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.
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 interface{}) *gomock.Call
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, opts ...Opt, ) *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, nonce types.VRFPostIndex, vrfSig []byte, ) (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, nonce types.VRFPostIndex, layer types.LayerID, round uint32) ([]byte, error)
Proof returns the role proof for the current Layer & Round.
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 []byte, 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 Nonce types.VRFPostIndex Beacon types.Beacon Round uint32 Layer types.LayerID }
VrfMessage is a verification message.
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)