eligibility

package
v0.3.10-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 22 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

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

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

func (*MockactiveSetCache) Get added in v1.0.0

func (m *MockactiveSetCache) Get(key types.EpochID) (*cachedActiveSet, bool)

Get mocks base method.

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

Add indicates an expected call of Add.

func (*MockactiveSetCacheMockRecorder) Get added in v1.0.0

func (mr *MockactiveSetCacheMockRecorder) 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) ActiveSet added in v1.0.0

func (o *Oracle) ActiveSet(ctx context.Context, targetEpoch types.EpochID) ([]types.ATXID, error)

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 // always types.EligibilityHare
	Nonce  types.VRFPostIndex
	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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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