Commit Graph

25 Commits

Author SHA1 Message Date
Dustin Brody c53de3e550 Caching updates/refactoring & state_sim defaults updates (#235)
* rm now-superceded shuffling cache (shuffling is only called from get_crosslinks), which was badly architected due to trying to exist in state; rm one more vestige of previous light-client regime (one more to go, from datatypes)

* fix wrong shuffling list size (active validator size, not validator size) to make consistent with 0.5.1 (will be inconsistent with testnet0); fix typo and change defaults in state_sim

* doAssert a couple of constant relationships necessary to avoid underflow; rm non-spec, unused helper function get_new_recent_block_roots

* refactor separate crosslink_committee_cache and winning_root_participants_cache(s) into StateData object; remove last vestige of previous shuffling cache

* separate out caching parts of StateData to new StateCache object
2019-04-05 08:18:13 -06:00
Ștefan Talpalaru de295619be
assert() -> doAssert() 2019-03-14 00:04:43 +01:00
Dustin Brody 1479bae22f implement distinct Epoch type and continue 0.4.0 spec update (#173)
* implement distinct Epoch type
* update two more spec 0.4.0 markers, leaving just deposit processing
2019-03-12 19:46:44 -06:00
Dustin Brody b8402e9809
speed up epoch processing by caching shuffling results (#153)
* speed up epoch processing by caching shuffling results
2019-03-05 19:10:36 +00:00
Dustin Brody 81d5becc7b Switch hash functions, prevent underflow & verify that shuffling works (#149)
* prevent balance underflow, per spec implementation note

* verify that permutation shuffing works: add YAML dependency to be used for ingesting test cases; switch from blake2 to keccak256 to match EF test cases; remove inefficient naive-spec-version of shuffling algorithm now that protolambda's can be tested directly
2019-03-01 17:50:01 -06:00
Dustin Brody 8baab40ea6 much faster shuffling based on observations from https://github.com/protolambda/eth2-shuffle enough that it's not easy to get exact speedup numbers 2019-02-25 14:58:04 +00:00
Dustin Brody 2d52d5cbfe convert some asserts to doAsserts to keep them in release mode builds; rename get_initial_beacon_state to get_genesis_beacon_state to track spec; switch target spec version to 0.3.0; switch references to penalize_validator to slash_validator/slashValidator to track spec; make some function returns safer by omitting 'return' (#132)
* convert some asserts to doAsserts to keep them in release mode builds; rename get_initial_beacon_state to get_genesis_beacon_state to track spec; switch target spec version to 0.3.0; switch references to penalize_validator to slash_validator/slashValidator to track spec; make some function returns safer by omitting 'return'

* 2x shuffling speedup by hoisting pivot calculations per https://github.com/protolambda/eth2-shuffle
2019-02-22 10:56:45 +01:00
Dustin Brody 132f1147a2 spec 0.3.0 updates: EPOCH_LENGTH -> SLOTS_PER_EPOCH, SlotNumber -> Slot, EpochNumber -> Epoch (#127)
* spec 0.3.0 updates: EPOCH_LENGTH -> SLOTS_PER_EPOCH, SlotNumber -> Slot, EpochNumber -> Epoch
2019-02-19 19:33:58 -06:00
Dustin Brody ad3de5fde9 Uint24 -> ValidatorIndex; Fork.pre_fork_version -> Fork.previous_version; Fork.post_fork_version -> Fork.current_version 2019-01-28 20:15:00 -08:00
Dustin Brody 4574178836 epochs replace slots as main first-class entity; several mechanical renamings (ForkData -> Fork; .fork_data -> .fork; remove stub custody types/code; some type aliasing to keep slots and epochs more enforceably separate; fix test_state_transition.nim assumption that GENESIS_SLOT == 0 2019-01-28 19:22:22 -08:00
Dustin Brody b4e98f1e6e add doc note re spec reqs 2019-01-23 10:16:16 -08:00
Dustin Brody 21b8bd7f71 new shuffling routine and adjust tests for it 2019-01-22 14:36:31 -08:00
Dustin Brody d728f113ac move existing shuffling routine out of way and keep existing references to it 2019-01-22 11:17:34 -08:00
Dustin Brody eed9ea8f0a Spec updates (#64)
* s/CrosslinkRecord/Crosslink/

* {MIN,MAX}_DEPOSIT to {MIN,MAX}_DEPOSIT_AMOUNT; rm SHARD_PERSISTENT_COMMITTEE_CHANGE_PERIOD; per https://github.com/ethereum/eth2.0-specs/issues/378 and 35adc9c61a rm persistent_committees, persistent_committee_reassignments, and ShardReassignmentRecord

* complete switchover from status/ValidatorStatusCodes to status_flags/INITIATED_EXIT/WITHDRAWABLE validator representation
2019-01-21 19:26:58 +01:00
Dustin Brody 9dcf37aad6 adjust get_shuffling and get_active_validator_indices to use slot, per spec 2019-01-18 12:47:30 +02:00
Dustin Brody f30b4f822e ValidatorRecord -> Validator 2019-01-18 12:47:30 +02:00
Dustin Brody 1bf876f5c1 mechanical renamings 2019-01-16 02:21:06 -08:00
Jacek Sieka e8ec26debb
spec updates
* bunch of renames
* bunch of new constants
* more long variable names!
2018-12-05 20:07:04 -06:00
tersec 0141c84fe5 data type updates from spec (#25)
* data type updates from spec
2018-12-03 11:46:22 -06:00
Jacek Sieka 6669e698b5
spec updates
* more work on block processing
* fix some unsigned issues
* fix ssz issue when last chunk is not full
* work around empty const seq compiler bug
* XXX -> TODO
2018-11-29 16:16:07 -06:00
Jacek Sieka 4d6b068697
beacon state updates
* add `on_startup` genesis state constructor
* update state transition to use ssz
* update validator adder
2018-11-28 23:38:44 -06:00
Jacek Sieka b01c51b3e2
move spec stuff to spec directory
helps maintain sanity in the face of spec changes
2018-11-28 13:49:03 -06:00
Jacek Sieka 548b6922ba
introduce Eth2Hash, Eth2Digest and friends (#22, fixes #3)
* introduce Eth2Hash, Eth2Digest and friends
2018-11-27 17:10:09 -06:00
Jacek Sieka da22f2065f
docs & comments
* link to resources for shuffling
* describe get_beacon_proposer
* hints for solving init issue
2018-11-26 09:44:49 -06:00
Jacek Sieka d1839dad9a
more small fixes
* move consts to top
* move some functions to validator.nim
* add some validator functoin smoke tests
2018-11-23 16:44:43 -06:00