8000 feat: introduce post-state-root protocol feature by pugachAG · Pull Request #9538 · near/nearcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: introduce post-state-root protocol feature #9538

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

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

pugachAG
Copy link
Contributor
@pugachAG pugachAG commented Sep 19, 2023

This PR introduces ProtocolFeature::PostStateRoot which is included in nightly.
After a discussion with @nikurt and @jakmeier it was decided not to introduce a cargo feature for conditional compilation until it is actually needed. As far as I see all post-state-root code can be added without need for conditional compilation. The only switch we need is to enable post-state-root chunk and block production based on protocol version check.

This PR is a groundwork for #9450.

@pugachAG pugachAG marked this pull request as ready for review September 19, 2023 12:28
@pugachAG pugachAG requested a review from a team as a 8000 code owner September 19, 2023 12:28
@jakmeier
Copy link
Contributor

As far as I see all post-state-root code can be added without need for conditional compilation. The only switch we need is to enable post-state-root chunk and block production based on protocol version using checked_feature! check.

checked_feature! uses conditional compilation. :) If you want to avoid conditional compilation, you just write an if condition like ProtocolFeature::PostStateRoot.protocol_version() <= protocol_version.

@@ -120,6 +120,7 @@ pub enum ProtocolFeature {
RejectBlocksWithOutdatedProtocolVersions,
#[cfg(feature = "protocol_feature_simple_nightshade_v2")]
SimpleNightshadeV2,
PostStateRoot,
Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure rustc will complain about unused enum variants. Either mark it as an exception, or maybe just wait with introducing it until you have your first PR that actually needs it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like rustc is OK with it 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh right because it's pub it may be used outside the crate! Well, then I'm even more confused why we bother with hiding even the enum variants behind compilation flags, seems completely pointless to me. 🤔

@@ -173,6 +174,7 @@ impl ProtocolFeature {
ProtocolFeature::RejectBlocksWithOutdatedProtocolVersions => 132,
#[cfg(feature = "protocol_feature_simple_nightshade_v2")]
ProtocolFeature::SimpleNightshadeV2 => 135,
ProtocolFeature::PostStateRoot => 136,
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the nightly protocol version is 138.

I guess it is fine to re-use protocol version numbers of stabilized features.

@pugachAG pugachAG force-pushed the post-state-root-protocol-feature branch from 1b3ea4e to 3577277 Compare September 19, 2023 13:27
@pugachAG pugachAG added the A-chain Area: Chain, client & related label Sep 20, 2023
@pugachAG pugachAG enabled auto-merge September 20, 2023 14:06
@pugachAG pugachAG disabled auto-merge September 20, 2023 14:31
@pugachAG pugachAG added this pull request to the merge queue Sep 20, 2023
Merged via the queue into near:master with commit 164e7c2 Sep 20, 2023
@pugachAG pugachAG deleted the post-state-root-protocol-feature branch September 20, 2023 17:54
nikurt pushed a commit that referenced this pull request Sep 22, 2023
nikurt pushed a commit that referenced this pull request Sep 26, 2023
nikurt pushed a commit that referenced this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-chain Area: Chain, client & related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0