test(state, rpc): handle coinbase Sapling spends in proptests broken by #10527 - #10533
Merged
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
upbqdn
force-pushed
the
fix-rpc-proptests-coinbase-sapling
branch
from
May 1, 2026 18:22
6da4610 to
5c7b905
Compare
arya2
previously approved these changes
May 1, 2026
…ction proptests The `any::<Transaction>()` arbitrary strategy can produce coinbase transactions that contain Sapling spends. Since #10527 (GHSA-rgwx-8r98-p34c), those transactions are rejected during deserialization, so `send_raw_transaction` returns a deserialization error before reaching the mempool. The five affected proptests then time out waiting for a mempool request that never arrives. Skip those cases with `prop_assume!` so each test exercises the mempool path it is intended to cover. The `transaction_roundtrip` proptest in `zebra-chain` was updated to handle the same combination in #10527.
upbqdn
force-pushed
the
fix-rpc-proptests-coinbase-sapling
branch
from
May 1, 2026 18:53
1aaec94 to
f190f18
Compare
Member
Author
|
Force-pushed. More proptests were failing than originally fixed. |
arya2
previously approved these changes
May 1, 2026
After #10527 (GHSA-rgwx-8r98-p34c) rejects coinbase transactions with Sapling spends during deserialization, three `zebra-state` proptests panic when arbitrary chains contain such transactions: - `roundtrip_transaction` reads back a generated `Transaction` via `IntoDisk`/`FromDisk` and panics in `FromDisk::from_bytes`. - `blocks_with_v5_transactions` and `all_upgrades_and_wrong_commitments_with_fake_activation_heights` commit chains generated by `PreparedChain` to the finalized state, whose underlying `partial_chain_strategy` produces coinbase transactions with arbitrary Sapling shielded data. Fix the chain-builder path by clearing `sapling_shielded_data` on coinbase transactions in `fix_generated_transaction`. Add a `prop_assume!` to `roundtrip_transaction` since it bypasses the chain builder and uses `any::<Transaction>()` directly. The `Transaction::Arbitrary` strategy is intentionally left unchanged so the rejection path is still exercised by the `transaction_roundtrip` proptest and the GHSA-rgwx-8r98-p34c reproduction vector in `zebra-chain` (per the design choice in #10527).
arya2
approved these changes
May 1, 2026
Collaborator
|
Admin-merging due to stuck disconnects_from_misbehaving_peers |
judah-caruso
pushed a commit
to ShieldedLabs/zebra-crosslink-staging
that referenced
this pull request
May 28, 2026
ZcashFoundation#10527 (ZcashFoundation#10533) * test(rpc): skip invalid coinbase Sapling-spend txs in send_raw_transaction proptests The `any::<Transaction>()` arbitrary strategy can produce coinbase transactions that contain Sapling spends. Since ZcashFoundation#10527 (GHSA-rgwx-8r98-p34c), those transactions are rejected during deserialization, so `send_raw_transaction` returns a deserialization error before reaching the mempool. The five affected proptests then time out waiting for a mempool request that never arrives. Skip those cases with `prop_assume!` so each test exercises the mempool path it is intended to cover. The `transaction_roundtrip` proptest in `zebra-chain` was updated to handle the same combination in ZcashFoundation#10527. * style: rustfmt drift in inbound/downloads.rs * test(state): handle coinbase Sapling spends in finalized-state proptests After ZcashFoundation#10527 (GHSA-rgwx-8r98-p34c) rejects coinbase transactions with Sapling spends during deserialization, three `zebra-state` proptests panic when arbitrary chains contain such transactions: - `roundtrip_transaction` reads back a generated `Transaction` via `IntoDisk`/`FromDisk` and panics in `FromDisk::from_bytes`. - `blocks_with_v5_transactions` and `all_upgrades_and_wrong_commitments_with_fake_activation_heights` commit chains generated by `PreparedChain` to the finalized state, whose underlying `partial_chain_strategy` produces coinbase transactions with arbitrary Sapling shielded data. Fix the chain-builder path by clearing `sapling_shielded_data` on coinbase transactions in `fix_generated_transaction`. Add a `prop_assume!` to `roundtrip_transaction` since it bypasses the chain builder and uses `any::<Transaction>()` directly. The `Transaction::Arbitrary` strategy is intentionally left unchanged so the rejection path is still exercised by the `transaction_roundtrip` proptest and the GHSA-rgwx-8r98-p34c reproduction vector in `zebra-chain` (per the design choice in ZcashFoundation#10527).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Several CI jobs are red on
main:zebra-rpc::methods::tests::propfail after fix(chain): reject coinbase Sapling spends during deserialization #10527. Theany::<Transaction>()(andany::<[Transaction; 2]>()) arbitrary strategies can produce coinbase transactions containing Sapling spends. After fix(chain): reject coinbase Sapling spends during deserialization #10527 those are rejected during deserialization, sosend_raw_transactionreturns a deserialization error before reaching the mempool, and each affected test waits indefinitely for a mempool request that never arrives.zebra-state::service::finalized_statepanic for the same reason: chains generated byPreparedChaincontain coinbase transactions with Sapling shielded data that fail to round-trip throughIntoDisk/FromDisk.roundtrip_transactionhits the same panic viaany::<Transaction>().Cargo.lockis out of date (missing therand 0.8.5→rand 0.8.6bump forzebra-script).cargo fmt --checkfails.#10527 updated the
transaction_roundtripproptest inzebra-chainfor the same case but missed the downstream proptests that consume the same arbitrary strategy.Solution
prop_assume!in the five affected RPC proptests:mempool_receives_raw_txmempool_errors_are_forwardedrejected_txs_are_reportedrpc_queue_main_looprpc_queue_receives_all_txs_from_channelzebra-state, fix the chain-builder fixup layer: clearsapling_shielded_dataon coinbase transactions infix_generated_transaction. This coversblocks_with_v5_transactionsand
all_upgrades_and_wrong_commitments_with_fake_activation_heights,which both build chains via
PreparedChain.prop_assume!toroundtrip_transactionsince it bypasses thechain builder and uses
any::<Transaction>()directly.Transaction::Arbitrarystrategy is intentionally left unchangedso the rejection path is still exercised by
transaction_roundtripand the GHSA-rgwx-8r98-p34c reproduction vector in
zebra-chain(perthe design choice in fix(chain): reject coinbase Sapling spends during deserialization #10527).
Cargo.lock.cargo fmt --all.AI Disclosure
PR Checklist
main.)