The beacon chain expects a `uint64` in part to avoid big-int computation.
This commit updates the `Deposit` log so that it broadcasts data of the
appropriate size.
There is an order based on the Vyper deposit contract which should be maintained
here. There is also a reference to it when processing `Deposit` messages.
This commit corrects the order here so all serializations will match.
1. The order of the `deposit_data` serialization does not match the current
Vyper contract. The description now matches that serialization.
2. The `deposit.merkle_tree_index` was not being used (at least explicitly) so
the text now reflects which inputs are to be used for which parameters in the
pseudocode spec that follows.
3. There seems to be a bug where we want the initial leaf to be the `hash` of
the `DepositData`, not the data itself. The text now reflects this requirement.
The variable name 'slot' in the for-loop in 'get_shuffling' conflicts with the get_shuffling argument name 'slot'. Renames 'slot' in for-loop to 'slot_num'.
In keeping with the rest of the code in this document we adhere to valid Python
where possible.
The custom comparator keyword argument for `sorted` is `key` so this commit
updates its usage when sorting validators by exit order.
This code determines the order in which the next branch element and the
current value should be hashed to produce the parent node in the Merkle tree.
The existing code fails to verify branches constructed in the standard way.
This patch fixes the spec code so that it works properly by using an appropriate
parity calculation.
Example code here to illustrate it working:
https://gist.github.com/ralexstokes/9d82e188bd3286ff74a1fa1dcb5068e0
`EJECTION_BALANCE` is in units of ETH.
`state.validator_balances[index]` is in units of Gwei.
For the ejection computation to work as desired, we need to convert the
`EJECTION_BALANCE` constant from ETH to Gwei.
There should be a correspondence here but referring to the slot is more
explicit, especially for those who are not as familiar with the
details of FFG finalization.