From 237e175b344d6dbf8d560f22679717d8a9bfb747 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Tue, 16 Jan 2024 10:23:34 +0100 Subject: [PATCH] Add Mana Decay and Generation Test Vectors --- tips/TIP-0039/tip-0039.md | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/tips/TIP-0039/tip-0039.md b/tips/TIP-0039/tip-0039.md index edd27d545..473d6b514 100644 --- a/tips/TIP-0039/tip-0039.md +++ b/tips/TIP-0039/tip-0039.md @@ -444,6 +444,83 @@ to avoid differences in floating point operations on different machines. This lookup table is an integer approximation of 2Decay Factors ExponentDecay per Epochn, for different values of `n` ranging from 1 to `Decay Factors Length`. +# Test Vectors + +The protocol parameters used in the following test vectors are the same as in +[TIP-49](../TIP-0049/tip-0049.md#protocol-parameters-hash). + +## Mana Generation + +The following structure consists of a base token `amount` to which the [Potential Mana Generation](#potential-mana) +formula is applied with the given slots, resulting in the generated `potentialMana` value. + +```json +{ + "testVectors": [ + { + "amount": "1000000000", + "outputCreationSlot": 1, + "transactionCreationSlot": 10000, + "potentialMana": "76228441" + }, + { + "amount": "1000000000", + "outputCreationSlot": 9000, + "transactionCreationSlot": 10000, + "potentialMana": "7629394" + }, + { + "amount": "800000000000000000", + "outputCreationSlot": 1, + "transactionCreationSlot": 10000, + "potentialMana": "60982753715241244" + }, + { + "amount": "800000000000000000", + "outputCreationSlot": 9000, + "transactionCreationSlot": 10000, + "potentialMana": "6103515625000000" + } + ] +} +``` + +## Mana Decay + +The following structure consists of a `mana` value to which the [Decay function](#decay-function) is applied with +`epochIndexDiff = targetEpoch - creationEpoch`, resulting in the `decayedMana` value. + +```json +{ + "testVectors": [ + { + "mana": "25000000000", + "creationEpoch": 1, + "targetEpoch": 1000, + "decayedMana": "9907379812" + }, + { + "mana": "25000000000", + "creationEpoch": 900, + "targetEpoch": 1000, + "decayedMana": "22787760727" + }, + { + "mana": "9000000000000000", + "creationEpoch": 1, + "targetEpoch": 1000, + "decayedMana": "3566656732891364" + }, + { + "mana": "9000000000000000", + "creationEpoch": 900, + "targetEpoch": 1000, + "decayedMana": "8203593862010166" + } + ] +} +``` + # Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).