Closed Valentine1898 closed 2 weeks ago
Latest commit: 07a935e5913001d86ab8936446c990f884a7ccc2
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
should updatePriceForValidatorDelegationToken also be updated to reflect using the
CurrentValidatorRate
rpc?
Good question, we probably don't want to run a couple hundred extra queries while scanning blocks
Actually I wonder why validatorInfo
might contain validatorExchangeRate
values that are not up to date. Maybe you know who from the core team can help us with this?
can we get ride of the getRateData getter?
I'm in no rush to remove getters that aren't being used, because in theory it could be useful to other consumers of the getters package
Wait, shouldn't the validator exchange rates be updated by the block processor? if they're not, what if made it do that instead of doing a leaky RPC on every delegation/undelegation request
Wait, shouldn't the validator exchange rates be updated by the block processor? if they're not, what if made it do that instead of doing a leaky RPC on every delegation/undelegation request
block processor updates validatorInfo
, and validatorInfo
contains rate data. But the problem is that rate data retrieved from validatorInfo sometimes does not equal to rate data retrieved from CurrentValidatorRate rpc
Can rate data change during an epoch?
Generally speaking, rate data only ever change at epoch boundaries and any deviation from this behavior is a serious bug. I think what's more likely is that the calls happened in different epoch, and that the bug we're observing is due to lossy conversions when storing to IDB.
IMO it would be best to investigate this conjecture ("what happens when we record the exchange rate to IDB") before considering doing those RPC calls on each staking actions
Generally speaking, rate data only ever change at epoch boundaries and any deviation from this behavior is a serious bug. I think what's more likely is that the calls happened in different epoch, and that the bug we're observing is due to lossy conversions when storing to IDB.
IMO it would be best to investigate this conjecture ("what happens when we record the exchange rate to IDB") before considering doing those RPC calls on each staking actions
Okay, that makes sense.
I'll hold this PR until I investigate why rate data in indexed-db is outdated
closed as there is a better solution to this issue which will be fixed in core repo
https://discord.com/channels/824484045370818580/1044457038886998137/1250096780880908298
close #1239
context: