ethereum / beacon_chain

MIT License
209 stars 65 forks source link

[WIP] refactor(crystallized_state): calculate total_deposits dynamically #111

Closed johnsBeharry closed 5 years ago

johnsBeharry commented 5 years ago

EXPECTED BEHAVIOR?

Scenario: Initialize new cycle
Given each validator must deposit "32 ETH"
And CYCLE_LENGTH is "64"
And DEFAULT_NUM_VALIDATORS is "40"
When a new cycle is initialised
Then total_deposits is calculated at "1280"
And justified_streak is calculated at "64"

NOTES

vote_balance and total_deposits are currently used to calculate last_justified_slot and justified_streak.

Some thing that is still unclear to me though is how much a validator have to stake for each cycle – can that be an arbitrary amount or is it always the full 32 ETH that was staked? The current tests for initialize_new_cycle suggest there could be a 3 ETH total_deposit which assumes the former.

djrtwo commented 5 years ago

Hi! Turns out fixing this test was non-trivial. I've submitted a new PR in which I'm fixing it. Sorry to bypass your work. Thanks for bringing the issue to my attention.