zebra icon indicating copy to clipboard operation
zebra copied to clipboard

Tracking: Add parameters to `Network::Testnet` variant

Open arya2 opened this issue 2 years ago • 6 comments

Motivation

Zebra currently hard-codes some consensus parameters that may need to be changed for testing.

Scope

To be discussed in https://github.com/ZcashFoundation/zebra/discussions/7967.

Preparatory Refactors:

  • [x] #8325
  • [x] #8326
  • [x] #7968

After these changes are merged, we should decide which parameters we want to add and create more issues like #7970 for each of them.

Adding Parameters:

  • [x] #7970
    • [x] #7840
  • [x] #8361
  • [x] #8362
  • [x] #8327
  • [x] #8412
  • [ ] Add a default_port field to NetworkParameters (needed for custom Testnets but not Regtest)
  • [ ] #8364
  • [x] #8365
  • [x] #8366
  • [ ] #8367

Possible Design

  • Turn the Testnet variant into:
Testnet(Arc<NetworkParameters { 
   cache_name,
   genesis_hash,
   network_id,
   default_port,
   activation_heights,
   ..
>)
  • Consider adding fields for:
    • slow_start_interval (nSubsidySlowStartInterval)
    • target_difficulty_limit (powLimit)
    • key_prefixes
    • debug_mandatory_checkpoint_height: Option<Height>
    • checkpoints: Path
    • pow_avg_window (update logic to use min(num_blocks_in_cache, 17))
  • Add a new_testnet() method or DEFAULT_TESTNET constant with the existing testnet defaults, to replace literal Testnet variant.
  • Replace matching against Testnet with an is_mainnet() method. (This is only required when we're matching against Testnet, we can change the Mainnet matches gradually.)

arya2 avatar Oct 26 '23 19:10 arya2

Lowering priority as it's not clear that it's a blocker for ZSA testing anymore

mpguerra avatar Nov 06 '23 20:11 mpguerra

Elevating priority so ZSAs can be tested with a new genesis block.

arya2 avatar Nov 07 '23 17:11 arya2

Elevating priority so ZSAs can be tested with a new genesis block.

Mining a new genesis block is out of scope for this ticket. It's an extremely tricky process, let's check what zcashd does, and open another ticket?

(It's possible they just re-use the mainnet or testnet block for all networks.)

teor2345 avatar Nov 07 '23 21:11 teor2345

zcashd uses a separate genesis block for testnet, and does not support multiple testnets without modifying code and rebuilding. Is it sufficient to just use that block and upgrade at height 1?

daira avatar Nov 08 '23 08:11 daira

zcashd uses a separate genesis block for testnet, and does not support multiple testnets without modifying code and rebuilding. Is it sufficient to just use that block and upgrade at height 1?

@arya2 let's ask the QEDIT team when we get in touch with them? (Along with everything else, it's not an urgent question.)

teor2345 avatar Nov 08 '23 19:11 teor2345

@arya2 can you split out what we're going to work on from here on Sprint 24?

mpguerra avatar Nov 20 '23 21:11 mpguerra