eligibility

package
v0.3.1-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package eligibility is a generated GoMock package.

nolint

Index

Constants

View Source
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
)
View Source
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) Add

func (m *Mockcache) Add(key, value any) bool

Add mocks base method.

func (*Mockcache) EXPECT

func (m *Mockcache) EXPECT() *MockcacheMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*Mockcache) Get

func (m *Mockcache) Get(key any) (any, bool)

Get mocks base method.

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

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

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 interface{}) *gomock.Call

Verify indicates an expected call of Verify.

type Opt

type Opt func(h *Oracle)

Opt for configuring Validator.

type Oracle

type Oracle struct {
	log.Log
	// contains filtered or unexported fields
}

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 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, nonce types.VRFPostIndex, layer types.LayerID, round uint32) (types.VrfSignature, error)

Proof returns the role proof for the current Layer & Round.

func (*Oracle) UpdateActiveSet added in v1.0.0

func (o *Oracle) UpdateActiveSet(epoch types.EpochID, activeSet []types.ATXID)

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
	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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL