* Updates `coinbase_spend_restriction()` method to always return `OnlyShieldedOutputs` on Regtest.
* Adds a `should_allow_unshielded_coinbase_spends` field to testnet::Parameters
* Adds a test
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* Renames CoinbaseSpendRestriction variants and updates their documentation.
Updates a comment.
---------
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Marek <mail@marek.onl>
* skips re-verifying transactions in blocks that are present in the mempool.
* clippy fix
* adds a test
* fixes clippy lint
* Use NU6 & V5 tx in new test
* Uses correct consensus branch id in test
* change(mempool): Return verification result after attempting to insert transactions in the mempool (#8901)
* respond with mempool verification result after a transaction has been inserted or has failed to be inserted into the mempool
* returns mempool verification errors early, and fixes handling for cancellations or timeouts.
* Adds a comment in test warning against code reuse with buffered services.
* De-duplicates handling for timeout errors
* Adds a parameter to `zebra_consensus::router::init()` for accepting a mempool setup argument, adds and uses an `init_test()` fn for passing a closed channel receiver in tests where no mempool service is needed in the transaction verifier.
* Adds a `mempool` argument to the transaction::Verifier constructor (and a `new_for_tests()` constructor for convenience)
* Removes `Clone` impl on `transaction::Verifier` to add mempool oneshot receiver, updates tests.
* Adds TODOs
* updates transaction verifier's poll_ready() method to setup the mempool service handle.
* Updates VerifiedSet struct used in mempool storage
* Updates mempool service and its `Storage` to use the updated `VerifiedSet` `transactions()` return type.
* updates `created_outputs` when inserting or removing a transaction from the mempool's verified set
* Adds a TODO, updates field docs
* Updates `spent_utxos()` to query the mempool for unspent outputs
* Adds `spent_mempool_outpoints` as a field on tx verifier mempool response
* Updates mempool `Downloads` to return the spent_mempool_outpoints from the tx verifier response
* Updates `Storage.insert()` to accept a list of spent mempool transaction outputs
* Adds transaction dependencies when inserting a tx in `VerifiedSet`
* polls mempool svc from tx verifier when a mempool tx that creates transparent outputs has been verified.
adds a TODO for adding a `pending_outputs` field to the mempool Storage
* Adds `pending_outputs` field on mempool Storage and responds to pending outputs requests when inserting new transactions into the mempool's verified set
* replaces `UnminedTxId` type with `transaction::Hash` in mempool's verified set
* prune pending outputs when rejecting and removing same effects.
* Remove dependent transactions from verified set when removing a tx
* updates tests
* appeases clippy.
* removes unused `len()` method
* fixes doc links
* Adds transaction dependencies to the `FullTransactions` response, let the caller handle it (required to avoid moving zip317 tx selection code to mempool)
* updates block template construction to avoid including transactions unless their dependencies have already been added.
* updates tests
* Replaces placeholder setup channel with one that sends the mempool svc to the tx verifier, adds a timeout layer, adds a TODO about a concurrency bug
* Use a single query to check for unspent outputs in the mempool
* Updates `getblocktemplate` method to consider dependencies when sorting transactions for the final template
* fixes clippy lints, removes unnecessary Option in UnspentOutput response variant
* renames type alias and method, adds a TODO to use iteration instead of recursion
* Adds mempool_removes_dependent_transactions() test
* Updates Storage and VerifiedSet clear() methods to clear pending_outputs, created_outputs, and transaction_dependencies, adds TODO to use iteration instead of recursion.
* removes outdated TODO
* Adds a TODO for reporting queued transaction verification results from the mempool from the poll_ready() method
* Adds `mempool_responds_to_await_output` test
* updates mempool_responds_to_await_output test
* Uses iteration instead of recursion in verified set's remove() method and zip317 mod's dependencies_depth() method
* Adds a mempool_request_with_mempool_output_is_accepted test for the transaction verifier
* Moves delay duration before polling the mempool to a constant, uses a shorter timeout for mempool output lookups, adds a `poll_count` to MockService, and updates `mempool_request_with_unmined_output_spends_is_accepted` to check that the transaction verifier polls the mempool after verifying a mempool transaction with transparent outputs
* adds long_poll_input_mempool_tx_ids_are_sorted test
* Adds a `excludes_tx_with_unselected_dependencies` test
* Updates a TODO
* moves `TransactionDependencies` struct to `zebra-node-services`
* Updates `FullTransactions` response variant's `transaction_dependencies` type
* updates zip317 transaction selection for block templates to include dependent transactions
* Moves and refactors zip317 tx selection test to its own module, adds an `unmined_transactions_in_blocks()` method on network
* Removes `unmined_transactions_in_blocks()` test utility fn from mempool Storage test module and replaces calls to it with calls to the new test method on Network
* Fixes spelling mistake
* Adds `includes_tx_with_selected_dependencies` test
* fixes zip317 block construction issue
* Fixes vectors test
* Update zebra-node-services/src/mempool.rs
* restores `tip_rejected_exact` type
* updates affected tests
* Documents the new argument in `Storage::insert()`, updates outdated comment
* Update zebrad/src/components/mempool/storage/verified_set.rs
* fixes potential issue with calling buffered mempool's poll_ready() method without calling it.
* Avoids removing dependent transactions of transactions that have been mined onto the best chain.
* Updates `spent_utxos()` method documentation
* Avoids sorting getblocktemplate transactions in non-test compilations
* documents PendingOutputs struct
* Apply suggestions from code review
Co-authored-by: Marek <mail@marek.onl>
* cargo fmt
* Applies suggestions from code review
Avoids unnecessarily rejecting dependent transactions of randomly evicted mempool transactions.
Updates `TransactionDependencies::remove_all()` to omit provided transaction id from the list of removed transaction ids.
* Applies suggestions from code review.
* Adds minor comments
* Update zebrad/src/components/mempool/storage/verified_set.rs
Co-authored-by: Marek <mail@marek.onl>
* Remove an outdated comment (#9013)
---------
Co-authored-by: Marek <mail@marek.onl>
* Update docs for min network protocol versions
* Add a TODO for updating init net protocol version
* Update `CURRENT_NETWORK_PROTOCOL_VERSION`
* Add NU6 Mainnet activation height
* Extend docs for funding streams
* Extend tests for Mainnet funding streams
* Update snapshots
* replaces some potential panics with error in block verifier checks
* fixes outstanding documentation issues listed as examples in audit report
* fixes remaining TODOs in `parameters::network::subsidy` module.
* Addresses other TODOs added during NU6 implementation, fixes a TODO in `subsidy_is_valid()` about using the network slow start interval parameters when PoW is disabled.
* updates snapshot
* add halving interval to regtest and to custom testnet
* add nuparams.py rpc test
* fix inconsistency in nu6 name in rpc methods
* rename `halving_interval` to `pre_blossom_halving_interval` in the config
* make fixes
* Suggestion for "feat(regtest): Add regtest halving interval and port test" (#8894)
* adds `height_for_halving_index()` and `num_halvings()` fns
* avoid unnecessary panic
* avoid using constant pre/post blossom halving intervals in num_halvings()
* make regtest and testnet constant more private
* move `height_for_halving_index`
* fmt
* add a `funding_stream_address_change_interval` method
* add checked operations to `height_for_halving_index` fn
* add post_blossom interval as paramneters + other refactors
* rename function
* fix docs
* move constant
* Updates `new_regtest()` method to return a Testnet without funding streams, updates funding stream setter methods to set a flag indicating that parameters affecting the funding stream address period should be locked, updates the setter methods for parameters that affect the funding stream address period to panic if those parameters should be locked. (#8921)
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
* 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>
* 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
* Add `Deferred` to `ValueBalance`
* Update snapshots
* Unrelated: Revise docs
* Add TODOs
* Stop recalculating the block subsidy
* Track deferred balances
* Support heights below slow start shift in halvings
* Fix `CheckpointVerifiedBlock` conversion in tests
* Allow deserialization of legacy `ValueBalance`s
* Simplify docs
* Fix warnings raised by Clippy
* Fix warnings raised by `cargo fmt`
* Update zebra-chain/src/block.rs
Co-authored-by: Arya <aryasolhi@gmail.com>
* Refactor docs around chain value pool changes
* 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.
* Update zebra-consensus/src/checkpoint.rs
Co-authored-by: Arya <aryasolhi@gmail.com>
* Update docs for value balances
* Cleanup: Simplify getting info for FS receivers
* Avoid a panic when deserializing value balances
* Uses FPF Testnet address for post-NU6 testnet funding streams
* Updates the NU6 consensus branch id
* Update zebra-consensus/src/checkpoint.rs
* Bump the major database format version
* Add a database upgrade mark
* Fix tests after merge
* Improve docs
* Consolidate error handling for block subsidies
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
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
* 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
* Add `Deferred` to `ValueBalance`
* Update snapshots
* Unrelated: Revise docs
* Add TODOs
* Stop recalculating the block subsidy
* Track deferred balances
* Support heights below slow start shift in halvings
* Fix `CheckpointVerifiedBlock` conversion in tests
* Allow deserialization of legacy `ValueBalance`s
* Simplify docs
* Fix warnings raised by Clippy
* Fix warnings raised by `cargo fmt`
* Update zebra-chain/src/block.rs
Co-authored-by: Arya <aryasolhi@gmail.com>
* Refactor docs around chain value pool changes
* 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.
* Update zebra-consensus/src/checkpoint.rs
Co-authored-by: Arya <aryasolhi@gmail.com>
* Update docs for value balances
* Cleanup: Simplify getting info for FS receivers
* Avoid a panic when deserializing value balances
* Uses FPF Testnet address for post-NU6 testnet funding streams
* Updates the NU6 consensus branch id
* Update zebra-consensus/src/checkpoint.rs
* Bump the major database format version
* Add a database upgrade mark
* Fix tests after merge
* trigger GitHub actions
---------
Co-authored-by: Arya <aryasolhi@gmail.com>
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
* 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>
* 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>
* 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.
* 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>
* 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
* - 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>