Skip to content

Round change according to duty start time - #352

Open
GalRogozinski wants to merge 30 commits into
ssvlabs:mainfrom
GalRogozinski:dynamic-roundchange
Open

Round change according to duty start time#352
GalRogozinski wants to merge 30 commits into
ssvlabs:mainfrom
GalRogozinski:dynamic-roundchange

Conversation

@GalRogozinski

Copy link
Copy Markdown
Contributor

Implements ssvlabs/SIPs#37

Changes logic to all duties but proposer

@GalRogozinski
GalRogozinski marked this pull request as ready for review January 21, 2024 13:21
Comment thread qbft/timeout.go
func RoundTimeout(round Round, height Height, baseDuration int64, network types.BeaconNetwork) int64 {
// Calculate additional timeout in seconds based on round
var additionalTimeout int64
additionalTimeout = int64(min(round, quickTimeoutThreshold)) * quickTimeout

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different than impl

Comment thread qbft/timeout.go
Comment on lines +33 to +36
case types.BNRoleAttester, types.BNRoleSyncCommittee:
return max(AttestationOrSyncCommitteeTimeout(round, t.Height, t.Network)-t.CurrentTime, 0)
case types.BNRoleAggregator, types.BNRoleSyncCommitteeContribution:
return max(AggregationOrContributionTimeout(round, t.Height, t.Network)-t.CurrentTime, 0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different than impl

not sure if this can happen even if the system clock is bad...

@MatheusFranco99 MatheusFranco99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread qbft/timeout.go Outdated
Comment thread qbft/timeout.go
// network is the beacon network
Network types.BeaconNetwork
//current unix epoch time in seconds
CurrentTime int64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use time.Time and time.Duration instead of integers, makes it a bit more friendly.

For tests, you can use time.Unix() to create time.Time from an integer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally don't want the spec to rely on go standard lib

Comment thread qbft/timeout.go
slowTimeout int64 = 120 // 2 minutes
// CutoffRound which round the instance should stop its timer and progress no further
CutoffRound = 15 // stop processing instances after 8*2+120*6 = 14.2 min (~ 2 epochs)
CutoffRound = 14 // stop processing instances after 6*2+120*7 = 14.2 min (~ 2 epochs)

@moshe-blox moshe-blox Mar 25, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make the variable cutoff change we discussed here or it wouldn't fit this PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remind me please

Co-authored-by: moshe-blox <89339422+moshe-blox@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to 60 days of inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants