-
Notifications
You must be signed in to change notification settings - Fork 500
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
services/horizon/internal/ingest/processors: Fix bug in claimable balance change processor #5246
services/horizon/internal/ingest/processors: Fix bug in claimable balance change processor #5246
Conversation
Add unit tests for claimable balanace update case
@@ -112,6 +117,12 @@ func (p *ClaimableBalancesChangeProcessor) Commit(ctx context.Context) error { | |||
return errors.Wrap(err, "error executing ClaimableBalanceBatchInsertBuilder") | |||
} | |||
|
|||
if len(updatedBalances) > 0 { | |||
if err = p.qClaimableBalances.UpsertClaimableBalances(ctx, updatedBalances); err != nil { |
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.
Do we also need to restore the BatchInsertBuilder to handle upserts for claimants? Like what happens if new claimants are added? Will we skip adding those to the claimants table?
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.
UpsertClaimableBalances()
will upsert to both the claimable_balances and the claimable_balance_claimants tables
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.
Oh, it seemed to me that UpsertClaimableBalances exclusively inserts to claimable_balances
table
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 updated the function in a later commit:
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
needed with deprecations, added features, breaking changes, and DB schema changes.
semver, or if it's mainly a patch change. The PR is targeted at the next
release branch if it's not a patch change.
What
In #5086 we made some optimizations to the claimable change processor based on the assumption that claimable balances are always created or removed but never updated. It turns out that assumption is incorrect because it's possible for the sponsor of a claimable balance to change. This commit corrects that assumption and allows the change processor to ingest updated claimable balance ledger entries.
Known limitations
[N/A]