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) error
- func (m *Mockcoin) StartEpoch(arg0 context.Context, arg1 types.EpochID)
- func (m *Mockcoin) StartRound(arg0 context.Context, arg1 types.RoundID, arg2 []weakcoin.Participant)
- type MockcoinFinishEpochCall
- type MockcoinFinishRoundCall
- type MockcoinGetCall
- func (c *MockcoinGetCall) Do(f func(context.Context, types.EpochID, types.RoundID) (bool, error)) *MockcoinGetCall
- func (c *MockcoinGetCall) DoAndReturn(f func(context.Context, types.EpochID, types.RoundID) (bool, error)) *MockcoinGetCall
- func (c *MockcoinGetCall) Return(arg0 bool, arg1 error) *MockcoinGetCall
- type MockcoinHandleProposalCall
- func (c *MockcoinHandleProposalCall) Do(f func(context.Context, p2p.Peer, []byte) error) *MockcoinHandleProposalCall
- func (c *MockcoinHandleProposalCall) DoAndReturn(f func(context.Context, p2p.Peer, []byte) error) *MockcoinHandleProposalCall
- func (c *MockcoinHandleProposalCall) Return(arg0 error) *MockcoinHandleProposalCall
- type MockcoinMockRecorder
- func (mr *MockcoinMockRecorder) FinishEpoch(arg0, arg1 any) *MockcoinFinishEpochCall
- func (mr *MockcoinMockRecorder) FinishRound(arg0 any) *MockcoinFinishRoundCall
- func (mr *MockcoinMockRecorder) Get(arg0, arg1, arg2 any) *MockcoinGetCall
- func (mr *MockcoinMockRecorder) HandleProposal(arg0, arg1, arg2 any) *MockcoinHandleProposalCall
- func (mr *MockcoinMockRecorder) StartEpoch(arg0, arg1 any) *MockcoinStartEpochCall
- func (mr *MockcoinMockRecorder) StartRound(arg0, arg1, arg2 any) *MockcoinStartRoundCall
- type MockcoinStartEpochCall
- type MockcoinStartRoundCall
- func (c *MockcoinStartRoundCall) Do(f func(context.Context, types.RoundID, []weakcoin.Participant)) *MockcoinStartRoundCall
- func (c *MockcoinStartRoundCall) DoAndReturn(f func(context.Context, types.RoundID, []weakcoin.Participant)) *MockcoinStartRoundCall
- func (c *MockcoinStartRoundCall) Return() *MockcoinStartRoundCall
- type MockeligibilityChecker
- type MockeligibilityCheckerMockRecorder
- type MockeligibilityCheckerPassStrictThresholdCall
- func (c *MockeligibilityCheckerPassStrictThresholdCall) Do(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassStrictThresholdCall
- func (c *MockeligibilityCheckerPassStrictThresholdCall) DoAndReturn(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassStrictThresholdCall
- func (c *MockeligibilityCheckerPassStrictThresholdCall) Return(arg0 bool) *MockeligibilityCheckerPassStrictThresholdCall
- type MockeligibilityCheckerPassThresholdCall
- func (c *MockeligibilityCheckerPassThresholdCall) Do(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassThresholdCall
- func (c *MockeligibilityCheckerPassThresholdCall) DoAndReturn(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassThresholdCall
- func (c *MockeligibilityCheckerPassThresholdCall) Return(arg0 bool) *MockeligibilityCheckerPassThresholdCall
- type MocklayerClock
- type MocklayerClockAwaitLayerCall
- func (c *MocklayerClockAwaitLayerCall) Do(f func(types.LayerID) <-chan struct{}) *MocklayerClockAwaitLayerCall
- func (c *MocklayerClockAwaitLayerCall) DoAndReturn(f func(types.LayerID) <-chan struct{}) *MocklayerClockAwaitLayerCall
- func (c *MocklayerClockAwaitLayerCall) Return(arg0 <-chan struct{}) *MocklayerClockAwaitLayerCall
- type MocklayerClockCurrentLayerCall
- func (c *MocklayerClockCurrentLayerCall) Do(f func() types.LayerID) *MocklayerClockCurrentLayerCall
- func (c *MocklayerClockCurrentLayerCall) DoAndReturn(f func() types.LayerID) *MocklayerClockCurrentLayerCall
- func (c *MocklayerClockCurrentLayerCall) Return(arg0 types.LayerID) *MocklayerClockCurrentLayerCall
- type MocklayerClockLayerToTimeCall
- func (c *MocklayerClockLayerToTimeCall) Do(f func(types.LayerID) time.Time) *MocklayerClockLayerToTimeCall
- func (c *MocklayerClockLayerToTimeCall) DoAndReturn(f func(types.LayerID) time.Time) *MocklayerClockLayerToTimeCall
- func (c *MocklayerClockLayerToTimeCall) Return(arg0 time.Time) *MocklayerClockLayerToTimeCall
- type MocklayerClockMockRecorder
- type MocknonceFetcher
- type MocknonceFetcherMockRecorder
- type MocknonceFetcherVRFNonceCall
- func (c *MocknonceFetcherVRFNonceCall) Do(f func(types.NodeID, types.EpochID) (types.VRFPostIndex, error)) *MocknonceFetcherVRFNonceCall
- func (c *MocknonceFetcherVRFNonceCall) DoAndReturn(f func(types.NodeID, types.EpochID) (types.VRFPostIndex, error)) *MocknonceFetcherVRFNonceCall
- func (c *MocknonceFetcherVRFNonceCall) Return(arg0 types.VRFPostIndex, arg1 error) *MocknonceFetcherVRFNonceCall
- type MockvrfSigner
- type MockvrfSignerMockRecorder
- type MockvrfSignerNodeIDCall
- type MockvrfSignerSignCall
- type MockvrfVerifier
- type MockvrfVerifierMockRecorder
- type MockvrfVerifierVerifyCall
- func (c *MockvrfVerifierVerifyCall) Do(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
- func (c *MockvrfVerifierVerifyCall) DoAndReturn(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
- func (c *MockvrfVerifierVerifyCall) Return(arg0 bool) *MockvrfVerifierVerifyCall
- type Opt
- type Proposal
- 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) error
- func (pd *ProtocolDriver) HandleFollowingVotes(ctx context.Context, peer p2p.Peer, msg []byte) error
- func (pd *ProtocolDriver) HandleProposal(ctx context.Context, peer p2p.Peer, msg []byte) error
- func (pd *ProtocolDriver) HandleWeakCoinProposal(ctx context.Context, peer p2p.Peer, msg []byte) (err error)
- func (pd *ProtocolDriver) MinerAllowance(epoch types.EpochID, nodeID types.NodeID) uint32
- func (pd *ProtocolDriver) OnAtx(atx *types.ActivationTxHeader)
- func (pd *ProtocolDriver) Register(s *signing.EdSigner)
- func (pd *ProtocolDriver) ReportBeaconFromBallot(epoch types.EpochID, ballot *types.Ballot, beacon types.Beacon, ...)
- func (pd *ProtocolDriver) Results() <-chan result.Beacon
- func (pd *ProtocolDriver) SetSyncState(sync system.SyncStateProvider)
- func (pd *ProtocolDriver) Start(ctx context.Context)
- func (pd *ProtocolDriver) UpdateBeacon(epoch types.EpochID, beacon types.Beacon) error
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 ¶
FinishEpoch mocks base method.
func (*Mockcoin) FinishRound ¶
FinishRound mocks base method.
func (*Mockcoin) HandleProposal ¶
HandleProposal mocks base method.
func (*Mockcoin) StartEpoch ¶
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
MockcoinFinishEpochCall wrap *gomock.Call
func (*MockcoinFinishEpochCall) Do ¶ added in v1.4.0
func (c *MockcoinFinishEpochCall) Do(f func(context.Context, types.EpochID)) *MockcoinFinishEpochCall
Do rewrite *gomock.Call.Do
func (*MockcoinFinishEpochCall) DoAndReturn ¶ added in v1.4.0
func (c *MockcoinFinishEpochCall) DoAndReturn(f func(context.Context, types.EpochID)) *MockcoinFinishEpochCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockcoinFinishEpochCall) Return ¶ added in v1.4.0
func (c *MockcoinFinishEpochCall) Return() *MockcoinFinishEpochCall
Return rewrite *gomock.Call.Return
type MockcoinFinishRoundCall ¶ added in v1.4.0
MockcoinFinishRoundCall wrap *gomock.Call
func (*MockcoinFinishRoundCall) Do ¶ added in v1.4.0
func (c *MockcoinFinishRoundCall) Do(f func(context.Context)) *MockcoinFinishRoundCall
Do rewrite *gomock.Call.Do
func (*MockcoinFinishRoundCall) DoAndReturn ¶ added in v1.4.0
func (c *MockcoinFinishRoundCall) DoAndReturn(f func(context.Context)) *MockcoinFinishRoundCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockcoinFinishRoundCall) Return ¶ added in v1.4.0
func (c *MockcoinFinishRoundCall) Return() *MockcoinFinishRoundCall
Return rewrite *gomock.Call.Return
type MockcoinGetCall ¶ added in v1.4.0
MockcoinGetCall wrap *gomock.Call
func (*MockcoinGetCall) Do ¶ added in v1.4.0
func (c *MockcoinGetCall) Do(f func(context.Context, types.EpochID, types.RoundID) (bool, error)) *MockcoinGetCall
Do rewrite *gomock.Call.Do
func (*MockcoinGetCall) DoAndReturn ¶ added in v1.4.0
func (c *MockcoinGetCall) DoAndReturn(f func(context.Context, types.EpochID, types.RoundID) (bool, error)) *MockcoinGetCall
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
MockcoinHandleProposalCall wrap *gomock.Call
func (*MockcoinHandleProposalCall) Do ¶ added in v1.4.0
func (c *MockcoinHandleProposalCall) Do(f func(context.Context, p2p.Peer, []byte) error) *MockcoinHandleProposalCall
Do rewrite *gomock.Call.Do
func (*MockcoinHandleProposalCall) DoAndReturn ¶ added in v1.4.0
func (c *MockcoinHandleProposalCall) DoAndReturn(f func(context.Context, p2p.Peer, []byte) error) *MockcoinHandleProposalCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockcoinHandleProposalCall) Return ¶ added in v1.4.0
func (c *MockcoinHandleProposalCall) Return(arg0 error) *MockcoinHandleProposalCall
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
MockcoinStartEpochCall wrap *gomock.Call
func (*MockcoinStartEpochCall) Do ¶ added in v1.4.0
func (c *MockcoinStartEpochCall) Do(f func(context.Context, types.EpochID)) *MockcoinStartEpochCall
Do rewrite *gomock.Call.Do
func (*MockcoinStartEpochCall) DoAndReturn ¶ added in v1.4.0
func (c *MockcoinStartEpochCall) DoAndReturn(f func(context.Context, types.EpochID)) *MockcoinStartEpochCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockcoinStartEpochCall) Return ¶ added in v1.4.0
func (c *MockcoinStartEpochCall) Return() *MockcoinStartEpochCall
Return rewrite *gomock.Call.Return
type MockcoinStartRoundCall ¶ added in v1.4.0
MockcoinStartRoundCall wrap *gomock.Call
func (*MockcoinStartRoundCall) Do ¶ added in v1.4.0
func (c *MockcoinStartRoundCall) Do(f func(context.Context, types.RoundID, []weakcoin.Participant)) *MockcoinStartRoundCall
Do rewrite *gomock.Call.Do
func (*MockcoinStartRoundCall) DoAndReturn ¶ added in v1.4.0
func (c *MockcoinStartRoundCall) DoAndReturn(f func(context.Context, types.RoundID, []weakcoin.Participant)) *MockcoinStartRoundCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockcoinStartRoundCall) Return ¶ added in v1.4.0
func (c *MockcoinStartRoundCall) Return() *MockcoinStartRoundCall
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 ¶
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 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 ¶
func (mr *MockeligibilityCheckerMockRecorder) PassStrictThreshold(arg0 any) *MockeligibilityCheckerPassStrictThresholdCall
PassStrictThreshold indicates an expected call of PassStrictThreshold.
func (*MockeligibilityCheckerMockRecorder) PassThreshold ¶
func (mr *MockeligibilityCheckerMockRecorder) PassThreshold(arg0 any) *MockeligibilityCheckerPassThresholdCall
PassThreshold indicates an expected call of PassThreshold.
type MockeligibilityCheckerPassStrictThresholdCall ¶ added in v1.4.0
MockeligibilityCheckerPassStrictThresholdCall wrap *gomock.Call
func (*MockeligibilityCheckerPassStrictThresholdCall) Do ¶ added in v1.4.0
func (c *MockeligibilityCheckerPassStrictThresholdCall) Do(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassStrictThresholdCall
Do rewrite *gomock.Call.Do
func (*MockeligibilityCheckerPassStrictThresholdCall) DoAndReturn ¶ added in v1.4.0
func (c *MockeligibilityCheckerPassStrictThresholdCall) DoAndReturn(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassStrictThresholdCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockeligibilityCheckerPassStrictThresholdCall) Return ¶ added in v1.4.0
func (c *MockeligibilityCheckerPassStrictThresholdCall) Return(arg0 bool) *MockeligibilityCheckerPassStrictThresholdCall
Return rewrite *gomock.Call.Return
type MockeligibilityCheckerPassThresholdCall ¶ added in v1.4.0
MockeligibilityCheckerPassThresholdCall wrap *gomock.Call
func (*MockeligibilityCheckerPassThresholdCall) Do ¶ added in v1.4.0
func (c *MockeligibilityCheckerPassThresholdCall) Do(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassThresholdCall
Do rewrite *gomock.Call.Do
func (*MockeligibilityCheckerPassThresholdCall) DoAndReturn ¶ added in v1.4.0
func (c *MockeligibilityCheckerPassThresholdCall) DoAndReturn(f func(types.VrfSignature) bool) *MockeligibilityCheckerPassThresholdCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockeligibilityCheckerPassThresholdCall) Return ¶ added in v1.4.0
func (c *MockeligibilityCheckerPassThresholdCall) Return(arg0 bool) *MockeligibilityCheckerPassThresholdCall
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 ¶
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 MocklayerClockAwaitLayerCall ¶ added in v1.4.0
MocklayerClockAwaitLayerCall wrap *gomock.Call
func (*MocklayerClockAwaitLayerCall) Do ¶ added in v1.4.0
func (c *MocklayerClockAwaitLayerCall) Do(f func(types.LayerID) <-chan struct{}) *MocklayerClockAwaitLayerCall
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
MocklayerClockCurrentLayerCall wrap *gomock.Call
func (*MocklayerClockCurrentLayerCall) Do ¶ added in v1.4.0
func (c *MocklayerClockCurrentLayerCall) Do(f func() types.LayerID) *MocklayerClockCurrentLayerCall
Do rewrite *gomock.Call.Do
func (*MocklayerClockCurrentLayerCall) DoAndReturn ¶ added in v1.4.0
func (c *MocklayerClockCurrentLayerCall) DoAndReturn(f func() types.LayerID) *MocklayerClockCurrentLayerCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MocklayerClockCurrentLayerCall) Return ¶ added in v1.4.0
func (c *MocklayerClockCurrentLayerCall) Return(arg0 types.LayerID) *MocklayerClockCurrentLayerCall
Return rewrite *gomock.Call.Return
type MocklayerClockLayerToTimeCall ¶ added in v1.4.0
MocklayerClockLayerToTimeCall wrap *gomock.Call
func (*MocklayerClockLayerToTimeCall) Do ¶ added in v1.4.0
func (c *MocklayerClockLayerToTimeCall) Do(f func(types.LayerID) time.Time) *MocklayerClockLayerToTimeCall
Do rewrite *gomock.Call.Do
func (*MocklayerClockLayerToTimeCall) DoAndReturn ¶ added in v1.4.0
func (c *MocklayerClockLayerToTimeCall) DoAndReturn(f func(types.LayerID) time.Time) *MocklayerClockLayerToTimeCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MocklayerClockLayerToTimeCall) Return ¶ added in v1.4.0
func (c *MocklayerClockLayerToTimeCall) Return(arg0 time.Time) *MocklayerClockLayerToTimeCall
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 ¶
func (mr *MocklayerClockMockRecorder) AwaitLayer(arg0 any) *MocklayerClockAwaitLayerCall
AwaitLayer indicates an expected call of AwaitLayer.
func (*MocklayerClockMockRecorder) CurrentLayer ¶
func (mr *MocklayerClockMockRecorder) CurrentLayer() *MocklayerClockCurrentLayerCall
CurrentLayer indicates an expected call of CurrentLayer.
func (*MocklayerClockMockRecorder) LayerToTime ¶
func (mr *MocklayerClockMockRecorder) LayerToTime(arg0 any) *MocklayerClockLayerToTimeCall
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 any) *MocknonceFetcherVRFNonceCall
VRFNonce indicates an expected call of VRFNonce.
type MocknonceFetcherVRFNonceCall ¶ added in v1.4.0
MocknonceFetcherVRFNonceCall wrap *gomock.Call
func (*MocknonceFetcherVRFNonceCall) Do ¶ added in v1.4.0
func (c *MocknonceFetcherVRFNonceCall) Do(f func(types.NodeID, types.EpochID) (types.VRFPostIndex, error)) *MocknonceFetcherVRFNonceCall
Do rewrite *gomock.Call.Do
func (*MocknonceFetcherVRFNonceCall) DoAndReturn ¶ added in v1.4.0
func (c *MocknonceFetcherVRFNonceCall) DoAndReturn(f func(types.NodeID, types.EpochID) (types.VRFPostIndex, error)) *MocknonceFetcherVRFNonceCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MocknonceFetcherVRFNonceCall) Return ¶ added in v1.4.0
func (c *MocknonceFetcherVRFNonceCall) Return(arg0 types.VRFPostIndex, arg1 error) *MocknonceFetcherVRFNonceCall
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 ¶
func (m *MockvrfSigner) EXPECT() *MockvrfSignerMockRecorder
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 ¶
func (mr *MockvrfSignerMockRecorder) NodeID() *MockvrfSignerNodeIDCall
NodeID indicates an expected call of NodeID.
func (*MockvrfSignerMockRecorder) Sign ¶
func (mr *MockvrfSignerMockRecorder) Sign(msg any) *MockvrfSignerSignCall
Sign indicates an expected call of Sign.
type MockvrfSignerNodeIDCall ¶ added in v1.4.0
MockvrfSignerNodeIDCall wrap *gomock.Call
func (*MockvrfSignerNodeIDCall) Do ¶ added in v1.4.0
func (c *MockvrfSignerNodeIDCall) Do(f func() types.NodeID) *MockvrfSignerNodeIDCall
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
func (c *MockvrfSignerNodeIDCall) Return(arg0 types.NodeID) *MockvrfSignerNodeIDCall
Return rewrite *gomock.Call.Return
type MockvrfSignerSignCall ¶ added in v1.4.0
MockvrfSignerSignCall wrap *gomock.Call
func (*MockvrfSignerSignCall) Do ¶ added in v1.4.0
func (c *MockvrfSignerSignCall) Do(f func([]byte) types.VrfSignature) *MockvrfSignerSignCall
Do rewrite *gomock.Call.Do
func (*MockvrfSignerSignCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvrfSignerSignCall) DoAndReturn(f func([]byte) types.VrfSignature) *MockvrfSignerSignCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvrfSignerSignCall) Return ¶ added in v1.4.0
func (c *MockvrfSignerSignCall) Return(arg0 types.VrfSignature) *MockvrfSignerSignCall
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 ¶
func (m *MockvrfVerifier) EXPECT() *MockvrfVerifierMockRecorder
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
MockvrfVerifierVerifyCall wrap *gomock.Call
func (*MockvrfVerifierVerifyCall) Do ¶ added in v1.4.0
func (c *MockvrfVerifierVerifyCall) Do(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
Do rewrite *gomock.Call.Do
func (*MockvrfVerifierVerifyCall) DoAndReturn ¶ added in v1.4.0
func (c *MockvrfVerifierVerifyCall) DoAndReturn(f func(types.NodeID, []byte, types.VrfSignature) bool) *MockvrfVerifierVerifyCall
DoAndReturn rewrite *gomock.Call.DoAndReturn
func (*MockvrfVerifierVerifyCall) Return ¶ added in v1.4.0
func (c *MockvrfVerifierVerifyCall) Return(arg0 bool) *MockvrfVerifierVerifyCall
Return rewrite *gomock.Call.Return
type Opt ¶
type Opt func(*ProtocolDriver)
Opt for configuring beacon protocol.
func WithContext ¶
WithContext defines context for beacon.
type Proposal ¶
type Proposal [types.BeaconSize]byte
func ProposalFromVrf ¶
func ProposalFromVrf(vrf types.VrfSignature) Proposal
func (*Proposal) DecodeScale ¶
DecodeScale implements scale codec interface.
func (*Proposal) EncodeScale ¶
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) GetBeacon ¶
GetBeacon returns the beacon for the specified epoch or an error if it doesn't exist.
func (*ProtocolDriver) HandleFirstVotes ¶
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 ¶
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 (*ProtocolDriver) OnAtx ¶
func (pd *ProtocolDriver) OnAtx(atx *types.ActivationTxHeader)
func (*ProtocolDriver) Register ¶ added in v1.3.0
func (pd *ProtocolDriver) Register(s *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.