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

feat: consume finality provider event #10

Merged
merged 3 commits into from
Oct 14, 2024
Merged

Conversation

jrwbabylonlab
Copy link
Collaborator

No description provided.

Copy link
Member

@gitferry gitferry left a comment

Choose a reason for hiding this comment

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

Lgtm! Mostly nits

@@ -3,7 +3,7 @@ module github.com/babylonlabs-io/babylon-staking-indexer
go 1.23.2

require (
github.com/babylonlabs-io/babylon v0.11.0
github.com/babylonlabs-io/babylon v0.12.0
Copy link
Member

Choose a reason for hiding this comment

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

can change to babylonlabs-io/babylon@86f6bc5 which includes format change

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gitferry Require BBN bump to newer version first. Since this repo is WIP as well. I'm not in a hurry to use commit based, we can wait for BBN till released a newer version

if err != nil {
return err
}
if res.MatchedCount == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

seems strange to check this for object not found

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the response type from the UpdateOne method

// UpdateResult is the result type returned from UpdateOne, UpdateMany, and ReplaceOne operations.
type UpdateResult struct {
	MatchedCount  int64       // The number of documents matched by the filter.
	ModifiedCount int64       // The number of documents modified by the operation.
	UpsertedCount int64       // The number of documents upserted by the operation.
	UpsertedID    interface{} // The _id field of the upserted document, or nil if no upsert was done.
}

This is because we could end up with not updating anything if nothing was found. Mongodb does not throw error

internal/db/error.go Outdated Show resolved Hide resolved
internal/db/error.go Outdated Show resolved Hide resolved
internal/db/error.go Outdated Show resolved Hide resolved
internal/db/finality-provider.go Outdated Show resolved Hide resolved
internal/db/finality-provider.go Outdated Show resolved Hide resolved
internal/services/events.go Outdated Show resolved Hide resolved
@jrwbabylonlab jrwbabylonlab merged commit 6c93870 into main Oct 14, 2024
7 of 11 checks passed
@jrwbabylonlab jrwbabylonlab deleted the consume-fp-event branch October 14, 2024 02:53
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