Skip to content

[ZIP-233] Network Sustainability Mechanism: Burning#1567

Merged
8 commits merged into
zcash:mainfrom
ShieldedLabs:nsm
Aug 6, 2025
Merged

[ZIP-233] Network Sustainability Mechanism: Burning#1567
8 commits merged into
zcash:mainfrom
ShieldedLabs:nsm

Conversation

@giddie
Copy link
Copy Markdown

@giddie giddie commented Oct 11, 2024

This mostly consists of the addition of a burn_amount transaction field, introduced in the ZFuture network upgrade. Enabling cfg(zcash_unstable = "zfuture") meant that a lot of TZE code was unnecessarily enabled, so we switched some of those sections to zcash_unstable = "tze" as well as introducing zcash_unstable = "nsm" to keep things separate. The zfuture cfg is now used just to enable the ZFuture network upgrade.

The code for the generated test vectors is available in this PR.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 24.65753% with 55 lines in your changes missing coverage. Please review.

Project coverage is 57.90%. Comparing base (0d388d8) to head (3ee2de4).

Files with missing lines Patch % Lines
zcash_primitives/src/transaction/mod.rs 16.32% 41 Missing ⚠️
zcash_primitives/src/transaction/builder.rs 10.00% 9 Missing ⚠️
pczt/src/roles/tx_extractor/mod.rs 0.00% 2 Missing ⚠️
zcash_client_sqlite/src/wallet.rs 0.00% 2 Missing ⚠️
zcash_primitives/src/transaction/sighash.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1567      +/-   ##
==========================================
- Coverage   58.01%   57.90%   -0.12%     
==========================================
  Files         181      181              
  Lines       21976    22046      +70     
==========================================
+ Hits        12750    12766      +16     
- Misses       9226     9280      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread components/zcash_protocol/src/consensus.rs Outdated
Copy link
Copy Markdown
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking on review by @str4d and @nuttycom, since this requires a design decision about the future of ZFuture (and the interaction of zcash_unstable flags).

@aphelionz
Copy link
Copy Markdown
Member

Can somebody re-run the clippy test when it's convenient? 🙏

@nuttycom
Copy link
Copy Markdown
Collaborator

@aphelionz there's an underlying clippy CI issue being fixed in #1785 - you might want to rebase once that merges to clear this issue.

@aphelionz
Copy link
Copy Markdown
Member

@mariopil are you able to quickly rebase one more time now that the clippy fixes are in?

Copy link
Copy Markdown
Collaborator

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few high-level blocking comments thus far.

Comment thread components/zcash_protocol/src/consensus.rs Outdated
Comment thread components/zcash_protocol/src/consensus.rs Outdated
Comment thread components/zcash_protocol/src/consensus.rs Outdated
Comment thread zcash_primitives/src/transaction/builder.rs Outdated
@mariopil
Copy link
Copy Markdown
Contributor

mariopil commented May 13, 2025

@aphelionz I was on vacation last two weeks - I've rebased now vs latest main and addressed @nuttycom comments.

Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/sighash.rs Outdated
Comment thread zcash_primitives/src/transaction/tests.rs Outdated
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/tests/data.rs
Copy link
Copy Markdown
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes needed.

@mariopil
Copy link
Copy Markdown
Contributor

mariopil commented Jun 9, 2025

Thank you @daira for the review. I've done the fixes. I've added read_v6_header_fragment and write_v6_header, and moved the reading and writing of zip233_amount there.

@mariopil mariopil force-pushed the nsm branch 2 times, most recently from 30ce9ad to 8c053ec Compare June 9, 2025 14:23
Comment thread zcash_primitives/src/transaction/tests.rs Outdated
Comment thread zcash_primitives/src/transaction/tests/data.rs Outdated
Copy link
Copy Markdown
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not compile.

@mariopil mariopil force-pushed the nsm branch 2 times, most recently from 3201291 to 2630263 Compare June 10, 2025 13:24
@daira
Copy link
Copy Markdown
Contributor

daira commented Jun 13, 2025

MarioP wrote in #zebra on the R&D Discord:

I've noticed this digest header change

h.write_u64_le((*zip233_amount).into()).unwrap();

in the ZIP-233 librustzcash PR breaks a few tests in Zebra (merkle_root_is_valid, v5_with_sapling_spends, v4_with_sapling_spends, block_test_vectors, binding_signatures) that test processing old blocks from testnet and mainnet. Shouldn't the writing zip233Amount in the header be conditioned e.g. based on the Tx version?

Yes, probably, although I haven't had chance to look in detail. Please check that this does not break Zebra tests before merging.

@mariopil
Copy link
Copy Markdown
Contributor

Thank you, @daira. Yes, I've tested this with Zebra, and all tests are passing.

@aphelionz
Copy link
Copy Markdown
Member

@daira @nuttycom friendly reminder to review again 🙏

Copy link
Copy Markdown
Contributor

@arya2 arya2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, there are a handful of outstanding lints and compilation issues that need fixing.

Comment thread zcash_client_sqlite/Cargo.toml
Comment thread zcash_primitives/src/transaction/mod.rs Outdated
Comment thread zcash_primitives/src/transaction/tests.rs Outdated
Comment thread zcash_primitives/src/transaction/tests/data.rs Outdated
lock_time,
pczt.global.expiry_height.into(),
#[cfg(all(zcash_unstable = "nu7", feature = "zip-233"))]
Zatoshis::ZERO,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Zatoshis::ZERO,
Zatoshis::ZERO, // TODO: change when PCZTs add v6 transaction support

@nuttycom
Copy link
Copy Markdown
Collaborator

#1879 now builds atop this branch, merging main and addressing comments from review.

@nuttycom nuttycom closed this pull request by merging all changes into zcash:main in 3f03a4a Aug 6, 2025
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.

9 participants