Documentation ¶
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeaconNetwork ¶ added in v1.1.0
type OnRoundTimeoutF ¶ added in v1.1.0
type RoundTimer ¶
type RoundTimer struct {
// contains filtered or unexported fields
}
RoundTimer helps to manage current instance rounds.
func New ¶
func New(pctx context.Context, beaconNetwork BeaconNetwork, role spectypes.BeaconRole, done OnRoundTimeoutF) *RoundTimer
New creates a new instance of RoundTimer.
func (*RoundTimer) OnTimeout ¶
func (t *RoundTimer) OnTimeout(done OnRoundTimeoutF)
OnTimeout sets a function called on timeout.
func (*RoundTimer) RoundTimeout ¶ added in v1.1.0
RoundTimeout calculates the timeout duration for a specific role, height, and round.
Timeout Rules: - For roles BNRoleAttester and BNRoleSyncCommittee, the base timeout is 1/3 of the slot duration. - For roles BNRoleAggregator and BNRoleSyncCommitteeContribution, the base timeout is 2/3 of the slot duration. - For role BNRoleProposer, the timeout is either quickTimeout or slowTimeout, depending on the round.
Additional Timeout: - For rounds less than or equal to quickThreshold, the additional timeout is 'quick' seconds. - For rounds greater than quickThreshold, the additional timeout is 'slow' seconds.
SIP Reference: For more details, see SIP at https://github.com/bloxapp/SIPs/pull/22
TODO: Update SIP for Deterministic Round Timeout TODO: Decide if to make the proposer timeout deterministic
Synchronization Note: To ensure synchronized timeouts across instances, the timeout is based on the duty start time, which is calculated from the slot height. The base timeout is set based on the role, and the additional timeout is added based on the round number.
func (*RoundTimer) TimeoutForRound ¶
func (t *RoundTimer) TimeoutForRound(height specqbft.Height, round specqbft.Round)
TimeoutForRound times out for a given round.
type TestQBFTTimer ¶ added in v1.1.0
type TestQBFTTimer struct {
State TimerState
}
func (*TestQBFTTimer) TimeoutForRound ¶ added in v1.1.0
func (t *TestQBFTTimer) TimeoutForRound(height specqbft.Height, round specqbft.Round)
type TimeoutOptions ¶ added in v1.1.0
type TimeoutOptions struct {
// contains filtered or unexported fields
}
type Timer ¶ added in v1.1.0
type Timer interface { // TimeoutForRound will reset running timer if exists and will start a new timer for a specific round TimeoutForRound(height specqbft.Height, round specqbft.Round) }
Timer is an interface for a round timer, calling the UponRoundTimeout when times out
func NewTestingTimer ¶ added in v1.1.0
func NewTestingTimer() Timer