Skip to content

Conversation

@gusin13
Copy link
Contributor

@gusin13 gusin13 commented Jan 2, 2025

@gusin13 gusin13 force-pushed the 188-add-staked-withdrawable-tvl branch from 14d01f4 to 0354abf Compare January 14, 2025 07:25
@gusin13 gusin13 marked this pull request as ready for review January 15, 2025 07:00
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"`
Copy link
Collaborator

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.

Copy link
Contributor Author

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 🤔

Copy link
Collaborator

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.

Copy link
Collaborator

@jrwbabylonlab jrwbabylonlab left a 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

@gusin13 gusin13 merged commit c4b08ad into main Jan 16, 2025
1 check passed
@jrwbabylonlab jrwbabylonlab deleted the 188-add-staked-withdrawable-tvl branch March 31, 2025 04:03
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.

4 participants