zebra/zebra-network/src
Arya e5d4d739b7
add(consensus/network): Adds `new_regtest()` constructors to `testnet::Parameters` and `Network` (#8413)
* 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>
2024-04-25 04:04:05 +00:00
..
address_book change(chain): Remove `Copy` trait impl from `Network` (#8354) 2024-03-19 20:45:27 +00:00
address_book_peers change(rpc): Add getpeerinfo RPC method (#5951) 2023-01-17 07:09:07 +00:00
config change(chain): Remove `Copy` trait impl from `Network` (#8354) 2024-03-19 20:45:27 +00:00
isolated add(consensus/network): Add an empty `Parameters` struct in `Network::Testnet` (#8368) 2024-04-17 02:20:34 +00:00
meta_addr fix(beta-toolchain): Warnings (#8404) 2024-04-18 01:45:22 +00:00
peer fix(beta-toolchain): Warnings (#8404) 2024-04-18 01:45:22 +00:00
peer_set fix(beta-toolchain): Warnings (#8404) 2024-04-18 01:45:22 +00:00
protocol fix(beta-toolchain): Warnings (#8404) 2024-04-18 01:45:22 +00:00
address_book.rs fix(beta-toolchain): Warnings (#8404) 2024-04-18 01:45:22 +00:00
address_book_peers.rs change(rpc): Add getpeerinfo RPC method (#5951) 2023-01-17 07:09:07 +00:00
address_book_updater.rs change(chain): Remove `Copy` trait impl from `Network` (#8354) 2024-03-19 20:45:27 +00:00
config.rs add(consensus/network): Adds `new_regtest()` constructors to `testnet::Parameters` and `Network` (#8413) 2024-04-25 04:04:05 +00:00
constants.rs add(consensus/network): Add an empty `Parameters` struct in `Network::Testnet` (#8368) 2024-04-17 02:20:34 +00:00
isolated.rs change(chain): Remove `Copy` trait impl from `Network` (#8354) 2024-03-19 20:45:27 +00:00
lib.rs Move history tree and value balance to typed column families (#8115) 2023-12-20 23:20:57 +00:00
meta_addr.rs fix(beta-toolchain): Warnings (#8404) 2024-04-18 01:45:22 +00:00
peer.rs Fix new nightly clippy and rustc lints (#7860) 2023-10-27 19:35:57 +00:00
peer_cache_updater.rs fix(ci): Increase peer cache startup wait time and test time (#7169) 2023-07-07 03:35:41 +00:00
peer_set.rs
policies.rs Delete outdated `TODOs` refering to closed issues (#6732) 2023-05-23 03:33:14 +00:00
protocol.rs