Grin’s first mainnet hardfork!

Oleksander Siryj
2 min readJun 3, 2019

--

Grin planned to hardfork every 6 month during the first 2 years

From well before launch, Grin planned to hardfork every 6 month during the first 2 years.
This is pretty much a necessity for any chain with an ASIC-resistant PoW, as an immutable PoW
falls to ASICs sooner or later. Grin’s GPU oriented PoW, Cuckaroo29, is no exception.

The PoW tweak was introduced in the Grin Forum post at https://www.grin-forum.org/t/mid-july-pow-hardfork-cuckaroo29-cuckarood29.

The crucial change in this PR is in function global::create_pow_context:

match chain_type {
// Mainnet has Cuckaroo(d)29 for AR and Cuckatoo30+ for AF
+ ChainTypes::Mainnet if edge_bits == 29 && valid_header_version(_height, HeaderVersion::new(2))
+ => new_cuckarood_ctx(edge_bits, proof_size),
ChainTypes::Mainnet if edge_bits == 29 => new_cuckaroo_ctx(edge_bits, proof_size),
ChainTypes::Mainnet => new_cuckatoo_ctx(edge_bits, proof_size, max_sols),

// Same for Floonet, except hardfork 32 days earlier
+ ChainTypes::Floonet if edge_bits == 29 && valid_header_version(_height+32*DAY_HEIGHT, HeaderVersion::new(2))
+ => new_cuckarood_ctx(edge_bits, proof_size),
ChainTypes::Floonet if edge_bits == 29 => new_cuckaroo_ctx(edge_bits, proof_size),
ChainTypes::Floonet => new_cuckatoo_ctx(edge_bits, proof_size, max_sols),

with all other changes just putting up the necessary scaffolding to make this work.

If all goes well, then the first block with header version 2, at height WEEK_HEIGHT * 52/2 = 60247*26 = 262080, will roll around on Jul 17, and will have to be solved by either good old Cuckatoo31+, or by the new Cuckarood29. We will be able to test this 32 days prior on Floonet.

Any nodes that fail to upgrade will not be able to advance to height 262080, as the current consensus::valid_header_version will simply return false. So there cannot actually be any chain split.
One side will advance, and the other will remain stuck until they upgrade as well.

The major work left to be done is in grin-miner. We may initially only offer a CUDA miner there as the CPU mean miner is an exceedingly complex beast.

--

--

Oleksander Siryj
Oleksander Siryj

Written by Oleksander Siryj

Christian. Conservative. Father. Unapologetic. Enthusiast of cryptocurrencies. Not necessarily in that order. God bless Ukraine.

No responses yet