Skip to content

Latest commit

 

History

History
245 lines (179 loc) · 10 KB

zip-0252.rst

File metadata and controls

245 lines (179 loc) · 10 KB
ZIP: 252
Title: Deployment of the NU5 Network Upgrade
Owners: teor <teor@zfnd.org>
        Daira Hopwood <daira@electriccoin.co>
Status: Final
Category: Consensus / Network
Created: 2021-02-23
License: MIT
Discussions-To: <https://github.com/zcash/zips/issues/440>
Pull-Request: <https://github.com/zcash/zips/pull/446>

Terminology

The key words "MUST" and "SHOULD" in this document are to be interpreted as described in RFC 2119.1

The term "network upgrade" in this document is to be interpreted as described in ZIP 200.2

The terms "Testnet" and "Mainnet" are to be interpreted as described in section 3.12 of the Zcash Protocol Specification3.

Abstract

This proposal defines the deployment of the NU5 network upgrade.

Specification

NU5 deployment

The primary sources of information about NU5 consensus and peer-to-peer protocol changes are:

  • The Zcash Protocol Specification45
  • ZIP 200: Network Upgrade Mechanism6
  • ZIP 216: Require Canonical Point Encodings7
  • ZIP 224: Orchard Shielded Protocol8
  • ZIP 225: Version 5 Transaction Format9
  • ZIP 239: Relay of Version 5 Transactions10
  • ZIP 244: Transaction Identifier Non-Malleability11
  • The Orchard Book12
  • The halo2 Book13

The network handshake and peer management mechanisms defined in ZIP 20114 also apply to this upgrade.

Unified addresses and viewing keys are described in ZIP 31615.

The following ZIPs have been updated in varying degrees to take into account Orchard:

  • ZIP 32: Shielded Hierarchical Deterministic Wallets16
  • ZIP 203: Transaction Expiry17
  • ZIP 209: Prohibit Negative Shielded Chain Value Pool Balances18
  • ZIP 212: Allow Recipient to Derive Ephemeral Secret from Note Plaintext19
  • ZIP 213: Shielded Coinbase20
  • ZIP 221: FlyClient - Consensus-Layer Changes21
  • ZIP 401: Addressing Mempool Denial-of-Service22

The following network upgrade constants23 are defined for the NU5 upgrade:

CONSENSUS_BRANCH_ID

0xc2d6d0b4

ACTIVATION_HEIGHT (NU5)

Testnet (second activation): 1842420

Mainnet: 1687104

MIN_NETWORK_PROTOCOL_VERSION (NU5)

Testnet (second activation): 170050

Mainnet: 170100

Note: A first activation of NU5, with a previous version of the Orchard circuit and other NU5 consensus rules, occurred on Testnet at block height 1599200 with consensus branch ID 0x37519621 and peer protocol version 170015. With the release of zcashd v4.7.0, Testnet is being rolled back to another chain that forks from the block immediately preceding that activation, at height 1599199. This chain had been continuously mined by zcashd v4.0.0 nodes modified to disable End-of-Service halt.

For each network (Testnet and Mainnet), nodes compatible with NU5 activation on that network MUST advertise a network protocol version that is greater than or equal to the MIN_NETWORK_PROTOCOL_VERSION (NU5) for that activation.

For each network, pre-NU5 nodes are defined as nodes advertising a protocol version less than that network's MIN_NETWORK_PROTOCOL_VERSION (NU5).

Once NU5 activates on Testnet or Mainnet, NU5 nodes SHOULD take steps to:

  • reject new connections from pre-NU5 nodes on that network;
  • disconnect any existing connections to pre-NU5 nodes on that network.

The change to the peer-to-peer protocol described in ZIP 239 took effect from peer protocol version 170014 onward, on both Testnet and Mainnet.24

Backward compatibility

Prior to the network upgrade activating on each network, NU5 and pre-NU5 nodes are compatible and can connect to each other. (In the case of Testnet, there was a prolonged period of network fracturing due to a consensus bug, but this is expected to be resolved with the release of zcashd v4.7.0.)

Once the network upgrades, even though pre-NU5 nodes can still accept the numerically larger protocol version used by NU5 as being valid, NU5 nodes will always disconnect peers using lower protocol versions.

Unlike Blossom, Heartwood, and Canopy, and like Overwinter and Sapling, NU5 defines a new transaction version. Therefore, NU5 transactions MAY be in the new v5 format specified by25. Unlike previous transaction version updates, the existing v4 transaction format remains valid after NU5 activation. Both transaction formats MUST be accepted by NU5 nodes.

Backward compatibility of the new MSG_WTX inv type introduced for inv and getdata messages is discussed in26.

Support in zcashd

Several versions of zcashd have implemented versions of the NU5 consensus rules on Testnet:

  • zcashd v4.5.0 implemented a consensus revision that contained critical bugs in the Orchard Action circuit.
  • Before that revision could activate, zcashd v4.5.1 was released, with a later activation height of 1599200 as described in section NU5 deployment above. This revision also had a consensus bug that caused many nodes to stall at or near height 1779199, shortly after the first block containing an Orchard output.
  • zcashd v4.7.0 implements what is expected to be the final revision of the NU5 consensus rules, causing a long rollback to an alternate Testnet chain. It is necessary to use the -reindex and -rescan options to zcashd in order to follow this chain as intended.

Support for NU5 on Mainnet will be implemented in zcashd version 5.0.0, which will advertise protocol version 170100.

Backward compatibility in zcashd

The minimum peer protocol version that NU5-compatible zcashd nodes will connect to is 170002. On Testnet, they will immediately disconnect from nodes advertising a peer protocol version less than 170040.

NU5 deployment for zcashd

For each network, approximately 1.5 days (defined in terms of block height) before the corresponding NU5 activation height, nodes compatible with NU5 activation on that network will change the behaviour of their peer connection logic in order to prefer pre-NU5 peers on that network for eviction from the set of peer connections:

/**
 * The period before a network upgrade activates, where connections to upgrading peers are preferred (in blocks).
 * This was three days for upgrades up to and including Blossom, and is 1.5 days from Heartwood onward.
 */
static const int NETWORK_UPGRADE_PEER_PREFERENCE_BLOCK_PERIOD = 1728;

The implementation is similar to that for Overwinter which was described in 27.

However, NU5 nodes will have a preference for connecting to other NU5 nodes, so pre-NU5 nodes will gradually be disconnected in the run up to activation.

Support in Zebra

Several versions of Zebra have implemented versions of the NU5 consensus rules on Testnet:

  • zebrad v1.0.0-alpha.18 implemented partial support for NU5 on Testnet, validating a strict subset of the NU5 consensus rules. This version had an activation height of 1599200, as described in section NU5 deployment above.
  • zebrad v1.0.0-beta.8 will fully validate what is expected to be the final revision of the NU5 consensus rules. As part of these consensus rule changes, zebrad v1.0.0-beta.8 will automatically re-download the entire chain from genesis, then follow an alternate chain starting at height 1599200. It will advertise protocol version 170050.

Support for NU5 on Mainnet will be implemented in zebrad version v1.0.0-beta.10, which will advertise protocol version 170100.

Backward compatibility in Zebra

The minimum peer protocol version that NU5-compatible Zebra nodes will connect to is 170002. They will immediately disconnect from nodes advertising a peer protocol version less than:

  • 170040 on Testnet, or
  • 170013 on Mainnet.

NU5 deployment for Zebra

For each network, at the corresponding NU5 activation height, nodes compatible with NU5 activation on that network will close existing connections with pre-NU5 peers, and reject new connections from pre-NU5 peers.

References


  1. RFC 2119: Key words for use in RFCs to Indicate Requirement Levels

  2. ZIP 200: Network Upgrade Mechanism

  3. Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 3.12: Mainnet and Testnet

  4. Zcash Protocol Specification, Version 2021.2.16 or later

  5. Zcash Protocol Specification, Version 2021.2.16 [NU5 proposal]. Section 7.1: Transaction Encoding and Consensus

  6. ZIP 200: Network Upgrade Mechanism

  7. ZIP 216: Require Canonical Point Encodings

  8. ZIP 224: Orchard Shielded Protocol

  9. ZIP 225: Version 5 Transaction Format

  10. ZIP 239: Relay of Version 5 Transactions

  11. ZIP 244: Transaction Identifier Non-Malleability

  12. The Orchard Book

  13. The halo2 Book

  14. ZIP 201: Network Peer Management for Overwinter

  15. ZIP 316: Unified Addresses and Unified Viewing Keys

  16. ZIP 32: Shielded Hierarchical Deterministic Wallets

  17. ZIP 203: Transaction Expiry

  18. ZIP 209: Prohibit Negative Shielded Chain Value Pool Balances

  19. ZIP 212: Allow Recipient to Derive Ephemeral Secret from Note Plaintext

  20. ZIP 213: Shielded Coinbase

  21. ZIP 221: FlyClient - Consensus-Layer Changes

  22. ZIP 401: Addressing Mempool Denial-of-Service

  23. ZIP 200: Network Upgrade Mechanism

  24. ZIP 239: Relay of Version 5 Transactions

  25. ZIP 225: Version 5 Transaction Format

  26. ZIP 239: Relay of Version 5 Transactions

  27. ZIP 201: Network Peer Management for Overwinter