Skip to content

feat(consensus): implement ZIP 235 behind a build feature - #858

Closed
evan-forbes wants to merge 5 commits into
feat/zip233-burn-amountfrom
feat/zip235-fee-burn
Closed

feat(consensus): implement ZIP 235 behind a build feature#858
evan-forbes wants to merge 5 commits into
feat/zip233-burn-amountfrom
feat/zip235-fee-burn

Conversation

@evan-forbes

@evan-forbes evan-forbes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Stacked on #857 (ZIP 233) → #856 (ZIP 2003) → #851 (ZIP 218). Fourth of the remaining NU7 consensus changes.

Implements ZIP 235 "Remove 60% of Transaction Fees From Circulation" behind the off-by-default zip235 cargo feature, which enables zip233 because that ZIP's zip233Amount field carries the burn, and because ZIP 235 "MUST be deployed at the same time or after ZIP 233".

Ported from the merged upstream zebra#10357. ZIP 235 is on the zcash/zips NU7 milestone rather than the poll ballot, but it is the third leg of the NSM alongside ZIPs 233 and 234.

Consensus

  • minimum_fee_burn is floor(block_miner_fees * 6 / 10) — the ZIP's 60%, with the rounding in the miner's favour.
  • miner_fees_are_valid rejects a coinbase whose zip233Amount is below that minimum, from NU7 activation onwards.
  • It also adds the coinbase's own zip233Amount to its total output value, because that value comes out of the same block subsidy and fees as its outputs. Without this a compliant coinbase would fail the NU6 "total output MUST equal total input" rule.

Block templates

TransactionTemplate::new_coinbase burns exactly the minimum and pays the miner the block subsidy plus the remaining 40% of the fees, so a template this node produces passes its own verifier. Burning more than the minimum is the miner's choice to make, not this node's, so templates do not.

The burn is set through Builder::set_zip233_amount after the outputs are added, so the builder's value balance already reflects the reduced miner reward. That setter only exists in a build that compiles zakura-primitives' ZIP 233 code, so the call is #[cfg(feature = "zip235")].

Tests

zip235_coinbase_must_burn_sixty_percent_of_fees covers the boundary in both build configurations: burning exactly 600 of 1000 zatoshi in fees is valid, burning more is valid, and burning 599 or nothing is rejected with InsufficientFeeBurn under the feature. Without the feature there is no minimum, and the test asserts the burn still balances against the coinbase's total output value.

Both configurations pass all 731 tests across zakura-chain, zakura-consensus, and zakura-rpc; clippy clean. A zip235 CI job mirrors the zip233 one.

Implements ZIP 235 "Network Sustainability Mechanism: Burning of
Transaction Fees", gated on the new `zip235` cargo feature. The feature
enables `zip233`, because ZIP 233's `zip233Amount` field carries the
burn, and because ZIP 235 must deploy at the same time as or after it.

- `minimum_fee_burn` is `floor(block_miner_fees * 6 / 10)`, the ZIP's
  60% with the rounding in the miner's favour.
- `miner_fees_are_valid` rejects a coinbase whose `zip233Amount` is below
  that minimum, from NU7 activation onwards. It also adds the coinbase's
  own `zip233Amount` to its total output value: that value comes out of
  the same block subsidy and fees as its outputs.
- `TransactionTemplate::new_coinbase` burns exactly the minimum and pays
  the miner the block subsidy plus the remaining 40% of the fees. Burning
  more is the miner's to choose, not this node's.
Merges the ZIP 233 feature fix and carries it into ZIP 235:

- `ZIP235_ENABLED` requires `ZIP233_ENABLED`, so it is false in a build
  that sets the feature without `RUSTFLAGS='--cfg zcash_unstable="nu7"'`,
  where the `zip233Amount` field that carries the burn does not exist.
- The `Builder::set_zip233_amount` call is gated on the cfg as well as
  the feature, because that is exactly when `zakura-primitives` compiles
  the setter. `cargo check --all-features` sets the feature but not the
  cfg, so gating on the feature alone failed to compile.

`TransactionTemplate::new_coinbase` takes the money reserve, so
`zakura-rpc` takes a major version bump.
The comments quoted "Network Sustainability Mechanism: Burning of Transaction
Fees", which is not ZIP 235's title. ZIP 235 is "Remove 60% of Transaction Fees
From Circulation", and unlike ZIPs 233 and 234 it does not carry the "Network
Sustainability Mechanism" prefix.
@evan-forbes

Copy link
Copy Markdown
Contributor Author

The August 2026 NU7 poll explicitly excludes transaction-format changes, so ZIP 235 is outside the current NU7 scope. Closing this superseded PR. PR #859 has been rebuilt without ZIP 233 or ZIP 235 and now stacks directly on #856.

@evan-forbes evan-forbes closed this Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant