* zebra_script: change to use new zcash_script callback API
* add precomputation
* cleanups
* use released zcash_script
* fix clippy error
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* improve docs
* use tuple instead of two Option params
---------
Co-authored-by: Marek <mail@marek.onl>
* Stop using `displaydoc`
* Fix comment alignment
This commit is unrelated to the solution in this branch. There's a new
lint that produces a warning when lists in comments are not aligned well.
* upgrade zcash_client_backend for zebra-scan
* leave zebra-utils untouched
* remove unused
* upgrade zcash_primitives and orchard only for zebra-chain crate
* update and use TryFrom for amounts
* fix imports in serialize
* leave doc as it was
* leave doc as it was 2
* use `try_into` for amount
* use `zip_212_enforcement`
* updgrades primitives in zebra-rpc
* upgrade ecc dependencies for cargo-utils
* fix threading issue
* remove non needed Arc
* update deny.toml
* update primitives for zebra-grpc
* fix doc
* remove non needed single thread code in test
* cleanup some tests
* improve a bit the `ready_scan_block_keys` function
* clippy
* add spawn back in `scan_height_and_store_results`
* remove todo
* add note comment
* use a more explicit import of sapling stuff in serialize
* change(scan): Refactor scanning keys (#8577)
* Refactor converting dfvks to scanning keys
* Simplify handling of scanning keys
* Remove `test-dependencies` from the scanner reader
* Add comments
---------
Co-authored-by: Marek <mail@marek.onl>
* 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
* 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
* - Adds `slow_start_interval` field to `testnet::Parameters`
- Moves SLOW_START_INTERVAL/SLOW_START_SHIFT constants to zebra-chain
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
---------
Co-authored-by: Marek <mail@marek.onl>
* 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>
* Use full paths for types from `zcash_primitives`
Upcoming commits will use `zcash_protocol::consensus::Parameters`, which
would make names such as `zp_consensus::Parameters` ambiguous since such
a name could stand for both `zcash_primitives...` and
`zcash_protocol...`.
* Impl and use conversion between network kinds
These conversions will make implementing
`zcash_protocol::consensus::Parameters` for `Network` easier.
* Impl conversions between network upgrades
* Impl `zcash_protocol::consensus::Parameters`
* Move `mod address` from under the gbt feature
* Remove a redundant `impl From`
* Impl `From` for a reference type correctly
The previous implementation called `into` on a reference without
dereferencing it. I thought the compiler would implicitly dereference,
but it didn't, which lead to infinite recursion since the fn ended up
calling itself.
* 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>
* 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>
* 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
* 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>
* 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>
* 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>
* 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>
* 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
* removed derive copy from network, address and ledgerstate
* changed is_max_block_time_enforced to accept ref
* changed NetworkUpgrade::Current to accept ref
* changed NetworkUpgrade::Next to accept ref
* changed NetworkUpgrade::IsActivationHeight to accept ref
* changed NetworkUpgrade::TargetSpacingForHeight to accept ref
* changed NetworkUpgrade::TargetSpacings to accept ref
* changed NetworkUpgrade::MinimumDifficultySpacing_forHeight to accept ref
* changed NetworkUpgrade::IsTestnetMinDifficultyBlock to accept ref
* changed NetworkUpgrade::AveragingWindowTimespanForHeight to accept ref
* changed NetworkUpgrade::ActivationHeight to accept ref
* changed sapling_activation_height to accept ref
* fixed lifetime for target_spacings
* fixed sapling_activation_height
* changed transaction_to_fake_v5 and fake_v5_transactions_for_network to accept ref to network
* changed Input::vec_strategy to accept ref to network
* changed functions in zebra-chain/src/primitives/zcash_history.rs to accept ref to network
* changed functions in zebra-chain/src/history_tree.rs to accept ref to network
* changed functions in zebra-chain/src/history_tree.rs to accept ref to network
* changed functions in zebra-chain/src/primitives/address.rs to accept ref to network
* changed functions in zebra-chain/src/primitives/viewing_key* to accept ref to network
* changed functions in zebra-chain/src/transparent/address.rs to accept ref to network
* changed functions in zebra-chain/src/primitives/zcash_primitives.rs to accept ref to network
* changed functions in zebra-chain/src/primitives/zcash_note_encryption.rs to accept ref to network
* changed functions in zebra-chain/src/primitives/history_tree* to accept ref to network
* changed functions in zebra-chain/src/block* to accept ref to network
* fixed errors in zebra-chain::parameters::network
* fixed errors in zebra-chain::parameters::network
* fixed errors in zebra-chain
* changed NonEmptyHistoryTree and InnerHistoryTree to hold value instead of ref
* changed NonEmptyHistoryTree and InnerHistoryTree to hold value instead of ref
* fixed errors in zebra-chain/src/block/arbitrary.rs
* finished fixing errors in zebra-chain - all crate tests pass
* changed functions in zebra-state::service::finalized_state to accept &Network
* changed functions in zebra-state::service::non_finalized_state to accept &Network
* zebra-state tests run but fail with overflow error
* zebra-state tests all pass
* converted zebra-network -- all crate tests pass
* applied all requested changes from review
* converted zebra-consensus -- all crate tests pass
* converted zebra-scan -- all crate tests pass
* converted zebra-rpc -- all crate tests pass
* converted zebra-grpc -- all crate tests pass
* converted zebrad -- all crate tests pass
* applied all requested changes from review
* fixed all clippy errors
* fixed build error in zebrad/src/components/mempool/crawler.rs
* begin refactor suggested as "step 2": https://github.com/ZcashFoundation/zebra/issues/7968#issue-2003245309
Squashed from multiple commits to enable partial rebase
* break out more little traits
* add activation implementation leveraging From<Network> for lrz::cons::
* for transfer of ownership I cannot return a type that's owned by the method
* hrp_sapling_extended_full_viewing_key
* complete implementation of interface of Parameters on Network reuse Parameters on zcash Network where possible
* move doc-comments to trait declarations (from impls)
* Simplify/complete Parameters impl for Network
* Add checkpoint_list method, move documentation, etc
* move last match network to inside network method
* add back comment
* use zcash_address for parameter types in zebra-chain
* use inherent methods instead of big parameters passthrough
* revert to implementation of From on zcash_primitives::..::Network vs &zcash_prim...
* move match
* add test to block maximum time rule
* update changelog
* finish porting target_difficutly_limit
* remove obscelete code comment
* revert non-functional change
* finish migrating target_difficulty_limit, checkpoint_list
* update changelog
---------
Co-authored-by: Hazel OHearn <gygaxis@zingolabs.org>
* added functions for fetching block vectors
* inserted new network methods for vector fetching into zebra-chain
* changed tag back to test/feature=branch
* changed tag back to test/feature=branch
* changed tag back to test/feature=branch
* changed feature tag to proptest-impl, started implementing in zebra-consensus tests
* adding methods to zebra-consensus, lifetime error in src/transaction/tests.rs, needs refactoring
* finished adding methods to zebra-consensus
* finished adding new methods to zebrad
* added new methods to zebra-rpc and zebra-scan
* finished removing statements matching on Network from tests
* updated new error message
* changed get_block_bytes() and get_block_sapling_roots_bytes to return option and removed serialization error types as per requested changes in PR review
* removed match statements from zebra_chain::transaction::arbitrary::test_transactions() and new zebra-grpc tests
* moved zebra-chain::test_utils to zebra-chain::test
* removed get_ prefix from getter methods
* renamed zebra-chain::test to zebra-chain::tests
* renamed zebra-chain::test to zebra-chain::tests
* fixed clippy warnings
* changed block_map to return clone
* chore(dev-deps): always specify the version for dev-dependencies
* test(tower-batch-control): remove zebra-consensus dev dependency
Copies the Ed25519Verifier code directly to tower-batch-control tests
* test(zebra-consensus): update ed25519 verifier tests with ones from batch-control
* test(zebra-consensus): restore previous timeout values
The timeouts copied from tower-batch-control seems too low
and there must have been a reasoning why were they introduced
* chore: update dev-deps versions to beta.33
* chore(tower-batch-control): remove dev-dependency on metrics
* chore(tower-batch-control): remove zebra-chain dev-dependency
* Update zebra-scan/Cargo.toml
* bump all versions to match current release
* fix missed commas in version bumps
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
Co-authored-by: Pili Guerra <mpguerra@users.noreply.github.com>
* Impl generating continuous deserialized blocks
* Make `sapling_efvk_hrp` `pub`
* Don't wait for Sapling activation height in tests
* Set the sleep interval for scan service to 10 secs
* Simplify `sapling_key_to_scan_block_keys`
* Enable mocking Sapling scanning keys for Testnet
* Test the `RegisterKeys` scan service call
* Enable `shielded-scan` for `zebra-chain`
* Use an ephemeral database so results don't persist
* Don't generate blocks when mocking the state
* Improve error messages
* Simplify seeding mocked Sapling viewing keys
* Apply suggestions from code review
Co-authored-by: Arya <aryasolhi@gmail.com>
* Use a manual iterator over `Network`
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* Refactor obtaining of activation heights
* Impl the `RegisterKeys` service request
* Mock viewing keys for tests
* Refactor tests
* Apply suggestions from code review
Co-authored-by: Arya <aryasolhi@gmail.com>
* Remove a redundant comment
I don't think we need to assume the genesis block doesn't contain
shielded data as the comment says.
* Avoid using a single-letter variable
* Refactor mocking Sapling scanning keys
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* adds/impls types in zebra-chain to be used by the zebra-scan RPC server
* Adds methods for parsing and a test
* adds test for key hash encoding
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* refactors viewing key type
* refactors/renames for viewing keys
* fixes doc links
* Apply suggestions from code review
* Apply suggestions from code review
* removes ViewingKeyHash and ViewingKeyWithHash types
* removes `to_bytes` methods
* remove outdated method and call
---------
Co-authored-by: Marek <mail@marek.onl>
* Patch equihash to use the solver branch
* Add an internal-miner feature and set up its dependencies
* Remove 'Experimental' from mining RPC docs
* Fix a nightly clippy::question_mark lint
* Move a byte array utility function to zebra-chain
* fixup! Add an internal-miner feature and set up its dependencies
* Add an equihash::Solution::solve() method with difficulty checks
* Check solution is valid before returning it
* Add a TODO to check for peers before mining
* Move config validation into GetBlockTemplateRpcImpl::new()
* fixup! fixup! Add an internal-miner feature and set up its dependencies
* Use the same generic constraints for GetBlockTemplateRpcImpl struct and impls
* Start adding an internal miner component
* Add the miner task to the start command
* Add basic miner code
* Split out a method to mine one block
* Spawn to a blocking thread
* Wait until a valid template is available
* Handle shutdown
* Run mining on low priority threads
* Ignore some invalid solutions
* Use a difference nonce for each solver thread
* Update TODOs
* Change the patch into a renamed dependency to simplify crate releases
* Clean up instrumentation and TODOs
* Make RPC instances cloneable and clean up generics
* Make LongPollId Copy so it's easier to use
* Add API to restart mining if there's a new block template
* Actually restart mining if there's a new block template
* Tidy instrumentation
* fixup! Move config validation into GetBlockTemplateRpcImpl::new()
* fixup! Make RPC instances cloneable and clean up generics
* Run the template generator and one miner concurrently
* Reduce logging
* Fix a bug in getblocktemplate RPC tip change detection
* Work around some watch channel change bugs
* Rate-limit template changes in the receiver
* Run one mining solver per available core
* Use updated C code with double-free protection
* Update to the latest solver branch
* Return and submit all valid solutions
* Document what INPUT_LENGTH means
* Fix watch channel change detection
* Don't return early when a mining task fails
* Spawn async miner tasks to avoid cooperative blocking, deadlocks, and improve shutdown responsiveness
* Make existing parallelism docs and configs consistent
* Add a mining parallelism config
* Use the minimum of the configured or available threads for mining
* Ignore optional feature fields in tests
* Downgrade some frequent logs to debug
* Document new zebrad features and tasks
* Describe the internal-miner feature in the CHANGELOG
* Update dependency to de-duplicate equihash solutions
* Use futures::StreamExt instead of TryStreamExt
* Fix a panic message typo
* impl TryFrom<zcash_primitives::BlockHeight> for Height
* Add type-safe read and write database methods
* Only allow typed access to the scanner DB
* Update docs
* Implement a common method as a trait
* Fix imports
* Tidy state imports
* Activate tracing logging macros in the whole scanner crate
* Fix dead code warnings
* Use a more sensible export order
* Remove a 1.72 lint exception now 1.74 is stable
* Switch history trees over to TypedColumnFamily, and remove redundant code
* Add typed batch creation methods, and switch history trees to them
* Convert ValueBalance to typed column families
* Make the APIs compatible after a merge
* Use `ZebraDb` instead of `DiskDb` where needed
---------
Co-authored-by: Marek <mail@marek.onl>
* impl TryFrom<zcash_primitives::BlockHeight> for Height
* Add type-safe read and write database methods
* Only allow typed access to the scanner DB
* Update docs
* Implement a common method as a trait
* Fix imports
* Tidy state imports
* Activate tracing logging macros in the whole scanner crate
* Fix dead code warnings
* Add a scanning results reader
* Simplify intro & titles in `zebra-utils/README.md`
* Add a tutorial for the scanning results reader
* Reformat `zebra-utils/Cargo.toml`
Co-authored-by: teor <teor@riseup.net>
* Update `zebra-utils/README.md`
Co-authored-by: teor <teor@riseup.net>
* standard grouping
Co-authored-by: teor <teor@riseup.net>
* Add a comment on a first empty memo
Co-authored-by: teor <teor@riseup.net>
* Use `exactly_one()` instead of `next()`
* Simplify various type conversions
---------
Co-authored-by: teor <teor@riseup.net>
* Refactor test data into functions
* Add a typed snapshot test for scanner storage
* Use standard hex serialization with SaplingScannedResult
* Simplify transaction::Hash hex serialization
* Sort HashMaps before snapshotting
* Add typed snapshot data
* Derive & impl helper traits from `std`
* Create `compact_to_v4` fn
* Create `fake_block` fn
* Refactor existing tests to use the new functions
* Cosmetics
* Refactor docs
* Put `Default` behind `cfg_attr(test)`
Rationale
---------
We avoid implementing `Default` on consensus-critical types because it's
easy to miss an incorrect use in a review. It's easy to hide a
`default()` in a call like `unwrap_or_default()` or even more subtle
methods.
---------
Co-authored-by: teor <teor@riseup.net>
* Wrap `zcash_client_backend::scanning::scan_block`
* Use the new `scan_block` fn
* Use full path for `zcash::primitives::Network`
* Add docs for `scan_block`
* Impl `From` for networks in `zcash_primitives`
* Update zebra-scan/src/tests.rs
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Move code from `tests.rs` to `scan.rs`
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* Refactor return type of poll_discover()
* Simplify poll_ready() by removing preselected peers
* Fix peer set readiness check
* Pass task context correctly to background tasks
* Make poll_discover() return Pending
* Make poll_inventory() return Pending
* Make poll_unready() return Poll::Pending
* Simplify with futures::ready!() and ?
* When there are no peers, wake on newly ready peers, or new peers, in that order
* Preserve the original waker when there are no unready peers
* Fix polling docs and remove unnecessary code
* Make sure we're ignoring Poll::Pending not Result
* Make panic checking method names clearer
* Fix connection Client task wakeups and error handling
* Cleanup connection panic handling and add wakeup docs
* Fix connection client task wakeups to prevent hangs
* Simplify error and pending handling
* Clarify inventory set behaviour
* Define peer set poll_* methods so they return Ok if they do something
* Clarify documentation
Co-authored-by: Arya <aryasolhi@gmail.com>
* Fix test that depended on preselected peers
* Check ready peers for errors before sending requests to them
* Fix a hanging test by not waiting for irrelevant actions
* Only remove cancel handles when they are required
* fix incorrect panic on termination setting
* Clarify method comments
Co-authored-by: Arya <aryasolhi@gmail.com>
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* Stop using `SemanticallyVerifiedBlockWithTrees`
* Apply suggestions from code review
Co-authored-by: teor <teor@riseup.net>
* Doc that default treestate corresponds to genesis
* Doc the diff between default values of tree roots
---------
Co-authored-by: teor <teor@riseup.net>
* Simple replacements of doc.zebra.zfnd.org with docs.rs
* Manual fixes for specific main/internal/external docs
* Point developer docs to doc-internal.zebra.zfnd.org
* fastmod --glob '\!.git' -- doc.zebra.zfnd.org/zebrad docs.rs/zebrad/latest/zebrad
* Manually remove any remaining doc.zfnd.zebra.org links
* Remove the external docs job
* Add changelog entry and fix links
* Fix links that were broken before this PR
* Fix the combining of Sapling subtrees
This commit fixes a bug due to which the function `sapling_subtrees`
used to always include all subtrees from the non-finalized state without
respecting the given limit.
* Fix the combining of Orchard subtrees
This commit fixes a bug due to which the function `orchard_subtrees`
used to always include all subtrees from the non-finalized state without
respecting the given limit.
* Add additional checks when retrieving subtrees
* Allow raw subtree insertions into `Chain` in tests
* Derive `Default` for `Chain`
* Derive `Default` for note commitment tree nodes
* Use `pub(super)` for `DiskWriteBatch`
Set the visibility of `DiskWriteBatch` to `pub(super)`.
* Add tests for retrieving subtrees
* Use `default()` for subtree roots in tests
This change is unrelated to the PR.
* Refactor docs for inserting subtrees
This change is unrelated to the PR.
* Handle negative and zero getnetworksolsps arguments correctly
* Simplify the solsps loop structure
* Simplify loop by avoiding manual iteration and peeking
* Avoid division by zero
* Use min and max times rather than first and last times
* Refactor block iterators so they are more efficient
* Make finding chains easier
* Simplify block iteration code
* Remove implemented TODO comments
* Simplify internal iterator state
* Implement iteration by any chain item
* Iterate block headers rather than full blocks
* Ignore code that is (sometimes) dead
* Fix a dead code warning
* Add a no blocks in state error constant
* Check result values in the RPC test
* Fix invalid calculation handling
* Avoid manual handling of previous sapling trees by using iterator windows instead
* Avoid manual sapling subtree index handling by comparing prev and current subtree indexes instead
* Simplify adding notes by using the exact number of remaining notes
* Simplify by skipping the first block, because it can't complete a subtree
* Re-use existing tree update code
* Apply the sapling changes to orchard subtree updates
* add a reverse database column family iterator function
* Make skipping the lowest tree independent of iteration order
* Move new subtree checks into the iterator, rename to end_height
* Split subtree calculation into a new method
* Split the calculate and write methods
* Quickly check the first subtree before running the full upgrade
* Do the quick checks every time Zebra runs, and refactor slow check error handling
* Do quick checks for orchard as well
* Make orchard tree upgrade match sapling upgrade code
* Upgrade subtrees in reverse height order
* Bump the database patch version so the upgrade runs again
* Reset previous subtree upgrade data before doing this one
* Add extra checks to subtree calculation to diagnose errors
* Use correct heights for subtrees completed at the end of a block
* Add even more checks to diagnose issues
* Instrument upgrade methods to improve diagnostics
* Prevent modification of re-used trees
* Debug with subtree positions as well
* Fix an off-by-one error with completed subtrees
* Fix typos and confusing comments
Co-authored-by: Marek <mail@marek.onl>
* Fix mistaken previous tree handling and end tree comments
* Remove unnecessary subtraction in remaining leaves calc
* Log heights when assertions fail
* Fix new subtree detection filter
* Move new subtree check into a method, cleanup unused code
* Remove redundant assertions
* Wait for subtree upgrade before testing RPCs
* Fix subtree search in quick check
* Temporarily upgrade subtrees in forward height order
* Clarify some comments
* Fix missing test imports
* Fix subtree logging
* Add a comment about a potential hang with future upgrades
* Fix zebrad var ownership
* Log more info when add_subtrees.rs fails
* cargo fmt --all
* Fix unrelated clippy::unnecessary_unwrap
* cargo clippy --fix --all-features --all-targets; cargo fmt --all
* Stop the quick check depending on tree de-duplication
* Refactor waiting for the upgrade into functions
* Wait for state upgrades whenever the cached state is updated
* Wait for the testnet upgrade in the right place
* Fix unused variable
* Fix a subtree detection bug and comments
* Remove an early reference to reverse direction
* Stop skipping subtrees completed at the end of blocks
* Actually fix new subtree code
---------
Co-authored-by: Marek <mail@marek.onl>