Commit Graph

5309 Commits

Author SHA1 Message Date
Arya c91f60d5be Merge branch 'params-new-regtest' into params-genesis-hash 2024-04-24 12:35:59 -04:00
Arya 3b5a7f5f10 drop custom panic hooks after expected panics 2024-04-24 12:25:57 -04:00
Arya 13d59add1f Updates test docs 2024-04-24 11:08:51 -04:00
Arya b7957e9bc5 Merge remote-tracking branch 'origin/main' into params-new-regtest 2024-04-24 11:07:22 -04:00
Arya 275e99ec72
add(chain): Adds a `network_name` field to `testnet::Parameters` (#8411)
* 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

---------

Co-authored-by: Marek <mail@marek.onl>
2024-04-24 11:03:37 +00:00
Arya b3db5b03e5 Avoids panic in test 2024-04-23 19:58:33 -04:00
Arya 479b0b272e Reverts changes to `activation_height()` method 2024-04-23 19:47:31 -04:00
Arya 0f91dd03df Applies suggestions from code review. 2024-04-23 19:12:15 -04:00
Arya d4f6a0ef6b use genesis_hash as first checkpoint when checkpoints are missing for configured testnets too 2024-04-22 19:51:53 -04:00
Alfredo Garcia 8cf0b7a36a
bump(zcash_script): Bump zcash script v0.1.15 and restore Windows support (#8393)
* update zcash_script and zcash_primitives

* restore windows support

* add a windows config file

* try exact output from CI

* ignore config test in windows

* disable test for windows

* remove test for windows

* change zcash_script branch to release

* bump top the last zcash_script release version

* restore `rejection_restores_internal_state_genesis` test

* fix typo in test name and enable single thread on windows

* disable single thread
2024-04-22 22:07:04 +00:00
dependabot[bot] 74319ec477
build(deps): bump rustls from 0.21.10 to 0.21.11 in the cargo group (#8418)
Bumps the cargo group with 1 update: [rustls](https://github.com/rustls/rustls).


Updates `rustls` from 0.21.10 to 0.21.11
- [Release notes](https://github.com/rustls/rustls/releases)
- [Changelog](https://github.com/rustls/rustls/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rustls/rustls/compare/v/0.21.10...v/0.21.11)

---
updated-dependencies:
- dependency-name: rustls
  dependency-type: indirect
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 19:32:06 +00:00
Arya 66336225d8 Makes `equihash::Solution` an enum to support Regtest solutions, adds a test for validating and committing the Regtest genesis block 2024-04-19 20:07:35 -04:00
Arya 69d5d75ac5 Adds a `disable_pow` field and skips checking proof of work if it's true 2024-04-19 20:06:38 -04:00
Marek 2ba837470e
Bump `chrono` from 0.4.34 to 0.4.38 (#8400)
* Bump `chrono` from 0.4.34 to 0.4.38

* Stop using the deprecated `from_timestamp_opt`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2024-04-19 23:23:57 +00:00
Arya bcc127b618 Adds a doc comment to `ParametersBuilder::default()` 2024-04-19 17:33:32 -04:00
Arya 336c8277c5 Checks that there is _some_ genesis block in the checkpoints list in `from_list()`, adds Regtest checkpoints (which only includes the genesis block) 2024-04-19 17:18:06 -04:00
Arya 5690d4e2f4 Checks the first line in the checkpoint list instead of the first item in the BTreeMap 2024-04-19 16:32:05 -04:00
Arya c30537d946 moves genesis hash check to Network.checkpoint_list() 2024-04-19 16:16:57 -04:00
Arya 97b43cb8ff Copies Regtest genesis block from zcashd 2024-04-19 15:46:03 -04:00
Arya a8b4e278b7 Adds genesis hash methods and fields to `testnet::Parameters` and its builder 2024-04-19 15:46:03 -04:00
Arya b38dbfd252 Adds `is_regtest()` methods 2024-04-19 15:43:51 -04:00
Arya 9b41cba5a3 Uses the correct constant in test 2024-04-19 15:43:51 -04:00
Arya 4671efe98c Checks that default Mainnet/Testnet/Regtest Sapling HRPs pass validation in `with_sapling_hrps()` 2024-04-19 15:43:51 -04:00
Arya d8715909e2 Adds `with_sapling_hrps()` method and uses it to set the Regtest HRPs in `new_regtest()`.
Adds a test for Sapling HRP validation
2024-04-19 15:43:51 -04:00
Arya 63623ae53f Restores `testnet_parameters` section of the latest stored config. 2024-04-19 15:43:51 -04:00
Arya 32e4fbbc51 Removes outdated TODO 2024-04-19 15:43:51 -04:00
Arya e816c6616c 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` 2024-04-19 15:43:51 -04:00
Arya 32d0758702 Updates `activates_network_upgrades_correctly` test to check Regtest activation heights (and default Mainnet/Testnet) 2024-04-19 15:43:51 -04:00
Arya 6e29727861 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 2024-04-19 15:43:51 -04:00
Arya c79e06f2b5 Merge remote-tracking branch 'origin/main' into params-network-name 2024-04-19 15:42:21 -04:00
dependabot[bot] f1334a8378
build(deps): bump the devops group with 2 updates (#8408)
Bumps the devops group with 2 updates: [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) and [baptiste0928/cargo-install](https://github.com/baptiste0928/cargo-install).


Updates `reviewdog/action-actionlint` from 1.43.0 to 1.44.0
- [Release notes](https://github.com/reviewdog/action-actionlint/releases)
- [Commits](https://github.com/reviewdog/action-actionlint/compare/v1.43.0...v1.44.0)

Updates `baptiste0928/cargo-install` from 3.0.1 to 3.1.0
- [Release notes](https://github.com/baptiste0928/cargo-install/releases)
- [Changelog](https://github.com/baptiste0928/cargo-install/blob/main/CHANGELOG.md)
- [Commits](https://github.com/baptiste0928/cargo-install/compare/v3.0.1...v3.1.0)

---
updated-dependencies:
- dependency-name: reviewdog/action-actionlint
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: devops
- dependency-name: baptiste0928/cargo-install
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: devops
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-19 09:25:56 +00:00
Arya f8c153991b
add(consensus): Add `activation_heights` field to `NetworkParameters` and implement `Parameters` for `Network` (#8383)
* 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>

---------

Co-authored-by: Marek <mail@marek.onl>
2024-04-19 01:20:34 +00:00
Arya a842c12d55 updates stored test configs and fixes `network_name()` docs 2024-04-18 14:06:22 -04:00
Arya 0e97b53937 Adds `MainnetKind`, `TestnetKind`, and `RegtestKind` to reserved network names 2024-04-18 14:06:22 -04:00
Arya 08f0838079 adds config field for setting network name, adds "with_" prefix to ParameterBuilder setter methods 2024-04-18 14:06:22 -04:00
Arya 1608472f5a adds constraints on valid network names and a test 2024-04-18 14:06:22 -04:00
Arya 1173faf894 Removes unnecessary `.filter()` 2024-04-18 14:06:22 -04:00
Arya a94dcabaca Adds `network_name` field and accessor method on `Parameters`, uses it in the `Display` impl for `Network` 2024-04-18 14:06:22 -04:00
Arya fea2162419
Update zebra-chain/src/parameters/network_upgrade.rs
Co-authored-by: Marek <mail@marek.onl>
2024-04-18 10:13:53 -04:00
Alfredo Garcia 887d4a2457
fix(beta-toolchain): Warnings (#8404)
* fix beta imports and other warnings

* clippy lints beta

* move attributes to after docs

Co-authored-by: Marek <mail@marek.onl>

* move some code to test module

* implement display instead of direct tostring for LongPollId

Co-authored-by: Arya <aryasolhi@gmail.com>

* fix typo

---------

Co-authored-by: Marek <mail@marek.onl>
Co-authored-by: Arya <aryasolhi@gmail.com>
2024-04-18 01:45:22 +00:00
Arya fb2d13a706 Applies suggestions from code review. 2024-04-17 18:57:01 -04:00
Arya 0b835f1f05
Adds Sapling HRPs as fields on testnet params. (#8398) 2024-04-18 00:39:16 +02:00
Alfredo Garcia 2995ea087b
send ping to ES server before inserting data (#8409) 2024-04-17 19:09:16 +00:00
Arya 868535b54c Merge branch 'main' into activ-heights-param-impl 2024-04-17 11:13:54 -04:00
Arya 16a39f89d0
add(consensus/network): Add an empty `Parameters` struct in `Network::Testnet` (#8368)
* 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

---------

Co-authored-by: Marek <mail@marek.onl>
2024-04-17 02:20:34 +00:00
Marek 5fd15a022c
build(deps): bump the prod group with 21 updates (#8402)
* Bump `clap` from 4.5.3 to 4.5.4

* Bump `indexmap` from 2.2.5 to 2.2.6

* Bump `rayon` from 1.9.0 to 1.10.0

* Bump `tokio` from 1.36.0 to 1.37.0

* Bump `tokio-stream` from 0.1.14 to 0.1.15

* Bump `regex` from 1.10.3 to 1.10.4

* Bump `insta` from 1.36.1 to 1.38.0

* Bump `serde_json` from 1.0.113 to 1.0.115

* Bump `prost` from 0.12.2 and 0.12.3 to 0.12.4

* Bump `bitflags` from 2.4.2 to 2.5.0

* Bump `bs58` from 0.5.0 to 0.5.1

* Bump `incrementalmerkletree` from 0.5.0 to 0.5.1

* Bump `zcash_address` from 0.3.1 to 0.3.2

* Bump `bytes` from 1.5.0 to 1.6.0

* Bump `syn` from 2.0.53 to 2.0.58

* Bump `quote` from 1.0.35 to 1.0.36

* Bump `serde_yaml` from 0.9.33 to 0.9.34+deprecated

* Bump `primitive-types` + `zcash_history`

* Bump `jsonrpc` from 0.17.0 to 0.18.0
2024-04-17 02:20:28 +00:00
Arya 1498f8e24e
Release v1.6.1 (#8396)
* Updates crates versions

* Updates end of support height

* Updates README

* Updates CHANGELOG

* Updates Known Issues in README

* Updates Changelog

* updates release-crates-dry-run.sh

* updates install.md and docker.md

* Update CHANGELOG.md

Co-authored-by: Marek <mail@marek.onl>

---------

Co-authored-by: Marek <mail@marek.onl>
2024-04-15 23:24:40 +00:00
dependabot[bot] 153444234b
build(deps): bump the devops group with 2 updates (#8391)
Bumps the devops group with 2 updates: [codecov/codecov-action](https://github.com/codecov/codecov-action) and [tj-actions/changed-files](https://github.com/tj-actions/changed-files).


Updates `codecov/codecov-action` from 4.1.1 to 4.3.0
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4.1.1...v4.3.0)

Updates `tj-actions/changed-files` from 44.0.0 to 44.0.1
- [Release notes](https://github.com/tj-actions/changed-files/releases)
- [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md)
- [Commits](https://github.com/tj-actions/changed-files/compare/v44.0.0...v44.0.1)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: devops
- dependency-name: tj-actions/changed-files
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: devops
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-15 06:51:56 +00:00
Arya 1dfad530b1 Simplifies the `ParametersBuilder::activation_heights()` method and removes an unnecessary test. 2024-04-12 18:15:52 -04:00
Arya 0abe87312b panics if any network upgrades are configured to activate at Height(0) because it's reserved for Genesis 2024-04-12 17:36:07 -04:00