-
Notifications
You must be signed in to change notification settings - Fork 83
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
core/tracker: implement inclusion delay tracker #1468
Conversation
Codecov ReportBase: 54.01% // Head: 53.72% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1468 +/- ##
==========================================
- Coverage 54.01% 53.72% -0.30%
==========================================
Files 147 148 +1
Lines 18683 18751 +68
==========================================
- Hits 10092 10074 -18
- Misses 7217 7297 +80
- Partials 1374 1380 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
core/tracker/incldelay.go
Outdated
"github.com/obolnetwork/charon/core" | ||
) | ||
|
||
// epochLag is the number of epochs to lag when calculating inclusion delay (to ensure finality). |
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.
finality is ensured in atleast 2 epochs, why is the lag equal to 1 ?
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.
updated the comment accordingly
core/tracker/incldelay.go
Outdated
} | ||
|
||
blockSlot := current.Slot - (epochLag * current.SlotsPerEpoch) | ||
if blockSlot < fromSlot { |
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.
add a comment for this condition
core/tracker/incldelay.go
Outdated
// is expected by the network and the slot the attestation is actually included on-chain. | ||
// See https://rated.gitbook.io/rated-documentation/rating-methodologies/ethereum-beacon-chain/network-explorer-definitions/top-screener#inclusion-delay. | ||
func NewInclDelayFunc(eth2Cl eth2wrap.Client, dutiesFunc dutiesFunc) func(context.Context, core.Slot) error { | ||
return newInclDelayFunc(eth2Cl, dutiesFunc, func(delays []int64) { |
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.
nit: this callback function can be written outside as a separate function for better readability
core/tracker/incldelay.go
Outdated
|
||
// newInclDelayFunc extends NewInclDelayFunc with abstracted callback. | ||
func newInclDelayFunc(eth2Cl eth2wrap.Client, dutiesFunc dutiesFunc, callback func([]int64)) func(context.Context, core.Slot) error { | ||
var fromSlot int64 |
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.
suggest: add comment for this variable
Co-authored-by: Abhishek Kumar <43061995+xenowits@users.noreply.github.com>
Implement a function that calculates the clusters inclusion delay for a specific block.
category: feature
ticket: #1254