-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat(manager): max skew based on time instead of batches #1140
base: main
Are you sure you want to change the base?
Conversation
types/state.go
Outdated
func (s *State) GetSkewTime() time.Duration { | ||
if s.LastBlockTime.Before(s.LastSubmittedBlockTime) { | ||
return 0 | ||
} | ||
return s.LastBlockTime.Sub(s.LastSubmittedBlockTime) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's more mathematically correct to just keep the negative here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure im following, why do we want to return a negative gap time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's more mathematically natural, there is no reason to go to zero, it's an unexpected thing to do
block/state.go
Outdated
@@ -112,6 +112,7 @@ func (e *Executor) UpdateStateAfterInitChain(s *types.State, res *abci.ResponseI | |||
} | |||
// We update the last results hash with the empty hash, to conform with RFC-6962. | |||
copy(s.LastResultsHash[:], merkle.HashFromByteSlices(nil)) | |||
s.LastSubmittedBlockTime = time.Now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure I understand this, why it happens after init chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its a way to initialize the LastSubmittedBlockTime to measure the gap between produced and submitted. this way the gap can be still measured when there is no submitted batch yet...
@@ -110,6 +111,8 @@ | |||
} | |||
// We update the last results hash with the empty hash, to conform with RFC-6962. | |||
copy(s.LastResultsHash[:], merkle.HashFromByteSlices(nil)) | |||
|
|||
s.SetLastSubmittedBlockTime(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time Warning
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1140 +/- ##
==========================================
- Coverage 19.54% 17.03% -2.51%
==========================================
Files 165 174 +9
Lines 41268 51520 +10252
==========================================
+ Hits 8065 8776 +711
- Misses 32034 41366 +9332
- Partials 1169 1378 +209 ☔ View full report in Codecov by Sentry. |
PR Standards
This PR substitutes the max batch skew calculation, and instead of pausing block production after N unsubmitted batches (Config parameter), it pauses block production when the gap between the last submitted block and the last produced bock is higher than a config value.
Opening a pull request should be able to meet the following requirements
--
PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A
Close #1139
<-- Briefly describe the content of this pull request -->
For Author:
godoc
commentsFor Reviewer:
After reviewer approval: