* ref(ci): consolidate cached states workflows and scripts
We've been using multiple approaches to locate and retrieve cached states in GCP. However, this has made it difficult to reuse the same methods across new workflows or different scenarios.
To address this, we've streamlined the process to make it more reusable in other contexts. This change will support deploying instances from both the `main` branch and `release`, simplifying future implementations and speeding up the process.
Changes:
- Use a single bash script (`gcp-get-cached-disks.sh`) to get cached states names and availability
- Move script logic from `sub-find-cached-disks.yml` to `gcp-get-cached-disks.sh` and adapt `sub-find-cached-disks.yml` to allow to output available disks and disks names.
- Simplify parameters usage in `sub-deploy-integration-tests-gcp.yml` and convert the `Find ${{ inputs.test_id }} cached state disk` step into an independent job, to be able to use the `sub-find-cached-disks.yml` reusable workflow
- Remove repetition in `sub-ci-integration-tests-gcp.yml`
* ref(tests): Use the `ZEBRA_CACHED_STATE_DIR` env var across tests
We had a technical debt with some tests using a hardcoded value for the cache directory (`/zebrad-cache`), which generated inconsistency across disks and cached states directories.
Changes:
- Allow sync tests to use the `ZEBRA_CACHED_STATE_DIR` as the cache directory, if specified
- Update the `entrypoint.sh` to reflect this change
- Add the `ZEBRA_CACHED_STATE_DIR` variable to the missing tests in `sub-ci-integration-tests-gcp.yml`, and remove extra parameters to call reusable workflows.
* Adds a mempool request to wait for a transaction verification result and uses it in `sendrawtransaction` RPC method
* removes unnecessary clone
* fix clippy warnings
* returns verification errors for all `mempool::Queue` requests, removes `QueueRpc` request variant
* returns oneshot channel in mempool::Response::Queue
* updates a test vector to check for download or verification error in mempool::response::Queued result receiver
* Always require tokio as a dependency in zebra-node-services
* checks for closed channel errors in sendrawtransaction and updates a prop test to check that verification errors are propagated correctly
* Updates `EOS_PANIC_AFTER` end of support constant from 16 weeks to 14 weeks, so the Mainnet panic height is just before the second halving and end of the current dev fund.
* version bumps
* Updates CHANGELOG.md
* Updates changelog
* updates end of support time to 10 weeks
* Adds a note to the changelog about recovering after finalizing blocks from a fork
* Add new changes on main to CHANGELOG.md
* Updates ESTIMATED_RELEASE_HEIGHT
* Apply suggestions from code review
Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
* Update zebrad/src/components/sync/end_of_support.rs
---------
Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
* temporally upgrade zcash primitives to github main branch
* add allowed git repo in deny.toml
* add quotes to url
* fix denies
* change issue number for TODOs
* fix test name
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
---------
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
Co-authored-by: Marek <mail@marek.onl>
* Addresses clippy lints
* checks network magic and returns early from `is_regtest()`
* Moves `subsidy.rs` to `zebra-chain`, refactors funding streams into structs, splits them into pre/post NU6 funding streams, and adds them as a field on `testnet::Parameters`
* Replaces Vec with HashMap, adds `ConfiguredFundingStreams` type and conversion logic with constraints.
Minor refactors
* Empties recipients list
* Adds a comment on num_addresses calculation being invalid for configured Testnets, but that being okay since configured testnet parameters are checked when they're being built
* Documentation fixes, minor cleanup, renames a test, adds TODOs, and fixes test logic
* Removes unnecessary `ParameterSubsidy` impl for &Network, adds docs and TODOs
* Adds a "deferred" FundingStreamReceiver, adds a post-NU6 funding streams, updates the `miner_fees_are_valid()` and `subsidy_is_valid()` functions to check that the deferred pool contribution is valid and that there are no unclaimed block subsidies after NU6 activation, and adds some TODOs
* adds `lockbox_input_value()` fn
* Adds TODOs for linking to relevant ZIPs and updating height ranges
* Adds `nu6_lockbox_funding_stream` acceptance test
* updates funding stream values test to check post-NU6 funding streams too, adds Mainnet/Testnet NU6 activation heights, fixes lints/compilation issue
* Reverts Mainnet/Testnet NU6 activation height definitions, updates `test_funding_stream_values()` to use a configured testnet with the post-NU6 Mainnet funding streams height range
* reverts unnecessary refactor
* appease clippy
* Adds a test for `lockbox_input_value()`
* Applies suggestions from code review
* Fixes potential panic
* Fixes bad merge
* Update zebra-chain/src/parameters/network_upgrade.rs
* Updates acceptance test to check that invalid blocks are rejected
* Checks that the original valid block template at height 2 is accepted as a block submission
* Reverts changes for coinbase should balance exactly ZIP
* updates test name
* Updates deferred pool funding stream name to "Lockbox", moves post-NU6 height ranges to constants, updates TODO
* Updates `get_block_subsidy()` RPC method to exclude lockbox funding stream from `fundingstreams` field
* Adds a TODO for updating `FundingStreamReceiver::name()` method docs
* Updates `FundingStreamRecipient::new()` to accept an iterator of items instead of an option of an iterator, updates a comment quoting the coinbase transaction balance consensus rule to note that the current code is inconsistent with the protocol spec, adds a TODO for updating the quote there once the protocol spec has been updated.
* Uses FPF Testnet address for post-NU6 testnet funding streams
* Updates the NU6 consensus branch id
* checks that coinbase transactions balance exactly
* updates test name
* Add a TODO
* Refactor `miner_fees_are_valid`
---------
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
Co-authored-by: Marek <mail@marek.onl>
* Addresses clippy lints
* checks network magic and returns early from `is_regtest()`
* Moves `subsidy.rs` to `zebra-chain`, refactors funding streams into structs, splits them into pre/post NU6 funding streams, and adds them as a field on `testnet::Parameters`
* Replaces Vec with HashMap, adds `ConfiguredFundingStreams` type and conversion logic with constraints.
Minor refactors
* Empties recipients list
* Adds a comment on num_addresses calculation being invalid for configured Testnets, but that being okay since configured testnet parameters are checked when they're being built
* Documentation fixes, minor cleanup, renames a test, adds TODOs, and fixes test logic
* Removes unnecessary `ParameterSubsidy` impl for &Network, adds docs and TODOs
* Adds a "deferred" FundingStreamReceiver, adds a post-NU6 funding streams, updates the `miner_fees_are_valid()` and `subsidy_is_valid()` functions to check that the deferred pool contribution is valid and that there are no unclaimed block subsidies after NU6 activation, and adds some TODOs
* adds `lockbox_input_value()` fn
* Adds TODOs for linking to relevant ZIPs and updating height ranges
* Adds `nu6_lockbox_funding_stream` acceptance test
* updates funding stream values test to check post-NU6 funding streams too, adds Mainnet/Testnet NU6 activation heights, fixes lints/compilation issue
* Reverts Mainnet/Testnet NU6 activation height definitions, updates `test_funding_stream_values()` to use a configured testnet with the post-NU6 Mainnet funding streams height range
* reverts unnecessary refactor
* appease clippy
* Adds a test for `lockbox_input_value()`
* Applies suggestions from code review
* Fixes potential panic
* Fixes bad merge
* Update zebra-chain/src/parameters/network_upgrade.rs
* Updates acceptance test to check that invalid blocks are rejected
* Checks that the original valid block template at height 2 is accepted as a block submission
* Reverts changes for coinbase should balance exactly ZIP
* updates test name
* Updates deferred pool funding stream name to "Lockbox", moves post-NU6 height ranges to constants, updates TODO
* Updates `get_block_subsidy()` RPC method to exclude lockbox funding stream from `fundingstreams` field
* Adds a TODO for updating `FundingStreamReceiver::name()` method docs
* Updates `FundingStreamRecipient::new()` to accept an iterator of items instead of an option of an iterator, updates a comment quoting the coinbase transaction balance consensus rule to note that the current code is inconsistent with the protocol spec, adds a TODO for updating the quote there once the protocol spec has been updated.
* Uses FPF Testnet address for post-NU6 testnet funding streams
* Updates the NU6 consensus branch id
---------
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
* Addresses clippy lints
* checks network magic and returns early from `is_regtest()`
* Moves `subsidy.rs` to `zebra-chain`, refactors funding streams into structs, splits them into pre/post NU6 funding streams, and adds them as a field on `testnet::Parameters`
* Replaces Vec with HashMap, adds `ConfiguredFundingStreams` type and conversion logic with constraints.
Minor refactors
* Empties recipients list
* Adds a comment on num_addresses calculation being invalid for configured Testnets, but that being okay since configured testnet parameters are checked when they're being built
* Documentation fixes, minor cleanup, renames a test, adds TODOs, and fixes test logic
* Removes unnecessary `ParameterSubsidy` impl for &Network, adds docs and TODOs
---------
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
* adds a tonic server
* Adds a test stub, moves method impls to their own modules, minor fixes.
* Moves indexer rpc mod behind a feature, adds a config field for its listen address, and initializes the indexer RPC when zebrad starts
* Skips tonic_build() in zebra-rpc build script unless indexer-rpcs feature is selected, simplifies indexer.proto file, makes tonic deps optional
* formats zebra-rpc Cargo.toml
* Adds tokio_stream dependency, adds chain_tip_change field to IndexerRPC, and implements a simple version of the chain_tip_change RPC method
* passes latest chain tip to indexer::server::init from start cmd and updates vectors test
* Update zebra-rpc/src/config.rs
* fixes a race condition in trusted_chain_sync_handles_forks_correctly
* readd the scanner tests in the new binary context
* remove commented out tests from zebrad
* add Cargo.lock
* add local copy of `ZECPAGES_SAPLING_VIEWING_KEY` to binary scanning tests
* moves scanner-results-reader to zebra-scan, adds zebrad bin to zebra-scan, adds a short sleep before trying to connect to gRPC server in test
* always include zebrad dependency in zebra-scan
* renames zebrad bin in zebra-scan to zebrad-for-scanner
* skip test when a cached state is missing
* remove scanning config from zebrad
* move `scan_task_commands` out of zebrad acceptance tests
* remove scanner config from zebrad
* do not panic if env var is not there
* re enable start_scan_where left, remove shielded-scan feature foir scanning tests in CI
* change app names
* uncomment test
* fix the scanner tests in CI by changing the test command
* add log needed by CI?
* move test
* rename trait, docs fix
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* Adds an init_read_only() fn in zebra-state
* moves elasticsearch initialization to `FinalizedState::new_with_debug()`
* Updates callers of `FinalizedState::{new, new_with_debug}` to pass a bool to try enabling elasticsearch
* Adds a non-finalized read state syncer to zebra-rpc
* moves, removes, updates, or addresses TODOs
* reduces disk IO while waiting for the a new chain tip & updates the chain tip sender when the finalized tip has changed.
* Returns boxed errors from RpcRequestClient methods instead of color_eyre type
* Avoids resetting the non-finalized state when there's an error getting a block unless it has the missing block error code.
* Adds stub for acceptance test(s) and removes outdated TODO
* adds TODOs for testing
* Tests that `ChainTipChange` is updated when the non-finalized best chain grows
* adds a last_chain_tip_hash and uses a FuturesOrdered for getblock requests
* Fixes a pre-flush sync issue by using a secondary db instead of a read-only db
* Moves disk IO to blocking tasks
* Updates acceptance test to how forks are handled
* Checks synced read state for all of the expected blocks
* checks that there isn't a tip change until the best chain changes
* checks for chain tip changes in test
* run test without feature
* fixes lint
* Fixes compilation/test issues
* Adds docs / comments, moves HexData out from behind the getblocktemplate-rpcs feature flag, moves test behind the mining feature flag.
* Fixes lints
* removes syncer and rpc-syncer features
* Fixes test on Windows, applies suggestions from code review
* Updates `POLL_DELAY` documentation
* Updates method docs
* Fixes a test bug
* use rpc-client feature in zebrad production code
* use rpc-client feature in zebra-node-services for building zebra-rpc crate
---------
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Update `CHANGELOG.md`
* chore: Release
* Update versions in the release dry-run workflow
* Update EOS
* Estimate release height to ~ upcoming Tuesday
* Apply suggestions from code review
Co-authored-by: Arya <aryasolhi@gmail.com>
* Add a "Summary" title to the changelog
* Remove the summary title
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* Adds documention to the Zebra book about custom Testnets, allows for configuring custom Testnet genesis hashes, refactors check for compatible custom Testnets, adds a TODO, and uses the default testnet when there's an empty or default `testnet_parameters` field in Zebra's network config.
* Adds example configs to custom Testnet docs, moves note about inbound connections on Regtest to a footnote.
* Adds a changelog entry
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* Addresses suggestions from code review.
* Apply suggestions from code review
Co-authored-by: Arya <aryasolhi@gmail.com>
* Update book/src/user/custom-testnets.md
---------
Co-authored-by: Marek <mail@marek.onl>
* Uses an OS-assigned port when testing rpc_server_spawn
* reads port from logs and enables 2 acceptance tests on Windows
* generalizes read listen addr from logs fn and re-enables another test
* updates zebra-grpc snapshot tests to use OS-assigned port
* Re-enable grpc vectors tests on Windows while avoiding port conflicts
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Remove code that starts the scanner
* Update CHANGELOG
* Disable tests of the scanner
* Disable scanning tests in CI
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Remove general conditional compilation flags
See https://blog.rust-lang.org/2024/05/06/check-cfg.html
The conditional compilation flags for tor were superfluous as we can
make do fine with using only features.
* Update changelog
* Add `tokio_unstable` to to `unexpected_cfgs`
* Update changelog
* Fix `tokio_unstable` in `zebrad`
* Always set mempool.debug_enable_at_height to 0 on Regtest
* Adds a Regtest with Zebra page to the book
* Deduplicates calls to is_regtest() in start fn
* upgrade min rust version in zebrad
* Display full network name in logs except for Mainnet and default Testnet
* Add example logs/code to regtest section of the book
* apply some extra information
Co-authored-by: Arya <aryasolhi@gmail.com>
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Marek <mail@marek.onl>
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
* Allow custom testnets to define more parameters and to make peer connections based on the initial_testnet_peer config field
* Updates latest stored test config
* Update zebra-network/src/config.rs
Co-authored-by: Arya <aryasolhi@gmail.com>
---------
Co-authored-by: Marek <mail@marek.onl>
* Adds a `target_difficulty_limit` field on `testnet::Parameters`
* updates test to increment block nonce until finding a block that's below the difficulty threshold
* increment the nonce while the difficulty is invalid instead of while the difficulty threshold is invalid
* Adds comments
* moves network Magic type from zebra-network to zebra-chain
* Adds `network_magic` field to `testnet::Parameters` and uses the regtest network magic from zcashd
* Add a network magic config field for custom testnets
* Adds/updates tests
* Update zebra-chain/src/parameters/network/testnet.rs
* Adds a link to the Regtest network magic in zcashd
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Adds a `target_difficulty_limit` field on `testnet::Parameters`
* updates test to increment block nonce until finding a block that's below the difficulty threshold
* increment the nonce while the difficulty is invalid instead of while the difficulty threshold is invalid
* Adds comments
* Reduce the end of support time from 20 weeks to 16 weeks.
* Update release-process section of the book
* Adds changelog entry
* Update CHANGELOG.md
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Allow configurable Nu5 activation height on Regtest
* Fixes test
* removes outdated TODO
* Adds `current_with_activation_height()` method and uses it in `Commitment::from_bytes()`
* Enables parts of the internal miner for use on Regtest when the solution isn't checked
* Update internal miner config field docs
* Allow configurable Nu5 activation height on Regtest
* Fixes test
* removes outdated TODO
* Adds `current_with_activation_height()` method and uses it in `Commitment::from_bytes()`
* changelog and readme for 1.7.0 release
* chore: Release
* update zebra-scan and zebra-grpc to the release crates dry run script
* update ESTIMATED_RELEASE_HEIGHT
* update the release period to 6 weeks
* update release block
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
---------
Co-authored-by: Marek <mail@marek.onl>
* Always activate Canopy at Height(1) on Regtest
* Ignores the zip 212 grace period on configured Testnets and Regtest
* - Returns early when there is no Heartwood activation height when creating or updating HistoryTree
- Skips call to `check::legacy_chain()` when no NU5 activation height is set (it would return immediately anyway)
- Replaces `.map()` with `.filter_map()` in `NetworkUpgrade::target_spacings()`
- Removes outdated TODO
* - When proof of work is disabled, skips checking if Zebra is synced to the network tip in the getblocktemplate method
* Sets full_verifier_utxo_lookahead to Height::MIN instead of panicking
* When network is regtest, skips starting sync task and commits the genesis block if it's missing in the state
* updates/fixes test config
* Adds test for committing Canopy blocks on Regtest
* - Updates median time past and difficulty checks to use fewer than 11/17/28 blocks
* uses SLOW_START_INTERVAL of 0 if PoW is disabled, adds TODOs
* Update getblocktemplate method to return reserved chain history activation root hash, uses Nu5 at height 1
Test passes.
* Updates test to expect NU5 as the default nu activation at Height(1)
* Removes invalid difficulty snapshot
* fixes tests
* removes regtest NU5 activation height config field
* Apply suggestions from code review
* Update zebra-state/src/service/check/difficulty.rs
Co-authored-by: Marek <mail@marek.onl>
* Update zebra-state/src/service/check/difficulty.rs
* Updates docs/comments, renames an argument
---------
Co-authored-by: Marek <mail@marek.onl>
* minor cleanup and rename
* Adds an empty NetworkParameters struct to Network::Testnet variant, updates production code.
* Updates tests
* Adds `NetworkKind` and uses it instead of `Network` in `HistoryTreeParts` and `transparent::Address`
* Adds a [network.testnet_parameters] section to the config, uses `NetworkKind` as zebra_network::Config::network field type, and converts 'Network' to `NetworkKind` before serializing
* Applies some suggestions from code review
* Applies suggestions from code review
* returns b58 prefix constants directly to remove From<NetworkKind> impl for zcash_primitives::consensus::Network
* Applies more suggestions from code review.
* moves conversions to zcash_primitives::consensus::Network to where they're used.
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* rename `network` variables and method names typed as NetworkKind to `network_kind`
* use only test block heights for the network associated with them
* Applies more suggestions from code review.
* Rename `NetworkParameters` to `Parameters` and move it a new `testnet` module
* adds activation heights field
* updates stored test config, adds a quicker test for checking that stored configs can be parsed, adds an intermediate representation of activation heights
* implement Parameters for Network
* Passes &Network directly instead of converting to zp_consensus::Network where there were conversions
* fixes a bad merge (removes a network conversion in zcash_note_encryption)
* Adds a test for the Parameters impl for zebra_chain::Network
* fixes doc links
* - Makes the `activation_heights` config field optional by adding a #[serde(default)]
- Panics if a non-zero activation height is provided for the `Genesis` network upgrade
- Always sets the `Genesis` and `BeforeOverwinter` network upgrade activation heights to 0 and 1, `BeforeOverwinter` could be overwritten by a later network upgrade
- Makes the `activation_heights` field on `Parameters` private, adds/uses an accessor method instead, and adds a builder struct and `build()` method
* small refactor of activation_heights() method
* check that activation heights are in the right order
* Updates `NetworkUpgrade::activation_height()` to return the height of the next NetworkUpgrade if it doesn't find the activation height of `&self`
* checks that the miner address is of TestnetKind on Regtest and update assertion message
* Adds a DNetworkUpgradeActivationHeights struct for better control over how activation heights can be configured
* moves all ordered network upgrades to a constant, adds a no_duplicates test, moves struct with activation heights outside deserialization impl and accepts it in `ParametersBuilder::activation_heights()` instead of a Vec
* panics if any network upgrades are configured to activate at Height(0) because it's reserved for Genesis
* Simplifies the `ParametersBuilder::activation_heights()` method and removes an unnecessary test.
* Adds Sapling HRPs as fields on testnet params. (#8398)
* Applies suggestions from code review.
* Update zebra-chain/src/parameters/network_upgrade.rs
Co-authored-by: Marek <mail@marek.onl>
* Adds `network_name` field and accessor method on `Parameters`, uses it in the `Display` impl for `Network`
* Removes unnecessary `.filter()`
* adds constraints on valid network names and a test
* adds config field for setting network name, adds "with_" prefix to ParameterBuilder setter methods
* Adds `MainnetKind`, `TestnetKind`, and `RegtestKind` to reserved network names
* updates stored test configs and fixes `network_name()` docs
* Adds a `new_regtest()` method on `Network` and `testnet::Parameters`, updates config deserialization to return an error if the initial_testnet_peers include any default initial peers AND contain configured activation heights
* Updates `activates_network_upgrades_correctly` test to check Regtest activation heights (and default Mainnet/Testnet)
* Refactors if-let & match statement into general match statement, removes constraint against including `testnet_parameters` field/section in the config when using `Mainnet` or `Regtest`
* Removes outdated TODO
* Restores `testnet_parameters` section of the latest stored config.
* Adds `with_sapling_hrps()` method and uses it to set the Regtest HRPs in `new_regtest()`.
Adds a test for Sapling HRP validation
* Checks that default Mainnet/Testnet/Regtest Sapling HRPs pass validation in `with_sapling_hrps()`
* Uses the correct constant in test
* Adds `is_regtest()` methods
* Adds genesis hash methods and fields to `testnet::Parameters` and its builder
* Copies Regtest genesis block from zcashd
* moves genesis hash check to Network.checkpoint_list()
* Checks the first line in the checkpoint list instead of the first item in the BTreeMap
* Checks that there is _some_ genesis block in the checkpoints list in `from_list()`, adds Regtest checkpoints (which only includes the genesis block)
* Adds a doc comment to `ParametersBuilder::default()`
* Adds a `disable_pow` field and skips checking proof of work if it's true
* Makes `equihash::Solution` an enum to support Regtest solutions, adds a test for validating and committing the Regtest genesis block
* use genesis_hash as first checkpoint when checkpoints are missing for configured testnets too
* Applies suggestions from code review.
* Reverts changes to `activation_height()` method
* Avoids panic in test
* Updates test docs
* drop custom panic hooks after expected panics
---------
Co-authored-by: Marek <mail@marek.onl>
* minor cleanup and rename
* Adds an empty NetworkParameters struct to Network::Testnet variant, updates production code.
* Updates tests
* Adds `NetworkKind` and uses it instead of `Network` in `HistoryTreeParts` and `transparent::Address`
* Adds a [network.testnet_parameters] section to the config, uses `NetworkKind` as zebra_network::Config::network field type, and converts 'Network' to `NetworkKind` before serializing
* Applies some suggestions from code review
* Applies suggestions from code review
* returns b58 prefix constants directly to remove From<NetworkKind> impl for zcash_primitives::consensus::Network
* Applies more suggestions from code review.
* moves conversions to zcash_primitives::consensus::Network to where they're used.
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* rename `network` variables and method names typed as NetworkKind to `network_kind`
* use only test block heights for the network associated with them
* Applies more suggestions from code review.
* Rename `NetworkParameters` to `Parameters` and move it a new `testnet` module
* adds activation heights field
* updates stored test config, adds a quicker test for checking that stored configs can be parsed, adds an intermediate representation of activation heights
* implement Parameters for Network
* Passes &Network directly instead of converting to zp_consensus::Network where there were conversions
* fixes a bad merge (removes a network conversion in zcash_note_encryption)
* Adds a test for the Parameters impl for zebra_chain::Network
* fixes doc links
* - Makes the `activation_heights` config field optional by adding a #[serde(default)]
- Panics if a non-zero activation height is provided for the `Genesis` network upgrade
- Always sets the `Genesis` and `BeforeOverwinter` network upgrade activation heights to 0 and 1, `BeforeOverwinter` could be overwritten by a later network upgrade
- Makes the `activation_heights` field on `Parameters` private, adds/uses an accessor method instead, and adds a builder struct and `build()` method
* small refactor of activation_heights() method
* check that activation heights are in the right order
* Updates `NetworkUpgrade::activation_height()` to return the height of the next NetworkUpgrade if it doesn't find the activation height of `&self`
* checks that the miner address is of TestnetKind on Regtest and update assertion message
* Adds a DNetworkUpgradeActivationHeights struct for better control over how activation heights can be configured
* moves all ordered network upgrades to a constant, adds a no_duplicates test, moves struct with activation heights outside deserialization impl and accepts it in `ParametersBuilder::activation_heights()` instead of a Vec
* panics if any network upgrades are configured to activate at Height(0) because it's reserved for Genesis
* Simplifies the `ParametersBuilder::activation_heights()` method and removes an unnecessary test.
* Adds Sapling HRPs as fields on testnet params. (#8398)
* Applies suggestions from code review.
* Update zebra-chain/src/parameters/network_upgrade.rs
Co-authored-by: Marek <mail@marek.onl>
* Adds `network_name` field and accessor method on `Parameters`, uses it in the `Display` impl for `Network`
* Removes unnecessary `.filter()`
* adds constraints on valid network names and a test
* adds config field for setting network name, adds "with_" prefix to ParameterBuilder setter methods
* Adds `MainnetKind`, `TestnetKind`, and `RegtestKind` to reserved network names
* updates stored test configs and fixes `network_name()` docs
* Adds a `new_regtest()` method on `Network` and `testnet::Parameters`, updates config deserialization to return an error if the initial_testnet_peers include any default initial peers AND contain configured activation heights
* Updates `activates_network_upgrades_correctly` test to check Regtest activation heights (and default Mainnet/Testnet)
* Refactors if-let & match statement into general match statement, removes constraint against including `testnet_parameters` field/section in the config when using `Mainnet` or `Regtest`
* Removes outdated TODO
* Restores `testnet_parameters` section of the latest stored config.
* Adds `with_sapling_hrps()` method and uses it to set the Regtest HRPs in `new_regtest()`.
Adds a test for Sapling HRP validation
* Checks that default Mainnet/Testnet/Regtest Sapling HRPs pass validation in `with_sapling_hrps()`
* Uses the correct constant in test
* Adds `is_regtest()` methods
* Updates test docs
* drop custom panic hooks after expected panics
---------
Co-authored-by: Marek <mail@marek.onl>