-
Notifications
You must be signed in to change notification settings - Fork 2
chore: setup withdrawable event queue #14
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
Conversation
14d01f4 to
0354abf
Compare
This reverts commit e7e0311.
| StakerBtcPkHex string `json:"staker_btc_pk_hex"` | ||
| FinalityProviderBtcPksHex []string `json:"finality_provider_btc_pks_hex"` | ||
| StakingAmount uint64 `json:"staking_amount"` | ||
| StateHistory []string `json:"state_history"` |
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.
The more I think about it, the more it feels like passing everything down via msg might have been the wrong decision.
Perhaps passing down just a staking transaction hash would be sufficient and letting the API handle the lookup instead. 🤔
I’m trying to approach this from an extensibility perspective—considering whether this approach is flexible enough to support new features in the future.
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.
hmm good question - if we let api query the db on every event, it would cause load on db no?
we don't have any db cache or something in api so all the queries would go to mongo.
so basically it boils down to
queue bandwidth(storage) vs db query load 🤔
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.
The queue bandwidth is fine since we’re not passing large-sized content. This is more of an extensibility concern.
For instance, if we add new metadata to the database, we can avoid modifying the queue code and instead rely on the API(or other) service to handle its own lookups.
While database load is a valid concern, MongoDB performs some internal caching for recently accessed documents. As long as the data has been accessed recently, the performance should remain reasonable.
In any case, this is neither a concern nor a blocker for this PR, in my opinion. It’s something we can revisit in the future, @kirugan, if there’s a need to redesign this communication pattern.
jrwbabylonlab
left a comment
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.
Approved with some small comments/questions
Fixes - babylonlabs-io/staking-api-service#188