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

HardFork3 #3334

Merged
merged 2 commits into from
Jun 4, 2020
Merged

HardFork3 #3334

merged 2 commits into from
Jun 4, 2020

Conversation

tromp
Copy link
Contributor

@tromp tromp commented May 26, 2020

name: HardFork3
about: This hard-fork allows blocks with 3*HARD_FORK_INTERVAL/FLOONET_THIRD_HARD_FORK <= height < 4*HARD_FORK_INTERVAL with header version 4 and Cuckarooz29 as secondary PoW.
title: HardFork3
labels: consensus breaking
assignees: @antiochp @yeastplume @quentinlesceller

Currently, consensus::valid_header_version(height, version) returns false for all height >= 3*HARD_FORK_INTERVAL.
This PR changes that to return true for version 4 at either FLOONET_THIRD_HARD_FORK <= height < 4*HARD_FORK_INTERVAL on floonet or 3*HARD_FORK_INTERVAL <= height < 4*HARD_FORK_INTERVAL on mainnet.

This PR also changes global::create_pow_context to return new_cuckarooz_ctx(edge_bits, proof_size) when consensus::valid_header_version(height, version) holds for version 4, which means that Cuckarooz29 [1] is the only valid secondary PoW after the hard fork.

Successfully tested on a mainnet fast sync.

[1] https://forum.grin.mw/t/introducing-the-final-tweak-cuckarooz

@quentinlesceller quentinlesceller added consensus breaking Use for issues or PRs that will break consensus and force a hard fork must-have Required for the associated milestone labels May 26, 2020
@quentinlesceller quentinlesceller added this to the 4.0.0 milestone May 26, 2020
@tromp
Copy link
Contributor Author

tromp commented May 26, 2020

NOTE that the FLOONET_THIRD_HARD_FORK value may need revising when building a beta or RC according to whether we still want to HF on June 20 and how fast floonet progressed.

@antiochp antiochp self-requested a review May 28, 2020 14:08
Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

valid_header_version() is incorrect logic for floonet but this is not directly related to this PR (see comment above).

Otherwise 👍.

Minor comment - I think there's a typo in there.

Can't speak for the cuckarooz impl but the HF stuff looks 👍.

core/src/consensus.rs Outdated Show resolved Hide resolved
Comment on lines 186 to 188
pub fn valid_header_version(height: u64, version: HeaderVersion) -> bool {
height < 3 * HARD_FORK_INTERVAL && version == header_version(height)
height < 4 * HARD_FORK_INTERVAL && version == header_version(height)
}
Copy link
Member

Choose a reason for hiding this comment

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

Just realized this logic is only correct for mainnet.
It is not valid for either floonet or usertesting which do not use HARD_FORK_INTERVAL directly.

This is not specific to this PR and I don't think it has a material impact here - but we should revisit this.

Tracking here - #3335

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why can't floonet and usertesting be limited to 2 years worth of block just like mainnet is for version 4? Of course that will be changed downward at the next HF, but for now it looks fine to me.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah maybe that is fine actually.
I was originally thinking automatedtesting wants to be able to test an invalid block due to excessive block height. But its going to be based on header version anyway.

👍

core/src/global.rs Show resolved Hide resolved
@quentinlesceller
Copy link
Member

@tromp can you fix the merge conflict?

Copy link
Member

@quentinlesceller quentinlesceller left a comment

Choose a reason for hiding this comment

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

Looking good to me

@@ -133,12 +133,18 @@ pub const FLOONET_FIRST_HARD_FORK: u64 = 185_040;
/// Floonet second hard fork height, set to happen around 2019-12-19
pub const FLOONET_SECOND_HARD_FORK: u64 = 298_080;

/// Floonet second hard fork height, set to happen around 2020-06-20
pub const FLOONET_THIRD_HARD_FORK: u64 = 552_960;
Copy link
Member

Choose a reason for hiding this comment

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

For reference the exact time is currently 2020-06-19 18:49:36 +0000 UTC

@anton679

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus breaking Use for issues or PRs that will break consensus and force a hard fork must-have Required for the associated milestone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants