Skip to content

Commit ba31e4f

Browse files
committed
Tidy NOTES.md markdown
1 parent 08c4908 commit ba31e4f

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

modules/accounts_state/NOTES.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Reserve calculations
44

5+
```
56
reserve(epoch) = reserve(epoch-1)
67
- monetary_expansion
78
- sum_of_MIRs_to_or_from_reserves
@@ -19,10 +20,11 @@ treasury(epoch) = treasury(epoch-1)
1920
+ sum_of_MIRs_to_or_from_treasury
2021
2122
treasury_increase = total_rewards * tau ( 0.2 )
23+
```
2224

25+
## Epoch numbers from DBSync (ada_pots)
2326

24-
Epoch numbers from DBSync (ada_pots):
25-
27+
```
2628
e208: 13888022852926644 from Java implementation - can't replicate
2729
2830
e209:
@@ -59,11 +61,12 @@ treasury 40198464232058 X - too low by 4.6kA |- Sums almost match
5961
rewards 133110645284460 X - too high by 496kA /
6062
deposits 651738000000 match
6163
fees 5578218279 match
64+
```
6265

6366

67+
## Per-SPO rewards table for an epoch
6468

65-
Per-SPO rewards table for an epoch:
66-
69+
```sql
6770
SELECT
6871
encode(ph.hash_raw, 'hex') AS pool_id_hex,
6972
SUM(CASE WHEN r.type = 'member' THEN r.amount ELSE 0 END) AS member_rewards,
@@ -73,10 +76,13 @@ JOIN pool_hash ph ON r.pool_id = ph.id
7376
WHERE r.spendable_epoch = 213
7477
GROUP BY ph.hash_raw
7578
ORDER BY pool_id_hex;
79+
```
7680

81+
## Specific SPO test
7782

7883
Epoch 212 (spendable in 213), SPO 30c6319d1f680..., rewards actually given out:
7984

85+
```sql
8086
SELECT
8187
encode(ph.hash_raw, 'hex') AS pool_id_hex,
8288
SUM(CASE WHEN r.type = 'member' THEN r.amount ELSE 0 END) AS member_rewards,
@@ -86,19 +92,26 @@ JOIN pool_hash ph ON r.pool_id = ph.id
8692
WHERE r.spendable_epoch = 213
8793
AND encode(ph.hash_raw, 'hex') LIKE '30c6319d1f680%'
8894
GROUP BY ph.hash_raw;
95+
```
8996

90-
pool_id_hex | member_rewards | leader_rewards
91-
----------------------------------------------------------+----------------+----------------
92-
30c6319d1f680470c8d2d48f8d44fd2848fa9b8cd6ac944d4dfc0c54 | 33869550293 | 2164196243
97+
| pool_id_hex | member_rewards | leader_rewards |
98+
|----------------------------------------------------------|----------------|----------------|
99+
| 30c6319d1f680470c8d2d48f8d44fd2848fa9b8cd6ac944d4dfc0c54 | 33869550293 | 2164196243 |
93100

94101
Total 34091555121
95102

96103
We have
97104

98-
2025-08-21T13:59:50.578627Z INFO acropolis_module_accounts_state::rewards: Pool 30c6319d1f680470c8d2d48f8d44fd2848fa9b8cd6ac944d4dfc0c54 blocks=1 pool_stake=44180895641393 relative_pool_stake=0.001392062719472796345022132114111547444335115561171699064775592918376184270138741760710696148952284469 relative_blocks=0.0005022601707684580612757408337518834756403817177297840281265695630336514314414866901054746358613761929 pool_performance=1 **optimum_rewards=34113076193** pool_rewards=34113076193
105+
```
106+
2025-08-21T13:59:50.578627Z INFO acropolis_module_accounts_state::rewards: Pool 30c6319d1f680470c8d2d48f8d44fd2848fa9b8cd6ac944d4dfc0c54 blocks=1 pool_stake=44180895641393 relative_pool_stake=0.001392062719472796345022132114111547444335115561171699064775592918376184270138741760710696148952284469 relative_blocks=0.0005022601707684580612757408337518834756403817177297840281265695630336514314414866901054746358613761929 pool_performance=1 optimum_rewards=34113076193 pool_rewards=34113076193
107+
```
108+
109+
Optimum rewards: 34113076193
99110

100111
Difference: We are too high by 21521072, or 0.06%
101112

102113
Input into this in epoch 212 is:
103114

115+
```
104116
Calculating rewards: epoch=212 total_supply=31737719158318701 stake_rewards=31854784667376
117+
```

0 commit comments

Comments
 (0)