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

Add initial support for NU5 to zebra #1823

Merged
merged 8 commits into from
Mar 2, 2021
Merged

Add initial support for NU5 to zebra #1823

merged 8 commits into from
Mar 2, 2021

Conversation

yaahc
Copy link
Contributor

@yaahc yaahc commented Feb 26, 2021

Motivation

We want to add a NetworkUpgrade::NU5 network upgrade variant, and a network protocol version for NU5.

Solution

This change updates various enums and constants to include variants for NU5.

The code in this pull request has:

  • Documentation Comments
  • Unit Tests and Property Tests

Review

@teor2345

Related Issues

Closes #1797

Follow Up Work

Need to implement actual NU5 logic, currently we panic if NU5 code paths get executed.

@zfnd-bot zfnd-bot bot assigned yaahc Feb 26, 2021
@yaahc yaahc changed the title Jane/nu5 Add initial support for NU5 to zebra Feb 26, 2021
@yaahc yaahc requested a review from teor2345 February 26, 2021 22:21
oxarbitrage
oxarbitrage previously approved these changes Feb 27, 2021
Copy link
Contributor

@oxarbitrage oxarbitrage 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 to me.

@oxarbitrage oxarbitrage mentioned this pull request Feb 27, 2021
2 tasks
teor2345
teor2345 previously approved these changes Mar 1, 2021
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Approved with changes and suggestions

Here's what I checked:

  • the consensus branch id matches the draft spec
  • the external network protocol versions match the draft spec

Here's what I suggested:

  • the specific change and ZIP for each unimplemented!()
  • remove unimplemented!() where there is no suggested change

Here's what I committed:

  • add NU5 to the protocol::version_consistent test ae76f99

This test change isn't required until we have a testnet or mainnet activation height for NU5, but we might as well do it now.

zebra-chain/src/block/root_hash.rs Outdated Show resolved Hide resolved
zebra-chain/src/parameters/network_upgrade.rs Show resolved Hide resolved
zebra-chain/src/parameters/network_upgrade.rs Outdated Show resolved Hide resolved
zebra-chain/src/transaction/arbitrary.rs Outdated Show resolved Hide resolved
zebra-chain/src/transaction/sighash.rs Outdated Show resolved Hide resolved
@teor2345 teor2345 assigned teor2345 and yaahc and unassigned yaahc Mar 1, 2021
@teor2345 teor2345 added A-consensus Area: Consensus rule updates A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement NU-5 Network Upgrade: NU5 specific tasks P-Medium labels Mar 1, 2021
@teor2345
Copy link
Contributor

teor2345 commented Mar 1, 2021

Since my suggestions were trivial, I went ahead and committed them.

@teor2345
Copy link
Contributor

teor2345 commented Mar 1, 2021

@oxarbitrage or @yaahc, can you double-check that:

  • Each instance of Canopy in the codebase has a corresponding NU5

Let's focus on wildcard matches and other code that the compiler doesn't automatically pick up.

oxarbitrage
oxarbitrage previously approved these changes Mar 1, 2021
Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

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

Thank you for the last changes @teor2345 , looks a lot better.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

We need to double-check that each instance of Canopy in the codebase has a corresponding NU5.

Let's just make sure 2 of us have checked this.

@oxarbitrage
Copy link
Contributor

We don't have an element for NU5 in MAINNET_ACTIVATION_HEIGHTS and TESTNET_ACTIVATION_HEIGHTS because we don't know the exact block for this upgrade yet. However, we can add a placeholder there with block height 10_000_000 or something like that(with a todo comment to change it). If we do this or if we don't i think we should open a ticket to add(or modify) the block height for NU5 when this info became available.

The rest looks good in regards to all the instances of Canopy(specially all matches) have a corresponding NU5.

@yaahc
Copy link
Contributor Author

yaahc commented Mar 2, 2021

@oxarbitrage you beat me to it but I just made a commit adding some TODO comments to the file, and I'll go ahead and add this follow up task to the checklist in the original issue

@yaahc yaahc mentioned this pull request Mar 2, 2021
13 tasks
@yaahc yaahc requested a review from teor2345 March 2, 2021 19:58
@yaahc yaahc enabled auto-merge (squash) March 2, 2021 19:58
@teor2345
Copy link
Contributor

teor2345 commented Mar 2, 2021

We don't have an element for NU5 in MAINNET_ACTIVATION_HEIGHTS and TESTNET_ACTIVATION_HEIGHTS because we don't know the exact block for this upgrade yet. However, we can add a placeholder there with block height 10_000_000 or something like that(with a todo comment to change it).

We want to avoid implementing incorrect consensus rules, because:

  • some Zebra instances might not be upgraded, so they will have the wrong rules
  • people will get confused when they read our code

Zebra should work if some network upgrades don't have an activation height. So we can just add it when it is decided.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Looks great, let's merge!

@yaahc yaahc merged commit e541746 into main Mar 2, 2021
@yaahc yaahc deleted the jane/nu5 branch March 2, 2021 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Area: Consensus rule updates A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement NU-5 Network Upgrade: NU5 specific tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NetworkUpgrade::NU5 and network protocol version
3 participants