Documentation ¶
Overview ¶
nolint
Package beacon is a generated GoMock package.
Index ¶
- type Config
- type FirstVotingMessage
- type FirstVotingMessageBody
- type FollowingVotingMessage
- type FollowingVotingMessageBody
- type Mockcoin
- func (m *Mockcoin) EXPECT() *MockcoinMockRecorder
- func (m *Mockcoin) FinishEpoch(arg0 context.Context, arg1 types.EpochID)
- func (m *Mockcoin) FinishRound(arg0 context.Context)
- func (m *Mockcoin) Get(arg0 context.Context, arg1 types.EpochID, arg2 types.RoundID) (bool, error)
- func (m *Mockcoin) HandleProposal(arg0 context.Context, arg1 p2p.Peer, arg2 []byte) pubsub.ValidationResult
- func (m *Mockcoin) StartEpoch(arg0 context.Context, arg1 types.EpochID)
- func (m *Mockcoin) StartRound(arg0 context.Context, arg1 types.RoundID, arg2 *types.VRFPostIndex)
- type MockcoinMockRecorder
- func (mr *MockcoinMockRecorder) FinishEpoch(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockcoinMockRecorder) FinishRound(arg0 interface{}) *gomock.Call
- func (mr *MockcoinMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockcoinMockRecorder) HandleProposal(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockcoinMockRecorder) StartEpoch(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockcoinMockRecorder) StartRound(arg0, arg1, arg2 interface{}) *gomock.Call
- type MockeligibilityChecker
- type MockeligibilityCheckerMockRecorder
- type MocklayerClock
- type MocklayerClockMockRecorder
- type MocknonceFetcher
- type MocknonceFetcherMockRecorder
- type MockvrfSigner
- type MockvrfSignerMockRecorder
- type MockvrfVerifier
- type MockvrfVerifierMockRecorder
- type Opt
- type ProposalMessage
- type ProposalVrfMessage
- type ProtocolDriver
- func (pd *ProtocolDriver) Close()
- func (pd *ProtocolDriver) GetBeacon(targetEpoch types.EpochID) (types.Beacon, error)
- func (pd *ProtocolDriver) HandleFirstVotes(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
- func (pd *ProtocolDriver) HandleFollowingVotes(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
- func (pd *ProtocolDriver) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
- func (pd *ProtocolDriver) HandleWeakCoinProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
- func (pd *ProtocolDriver) MinerAllowance(epoch types.EpochID, minerPK []byte) uint32
- func (pd *ProtocolDriver) OnAtx(atx *types.ActivationTxHeader)
- func (pd *ProtocolDriver) ReportBeaconFromBallot(epoch types.EpochID, ballot *types.Ballot, beacon types.Beacon, ...)
- func (pd *ProtocolDriver) SetSyncState(sync system.SyncStateProvider)
- func (pd *ProtocolDriver) Start(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Kappa int `mapstructure:"beacon-kappa"` // Security parameter (for calculating ATX threshold) Q *big.Rat `mapstructure:"beacon-q"` // Ratio of dishonest spacetime (for calculating ATX threshold). It should be a string representing a rational number. RoundsNumber types.RoundID `mapstructure:"beacon-rounds-number"` // Amount of rounds in every epoch GracePeriodDuration time.Duration `mapstructure:"beacon-grace-period-duration"` // Grace period duration ProposalDuration time.Duration `mapstructure:"beacon-proposal-duration"` // Proposal phase duration FirstVotingRoundDuration time.Duration `mapstructure:"beacon-first-voting-round-duration"` // First voting round duration VotingRoundDuration time.Duration `mapstructure:"beacon-voting-round-duration"` // Voting round duration WeakCoinRoundDuration time.Duration `mapstructure:"beacon-weak-coin-round-duration"` // Weak coin round duration Theta *big.Rat `mapstructure:"beacon-theta"` // Ratio of votes for reaching consensus VotesLimit uint32 `mapstructure:"beacon-votes-limit"` // Maximum allowed number of votes to be sent BeaconSyncWeightUnits int `mapstructure:"beacon-sync-weight-units"` // Numbers of layers to wait before determining beacon values from ballots when the node didn't participate in previous epoch. }
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 Signature []byte }
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 ValidProposals [][]byte PotentiallyValidProposals [][]byte }
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 Signature []byte }
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 }
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 ¶
FinishEpoch mocks base method.
func (*Mockcoin) FinishRound ¶
FinishRound mocks base method.
func (*Mockcoin) HandleProposal ¶
func (m *Mockcoin) HandleProposal(arg0 context.Context, arg1 p2p.Peer, arg2 []byte) pubsub.ValidationResult
HandleProposal mocks base method.
func (*Mockcoin) StartEpoch ¶
StartEpoch mocks base method.
func (*Mockcoin) StartRound ¶
StartRound mocks base method.
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 interface{}) *gomock.Call
FinishEpoch indicates an expected call of FinishEpoch.
func (*MockcoinMockRecorder) FinishRound ¶
func (mr *MockcoinMockRecorder) FinishRound(arg0 interface{}) *gomock.Call
FinishRound indicates an expected call of FinishRound.
func (*MockcoinMockRecorder) Get ¶
func (mr *MockcoinMockRecorder) Get(arg0, arg1, arg2 interface{}) *gomock.Call
Get indicates an expected call of Get.
func (*MockcoinMockRecorder) HandleProposal ¶
func (mr *MockcoinMockRecorder) HandleProposal(arg0, arg1, arg2 interface{}) *gomock.Call
HandleProposal indicates an expected call of HandleProposal.
func (*MockcoinMockRecorder) StartEpoch ¶
func (mr *MockcoinMockRecorder) StartEpoch(arg0, arg1 interface{}) *gomock.Call
StartEpoch indicates an expected call of StartEpoch.
func (*MockcoinMockRecorder) StartRound ¶
func (mr *MockcoinMockRecorder) StartRound(arg0, arg1, arg2 interface{}) *gomock.Call
StartRound indicates an expected call of StartRound.
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 ¶
func (m *MockeligibilityChecker) EXPECT() *MockeligibilityCheckerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockeligibilityChecker) PassStrictThreshold ¶
func (m *MockeligibilityChecker) PassStrictThreshold(arg0 []byte) bool
PassStrictThreshold mocks base method.
func (*MockeligibilityChecker) PassThreshold ¶
func (m *MockeligibilityChecker) PassThreshold(arg0 []byte) 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 ¶
func (mr *MockeligibilityCheckerMockRecorder) PassStrictThreshold(arg0 interface{}) *gomock.Call
PassStrictThreshold indicates an expected call of PassStrictThreshold.
func (*MockeligibilityCheckerMockRecorder) PassThreshold ¶
func (mr *MockeligibilityCheckerMockRecorder) PassThreshold(arg0 interface{}) *gomock.Call
PassThreshold indicates an expected call of PassThreshold.
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 ¶
func (m *MocklayerClock) EXPECT() *MocklayerClockMockRecorder
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 MocklayerClockMockRecorder ¶
type MocklayerClockMockRecorder struct {
// contains filtered or unexported fields
}
MocklayerClockMockRecorder is the mock recorder for MocklayerClock.
func (*MocklayerClockMockRecorder) AwaitLayer ¶
func (mr *MocklayerClockMockRecorder) AwaitLayer(arg0 interface{}) *gomock.Call
AwaitLayer indicates an expected call of AwaitLayer.
func (*MocklayerClockMockRecorder) CurrentLayer ¶
func (mr *MocklayerClockMockRecorder) CurrentLayer() *gomock.Call
CurrentLayer indicates an expected call of CurrentLayer.
func (*MocklayerClockMockRecorder) LayerToTime ¶
func (mr *MocklayerClockMockRecorder) LayerToTime(arg0 interface{}) *gomock.Call
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 ¶
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 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 ¶
func (m *MockvrfSigner) EXPECT() *MockvrfSignerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockvrfSigner) LittleEndian ¶
func (m *MockvrfSigner) LittleEndian() bool
LittleEndian mocks base method.
func (*MockvrfSigner) PublicKey ¶
func (m *MockvrfSigner) PublicKey() *signing.PublicKey
PublicKey mocks base method.
func (*MockvrfSigner) Sign ¶
func (m *MockvrfSigner) Sign(msg []byte) []byte
Sign mocks base method.
type MockvrfSignerMockRecorder ¶
type MockvrfSignerMockRecorder struct {
// contains filtered or unexported fields
}
MockvrfSignerMockRecorder is the mock recorder for MockvrfSigner.
func (*MockvrfSignerMockRecorder) LittleEndian ¶
func (mr *MockvrfSignerMockRecorder) LittleEndian() *gomock.Call
LittleEndian indicates an expected call of LittleEndian.
func (*MockvrfSignerMockRecorder) PublicKey ¶
func (mr *MockvrfSignerMockRecorder) PublicKey() *gomock.Call
PublicKey indicates an expected call of PublicKey.
func (*MockvrfSignerMockRecorder) Sign ¶
func (mr *MockvrfSignerMockRecorder) Sign(msg interface{}) *gomock.Call
Sign indicates an expected call of Sign.
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 ¶
func (m *MockvrfVerifier) EXPECT() *MockvrfVerifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
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 interface{}) *gomock.Call
Verify indicates an expected call of Verify.
type Opt ¶
type Opt func(*ProtocolDriver)
Opt for configuring beacon protocol.
func WithContext ¶
WithContext defines context for beacon.
type ProposalMessage ¶
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 Nonce types.VRFPostIndex Epoch types.EpochID }
ProposalVrfMessage is a message for buildProposal below.
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( nodeID types.NodeID, publisher pubsub.Publisher, edSigner *signing.EdSigner, pubKeyExtractor *signing.PubKeyExtractor, vrfSigner vrfSigner, vrfVerifier vrfVerifier, cdb *datastore.CachedDB, clock layerClock, opts ...Opt, ) *ProtocolDriver
New returns a new ProtocolDriver.
func (*ProtocolDriver) GetBeacon ¶
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) pubsub.ValidationResult
HandleFirstVotes handles beacon first votes from gossip.
func (*ProtocolDriver) HandleFollowingVotes ¶
func (pd *ProtocolDriver) HandleFollowingVotes(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
HandleFollowingVotes handles beacon following votes from gossip.
func (*ProtocolDriver) HandleProposal ¶
func (pd *ProtocolDriver) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
HandleProposal handles beacon proposal from gossip.
func (*ProtocolDriver) HandleWeakCoinProposal ¶
func (pd *ProtocolDriver) HandleWeakCoinProposal(ctx context.Context, peer p2p.Peer, msg []byte) pubsub.ValidationResult
HandleWeakCoinProposal handles weakcoin proposal from gossip.
func (*ProtocolDriver) MinerAllowance ¶
func (pd *ProtocolDriver) MinerAllowance(epoch types.EpochID, minerPK []byte) uint32
func (*ProtocolDriver) OnAtx ¶
func (pd *ProtocolDriver) OnAtx(atx *types.ActivationTxHeader)
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) 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.