Skip to content
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

fix: invalid return value from keeper GetLastCompleteUpgrade #11705

Conversation

daeMOn63
Copy link
Contributor

@daeMOn63 daeMOn63 commented Apr 20, 2022

Description

Add test case showing issue described in #11707

Expecting tests to pass, but currently fail with:

            	Error Trace:	keeper_test.go:313
            	Error:      	Not equal: 
            	            	expected: "test-v0.10"
            	            	actual  : "test-v0.9"

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@daeMOn63 daeMOn63 marked this pull request as ready for review April 25, 2022 15:58
@daeMOn63 daeMOn63 changed the title tests: invalid return value from keeper GetLastCompleteUpgrade fix: invalid return value from keeper GetLastCompleteUpgrade Apr 25, 2022
@daeMOn63 daeMOn63 force-pushed the xupgrade_get_last_completed_upgrade_ordering branch from bb61d25 to 12c812c Compare April 25, 2022 16:06
@daeMOn63 daeMOn63 force-pushed the xupgrade_get_last_completed_upgrade_ordering branch from 36d2902 to d62bb27 Compare April 25, 2022 16:27
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's be sure to add a changelog entry too 👍

CHANGELOG.md Outdated Show resolved Hide resolved
@robert-zaremba
Copy link
Collaborator

robert-zaremba commented Apr 26, 2022

Sorting is not a problem. The problem is with DB access. Now we query all upgrades. I think the better solution is to update the key and use block height (serialized as fixed len uint64) and name later.
So, we can keep this as a temporal fix, and do another (breaking) update to change the key scheme.

@alexanderbez
Copy link
Contributor

alexanderbez commented Apr 27, 2022

Actually @robert-zaremba has a good point here in that his suggestion to change the index/key is a cleaner approach.

However, I don't agree with should go with this just to fix/change it again later (since we can't backport it anyway). I'd rather get this right in one go. So @daeMOn63 if you're open to it, would you be willing to take another stab at this? You'd essentially have to scrap this PR and change the key along with doing some migration stuff.

I can also tackle this if you think it's something you're not interested in and/or don't have the time for.

@daeMOn63
Copy link
Contributor Author

daeMOn63 commented Apr 27, 2022

@alexanderbez just opened #11800 actually with this alternative implementation :) First time playing with migration, looking forward to your review there!

If we directly go with #11800, we can just close this one.

@ValarDragon
Copy link
Contributor

This should probably still be backported to 45

@alexanderbez
Copy link
Contributor

@ValarDragon #11800 isn't state-machine compatible with v0.45 AFAICT

@ValarDragon
Copy link
Contributor

Right, but this version is!

@alexanderbez
Copy link
Contributor

Would GetLastCompletedUpgrade return something potentially different though, even with this (closed) version?

@daeMOn63
Copy link
Contributor Author

Afaik, both versions of this PR would return similar results, the main difference is some potential performance impact with this one as it queries all upgrades to sort them by height in the code.

The v0.46 version should also apply nicely with or without this one in v0.45 as the migration will take care of reindexing things in the correct order.

@alexanderbez
Copy link
Contributor

alexanderbez commented Jun 14, 2022

Well Im mainly concerned with determinism here. The PR that is in 0.46 can't be used because it introduces state changes. This PR doesn't but it does change the order of what GetLastCompletedUpgrade returns and as long as that's not used in state, then we're OK to add this to 0.45.x

@ValarDragon
Copy link
Contributor

GetLastCompletedUpgrade was a function that was added in the v0.45 line to prevent accidental downgrades on bootup, it is safe to change its semantic! (Its not used in state machine)

@alexanderbez
Copy link
Contributor

Ok, I will wrap this up for 0.45 then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants