You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to apply ZIP-209 (#1895), Zebra needs to calculate the different chain transparent and shielded value pools and store them in the state.
As part of this change, we should verify the sprout, sapling, and orchard value balances against each transaction's transparent value pool.
Scope
Block subsidy, miner fees, and coinbase transaction transparent value pools are out of scope. (#801)
We can validate chain value pools by assuming that coinbase transaction value balances are valid.
Specification
Shielded Chain Value Pools
If any of the "Sprout chain value pool balance", "Sapling chain value pool balance", or "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.
Nodes MAY relay transactions even if one or more of them cannot be mined due to the aforementioned restriction.
Transparent Transaction Value Pool & Remaining Value
Transparent inputs to a transaction insert value into a transparent transaction value pool associated with the transaction, and transparent outputs remove value from this pool. As in Bitcoin, the remaining value in the pool is available to miners as a fee.
Consensus rule: The remaining value in the transparent transaction value pool MUST be nonnegative.
Note: there is no explicit rule that the remaining balance in the transparent chain value pool must be non-negative. But it follows from the transparent transaction value pool consensus rule, and the definition of value addition.
Sprout Chain Value Pool
Each JoinSplit transfer can be seen, from the perspective of the transparent transaction value pool , as an input and an output simultaneously.
vold takes value from the transparent transaction value pool and vnew adds value to the transparent transaction
value pool . As a result, vold is treated like an output value, whereas vnew is treated like an input value.
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.
A positive Sapling balancing value takes value from the Sapling transaction value pool and adds it to the transparent transaction value pool . A negative Sapling balancing value does the reverse. As a result, positive vbalanceSapling is treated like an input to the transparent transaction value pool , whereas negative vbalanceSapling is treated like an output from that pool.
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.
Orchard introduces Action transfers, each of which can optionally perform a spend, and optionally perform an output. Similarly to Sapling, the net value of Orchard spends minus outputs in a transaction is called the Orchard balancing value, measured in zatoshi as a signed integer vbalanceOrchard.
vbalanceOrchard is encoded in a transaction as the field valueBalanceOrchard. If a transaction has no Action descriptions, vbalanceOrchard is implicitly zero. Transaction fields are described in § 7.1 ‘Transaction Encoding and Consensus’ on p. 116.
A positive Orchard balancing value takes value from the Orchard transaction value pool and adds it to the transpar- ent transaction value pool . A negative Orchard balancing value does the reverse. As a result, positive vbalanceOrchard is treated like an input to the transparent transaction value pool , whereas negative vbalanceOrchard is treated like an output from that pool.
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.
Motivation
In order to apply ZIP-209 (#1895), Zebra needs to calculate the different chain transparent and shielded value pools and store them in the state.
As part of this change, we should verify the sprout, sapling, and orchard value balances against each transaction's transparent value pool.
Scope
Block subsidy, miner fees, and coinbase transaction transparent value pools are out of scope. (#801)
We can validate chain value pools by assuming that coinbase transaction value balances are valid.
Specification
Shielded Chain Value Pools
https://zips.z.cash/zip-0209#specification
Transparent Transaction Value Pool & Remaining Value
https://zips.z.cash/protocol/protocol.pdf#transactions
Note: there is no explicit rule that the remaining balance in the transparent chain value pool must be non-negative. But it follows from the transparent transaction value pool consensus rule, and the definition of value addition.
Sprout Chain Value Pool
https://zips.z.cash/protocol/protocol.pdf#joinsplitbalance
Sapling Chain Value Pool
https://zips.z.cash/protocol/protocol.pdf#saplingbalance
Orchard Chain Value Pool
https://zips.z.cash/protocol/protocol.pdf#orchardbalance
Solution
We need to design the value pool implementation in the form of an RFC.
Previous Work
This has already been started in #1928
The text was updated successfully, but these errors were encountered: