Skip to content

Commit

Permalink
Merge pull request #712 from zancas/zip317
Browse files Browse the repository at this point in the history
Mark each protocol-specific logical_action as such, and sum across them
  • Loading branch information
daira authored Feb 7, 2024
2 parents f8ad310 + 1d0c4ab commit 265cd39
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
18 changes: 12 additions & 6 deletions zip-0317.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,18 @@
</table>
<p>Wallets implementing this specification SHOULD use a conventional fee calculated in zatoshis per the following formula:</p>
<div class="math">\(\begin{array}{rcl}
logical\_actions &amp;=&amp; \mathsf{max}\big(\mathsf{ceiling}\big(\frac{tx\_in\_total\_size}{p2pkh\_standard\_input\_size}\big),
\mathsf{ceiling}\big(\frac{tx\_out\_total\_size}{p2pkh\_standard\_output\_size}\big)\big) \;+ \\
&amp; &amp; 2 \cdot nJoinSplit \;+ \\
&amp; &amp; \mathsf{max}(nSpendsSapling, nOutputsSapling) \;+ \\
&amp; &amp; nActionsOrchard \\
conventional\_fee &amp;=&amp; marginal\_fee \cdot \mathsf{max}(grace\_actions, logical\_actions)
contribution_{\,\mathsf{Transparent}} &amp;=&amp;
\mathsf{max}\big(\mathsf{ceiling}\big(\frac{tx\_in\_total\_size}{p2pkh\_standard\_input\_size}\big),\,
\mathsf{ceiling}\big(\frac{tx\_out\_total\_size}{p2pkh\_standard\_output\_size}\big)\big) \\
contribution_{\,\rlap{\mathsf{Sprout}}\phantom{\mathsf{Transparent}}} &amp;=&amp; 2 \cdot nJoinSplit \\
contribution_{\,\rlap{\mathsf{Sapling}}\phantom{\mathsf{Transparent}}} &amp;=&amp; \mathsf{max}(nSpendsSapling,\, nOutputsSapling) \\
contribution_{\,\rlap{\mathsf{Orchard}}\phantom{\mathsf{Transparent}}} &amp;=&amp; nActionsOrchard \\
\\
logical\_actions &amp;=&amp; contribution_{\,\mathsf{Transparent}} +
contribution_{\,\mathsf{Sprout}} +
contribution_{\,\mathsf{Sapling}} +
contribution_{\,\mathsf{Orchard}} \\
conventional\_fee &amp;=&amp; marginal\_fee \cdot \mathsf{max}(grace\_actions,\, logical\_actions)
\end{array}\)</div>
<p>The inputs to this formula are taken from transaction fields defined in the Zcash protocol specification <a id="footnote-reference-4" class="footnote_reference" href="#protocol-txnencoding">3</a>:</p>
<table>
Expand Down
18 changes: 12 additions & 6 deletions zip-0317.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,18 @@ calculated in zatoshis per the following formula:
.. math::
\begin{array}{rcl}
logical\_actions &=& \mathsf{max}\big(\mathsf{ceiling}\big(\frac{tx\_in\_total\_size}{p2pkh\_standard\_input\_size}\big),
\mathsf{ceiling}\big(\frac{tx\_out\_total\_size}{p2pkh\_standard\_output\_size}\big)\big) \;+ \\
& & 2 \cdot nJoinSplit \;+ \\
& & \mathsf{max}(nSpendsSapling, nOutputsSapling) \;+ \\
& & nActionsOrchard \\
conventional\_fee &=& marginal\_fee \cdot \mathsf{max}(grace\_actions, logical\_actions)
contribution_{\,\mathsf{Transparent}} &=&
\mathsf{max}\big(\mathsf{ceiling}\big(\frac{tx\_in\_total\_size}{p2pkh\_standard\_input\_size}\big),\,
\mathsf{ceiling}\big(\frac{tx\_out\_total\_size}{p2pkh\_standard\_output\_size}\big)\big) \\
contribution_{\,\rlap{\mathsf{Sprout}}\phantom{\mathsf{Transparent}}} &=& 2 \cdot nJoinSplit \\
contribution_{\,\rlap{\mathsf{Sapling}}\phantom{\mathsf{Transparent}}} &=& \mathsf{max}(nSpendsSapling,\, nOutputsSapling) \\
contribution_{\,\rlap{\mathsf{Orchard}}\phantom{\mathsf{Transparent}}} &=& nActionsOrchard \\
\\
logical\_actions &=& contribution_{\,\mathsf{Transparent}} +
contribution_{\,\mathsf{Sprout}} +
contribution_{\,\mathsf{Sapling}} +
contribution_{\,\mathsf{Orchard}} \\
conventional\_fee &=& marginal\_fee \cdot \mathsf{max}(grace\_actions,\, logical\_actions)
\end{array}
The inputs to this formula are taken from transaction fields defined in the Zcash protocol
Expand Down

0 comments on commit 265cd39

Please sign in to comment.