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(iota-benchmark): fix test_upgrade_compatibility #3732

Merged
merged 7 commits into from
Oct 29, 2024

Conversation

bingyanglin
Copy link
Contributor

Description of change

Now our min and max version of ProtocolVersion are both 1. The old logic needs to go to max version - 1 and upgrade to max version, which does not work because there is no version 0. In the testing we test the upgrade from 1 to 2 then it works.

Links to any relevant issues

Part of #3321

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

Tested pass locally by

./scripts/simtest/cargo-simtest simtest \
  --color always \
  --package iota-benchmark --test simtest -- test::test_upgrade_compatibility

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@bingyanglin bingyanglin added the node Issues related to the Core Node team label Oct 29, 2024
@bingyanglin bingyanglin self-assigned this Oct 29, 2024
@bingyanglin bingyanglin requested review from muXxer and a team as code owners October 29, 2024 08:16
@bingyanglin bingyanglin force-pushed the core-node/fix/upgrade_test branch from f2e5bc2 to 6f42e6d Compare October 29, 2024 08:22
@muXxer
Copy link
Contributor

muXxer commented Oct 29, 2024

So basically because we don't have a second bytecode snapshot which can be loaded right now, we never test this logic, right?
Should we add a dummy one for the simtests, or should we just rely on working code, because the moment we create a second bytecode snapshot, we can fix the logic anyway in that future version, in case it is broken? @alexsporn

@alexsporn
Copy link
Member

@bingyanglin use MAX_ALLOWED and it will handle the +1 for sim tests

@alexsporn
Copy link
Member

So basically because we don't have a second bytecode snapshot which can be loaded right now, we never test this logic, right? Should we add a dummy one for the simtests, or should we just rely on working code, because the moment we create a second bytecode snapshot, we can fix the logic anyway in that future version, in case it is broken? @alexsporn

Yes, no need to test snapshot loading now. We can revisit this once we have a protocol version 2 in place

@@ -668,7 +668,7 @@ mod test {
}

async fn test_protocol_upgrade_compatibility_impl() {
let max_ver = ProtocolVersion::MAX.as_u64();
let max_ver = ProtocolVersion::MAX.as_u64() + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work as well? Then we don't have to remove the +1 in the future.

Suggested change
let max_ver = ProtocolVersion::MAX.as_u64() + 1;
let max_ver = ProtocolVersion::MAX_ALLOWED.as_u64();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Under testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately it does not pass.

Copy link
Contributor Author

@bingyanglin bingyanglin Oct 29, 2024

Choose a reason for hiding this comment

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

@muXxer @alexsporn I changed the MAX_ALLOWED to be MAX + 1 to pass the upgrade testing in 60e3a3e.

Note that SUI also uses

    #[cfg(msim)]
    pub const MAX_ALLOWED: Self = Self(MAX_PROTOCOL_VERSION + 1);

Copy link
Contributor

Choose a reason for hiding this comment

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

NOOO that breaks another test I fixed by doing +4. 😢

Copy link
Contributor Author

@bingyanglin bingyanglin Oct 29, 2024

Choose a reason for hiding this comment

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

@muXxer got it. Sorry for that. Then how about we use MAX + 1 inside test_upgrade_compatibility now and add TODO comments, so we can remember to modify it when we have really version 2? Also we keep MAX_ALLOWED to be +4.

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, where did you see it doesn't work? The CI was green for this test, or am I confused?
grafik

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or I am fine with simply ignore it for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed with @muXxer in the call we decided to use MAX + 1 for now and add TODO comments at 24ad1a9

Copy link
Contributor Author

@bingyanglin bingyanglin Oct 29, 2024

Choose a reason for hiding this comment

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

btw, where did you see it doesn't work? The CI was green for this test, or am I confused?

Sorry just saw this message. It was lagged because I didn't refresh this page. It failed twice in my machine. I reran the sim-testing GA for the commit to see if I missed something.

@muXxer muXxer merged commit 605d028 into develop Oct 29, 2024
36 of 39 checks passed
@muXxer muXxer deleted the core-node/fix/upgrade_test branch October 29, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node Issues related to the Core Node team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants