-
Notifications
You must be signed in to change notification settings - Fork 4
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
analyzer: damask: Warn about incompatibility with slow-sync #565
Conversation
analyzer/consensus/consensus.go
Outdated
@@ -669,6 +669,13 @@ func (m *processor) queueEscrows(batch *storage.QueryBatch, data *stakingData) e | |||
escrower := e.Escrow.String() | |||
amount := e.Amount.String() | |||
newShares := e.NewShares.String() | |||
if e.NewShares.IsZero() { |
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.
we routinely have a lot of "zero" new shares add ecrow events because that's how staking rewards appear
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.
Huh well spotted. Thank you. I went ahead and made the NewShares field optional in our internal structure; now we can tell whether the node provided the field or not, and only warn for nodes with Cobalt-like API (when the field was actively missing).
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.
can you confirm if staking rewards explicitly have a zero? there's too many layers of go-esque omitempty and 'use nil instead of empty slice' stuff
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.
Yes, they do. Or, to be exact: as you predicted, the old warning that triggered whenever e.NewShares.IsZero()
produced a lot of noise. I assume those 0-shares events came from staking rewards. Regardless, they exist, and the new tweak on the code does not produce those spurious warnings.
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.
thanks
5851ff5
to
127bba5
Compare
127bba5
to
94940f3
Compare
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.
🥲
94940f3
to
698afd9
Compare
Certain old heights cannot be indexed using slow-sync without causing incorrectly dead-reckoned values in the DB.
A more thorough solution would be to separately query the node for the absolute number of shares whenever we encounter an
AddEscrow
withoutnew_shares
. But we're unlikely to really need to support that mode of operation, so let's do the simple thing (= this PR).