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

[core] Cleanup protocol version cheecks in transaction validity check #17530

Merged
merged 3 commits into from
May 28, 2024

Conversation

lxfind
Copy link
Contributor

@lxfind lxfind commented May 6, 2024

Description

This PR consolidates protocol version support checks on transactions during validity check.
Specifically, it breaks down the protocol config version checks from authority_server into two pieces:

  1. User signature related version checks. These are moved to a single function and called from validity_chec().
  2. Transaction data related version checks. This is the randomness check, and is moved to check_version_supported() of TransactionData.

One notable change is that the randomness check now only checks the protocol config feature, without checking whether the randomness object exists. I believe this is fine because if the randomness object does not exist, it will fail latter when loading input objects anyway. But worth double check @aschran

Test plan

CI


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:
  • Rust SDK:

@lxfind lxfind requested review from mystenmark and aschran May 6, 2024 18:27
Copy link

vercel bot commented May 6, 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 May 25, 2024 11:19pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 25, 2024 11:19pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 25, 2024 11:19pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 25, 2024 11:19pm

@lxfind lxfind requested a review from halfprice May 6, 2024 18:27
@@ -1490,6 +1490,12 @@ impl VersionedProtocolMessage for TransactionData {
});
}

if !protocol_config.random_beacon() && self.uses_randomness() {
Copy link
Contributor

Choose a reason for hiding this comment

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

why does this now go in check_version_supported? It doesn't seem to have anything to do with the message version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function doesn't actually just check message version. The next line checks a bunch of feature flags and whether some of the transaction features used are enabled by the config.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit, but while you're in the area, maybe rename it to something more representative to what it currently does?

Copy link
Contributor

@mystenmark mystenmark left a comment

Choose a reason for hiding this comment

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

Looks good. We should do a pass over the code coverage report after this lands.

@lxfind lxfind force-pushed the core-consolidate-protocol-checks branch from 67c4e71 to f6ad3f3 Compare May 25, 2024 23:18
@lxfind lxfind merged commit da97303 into main May 28, 2024
48 checks passed
@lxfind lxfind deleted the core-consolidate-protocol-checks branch May 28, 2024 14:54
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.

3 participants