fix(indexer): fix indexer bugs affecting zombie leases calculations #299
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug 1 : Wrong type for decimal columns
Three columns were recently changed from
bigint
type todecimal
. Those changes were applied to the database, but the typings were not updated accordingly. Sequelize handledecimal
columns as string which caused some undetected issues in the indexer.This PR sets the correct type (
string
) and adjust the code accordingly to restore the expected behavior. Calculations are still done using jsnumbers
which could cause issues due to floating point inaccuracy. The BigInt type could be used in the future to improve that.Bug 2 : Missing v1beta4 handler for MsgWithdrawLease
There was a missing handler for the v1beta4 version of MsgWithdrawLease. This means MsgWithdrawLease messages have not been processed since Nov 20, 2023. This resulted in the leases
predictedClosedHeight
being incorrectly updated. This PR adds the missing handler.Impact & Resolution
Those 2 bugs affected the calculations of leased resources and spent amount when zombie leases occurs. However, since zombie leases issues are mostly mitigated now, the effect it had on reported stats is minimal (<0.001%). The fixes will be released shortly to prevent any more impact.