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

ZIP-209: Prohibit Negative Shielded Chain Value Pool Balances - Implementation #1895

Closed
mpguerra opened this issue Mar 12, 2021 · 4 comments · Fixed by #2656
Closed

ZIP-209: Prohibit Negative Shielded Chain Value Pool Balances - Implementation #1895

mpguerra opened this issue Mar 12, 2021 · 4 comments · Fixed by #2656
Assignees
Labels
A-consensus Area: Consensus rule updates C-enhancement Category: This is an improvement NU Sprout Network Upgrade: Sprout specific tasks (before Overwinter) NU-0 Overwinter Network Upgrade: Overwinter specific tasks (Sprout after Overwinter) NU-1 Sapling Network Upgrade: Sapling specific tasks NU-2 Blossom Network Upgrade: Blossom specific tasks NU-3 Heartwood Network Upgrade: Heartwood specific tasks NU-4 Canopy Network Upgrade: Canopy specific tasks NU-5 Network Upgrade: NU5 specific tasks

Comments

@mpguerra
Copy link
Contributor

mpguerra commented Mar 12, 2021

Motivation

ZIP-209 defines how the consensus rules are altered such that blocks that produce negative shielded chain value pool balances are prohibited.

Specification

Transparent

Note: there is no explicit rule that the remaining balance in the transparent chain value pool must be non-negative. But it is implicit in the other consensus rules.

Sprout

As defined in [ZIP-209], the Sprout chain value pool balance for a given block chain is the sum of all vold field
values for transactions in the block chain, minus the sum of all vnew fields values for transactions in the block chain.

Consensus rule: If the Sprout chain value pool balance would become negative in the block chain created as a result of accepting a block , then all nodes MUST reject the block as invalid.

https://zips.z.cash/protocol/protocol.pdf#joinsplitbalance

Sapling

As defined in [ZIP-209], the Sapling chain value pool balance for a given block chain is the negation of the sum of all valueBalanceSapling field values for transactions in the block chain.

Consensus rule: If the Sapling chain value pool balance would become negative in the block chain created as a result of accepting a block , then all nodes MUST reject the block as invalid.

https://zips.z.cash/protocol/protocol.pdf#saplingbalance

Orchard

Similarly to the Sapling chain value pool balance defined in [ZIP-209], the Orchard chain value pool balance for a given block chain is the negation of the sum of all valueBalanceOrchard field values for transactions in the block chain.

Consensus rule: If the Orchard chain value pool balance would become negative in the block chain created as a result of accepting a block , then all nodes MUST reject the block as invalid.

https://zips.z.cash/protocol/protocol.pdf#orchardbalance

Solution

We should implement ZIP-209 in Zebra for the Transparent, Sprout, Sapling, and Orchard pools.

@mpguerra mpguerra added C-enhancement Category: This is an improvement S-needs-triage Status: A bug report needs triage labels Mar 12, 2021
@zfnd-bot zfnd-bot bot added this to To Do in 🦓 Mar 12, 2021
@mpguerra mpguerra added A-consensus Area: Consensus rule updates NU Sprout Network Upgrade: Sprout specific tasks (before Overwinter) NU-0 Overwinter Network Upgrade: Overwinter specific tasks (Sprout after Overwinter) NU-1 Sapling Network Upgrade: Sapling specific tasks NU-2 Blossom Network Upgrade: Blossom specific tasks NU-3 Heartwood Network Upgrade: Heartwood specific tasks NU-4 Canopy Network Upgrade: Canopy specific tasks NU-5 Network Upgrade: NU5 specific tasks labels Mar 12, 2021
@teor2345
Copy link
Collaborator

I explicitly listed all 3 shielded value pools in this ticket, and added the transparent pool consensus rule as well.

(We might as well implement all 4 at the same time, the data structures and code are very similar.)

@teor2345 teor2345 mentioned this issue Mar 17, 2021
53 tasks
@oxarbitrage oxarbitrage mentioned this issue Mar 21, 2021
4 tasks
@mpguerra mpguerra added this to No Estimate in Effort Affinity Grouping via automation Mar 23, 2021
@mpguerra mpguerra moved this from No Estimate to M - 5 in Effort Affinity Grouping Mar 23, 2021
@mpguerra mpguerra added P-Medium and removed S-needs-triage Status: A bug report needs triage labels Mar 23, 2021
@teor2345 teor2345 changed the title ZIP-209: Prohibit Negative Shielded Chain Value Pool Balances - Implementation ZIP-209: Prohibit Negative Chain Value Pool Balances - Implementation Jun 24, 2021
@teor2345 teor2345 changed the title ZIP-209: Prohibit Negative Chain Value Pool Balances - Implementation ZIP-209: Prohibit Negative Shielded Chain Value Pool Balances - Implementation Jun 24, 2021
@teor2345 teor2345 moved this from M - 5 to S - 3 in Effort Affinity Grouping Jun 24, 2021
@mpguerra
Copy link
Contributor Author

Are #2599 and #2610 the last 2 outstanding PRs before we can close this one or is there something else to be done?

@oxarbitrage
Copy link
Contributor

This is the last PR we have to close this issue when merged: #2652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-consensus Area: Consensus rule updates C-enhancement Category: This is an improvement NU Sprout Network Upgrade: Sprout specific tasks (before Overwinter) NU-0 Overwinter Network Upgrade: Overwinter specific tasks (Sprout after Overwinter) NU-1 Sapling Network Upgrade: Sapling specific tasks NU-2 Blossom Network Upgrade: Blossom specific tasks NU-3 Heartwood Network Upgrade: Heartwood specific tasks NU-4 Canopy Network Upgrade: Canopy specific tasks NU-5 Network Upgrade: NU5 specific tasks
Projects
No open projects
3 participants