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

[CLI] Add a warning if the CLI falls behind more than 2 protocol versions #20426

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

stefan-mysten
Copy link
Contributor

@stefan-mysten stefan-mysten commented Nov 25, 2024

Description

This change adds a warning when the CLI falls behind more than 2 protocol versions against the current active network on which the command will be executing against.

Test plan

Locally.


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI: Added a warn when trying to publish/upgrade a package, if the CLI fell behind more than two protocol versions than the network on which the package is about to be published/upgraded.
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Nov 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2024 11:37pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 26, 2024 11:37pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 26, 2024 11:37pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Nov 26, 2024 11:37pm

let on_chain_protocol_version = protocol_cfg.protocol_version.as_u64();
let cli_protocol_version = ProtocolConfig::get_for_max_version_UNSAFE()
.version
.as_u64();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could just be ProtocolVersion::MAX. Otherwise LGTM

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, from what I can tell we can only call max() on ProtocolConfig if we have the actual object/reference to it, which we don't. If you know a way how to avoid the get_for_max_version_UNSAFE(), happy to learn!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this could just be ProtocolVersion::MAX. Otherwise LGTM

You were right, this is the right way! Thanks for the suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

next time I'll have to put the diff I wasn't sure what you meant yesterday but figured it was caused by me not being clear enough 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at all, I misread it: instead of ProtocolVersion I read it ProtocolConfig so things did not click :D

@stefan-mysten stefan-mysten temporarily deployed to sui-typescript-aws-kms-test-env November 26, 2024 23:36 — with GitHub Actions Inactive
@stefan-mysten stefan-mysten merged commit 533043d into MystenLabs:main Nov 27, 2024
47 of 48 checks passed
@stefan-mysten stefan-mysten deleted the cli_protocal_lag_warn branch November 27, 2024 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants