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
RPC validators calls IncrementAccum if necessary #2808
Conversation
This needs to be rebased against develop. |
5eda184
to
ef0b0f5
Compare
Rebased. |
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.
🍓 🍌 🥛
@@ -191,12 +193,14 @@ func LoadValidators(db dbm.DB, height int64) (*types.ValidatorSet, error) { | |||
), | |||
) | |||
} | |||
valInfo2.ValidatorSet.IncrementAccum(int(height - valInfo.LastHeightChanged)) // mutate |
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.
Should we write a test for this?
Codecov Report
@@ Coverage Diff @@
## develop #2808 +/- ##
==========================================
Coverage ? 62.12%
==========================================
Files ? 212
Lines ? 17297
Branches ? 0
==========================================
Hits ? 10745
Misses ? 5644
Partials ? 908
|
Can we please get a quick explanation of how this was found / what it fixes and a corresponding test? Thanks! |
I think this was discovered by one of the validators. When we were loading vals, we didn't incrementAccum, so the accum values were incorrect.
|
wrote a test (TestStoreLoadValidatorsIncrementsAccum) before
after:
|
646d644
to
0075b8f
Compare
@@ -191,12 +193,14 @@ func LoadValidators(db dbm.DB, height int64) (*types.ValidatorSet, error) { | |||
), | |||
) | |||
} | |||
valInfo2.ValidatorSet.IncrementAccum(int(height - valInfo.LastHeightChanged)) // mutate |
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.
What happens if LoadValidators is called multiple times before the validator set changes? Won't we keep incorrectly changing the accum?
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.
we don't save valInfo2
as far as I can see, so I think we're fine
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.
You're right, the result of LoadValidators doesn't seem to be saved anywhere. Excellent! This looks fine to merge then.
This isn't a big deal, but good to fix nevertheless.