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

analyzer: damask: Warn about incompatibility with slow-sync #565

Merged
merged 2 commits into from
Nov 28, 2023

Conversation

mitjat
Copy link
Contributor

@mitjat mitjat commented Nov 10, 2023

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 without new_shares. But we're unlikely to really need to support that mode of operation, so let's do the simple thing (= this PR).

@@ -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() {
Copy link
Collaborator

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

Copy link
Contributor Author

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).

Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks

@mitjat mitjat force-pushed the mitjat/warn-absent-new-shares branch from 5851ff5 to 127bba5 Compare November 21, 2023 22:45
@mitjat mitjat requested a review from pro-wh November 21, 2023 22:45
@mitjat mitjat force-pushed the mitjat/warn-absent-new-shares branch from 127bba5 to 94940f3 Compare November 21, 2023 23:09
Copy link
Collaborator

@pro-wh pro-wh left a comment

Choose a reason for hiding this comment

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

🥲

@mitjat mitjat force-pushed the mitjat/warn-absent-new-shares branch from 94940f3 to 698afd9 Compare November 28, 2023 22:50
@mitjat mitjat enabled auto-merge November 28, 2023 22:50
@mitjat mitjat merged commit 6b2fe2e into main Nov 28, 2023
@mitjat mitjat deleted the mitjat/warn-absent-new-shares branch November 28, 2023 22:54
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.

2 participants