Jacek Sieka
125231d321
add initial block pool ( #139 )
...
* implement in-memory block graph
* store tail block in database
* resolve unknown parents by syncing them from peers
* introduce concept of resolved blocks and attestations - those that
follow minimal protocol rules
* update state head lazily
* log more stuff
* shortHash -> shortLog
* start 9/10 beacon nodes by default, last can be started manually
* see also #134
* fix start.sh epoch length
2019-02-28 15:21:29 -06:00
Mamy Ratsimbazafy
20f99db058
remove unused epoch template ( #142 )
2019-02-28 08:17:57 -06:00
Yuriy Glukhov
5b60c3b45f
Enable discovery service regardless bootnodes are provided
2019-02-28 09:48:33 +02:00
Dustin Brody
34e6149f89
fix crosslink epoch refs to begin with GENESIS_EPOCH; more minor epoch processing tweaks/unstubbed-code ( #137 )
...
* fix crosslink epoch refs to begin with GENESIS_EPOCH; more minor epoch processing tweaks/unstubbed-code
* remove obsolete TODO and use humanEpochNum
2019-02-27 13:58:07 +00:00
Dustin Brody
0305432a87
implement and call process_slashings and process_exit_queue from processEpoch; update a few more epoch processing details to be consistent with 0.3.0; add rest of final upates per epoch ( #136 )
2019-02-26 10:54:08 +01:00
Dustin Brody
60e6a9fedc
assert relationship between constants necessary to avoid underflow
2019-02-25 14:58:04 +00:00
Dustin Brody
eda43b5b1c
adjust copyright comment form
2019-02-25 14:58:04 +00:00
Dustin Brody
6dab867848
cleanup
2019-02-25 14:58:04 +00: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
f77016af68
switch sense of bls_verify check
2019-02-25 14:58:04 +00:00
Dustin Brody
de2cad0e12
switch from legacy pre-spec sum_effective_balances(...) to get_total_balance(...)
2019-02-25 14:58:04 +00:00
Dustin Brody
a42601e29e
initial epoch processing update switching from slot-oriented to epoch-oriented, using newer helper functions
2019-02-25 14:58:04 +00:00
Dustin Brody
fb3bbfccaa
small 0.3.0 adjustments; comment updates/clarifications; add Transfer processing
2019-02-25 14:58:04 +00:00
Yuriy Glukhov
a62d25ab98
Merge pull request #131 from status-im/state-replay
...
initial state replay implementation
2019-02-22 18:04:48 +02: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
Jacek Sieka
4c2d212781
updates
...
* comment on last finalized state
* use explicitly named proc's instead of type tricks
2019-02-21 15:38:26 -06:00
Jacek Sieka
1d9c91d230
cleanups
...
* add ancestor getter to db layer, and use
* remove head block call
* add trivial beacon chain db test
2019-02-21 11:20:50 -06:00
Jacek Sieka
2d307e2257
initial state replay implementation
...
* fix initial attestation pool on reordered attestations
* simplify db layer api
* load head block from database on startup, then load state
* significantly changes database format
* move subscriptions to separate proc's
* implement block replay from historical state
* avoid rescheduling epoch actions on block receipt (why?)
* make sure genesis block is created and used
* relax initial state sim parameters a bit
2019-02-20 22:42:17 -06:00
Dustin Brody
1d13007627
More spec v0.3.0 notations and updates ( #129 )
...
* tighten get_active_index_root epoch assertion bound
* implement merkle_root
* rm process_penalties_and_exits; add slash_validator
* rm rm'd and unused constant
2019-02-20 14:35:27 -06: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
Jacek Sieka
4670d6c98a
naive attestation pool, in preparation of fork choice integration ( #125 )
...
* move attestation pool to separate file
* combine attestations lazily when needed
* advance state when there's a gap while attesting
* compile beacon node with optimizations - it's tooo slow right now
* log when unable to keep up
2019-02-20 00:35:02 +01:00
Dustin Brody
1269e001ad
get most 0.3.0 spec renamings ( #126 )
...
* get most 0.3.0 spec renamings
2019-02-19 17:07:56 -06:00
Jacek Sieka
c64cd2f275
a few simple SlotNumber cleanups
2019-02-18 22:43:33 +02:00
Mamy Ratsimbazafy
8e48bac58b
[WIP] Fix some issues after introducing "humaneEpochNumber" ( #118 )
...
* Fix some issues after introducing "humaneEpochNumber" + use slot_duration to 4
* Address humane comments
* Fix comment
2019-02-18 16:58:34 +01:00
Jacek Sieka
0e9cc20cfe
beacon node simplifications ( #116 )
...
* remove previous randao scheme code
* fix some epoch logging
* move genesis time selection to state generation
2019-02-15 17:33:32 +01:00
Dustin Brody
d3f97c1d5c
Merge pull request #115 from status-im/nus
...
complete switching to v0.2.0 RANDAO scheme, with verification enabled
2019-02-15 10:57:14 +00:00
Dustin Brody
6bef36d418
remove more old RANDAO vestiges
2019-02-14 14:03:45 -08:00
Dustin Brody
8fbf87aa8c
complete switching to v0.2.0 RANDAO scheme, with verification enabled
2019-02-14 13:41:04 -08:00
Jacek Sieka
a71424d768
add more config options and log compile parameters ( #114 )
...
default sim runs with smaller chain now
2019-02-14 13:32:33 -06:00
Mamy Ratsimbazafy
c2a52d7fc5
Allow faster slots ( #112 )
...
* Allow compile time configurable slot time
2019-02-14 13:15:10 +01:00
Dustin Brody
55ac8d337b
some v0.2.0 updates and fixes a bug that should enable simulation to continue longer ( #110 )
...
* some v0.2.0 updates and fixes a bug that should enable simulation to continue longer
2019-02-14 04:16:50 +01:00
Dustin Brody
31a4c7255f
more v0.2.0 spec updates ( #107 )
...
* switch to v0.2.0 shuffling scheme
* fix some >80 char lines; add get_total_balance helper function (used in epoch processing, etc); note intended removal of repeat_hash and users thereof; add some int_to_bytes and bytes_to_int helpers; more underflow comments; add Gwei type; adjust generate_seed to include additional entropy source; note egregious inefficiencies
* minor code cleanup
* move some general helper functions to helpers.nim and clarify little-endian comments
2019-02-13 11:26:32 +01:00
Mamy Ratsimbazafy
b60fa131f1
Fix simulation regression due to custody_bitfield ( #108 )
2019-02-12 23:50:02 +01:00
Mamy Ratsimbazafy
899c8e5df9
Bitfield debugging asserts ( #106 )
...
* debugging asserts
* Ensure initialization of custody_bitfield for mock Attestations
2019-02-12 18:07:44 +01:00
Yuriy Glukhov
56a48cc60f
Fixed epoch actions ( #105 )
...
* Fixed epoch actions
* debugging asserts
* Revert "debugging asserts"
This reverts commit 9a11f5a7d8
.
2019-02-12 16:56:58 +01:00
Dustin Brody
433e2f78c2
Merge pull request #104 from status-im/oug
...
Spec updates for 0.2.0
2019-02-11 15:48:00 +00:00
Dustin Brody
f1cbc4a9dc
adjust indentation
2019-02-11 16:32:22 +01:00
Mamy Ratsimbazafy
f7feb9a6c9
Delay validators and add more log in crosslink asserts ( #103 )
2019-02-11 16:29:21 +01:00
Dustin Brody
b03ac3427f
split out get_previous_epoch into helper function
2019-02-11 16:10:46 +01:00
Dustin Brody
d44999abc5
latest_crosslink_root -> latest_crosslink; adjust checkAttestation; add SHUFFLE_ROUND_COUNT and FORK_CHOICE_BALANCE_INCREMENT constants; some additional casts because a few places where ValidatorIndex was used are now uint64; remove some old commented-out lines of code from shardcommittee transition
2019-02-11 15:32:27 +01:00
Dustin Brody
4747477160
more checking that various functions match v0.1; some variable/etc renaming; fix is_double_vote to check epoch, not slot equivalence; finish verify_slashable_attestation; adjust is_surround_vote logic ( #100 )
2019-02-08 00:07:15 +01:00
Zahary Karadjov
c567bc410f
Use human-readable names for the slot numbers
2019-02-07 22:14:08 +01:00
Yuriy Glukhov
f1f1beb703
Fixed block proposal signature domain
2019-02-07 21:55:44 +01:00
mratsim
1e574cf75a
Hacky (?) fix #97 assert fails
2019-02-07 21:22:46 +01:00
Dustin Brody
072c1607fd
implement new RANDAO reveals ( #92 )
...
* implement new RANDAO reveals
2019-02-07 21:13:10 +01:00
Dustin Brody
f2545318db
get_crosslink_committees_at_slot updates ( #95 )
2019-02-07 20:27:13 +01:00
Dustin Brody
2794181889
Spec updates ( #94 )
...
* s/slot_included/inclusion_slot/; s/participation_bitfield/aggregation_bitfield/; rearrange some type definitions to match spec order
* a couple more Eth1Data-related spec syncs
2019-02-07 17:55:48 +01:00
Zahary Karadjov
31abd31d8a
Fix an int conversion issue
2019-02-07 17:53:02 +01:00
Zahary Karadjov
dfcd22519b
Fix for getting the current epoch number
2019-02-07 16:40:00 +01:00
Dustin Brody
bc44744acd
rm unused work_pool module ( #90 )
...
* rm unused work_pool module
* preserve comment from Danny about signature aggregation
2019-02-07 16:28:59 +01:00
Jacek Sieka
ed8f7ab475
schedule epoch actions for all 64 slots in an epoch
2019-02-07 13:18:00 +01:00
Jacek Sieka
976e1e1f10
spec: remove unused code, fix state_sim speed
2019-02-07 13:03:02 +01:00
cheatfate
20e7ca48b5
Fix `validator not in registry` and `$` bugs.
2019-02-07 12:51:21 +02:00
Dustin Brody
2d71b998c7
Spec update to v0.1 ( #88 )
...
* update based on https://github.com/ethereum/eth2.0-specs/pull/483
* more spec updates
2019-02-07 11:43:21 +01:00
Dustin Brody
788b093284
Merge pull request #87 from status-im/vdy
...
Spec updates
2019-02-06 22:52:36 +00:00
Dustin Brody
74cb86ec21
more spec changes
2019-02-06 21:37:21 +01:00
Mamy Ratsimbazafy
224f22d377
Fix regression from #80 on validator_keygen ( #86 )
2019-02-06 20:58:18 +01:00
Jacek Sieka
337aa83f1a
spec: fix off-by-one, allows state_sim to continue
2019-02-06 20:53:05 +01:00
Jacek Sieka
2f96c4bade
spec: remove ShardCommittee remnants, add CrosslinkCommittee helper
2019-02-06 20:37:25 +01:00
Mamy Ratsimbazafy
11da02c34f
Asyncdispatch2 rebranding to chronos ( #84 )
...
* Asyncdispatch2 rebranding to chronos
* nim-eth and nim-chronos part of nimble packages
* fix package name
2019-02-06 18:56:04 +01:00
Dustin Brody
7cf13c22f0
fix up some non-spec things that interfere with state_sim with attestations
2019-02-06 13:31:41 +01:00
Yuriy Glukhov
7f1bddb267
Use nim-eth ( #82 )
2019-02-05 20:21:18 +01:00
Dustin Brody
d1af069c55
Spec update ( #83 )
...
* rm GWEI_PER_ETH
* update EJECTION_BALANCE; rm MAX_CASPER_VOTES/replace with MAX_INDICES_PER_SLASHABLE_VOTE; modify GENESIS_SLOT
* update various constants from slots to epochs; MAX_CASPER_SLASHINGS -> MAX_ATTESTER_SLASHINGS
* AttesterSlashing field renamings; SlashableVote -> SlashableAttestation; add DOMAIN_RANDAO
* rm aggregate_signature_poc_[01]_indices
* centralize some bitfield functions
2019-02-05 19:40:27 +01:00
Ștefan Talpalaru
20e02d5615
enable "--threads:on" for tests ( #75 )
...
* enable "--threads:on" for tests
* disable Chronicles colours on Windows
* delete forLoopMacros-related config
2019-02-05 18:48:34 +01:00
Mamy Ratsimbazafy
e5d152c6d6
Update BLS to the latest scheme. ( #80 )
...
* Attempt to switch to nim-blscurve.
* "Fix" BLS test for new tests
* Missing domain param in validator keygen
2019-02-05 17:13:29 +01:00
Yuriy Glukhov
bbd94185a4
State storage predicate moved to beacon_node, split persistBlock to persistBlock and persistState
2019-02-04 21:44:37 +01:00
Yuriy Glukhov
1606bc6f92
Cosmetics
2019-02-04 21:44:37 +01:00
Yuriy Glukhov
917c48d9a5
More persistance
2019-02-04 21:44:37 +01:00
Dustin Brody
dda24619e8
several mechanical renamings
2019-01-30 19:30:34 +02:00
Dustin Brody
68ca7850f4
rm min_empty_validator_index, ZERO_BALANCE_VALIDATOR_TTL, Validator.latest_status_change_slot; switch Fork.fork_slot to Fork.epoch; begin removing Validator.randao_layers; now that https://github.com/ethereum/eth2.0-specs/issues/352 is fixed, test out for more slots; get process_deposit consistent with current spec
2019-01-30 00:41:07 -08:00
Dustin Brody
8dadbd3257
fix spurious assertion per https://github.com/ethereum/eth2.0-specs/issues/515
2019-01-28 20:49:20 -08:00
Dustin Brody
5d0e1c026d
remove Validator.{custody_commitment,latest_custody_reseed_slot,penultimate_custody_reseed_slot}
2019-01-28 20:34:44 -08: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
b46183047f
remove BeaconState.shard_committees_at_slots in favor of crosslink committees; validator_registry_latest_change_slot -> validator_registry_update_slot mechanical renaming
2019-01-28 23:43:55 +02:00
Dustin Brody
f85088651c
Revert "remove BeaconState.shard_committees_at_slots in favor of crosslink committees; validator_registry_latest_change_slot -> validator_registry_update_slot mechanical renaming"
...
This reverts commit 2222a8e222
.
2019-01-26 11:17:22 -08:00
Dustin Brody
2222a8e222
remove BeaconState.shard_committees_at_slots in favor of crosslink committees; validator_registry_latest_change_slot -> validator_registry_update_slot mechanical renaming
2019-01-26 11:15:33 -08:00
Bruno Škvorc
7071021dc5
Typo fix
2019-01-25 23:13:41 +01:00
Jacek Sieka
e0a257406e
clean up and add some logging ( #70 )
2019-01-25 11:35:22 -06:00
zah
a0712e691a
Replace the usage of cligen with confutils ( #68 )
2019-01-23 12:45:15 -06:00
Dustin Brody
53952dd0c9
Merge pull request #66 from status-im/wcc
...
Spec update
2019-01-23 18:34:00 +00:00
Dustin Brody
3877ef263c
remove return to gain better error messages
2019-01-23 09:53:51 -08:00
Jacek Sieka
63f7302a41
Update beacon_chain/spec/beaconstate.nim
...
Co-Authored-By: tersec <tersec@users.noreply.github.com>
2019-01-23 17:51:59 +00:00
Dustin Brody
a11dcdfe64
switch from get_shuffling_prev to get_shuffling; remove some also-removed-in-spec calls and temporarily/ugly-bridge a still-useful reference to shard committees until they're completely removed
2019-01-22 17:50:51 -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
Jacek Sieka
523a990adc
ssz: switch to little-endian
...
https://github.com/ethereum/eth2.0-specs/pull/139
2019-01-22 11:56:01 -06:00
Zahary Karadjov
a9c026b957
More logging close to the code that fails often
2019-01-21 21:43:08 +02: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
476052b314
deposit root to Eth1Data transition
2019-01-18 12:47:30 +02:00
Dustin Brody
c788d72857
s/POW_RECEIPT_ROOT_VOTING_PERIOD/ETH1_DATA_VOTING_PERIOD/; rm COLLECTIVE_PENALTY_CALCULATION_PERIOD, ACTIVE_PENDING_EXIT, EXITED_WITH_PENALTY
2019-01-18 12:47:30 +02:00
Dustin Brody
1fe5ba07b8
update initiate_validator_exit and exit_validator helper functions to current spec; remove spec-removed EXITED_WITHOUT_PENALTY
2019-01-18 12:47:30 +02: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
38c2cc72fa
poc -> custody mechanical name changes
2019-01-18 12:47:30 +02:00
Zahary Karadjov
d753332c54
Fix the build of the validator_keygen
2019-01-17 14:38:27 +02:00
Zahary Karadjov
43ae45fe7e
Add --logLevel command-line flag; Fix running the start.sh script from the beacon-chain repo
2019-01-17 14:38:27 +02:00
Yuriy Glukhov
7e4d264887
Back the db by rocksdb backend
2019-01-17 14:38:16 +02:00
Dustin Brody
ce72c1b4bc
re-disable assertion creationg failures in research/state_sim; hadn't been set up to run before, either
2019-01-17 00:14:55 -08:00
Dustin Brody
6f103a7bcd
switch to new penalty calculation infrastructure
2019-01-16 06:50:54 -08:00