-
Notifications
You must be signed in to change notification settings - Fork 71
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
Conversation
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. |
f8938b3
to
63affef
Compare
120347e
to
4f0976b
Compare
bab82bb
to
c2bef84
Compare
block/initchain.go
Outdated
@@ -22,11 +23,16 @@ | |||
if err != nil { | |||
return err | |||
} | |||
err = m.SetLastSettlementBlockTime(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time Warning
block/state.go
Outdated
@@ -110,6 +111,7 @@ | |||
} | |||
// We update the last results hash with the empty hash, to conform with RFC-6962. | |||
copy(s.LastResultsHash[:], merkle.HashFromByteSlices(nil)) | |||
s.SetLastBlockTime(time.Now()) |
Check warning
Code scanning / CodeQL
Calling the system time Warning
block/produce.go
Outdated
@@ -76,16 +76,16 @@ func (m *Manager) ProduceBlockLoop(ctx context.Context, bytesProducedC chan int) | |||
} | |||
|
|||
bytesProducedN := block.SizeBytes() + commit.SizeBytes() | |||
m.logger.Info("New block.", "size", uint64(block.ToProto().Size())) | |||
m.logger.Info("New block.", "size", bytesProducedN) |
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 would remove the size value
change it to more useful values (height, num of tx)
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 removed this log and added size to the existing block created log in produceblock func
config/config.go
Outdated
// BatchSkew is the number of batches waiting to be submitted. Block production will be paused if this limit is reached. | ||
BatchSkew uint64 `mapstructure:"max_batch_skew"` | ||
// MaxSkewTime is the number of batches waiting to be submitted. Block production will be paused if this limit is reached. | ||
MaxBatchSkewTime time.Duration `mapstructure:"max_skew_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.
MaxBatchSkewTime time.Duration `mapstructure:"max_skew_time"` | |
MaxSkewTime time.Duration `mapstructure:"max_skew_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.
done
block/manager.go
Outdated
@@ -303,20 +310,28 @@ func (m *Manager) updateFromLastSettlementState() error { | |||
// The SL hasn't got any batches for this chain yet. | |||
m.logger.Info("No batches for chain found in SL.") | |||
m.LastSettlementHeight.Store(uint64(m.Genesis.InitialHeight - 1)) | |||
m.SetLastBlockTimeInSettlementFromHeight(uint64(m.Genesis.InitialHeight)) |
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.
m.SetLastBlockTimeInSettlementFromHeight(uint64(m.Genesis.InitialHeight)) | |
m.LastBlockTimeInSettlement.Store(m.Genesis.GenesisTime.UTC().UnixNano()) |
GenesisTime
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.
done
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: