beacon

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

nolint

Package beacon is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Security parameter (for calculating ATX threshold)
	Kappa int `mapstructure:"beacon-kappa"`
	// Ratio of dishonest spacetime (for calculating ATX threshold). It should be a string representing a rational number.
	Q big.Rat `mapstructure:"beacon-q"`
	// Amount of rounds in every epoch
	RoundsNumber types.RoundID `mapstructure:"beacon-rounds-number"`
	// Grace period duration
	GracePeriodDuration time.Duration `mapstructure:"beacon-grace-period-duration"`
	// Proposal phase duration
	ProposalDuration time.Duration `mapstructure:"beacon-proposal-duration"`
	// First voting round duration
	FirstVotingRoundDuration time.Duration `mapstructure:"beacon-first-voting-round-duration"`
	// Voting round duration
	VotingRoundDuration time.Duration `mapstructure:"beacon-voting-round-duration"`
	// Weak coin round duration
	WeakCoinRoundDuration time.Duration `mapstructure:"beacon-weak-coin-round-duration"`
	// Ratio of votes for reaching consensus
	Theta big.Rat `mapstructure:"beacon-theta"`
	// Maximum allowed number of votes to be sent
	VotesLimit uint32 `mapstructure:"beacon-votes-limit"`
	// Numbers of layers to wait before determining beacon values from ballots when the node didn't participate
	// in previous epoch.
	BeaconSyncWeightUnits int `mapstructure:"beacon-sync-weight-units"`
}

Config is the configuration of the beacon.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the beacon.

func NodeSimUnitTestConfig

func NodeSimUnitTestConfig() Config

NodeSimUnitTestConfig returns configuration for the beacon the unit tests with node simulation .

func UnitTestConfig

func UnitTestConfig() Config

UnitTestConfig returns the unit test configuration for the beacon.

type FirstVotingMessage

type FirstVotingMessage struct {
	FirstVotingMessageBody

	SmesherID types.NodeID
	Signature types.EdSignature
}

FirstVotingMessage is a message type which is used when sending first voting messages.

func (*FirstVotingMessage) DecodeScale

func (t *FirstVotingMessage) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*FirstVotingMessage) EncodeScale

func (t *FirstVotingMessage) EncodeScale(enc *scale.Encoder) (total int, err error)

type FirstVotingMessageBody

type FirstVotingMessageBody struct {
	EpochID types.EpochID
	// number of proposals is expected to be under 100, 1000 is a safe upper bound
	// This expectation holds true for any number of smeshers on the network
	ValidProposals []Proposal `scale:"max=1000"`
	// number of proposals is expected to be under 100, 1000 is a safe upper bound
	// This expectation holds true for any number of smeshers on the network
	PotentiallyValidProposals []Proposal `scale:"max=1000"`
}

FirstVotingMessageBody is FirstVotingMessage without a signature.

func (*FirstVotingMessageBody) DecodeScale

func (t *FirstVotingMessageBody) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*FirstVotingMessageBody) EncodeScale

func (t *FirstVotingMessageBody) EncodeScale(enc *scale.Encoder) (total int, err error)

type FollowingVotingMessage

type FollowingVotingMessage struct {
	FollowingVotingMessageBody

	SmesherID types.NodeID
	Signature types.EdSignature
}

FollowingVotingMessage is a message type which is used when sending following voting messages.

func (*FollowingVotingMessage) DecodeScale

func (t *FollowingVotingMessage) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*FollowingVotingMessage) EncodeScale

func (t *FollowingVotingMessage) EncodeScale(enc *scale.Encoder) (total int, err error)

type FollowingVotingMessageBody

type FollowingVotingMessageBody struct {
	EpochID        types.EpochID
	RoundID        types.RoundID
	VotesBitVector []byte `scale:"max=128"` // 128 bytes = 1024 bits and we limit the number of proposals to 1000
}

FollowingVotingMessageBody is FollowingVotingMessage without a signature.

func (*FollowingVotingMessageBody) DecodeScale

func (t *FollowingVotingMessageBody) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*FollowingVotingMessageBody) EncodeScale

func (t *FollowingVotingMessageBody) EncodeScale(enc *scale.Encoder) (total int, err error)

type Mockcoin

type Mockcoin struct {
	// contains filtered or unexported fields
}

Mockcoin is a mock of coin interface.

func NewMockcoin

func NewMockcoin(ctrl *gomock.Controller) *Mockcoin

NewMockcoin creates a new mock instance.

func (*Mockcoin) EXPECT

func (m *Mockcoin) EXPECT() *MockcoinMockRecorder

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

func (*Mockcoin) FinishEpoch

func (m *Mockcoin) FinishEpoch(arg0 context.Context, arg1 types.EpochID)

FinishEpoch mocks base method.

func (*Mockcoin) FinishRound

func (m *Mockcoin) FinishRound(arg0 context.Context)

FinishRound mocks base method.

func (*Mockcoin) Get

func (m *Mockcoin) Get(arg0 context.Context, arg1 types.EpochID, arg2 types.RoundID) (bool, error)

Get mocks base method.

func (*Mockcoin) HandleProposal

func (m *Mockcoin) HandleProposal(arg0 context.Context, arg1 p2p.Peer, arg2 []byte) error

HandleProposal mocks base method.

func (*Mockcoin) StartEpoch

func (m *Mockcoin) StartEpoch(arg0 context.Context, arg1 types.EpochID)

StartEpoch mocks base method.

func (*Mockcoin) StartRound

func (m *Mockcoin) StartRound(arg0 context.Context, arg1 types.RoundID, arg2 []weakcoin.Participant)

StartRound mocks base method.

type MockcoinFinishEpochCall added in v1.4.0

type MockcoinFinishEpochCall struct {
	*gomock.Call
}

MockcoinFinishEpochCall wrap *gomock.Call

func (*MockcoinFinishEpochCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockcoinFinishEpochCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockcoinFinishEpochCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockcoinFinishRoundCall added in v1.4.0

type MockcoinFinishRoundCall struct {
	*gomock.Call
}

MockcoinFinishRoundCall wrap *gomock.Call

func (*MockcoinFinishRoundCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockcoinFinishRoundCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockcoinFinishRoundCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockcoinGetCall added in v1.4.0

type MockcoinGetCall struct {
	*gomock.Call
}

MockcoinGetCall wrap *gomock.Call

func (*MockcoinGetCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockcoinGetCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockcoinGetCall) Return added in v1.4.0

func (c *MockcoinGetCall) Return(arg0 bool, arg1 error) *MockcoinGetCall

Return rewrite *gomock.Call.Return

type MockcoinHandleProposalCall added in v1.4.0

type MockcoinHandleProposalCall struct {
	*gomock.Call
}

MockcoinHandleProposalCall wrap *gomock.Call

func (*MockcoinHandleProposalCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockcoinHandleProposalCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockcoinHandleProposalCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockcoinMockRecorder

type MockcoinMockRecorder struct {
	// contains filtered or unexported fields
}

MockcoinMockRecorder is the mock recorder for Mockcoin.

func (*MockcoinMockRecorder) FinishEpoch

func (mr *MockcoinMockRecorder) FinishEpoch(arg0, arg1 any) *MockcoinFinishEpochCall

FinishEpoch indicates an expected call of FinishEpoch.

func (*MockcoinMockRecorder) FinishRound

func (mr *MockcoinMockRecorder) FinishRound(arg0 any) *MockcoinFinishRoundCall

FinishRound indicates an expected call of FinishRound.

func (*MockcoinMockRecorder) Get

func (mr *MockcoinMockRecorder) Get(arg0, arg1, arg2 any) *MockcoinGetCall

Get indicates an expected call of Get.

func (*MockcoinMockRecorder) HandleProposal

func (mr *MockcoinMockRecorder) HandleProposal(arg0, arg1, arg2 any) *MockcoinHandleProposalCall

HandleProposal indicates an expected call of HandleProposal.

func (*MockcoinMockRecorder) StartEpoch

func (mr *MockcoinMockRecorder) StartEpoch(arg0, arg1 any) *MockcoinStartEpochCall

StartEpoch indicates an expected call of StartEpoch.

func (*MockcoinMockRecorder) StartRound

func (mr *MockcoinMockRecorder) StartRound(arg0, arg1, arg2 any) *MockcoinStartRoundCall

StartRound indicates an expected call of StartRound.

type MockcoinStartEpochCall added in v1.4.0

type MockcoinStartEpochCall struct {
	*gomock.Call
}

MockcoinStartEpochCall wrap *gomock.Call

func (*MockcoinStartEpochCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockcoinStartEpochCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockcoinStartEpochCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockcoinStartRoundCall added in v1.4.0

type MockcoinStartRoundCall struct {
	*gomock.Call
}

MockcoinStartRoundCall wrap *gomock.Call

func (*MockcoinStartRoundCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockcoinStartRoundCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockcoinStartRoundCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockeligibilityChecker

type MockeligibilityChecker struct {
	// contains filtered or unexported fields
}

MockeligibilityChecker is a mock of eligibilityChecker interface.

func NewMockeligibilityChecker

func NewMockeligibilityChecker(ctrl *gomock.Controller) *MockeligibilityChecker

NewMockeligibilityChecker creates a new mock instance.

func (*MockeligibilityChecker) EXPECT

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

func (*MockeligibilityChecker) PassStrictThreshold

func (m *MockeligibilityChecker) PassStrictThreshold(arg0 types.VrfSignature) bool

PassStrictThreshold mocks base method.

func (*MockeligibilityChecker) PassThreshold

func (m *MockeligibilityChecker) PassThreshold(arg0 types.VrfSignature) bool

PassThreshold mocks base method.

type MockeligibilityCheckerMockRecorder

type MockeligibilityCheckerMockRecorder struct {
	// contains filtered or unexported fields
}

MockeligibilityCheckerMockRecorder is the mock recorder for MockeligibilityChecker.

func (*MockeligibilityCheckerMockRecorder) PassStrictThreshold

PassStrictThreshold indicates an expected call of PassStrictThreshold.

func (*MockeligibilityCheckerMockRecorder) PassThreshold

PassThreshold indicates an expected call of PassThreshold.

type MockeligibilityCheckerPassStrictThresholdCall added in v1.4.0

type MockeligibilityCheckerPassStrictThresholdCall struct {
	*gomock.Call
}

MockeligibilityCheckerPassStrictThresholdCall wrap *gomock.Call

func (*MockeligibilityCheckerPassStrictThresholdCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockeligibilityCheckerPassStrictThresholdCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockeligibilityCheckerPassStrictThresholdCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockeligibilityCheckerPassThresholdCall added in v1.4.0

type MockeligibilityCheckerPassThresholdCall struct {
	*gomock.Call
}

MockeligibilityCheckerPassThresholdCall wrap *gomock.Call

func (*MockeligibilityCheckerPassThresholdCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockeligibilityCheckerPassThresholdCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockeligibilityCheckerPassThresholdCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MocklayerClock

type MocklayerClock struct {
	// contains filtered or unexported fields
}

MocklayerClock is a mock of layerClock interface.

func NewMocklayerClock

func NewMocklayerClock(ctrl *gomock.Controller) *MocklayerClock

NewMocklayerClock creates a new mock instance.

func (*MocklayerClock) AwaitLayer

func (m *MocklayerClock) AwaitLayer(arg0 types.LayerID) <-chan struct{}

AwaitLayer mocks base method.

func (*MocklayerClock) CurrentLayer

func (m *MocklayerClock) CurrentLayer() types.LayerID

CurrentLayer mocks base method.

func (*MocklayerClock) EXPECT

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

func (*MocklayerClock) LayerToTime

func (m *MocklayerClock) LayerToTime(arg0 types.LayerID) time.Time

LayerToTime mocks base method.

type MocklayerClockAwaitLayerCall added in v1.4.0

type MocklayerClockAwaitLayerCall struct {
	*gomock.Call
}

MocklayerClockAwaitLayerCall wrap *gomock.Call

func (*MocklayerClockAwaitLayerCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MocklayerClockAwaitLayerCall) DoAndReturn added in v1.4.0

func (c *MocklayerClockAwaitLayerCall) DoAndReturn(f func(types.LayerID) <-chan struct{}) *MocklayerClockAwaitLayerCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MocklayerClockAwaitLayerCall) Return added in v1.4.0

func (c *MocklayerClockAwaitLayerCall) Return(arg0 <-chan struct{}) *MocklayerClockAwaitLayerCall

Return rewrite *gomock.Call.Return

type MocklayerClockCurrentLayerCall added in v1.4.0

type MocklayerClockCurrentLayerCall struct {
	*gomock.Call
}

MocklayerClockCurrentLayerCall wrap *gomock.Call

func (*MocklayerClockCurrentLayerCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MocklayerClockCurrentLayerCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MocklayerClockCurrentLayerCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MocklayerClockLayerToTimeCall added in v1.4.0

type MocklayerClockLayerToTimeCall struct {
	*gomock.Call
}

MocklayerClockLayerToTimeCall wrap *gomock.Call

func (*MocklayerClockLayerToTimeCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MocklayerClockLayerToTimeCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MocklayerClockLayerToTimeCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MocklayerClockMockRecorder

type MocklayerClockMockRecorder struct {
	// contains filtered or unexported fields
}

MocklayerClockMockRecorder is the mock recorder for MocklayerClock.

func (*MocklayerClockMockRecorder) AwaitLayer

AwaitLayer indicates an expected call of AwaitLayer.

func (*MocklayerClockMockRecorder) CurrentLayer

CurrentLayer indicates an expected call of CurrentLayer.

func (*MocklayerClockMockRecorder) LayerToTime

LayerToTime indicates an expected call of LayerToTime.

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

VRFNonce indicates an expected call of VRFNonce.

type MocknonceFetcherVRFNonceCall added in v1.4.0

type MocknonceFetcherVRFNonceCall struct {
	*gomock.Call
}

MocknonceFetcherVRFNonceCall wrap *gomock.Call

func (*MocknonceFetcherVRFNonceCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MocknonceFetcherVRFNonceCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MocknonceFetcherVRFNonceCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockvrfSigner

type MockvrfSigner struct {
	// contains filtered or unexported fields
}

MockvrfSigner is a mock of vrfSigner interface.

func NewMockvrfSigner

func NewMockvrfSigner(ctrl *gomock.Controller) *MockvrfSigner

NewMockvrfSigner creates a new mock instance.

func (*MockvrfSigner) EXPECT

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

func (*MockvrfSigner) NodeID

func (m *MockvrfSigner) NodeID() types.NodeID

NodeID mocks base method.

func (*MockvrfSigner) Sign

func (m *MockvrfSigner) Sign(msg []byte) types.VrfSignature

Sign mocks base method.

type MockvrfSignerMockRecorder

type MockvrfSignerMockRecorder struct {
	// contains filtered or unexported fields
}

MockvrfSignerMockRecorder is the mock recorder for MockvrfSigner.

func (*MockvrfSignerMockRecorder) NodeID

NodeID indicates an expected call of NodeID.

func (*MockvrfSignerMockRecorder) Sign

Sign indicates an expected call of Sign.

type MockvrfSignerNodeIDCall added in v1.4.0

type MockvrfSignerNodeIDCall struct {
	*gomock.Call
}

MockvrfSignerNodeIDCall wrap *gomock.Call

func (*MockvrfSignerNodeIDCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockvrfSignerNodeIDCall) DoAndReturn added in v1.4.0

func (c *MockvrfSignerNodeIDCall) DoAndReturn(f func() types.NodeID) *MockvrfSignerNodeIDCall

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockvrfSignerNodeIDCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockvrfSignerSignCall added in v1.4.0

type MockvrfSignerSignCall struct {
	*gomock.Call
}

MockvrfSignerSignCall wrap *gomock.Call

func (*MockvrfSignerSignCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockvrfSignerSignCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockvrfSignerSignCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type MockvrfVerifier

type MockvrfVerifier struct {
	// contains filtered or unexported fields
}

MockvrfVerifier is a mock of vrfVerifier interface.

func NewMockvrfVerifier

func NewMockvrfVerifier(ctrl *gomock.Controller) *MockvrfVerifier

NewMockvrfVerifier creates a new mock instance.

func (*MockvrfVerifier) EXPECT

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

func (*MockvrfVerifier) Verify

func (m *MockvrfVerifier) Verify(nodeID types.NodeID, msg []byte, sig types.VrfSignature) bool

Verify mocks base method.

type MockvrfVerifierMockRecorder

type MockvrfVerifierMockRecorder struct {
	// contains filtered or unexported fields
}

MockvrfVerifierMockRecorder is the mock recorder for MockvrfVerifier.

func (*MockvrfVerifierMockRecorder) Verify

func (mr *MockvrfVerifierMockRecorder) Verify(nodeID, msg, sig any) *MockvrfVerifierVerifyCall

Verify indicates an expected call of Verify.

type MockvrfVerifierVerifyCall added in v1.4.0

type MockvrfVerifierVerifyCall struct {
	*gomock.Call
}

MockvrfVerifierVerifyCall wrap *gomock.Call

func (*MockvrfVerifierVerifyCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MockvrfVerifierVerifyCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockvrfVerifierVerifyCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

type Opt

type Opt func(*ProtocolDriver)

Opt for configuring beacon protocol.

func WithConfig

func WithConfig(cfg Config) Opt

WithConfig defines protocol parameters.

func WithLogger

func WithLogger(logger log.Log) Opt

WithLogger defines logger for beacon.

type Proposal

type Proposal [types.BeaconSize]byte

func ProposalFromVrf

func ProposalFromVrf(vrf types.VrfSignature) Proposal

func (*Proposal) DecodeScale

func (p *Proposal) DecodeScale(d *scale.Decoder) (int, error)

DecodeScale implements scale codec interface.

func (*Proposal) EncodeScale

func (p *Proposal) EncodeScale(e *scale.Encoder) (int, error)

EncodeScale implements scale codec interface.

func (Proposal) MarshalLogObject added in v1.2.2

func (p Proposal) MarshalLogObject(enc zapcore.ObjectEncoder) error

type ProposalMessage

type ProposalMessage struct {
	EpochID      types.EpochID
	NodeID       types.NodeID
	VRFSignature types.VrfSignature
}

ProposalMessage is a message type which is used when sending proposals.

func (*ProposalMessage) DecodeScale

func (t *ProposalMessage) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*ProposalMessage) EncodeScale

func (t *ProposalMessage) EncodeScale(enc *scale.Encoder) (total int, err error)

type ProposalVrfMessage

type ProposalVrfMessage struct {
	Type  types.EligibilityType // always types.EligibilityBeacon
	Nonce types.VRFPostIndex
	Epoch types.EpochID
}

ProposalVrfMessage is the payload for the VRF Signature in `ProposalMessage`.

func (*ProposalVrfMessage) DecodeScale

func (t *ProposalVrfMessage) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*ProposalVrfMessage) EncodeScale

func (t *ProposalVrfMessage) EncodeScale(enc *scale.Encoder) (total int, err error)

type ProtocolDriver

type ProtocolDriver struct {
	// contains filtered or unexported fields
}

ProtocolDriver is the driver for the beacon protocol.

func New

func New(
	publisher pubsub.Publisher,
	edVerifier *signing.EdVerifier,
	vrfVerifier vrfVerifier,
	cdb *datastore.CachedDB,
	clock layerClock,
	opts ...Opt,
) *ProtocolDriver

New returns a new ProtocolDriver.

func (*ProtocolDriver) Close

func (pd *ProtocolDriver) Close()

Close closes ProtocolDriver.

func (*ProtocolDriver) GetBeacon

func (pd *ProtocolDriver) GetBeacon(targetEpoch types.EpochID) (types.Beacon, error)

GetBeacon returns the beacon for the specified epoch or an error if it doesn't exist.

func (*ProtocolDriver) HandleFirstVotes

func (pd *ProtocolDriver) HandleFirstVotes(ctx context.Context, peer p2p.Peer, msg []byte) error

HandleFirstVotes handles beacon first votes from gossip.

func (*ProtocolDriver) HandleFollowingVotes

func (pd *ProtocolDriver) HandleFollowingVotes(ctx context.Context, peer p2p.Peer, msg []byte) error

HandleFollowingVotes handles beacon following votes from gossip.

func (*ProtocolDriver) HandleProposal

func (pd *ProtocolDriver) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) error

HandleProposal handles beacon proposal from gossip.

func (*ProtocolDriver) HandleWeakCoinProposal

func (pd *ProtocolDriver) HandleWeakCoinProposal(ctx context.Context, peer p2p.Peer, msg []byte) (err error)

HandleWeakCoinProposal handles weakcoin proposal from gossip.

func (*ProtocolDriver) MinerAllowance

func (pd *ProtocolDriver) MinerAllowance(epoch types.EpochID, nodeID types.NodeID) uint32

func (*ProtocolDriver) OnAtx

func (pd *ProtocolDriver) OnAtx(atx *types.ActivationTxHeader)

func (*ProtocolDriver) Register added in v1.3.0

func (pd *ProtocolDriver) Register(sig *signing.EdSigner)

func (*ProtocolDriver) ReportBeaconFromBallot

func (pd *ProtocolDriver) ReportBeaconFromBallot(
	epoch types.EpochID,
	ballot *types.Ballot,
	beacon types.Beacon,
	weightPer fixed.Fixed,
)

ReportBeaconFromBallot reports the beacon value in a ballot along with the smesher's weight unit.

func (*ProtocolDriver) Results

func (pd *ProtocolDriver) Results() <-chan result.Beacon

Results notifies waiter that beacon for a target epoch has completed.

func (*ProtocolDriver) SetSyncState

func (pd *ProtocolDriver) SetSyncState(sync system.SyncStateProvider)

SetSyncState updates sync state provider. Must be executed only once.

func (*ProtocolDriver) Start

func (pd *ProtocolDriver) Start(ctx context.Context)

Start starts listening for layers and outputs.

func (*ProtocolDriver) UpdateBeacon

func (pd *ProtocolDriver) UpdateBeacon(epoch types.EpochID, beacon types.Beacon) error

Directories

Path Synopsis
Package weakcoin is a generated GoMock package.
Package weakcoin is a generated GoMock package.

Jump to

Keyboard shortcuts

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