Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate funding stream addresses #3040

Merged

Conversation

oxarbitrage
Copy link
Contributor

@oxarbitrage oxarbitrage commented Nov 8, 2021

Motivation

We need to validate the coinbase output addresses against the funding stream receivers. Close #338

Specifications

https://zips.z.cash/protocol/protocol.pdf#fundingstreams
https://zips.z.cash/protocol/protocol.pdf#zip214fundingstreams

Solution

This is based on #1170 where we had a draft PR to validate the founders reward addresses. The funding streams is similar so some concepts are taken from there adapting it for funding streams and making other improvements.

Review

@teor4321 and/or @jvff

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

With thisn in place we can validate the consensus rules related to miner rewards as they are the reminder of the block subsidy minus all the funding streams. #1162

@teor2345 teor2345 requested a review from jvff November 8, 2021 23:31
@mpguerra mpguerra requested review from teor2345 and removed request for jvff November 9, 2021 10:18
@oxarbitrage oxarbitrage marked this pull request as ready for review November 9, 2021 20:46
@oxarbitrage
Copy link
Contributor Author

I synchronized zebra up to tip based with this PR.

@teor2345 teor2345 requested review from jvff and removed request for teor2345 November 10, 2021 06:16
@teor2345
Copy link
Contributor

I'd like @jvff to do the initial review on this PR.

Copy link
Contributor

@jvff jvff left a comment

Choose a reason for hiding this comment

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

It's looking good, there's only one blocker. I'm not completely sure, but I think that maybe the values should be checked to match their intended receiver.

Besides that, I ended up adding a bunch of suggestions and ideas, but don't let those block you, we can ignore them and revisit later if needed 😁

zebra-consensus/src/error.rs Outdated Show resolved Hide resolved
zebra-consensus/src/block/subsidy/funding_streams.rs Outdated Show resolved Hide resolved
zebra-consensus/src/parameters/subsidy.rs Show resolved Hide resolved
zebra-consensus/src/block/subsidy/general.rs Show resolved Hide resolved
zebra-consensus/src/parameters/subsidy.rs Outdated Show resolved Hide resolved
zebra-consensus/src/parameters/subsidy.rs Outdated Show resolved Hide resolved
zebra-consensus/src/block/subsidy/funding_streams.rs Outdated Show resolved Hide resolved
zebra-consensus/src/block/check.rs Outdated Show resolved Hide resolved
zebra-consensus/src/block/check.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Looks good!

Once we have the address/amount matching fixed, everything else should be optional.

zebra-consensus/src/block/subsidy/funding_streams.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jvff jvff left a comment

Choose a reason for hiding this comment

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

Looks great!

@oxarbitrage oxarbitrage merged commit d321e8f into ZcashFoundation:main Nov 12, 2021
mpguerra added a commit that referenced this pull request May 19, 2023
mergify bot pushed a commit that referenced this pull request May 23, 2023
* ZIPs were updated to remove ambiguity, this was tracked in #1267.

* #2105 was fixed by #3039 and #2379 was closed by #3069

* #2230 was a duplicate of #2231 which was closed by #2511

* #3235 was obsoleted by #2156 which was fixed by #3505

* #1850 was fixed by #2944, #1851 was fixed by #2961 and #2902 was fixed by #2969

* We migrated to Rust 2021 edition in Jan 2022 with #3332

* #1631 was closed as not needed

* #338 was fixed by #3040 and #1162 was fixed by #3067

* #2079 was fixed by #2445

* #4794 was fixed by #6122

* #1678 stopped being an issue

* #3151 was fixed by #3934

* #3204 was closed as not needed

* #1213 was fixed by #4586

* #1774 was closed as not needed

* #4633 was closed as not needed

* Clarify behaviour of difficulty spacing

Co-authored-by: teor <[email protected]>

* Update comment to reflect implemented behaviour

Co-authored-by: teor <[email protected]>

* Update comment to reflect implemented behaviour when retrying block downloads

Co-authored-by: teor <[email protected]>

* Update `TODO` to remove closed issue and clarify when we might want to fix

Co-authored-by: teor <[email protected]>

* Update `TODO` to remove closed issue and clarify what we might want to change in future

Co-authored-by: teor <[email protected]>

* Clarify benefits of how we do block verification

Co-authored-by: teor <[email protected]>

* Fix rustfmt errors

---------

Co-authored-by: teor <[email protected]>
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.

Calc Block Subsidy and Funding Streams
4 participants