Skip to content

Commit

Permalink
Add storage score test vector
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Dec 21, 2023
1 parent c389e6a commit 13604b7
Showing 1 changed file with 78 additions and 2 deletions.
80 changes: 78 additions & 2 deletions tips/TIP-0042/tip-0042.md
Original file line number Diff line number Diff line change
Expand Up @@ -1027,8 +1027,8 @@ creation and block issuer feature transition.

- The account ID of an `Implicit Account` is referred to as `Implicit Account ID` and is the BLAKE2b-256 hash of the
Output ID of the Basic Output that represents the `Implicit Account`.
- If a transaction contains an input with an address unlock condition containing an implicit account address, the transaction is
only valid if all of the following conditions hold:
- If a transaction contains an input with an address unlock condition containing an implicit account address, the
transaction is only valid if all of the following conditions hold:
- A valid `Account` Output is created on the output side, for which all of the following conditions hold:
- The account must be a valid account creation, except that the `Account ID` of the `Account` must be set to the
`Implicit Account ID` instead of being zeroed out.
Expand Down Expand Up @@ -1145,6 +1145,82 @@ indices. The max value can be used to express that such features do not have an
Typically, one would want to set these features to not expire and only reduce the value to the closest possible one,
once removal of the feature is desired.

# Test Vectors

The protocol parameters used in the following test vectors are the same as in
[TIP-49 (Protocol Parameters Hash)](../TIP-0049/tip-0049.md#protocol-parameters-hash).

## Storage Score

The following test vector shows the calculation of the storage score according to [TIP-47](../TIP-0047/tip-0047.md).

Account Output (json-encoded):

```json
{
"type": 1,
"amount": "200000000",
"mana": "333000000",
"accountId": "0xe8494fe353f99783d3771c78798e1e839e649310513770fc6dc974fe53cf1a86",
"foundryCounter": 0,
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a"
}
}
],
"features": [
{
"type": 6,
"expirySlot": 888,
"blockIssuerKeys": [
{
"type": 0,
"publicKey": "0x9e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b5"
},
{
"type": 0,
"publicKey": "0xa504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b21"
}
]
},
{
"type": 7,
"stakedAmount": "150000000",
"fixedCost": "400",
"startEpoch": 25,
"endEpoch": 4294967295
}
],
"immutableFeatures": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0xed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a"
}
},
{
"type": 2,
"entries": {
"iota": "0x322e30"
}
}
]
}
```

Account Output (hex-encoded binary serialization):

```
0x0100c2eb0b00000000402dd91300000000e8494fe353f99783d3771c78798e1e839e649310513770fc6dc974fe53cf1a8600000000010000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a02067803000002009e05a32eafedefd40298e24ad4f8c334580187f7e9afbd9da13b5ba4007dd1b500a504844f7a0df2c5101d31696593b309040f8660d41035aba508f24c00668b210780d1f00800000000900100000000000019000000ffffffff020000ed1484f4d1f7d8c037087fed661dd92faccae1eed3c01182d6fdd6828cea144a020104696f74610300322e30
```

Account Output Storage Score: `621`.

# Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).

0 comments on commit 13604b7

Please sign in to comment.