From b70ba3406d00075dc6234d2249b238e6eb2d405d Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 17 Mar 2020 18:40:57 +0000 Subject: [PATCH] ZIP 207: use math markup. Signed-off-by: Daira Hopwood --- zip-0207.rst | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/zip-0207.rst b/zip-0207.rst index 18b44d5b..985ff0d8 100644 --- a/zip-0207.rst +++ b/zip-0207.rst @@ -83,16 +83,16 @@ Definitions We use the following constants and functions defined in [#protocol-constants]_, [#protocol-subsidies]_, and [#protocol-foundersreward]_: -- ``BlossomActivationHeight`` -- ``PostBlossomHalvingInterval`` -- ``Halving(height)`` -- ``BlockSubsidy(height)`` -- ``RedeemScriptHash(height)``. +- :math:`\mathsf{BlossomActivationHeight}` +- :math:`\mathsf{PostBlossomHalvingInterval}` +- :math:`\mathsf{Halving}(\mathsf{height})` +- :math:`\mathsf{BlockSubsidy}(\mathsf{height})` +- :math:`\mathsf{RedeemScriptHash}(\mathsf{height})`. We also define the following function: -- ``HeightForHalving(halving)``: Smallest ``height`` such that - ``Halving(height) = halving`` +- :math:`\mathsf{HeightForHalving}(\mathsf{halving})`: Smallest :math:`\mathsf{height}` such that + :math:`\mathsf{Halving}(\mathsf{height}) = \mathsf{halving}` Funding streams @@ -107,12 +107,14 @@ than absolute zatoshis, this ZIP dovetails with any changes to both block target spacing and issuance-per-block rates. Such a change occurred at the Blossom network upgrade, for example. [#zip-0208]_ -The value of a funding stream at a given block height is defined as:: +The value of a funding stream at a given block height is defined as: - FundingStream[FUND].Value(height) = - floor(( - BlockSubsidy(height) * FundingStream[FUND].ValueNumerator - ) / FundingStream[FUND].ValueDenominator) +.. math:: + + \mathsf{FundingStream[FUND].Value}(\mathsf{height}) = + \mathsf{floor}\left( + \frac{\mathsf{BlockSubsidy}(\mathsf{height}) \,\cdot\, \mathsf{FundingStream[FUND].ValueNumerator}}{\mathsf{FundingStream[FUND].ValueDenominator}} + \right) An active funding stream at a given block height is defined as a funding stream for which the block height is less than its end height, but not less @@ -123,16 +125,20 @@ each of which MUST be either a transparent P2SH address or a Sapling address. Each address is used for at most 1/48th of a halving interval, creating a roughly-monthly sequence of funding periods. The address to be used for a -given block height is defined as follows:: +given block height is defined as follows: - AddressChangeInterval = PostBlossomHalvingInterval / 48 - AddressPeriod(height) = - floor(( - height + PostBlossomHalvingInterval - HeightForHalving(1) - ) / AddressChangeInterval) - FundingStream[FUND].AddressIndex(height) = - AddressPeriod(height) - AddressPeriod(FundingStream[FUND].StartHeight) - Address(height) = FundingStream[FUND].Addresses[FundingStream[FUND].AddressIndex(height)] +.. math:: + + \begin{eqnarray*} + \mathsf{AddressChangeInterval} &=& \mathsf{PostBlossomHalvingInterval} / 48 \\ + \mathsf{AddressPeriod}(\mathsf{height}) &=& + \mathsf{floor}\left( + {\small\frac{\mathsf{height} + \mathsf{PostBlossomHalvingInterval} - \mathsf{HeightForHalving}(1)}{\mathsf{AddressChangeInterval}}} + \right) \\ + \mathsf{FundingStream[FUND].AddressIndex}(\mathsf{height}) &=& + \mathsf{AddressPeriod}(\mathsf{height}) - \\&&\hspace{2em} \mathsf{AddressPeriod}(\mathsf{FundingStream[FUND].StartHeight}) \\ + \mathsf{Address}(\mathsf{height}) &=& \mathsf{FundingStream[FUND].Addresses[} \\&&\hspace{2em} \mathsf{FundingStream[FUND].AddressIndex}(\mathsf{height})\mathsf{]} + \end{eqnarray*} This has the property that all active funding streams change the address they are using on the same block height schedule, aligned to the height of the