Skip to content

Commit

Permalink
Add Mana Decay and Generation Test Vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Jan 16, 2024
1 parent 207bf34 commit 237e175
Showing 1 changed file with 77 additions and 0 deletions.
77 changes: 77 additions & 0 deletions tips/TIP-0039/tip-0039.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,83 @@ to avoid differences in floating point operations on different machines.
This lookup table is an integer approximation of <code>2<sup>Decay Factors Exponent</sup>Decay per
Epoch<sup>n</sup></code>, 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/).

0 comments on commit 237e175

Please sign in to comment.