* 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.
* 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>
* 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
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* feat(build): use Docker Build Cloud for image build
* fix(build): secrets, runner and conditional login
* ref(build): avoid using an external cache with Docker Build Cloud
* fix(build): `buildx` setup must be after registry login
* fix: merge
* fix(login): always login to Docker
* fix(build): remove extra build steps
* 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`
* ref(ci): Use a single CI workflow for tests
This is an initial implementation to solve the re-building of our Docker image, which is being built multiple times by our Github Actions.
This is meant to fix -> devops: Build CI Docker runs twice for every PR #7816
* fix(patch): use correct name reference
* chore: reduce diff with correct sentence
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* fix(rules): revert job names, to avoid creating an extra rule
* Update .github/workflows/ci-tests.patch.yml
Co-authored-by: Marek <mail@marek.onl>
---------
Co-authored-by: Marek <mail@marek.onl>
* 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>
* 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>
* update zcash_proofs to 0.14 using custom sapling
* remove OnceLock
* Copies `parse_parameters()` function and other private functions it depends on from `zcash_proofs` (#8548)
* add links to copied code
* use upstream proofs and sapling
---------
Co-authored-by: Arya <aryasolhi@gmail.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
* - 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()`
* Updates `median_timespan()` method to align with zcashd implementation of ActualTimespan
* Minor refactor
---------
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
* 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>