Skip to content

Commit

Permalink
some changes to PROP-001.md text
Browse files Browse the repository at this point in the history
  • Loading branch information
giunatale committed Mar 21, 2024
1 parent e8b4091 commit 66f30b4
Showing 1 changed file with 34 additions and 40 deletions.
74 changes: 34 additions & 40 deletions PROP-001.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ directory:
- `balances.json` https://atomone.fra1.digitaloceanspaces.com/cosmoshub-4/prop848/balances.json
- `auth_genesis.json` https://atomone.fra1.digitaloceanspaces.com/cosmoshub-4/prop848/auth_genesis.json

The way those files were extracted from the snaphots is available
The way these files were extracted from proposal 848 snaphot is available
[here](SNAPSHOT-EXTRACT.md). If you prefer you can start from a Gaia blockchain
node and extract all the data, everything is detailed in the link above.

## Verify tally

A good way to check the correctness of the data is to compute the prop 848
tally from the data and compare it with the proposal `TallyResult` field stored
in the blockchain's store.
tally using it and compare the results with the `TallyResult` field of the
proposal object stored on-chain.

You can achieve that by running this command:
You can achieve this by running the following command:
```
$ go run . tally data/prop848/
173,165 votes
Expand All @@ -48,15 +48,16 @@ Yes percent: 0.517062127500689774
+-----------+------------+------------+------------+------------+-------------+
```

As printed in the output of the command, the diff is always 0, meaning there's
As printed in the output of the command, the diff is 0, meaning there's
no difference between the tally computed from the data and the `TallyResult`
field of the proposal.

## Consolidate accounts

The program allows you to create a `data/prop848/accounts.json` file that
consolidates all the interesting data from an account. This file will be used
by the following command to compute other things.
consolidates all the relevant data for accounts. This file will be the starting
point for the following steps, and will be fed to this very same program
but using a different command.

```
$ go run . accounts data/prop848/
Expand Down Expand Up @@ -107,8 +108,8 @@ For example, here is the representation of an account in this file:
}
```

It gives access to the liquid and staked amount, the vote, the delegations and
their relative vote.
It gives access to the unbonded and bonded amounts (here *liquid* and *staked*
amounts), the direct vote if present, the delegations and their relative vote.

> [!NOTE]
> `ModuleAccount` and `InterchainAccount` are skipped.
Expand Down Expand Up @@ -153,10 +154,10 @@ unbonded $ATOM is calculated to result in them having less than 1/3 of the
final $ATONE supply.

Let's define the following variables:
- `C` the multiplier
- `t` the target percent (known, 33%)
- `X` a supply in $ATOM (known)
- `Y` a supply in $ATONE
- `C` is the multiplier we want to compute to be applied to non-voter cathegories, i.e. *Not Staked*, *Abstain* and *Did Not Vote*
- `t` the target relative percentage of $ATONE supply distributed to non-voter cathegories we want to achieve (known, 33%)
- `X` is the supply in $ATOM (known)
- `Y` is the supply in $ATONE
- both `X` and `Y` will have an annotation indicating the portion of the supply:
- `Y` voted Yes
- `A` voted Abstain
Expand All @@ -167,42 +168,35 @@ Let's define the following variables:

For example, $X_{A}$ is the number of $ATOM that has votes ABSTAIN.

Intuitively, we can start by writing this formula, which expresses our need:
Using the above notation, we can express our what we want to achieve mathemacally as:
```math
\begin{flalign}
& \frac{Y_{A} + Y_{DNV} + Y_{U}}{Y_{A} + Y_{DNV} + Y_{U} + Y_{Y} + Y_{N} + Y_{NWV}} <= t &
\end{flalign}
\frac{Y_{A} + Y_{DNV} + Y_{U}}{Y_{A} + Y_{DNV} + Y_{U} + Y_{Y} + Y_{N} + Y_{NWV}} \leq t
```

Which can be translated by the number of abstainers, non-voters and unbonded
$ATONE divided by the total number of $ATONE must be less or equal to `t`, thus
33%.

Now let's replace the `Y`s, which are unknown at this point, with the `X`s,
using the multipliers we know and the multiplier we are looking for `C`:
It is know from the specifications of the distribution mechanism, disregarding
any additional bonus or malus:
```math
\begin{flalign}
& Y_{Y} = X_{Y} &\\
& Y_{N} = 4 \cdot X_{N} & \\
& Y_{NWN} = 4 \cdot X_{NWV} & \\
& Y_{A} + Y_{DNV} + Y_{U} = C \cdot (X_{A} + X_{DNV} + X_{U}) &
\end{flalign}
\left\{
\begin{aligned}
& Y_{Y} = X_{Y} \\
& Y_{N} = 4 \cdot X_{N} \\
& Y_{NWV} = 4 \cdot X_{NWV} \\
& Y_{A} + Y_{DNV} + Y_{U} = C \cdot X_{A} + C \cdot X_{DNV} + C \cdot X_{U} = C \cdot (X_{A} + X_{DNV} + X_{U})
\end{aligned}
\right.
```

Which, with respect to the first equation, gives:
Which if plugged in the above equation gives:
```math
\begin{flalign}
& \frac{C \cdot (X_{A} + X_{DNV} + X_{U})}{C \cdot (X_{A} + X_{DNV} + X_{U}) + X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV}} <= t &
\end{flalign}
\frac{C \cdot (X_{A} + X_{DNV} + X_{U})}{C \cdot (X_{A} + X_{DNV} + X_{U}) + X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV}} \leq t
```

Now let's isolate `C`:
Finally, let's isolate `C`:
```math
\begin{flalign}
& C \cdot (X_{A} + X_{DNV} + X_{U}) <= t \cdot C \cdot (X_{A} + X_{DNV} + X_{U}) + t \cdot (X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV}) &\\
& (1 - t) \cdot C \cdot (X_{A} + X_{DNV} + X_{U}) <= t \cdot (X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV}) &\\
& C <= \frac{t}{1-t} \cdot \frac{(X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV})}{(X_{A} + X_{DNV} + X_{U})} &\\
\end{flalign}
\begin{align}
C \cdot (X_{A} + X_{DNV} + X_{U}) &\leq t \cdot C \cdot (X_{A} + X_{DNV} + X_{U}) + t \cdot (X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV}) \\[10pt]
(1 - t) \cdot C \cdot (X_{A} + X_{DNV} + X_{U}) &\leq t \cdot (X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV}) \\[10pt]
C &\leq \frac{t}{1-t} \cdot \frac{(X_{Y} + 4 \cdot X_{N} + 4 \cdot X_{NWV})}{(X_{A} + X_{DNV} + X_{U})}
\end{align}
```
Which gives the final formula described in the [proposal 001][001].

Expand Down

0 comments on commit 66f30b4

Please sign in to comment.