Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round change according to duty start time #352

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

GalRogozinski
Copy link
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
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
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 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
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...

Copy link
Contributor

@MatheusFranco99 MatheusFranco99 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +78 to +80
} else {
return slowTimeout
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
} else {
return slowTimeout
}
return slowTimeout

// network is the beacon network
Network types.BeaconNetwork
//current unix epoch time in seconds
CurrentTime int64
Copy link
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
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

// 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)
Copy link
Contributor

@moshe-blox moshe-blox Mar 25, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants