Commit Graph

3527 Commits

Author SHA1 Message Date
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
Dustin Brody 7e3aa4dda2 initial process_penalties_and_exits 2019-01-16 05:39:34 -08:00
Dustin Brody 44edf400d2 rm PENDING_ACTIVATION 2019-01-16 05:24:58 -08:00
Dustin Brody 2ff973e46f add some helper functions from new spec; fix some comments; more plumbing; start removing some of the status-code refs in favor of the new status bitfield 2019-01-16 04:57:49 -08:00
Dustin Brody bc65693eae stop routing through update_validator_status 2019-01-16 04:20:44 -08:00
Dustin Brody 5823091501 some more fields, plumbing, comment fixes 2019-01-16 03:39:16 -08:00
Dustin Brody cb1096c581 add some helper functions, change epoch processing, add some new constants 2019-01-16 03:07:41 -08:00
Dustin Brody d101c117fd stage a few more working changes from the bunch 2019-01-16 02:42:40 -08:00
Dustin Brody 1bf876f5c1 mechanical renamings 2019-01-16 02:21:06 -08:00
Zahary Karadjov 7608fd76a3 Make the code compile in Nim 0.19.0 2019-01-12 13:57:50 +02:00
mratsim c3d6961eed Remove rebase hash leftovers 2019-01-12 13:57:50 +02:00
mratsim 0a080e4f27 Remove the vote count closure, unlike the spec we use a count table 2019-01-12 13:57:50 +02:00
mratsim 423f632606 Fork choice compiles (but untested) 2019-01-12 13:57:50 +02:00
mratsim f0e3de6b19 Depart from spec "attestation_targets" 2019-01-12 13:57:50 +02:00
mratsim 4a6e694268 Add BeaconChainDB 2019-01-12 13:57:50 +02:00
mratsim 8a68bbb26c Integrate fork choice helpers into skeleton 2019-01-12 13:57:50 +02:00
mratsim e3d8bc9695 Sync with latest specs
get_parent - https://github.com/ethereum/eth2.0-specs/pull/250
AttestationData - ac600d39

https://github.com/ethereum/eth2.0-specs/issues/285 and 5b35b6c2
2019-01-12 13:57:50 +02:00
mratsim 4c3cae5519 Move fork choice research out of beacon chain 2019-01-12 13:57:50 +02:00
mratsim 12c6e2f46b Implement spec helpers for lmd ghost 2019-01-12 13:57:50 +02:00
Zahary Karadjov a586087472 Stable network simulation 2019-01-09 10:45:33 +02:00
Zahary Karadjov 1c30214e9a Reach block 64 in the network simulation
* Slightly better logging
* Handling of incoming blocks and missing blocks
2019-01-07 14:59:52 +02:00
Zahary Karadjov 8f9a5441f1 More reliable network simulation
You'll need the latest versions of nim-eth-p2p, nim-serialization
and nim-json-serialization.

Before starting the simulation script, make sure to delete any previous
json files from the simulation folder:

```
rm tests/simulation/*.json
tests/simulation/start.sh
```

This should survive the creation of few blocks before diying with a
block validation error.
2019-01-05 14:35:47 +02:00
Jacek Sieka a0aa230c45 spec updates
* skip validation in a few more cases
* more renames
* add attestations to state sim
2018-12-28 02:32:41 +02:00
Jacek Sieka 12a819c110
spec updates (#48)
* spec updates
* balances move out to separate seq
* bunch of placeholders for proof-of-custody / phase1
* fix inclusion distance adjustment
* modify state in-place in `updateState` (tests spent over 80% time
copying state! now it's down to 25-50)
* document several conditions and conversations
* some renames here and there to follow spec
2018-12-27 14:14:37 -06:00
Dustin Brody 68644517da initial rough commit of a work/attestation pool (#46)
* initial rough commit of a work/attestation pool

* add kludgy participation_bitfield handling, some error handling, and document future improvments from spec update #47

* rename addAttestation to add for Nim consistency
2018-12-26 13:17:30 +01:00
Jacek Sieka eb369cee4e spec updates
* first attestation created!
* add hash_tree_root_final that returns an Eth2Digest
* hits the first real blocking spec bug :(
2018-12-24 10:08:11 +01:00
Jacek Sieka 04314589ff
spec updates (#45)
* spec updates

* random small updates
* ssz no longer sorts by field, fix enum serialization
* rewire block processing a little to avoid a few state copies
* add a state simulation tool that writes out jsons
2018-12-21 16:37:46 -06:00
Zahary Karadjov abb199d6dc Chain creation and network simulation start script 2018-12-19 15:39:00 +02:00
Jacek Sieka 0b0c66ebd9 spec updates
* spec-following renames
* more documentation
* simplify casper slashing
* fix block creation flow / logic
2018-12-19 14:48:25 +02:00
Jacek Sieka 400ac83aa0
BLSVerify > bls_verify 2018-12-17 13:36:17 -06:00
Jacek Sieka 142aa8ca8e ssz: finish implementation (#42)
* ssz: finish implementation

* add object support, simplify implementation
* fix extra round of hashing in tree_hash_root

* ssz: cleanups

* work around Nim range bug for Uint24, cleanups
2018-12-17 19:03:53 +01:00
Dustin Brody 5dc06f4496 switch some proc to func, add some infrastructure, update based on spec name changes (#40)
* switch some proc to func, add some infrastructure, update based on spec name changes

* typo
2018-12-15 10:32:36 -06:00
Danny Ryan aa5129b90e simplify randao layers tests 2018-12-15 01:17:59 +02:00
Danny Ryan b1114a94de fix double incrementing of proposer.randao_layers 2018-12-15 01:17:59 +02:00
Jacek Sieka 35ac0c4ddc
spec updates (#39)
* some minor renames
* fix some leftover block slot references (replaced by state slot)
* fix some more uint underflows
* update epoch calculations (reward et al)
* now works past 100 epochs at least with empty blocks (very slow)
2018-12-14 10:12:39 -06:00
Jacek Sieka 44bb13ae46
spec updates (#37)
* use repeat_hash from spec in randao
* add some logging to state processing
* export crypto string converters in spec insulation layer
* enable block signature verification
* ssz: add support for arrays, remove custom data type code
* correctly handle previous and new block
* add trivial block processing tests
* prefer iterative repeat_hash
* state transition mostly done
* handle most specials and slashings
2018-12-13 10:00:55 -06:00
Yuriy Glukhov a7ee8a71bb Sign block proposal and attestation 2018-12-13 12:58:05 +02:00
Dustin Brody 34f7254c61 fix build 2018-12-12 16:10:46 -08:00
Dustin Brody 4b1197bc17 fix one compile error 2018-12-12 13:44:18 -08:00
tersec d48f056be9
Merge pull request #33 from status-im/gossip_sub
Faux implementation of GossipSub based on RLPx
2018-12-12 21:36:43 +00:00
Yuriy Glukhov 5776393539 Fixed compilation error with newer nim 2018-12-12 12:36:20 +01:00
Jacek Sieka 5b35b6c2dc
hash -> root
ethereum/eth2.0-specs#285
2018-12-11 15:53:18 -06:00
Jacek Sieka 7ea51d5b0b
spec updates (#34)
* spec updates

* make several constants uint64 to help minimize casting
* document data type woes - will have to revisit these
* change comment style on fields and constants to make room for better
comments
* add BLSVerify and BLSAddPbkeys facades to insulate spec code from
milagro
* fix proof of possession type
* drop explicitly ordered container fields from ssz - there's an issue
open to sort this out before committing it to the spec
2018-12-11 11:55:45 -06:00
Zahary Karadjov c71f89e211 Faux implementation of GossipSub based on RLPx 2018-12-10 14:06:54 +02:00
Yuriy Glukhov 10ed2bd5b9 Comments addressed, cosmetics 2018-12-09 11:17:54 +02:00
Yuriy Glukhov 61f81fb0c4 Some bits of randao 2018-12-09 11:17:54 +02: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
Jacek Sieka eba4f18f71
Merge remote-tracking branch 'origin/master' into epoch-state-2 2018-12-05 11:58:01 -06:00
Yuriy Glukhov f12b679880 addLocalValidators impl 2018-12-05 18:58:28 +02:00
Jacek Sieka 94756cc5a2
add is_power_of_2 implementation 2018-12-05 07:19:57 -06:00
Jacek Sieka 4b41010610
add more epoch processing
* document several parts
* almost complete epoch state processing
2018-12-04 12:45:30 -06:00
Jacek Sieka ac600d398b
spec updates
* lots of renames
* add some epoch processing
2018-12-03 15:41:24 -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 a661e5afd8
call out inefficiencies and quirks for future consideration 2018-11-29 12:18:12 -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
Zahary Karadjov e4d1bebf4d Get the code to compiling state 2018-11-29 03:17:57 +02:00
Zahary Karadjov 32ebcb007a Add more flesh to the skeleton :) 2018-11-28 22:55:31 +02:00
Zahary Karadjov 4920c0a357 work-in-progress beacon node skeleton (not compiling at the moment) 2018-11-28 22:55:04 +02:00
Jacek Sieka 53f819689e
fix import 2018-11-28 14:01:30 -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
Dustin Brody e63b452181 assorted fixes; some of algorithms aren't 100% updated yet, but want to get data structures in place 2018-11-27 20:23:27 -08: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
Zahary Karadjov 2137b084b2 work-around a generics compilation issue 2018-11-26 18:41:03 +02: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
Jacek Sieka 3ce94623e3
spec updates 2018-11-23 13:42:47 -06:00
Mamy Ratsimbazafy 9989f2fe56
"Stub" hashSSZ function for BeaconBlock (#18)
* FIx hash_ssz in the generic case

* Add a stub hash function for BeaconBlocks
2018-11-22 11:17:05 +01:00
tersec 0fe8c6762c update data structures (#17) 2018-11-20 18:52:14 -06:00
Jacek Sieka 7e243d57cd
ssz: documentation updates, fix fromBytesSSZ type constraint 2018-11-20 11:35:11 -06:00
Jacek Sieka 6df3ec952b
hash_ssz: simplify per latest spec update
* update per https://github.com/ethereum/eth2.0-specs/pull/140
* join with ssz to form a single ssz module (like spec)
2018-11-20 10:43:09 -06:00
Yuriy Glukhov 7e630bf8bf Fixed compilation errors. Reenabled test 2018-11-19 19:09:39 +02:00
tersec eff23ba182
Merge pull request #14 from status-im/HelperSpecUpdates
update some helper functions to current spec, along with a couple of data types that needed tweaking/fixing
2018-11-16 22:57:54 +00:00
Jacek Sieka 949b24702c
hash_ssz: updates (#13)
* rename from tree_ssz
* add special cases for some types based on beacon chain code
* add smoke test
* avoids some trivial allocations, but the big one remains - the
temporary
chunk buffer is still heap allocated
* update to handle zero-length buffer case same as latest spec
2018-11-16 11:04:21 -06:00
Dustin Brody d0fd1b4eb7 update some helper functions to current spec, along with a couple of data types that needed tweaking/fixing 2018-11-15 16:54:36 -08:00
Dustin Brody 8493949456 update ShardAndCommittee and CrosslinkRecord 2018-11-15 10:20:27 -08:00
Dustin Brody b2d93f75c1 update ValidatorRecord 2018-11-15 10:16:09 -08:00
Dustin Brody 150d0b6055 rm CrystallizedState, add ShardReassignmentRecord, add BeaconState 2018-11-15 10:01:54 -08:00
Dustin Brody 9ea109ba4c rm ActiveState 2018-11-15 08:47:56 -08:00
Dustin Brody 6a95e2c664 add AttestationSignedData 2018-11-15 08:44:52 -08:00
Dustin Brody 0b45eb5b74 update AttestationRecord 2018-11-15 08:35:25 -08:00
mratsim 572b856dfd empty start at true 2018-11-13 19:19:10 +01:00
mratsim 3935d33457 Merge branch 'bls-scheme2' of https://github.com/status-im/nim-beacon-chain into bls-scheme2 2018-11-13 19:16:03 +01:00
mratsim b8a17522c0 Fix agg_pubkey initialization 2018-11-13 19:15:57 +01:00
Mamy Ratsimbazafy 45fb4f83a2
Merge branch 'master' into bls-scheme2 2018-11-12 17:18:14 +01:00
mratsim 6a3c7d6aa5 Update for bls scheme 2 2018-11-12 10:13:24 +01:00
mratsim dab75a76a2 comment out aggregated sig + make SSZ compile again 2018-11-12 09:46:16 +01:00
Jacek Sieka 786337e930
tree_ssz: naive implementation of treeHash
as seen in https://github.com/ethereum/eth2.0-specs/pull/120
2018-11-11 19:21:47 -06:00
Jacek Sieka 5bdcee6536
document spec links 2018-11-11 19:19:58 -06:00
tersec f389c454d6 first part of spec updating; some constants, structure changes, data type changes from int to uint (#9)
* first part of spec updating; some constants, structure changes, data type changes from int to uint

* Update beacon_chain/datatypes.nim

Co-Authored-By: tersec <tersec@users.noreply.github.com>
2018-11-09 10:34:30 +01:00
Jacek Sieka 577598cca7 ssz: fix buffer overflows, explicit error reporting (#7)
* ssz: fix buffer overflows, explicit error reporting

* ssz: harden against unaligned data
2018-10-08 12:56:34 +02:00
mratsim 46e8affee0 Delete outdated per_block_processing.nim 2018-10-03 13:15:17 +02:00
Mamy Ratsimbazafy f60d578fb3
Signature aggregation in block processing (#5)
* signature-aggreg-in-block-processing

* Message is a Blake2 hash not simple concat

* Address comments:

- Range change in parent_hashes computation
- Slot not beind module Cycles anymore
- justified_slot part of the hash

Not addressed: using parent.slot_number instead of block.slot_number
2018-10-02 18:09:11 +02:00
mratsim 99a394e084 Config CI + use Milagro BLS signatures 2018-09-26 18:26:39 +02:00
mratsim ca4082b316 Update to latest spec 2018-09-24 17:44:48 +02:00
mratsim 6ddab7e9c0 basic SimpleSerialize + tests 2018-09-20 17:45:02 +02:00
mratsim a42a0ad851 Fork choice compile and run 🔥 2018-09-12 15:41:49 +02:00
mratsim acf322ea7b Fix tables initialization issues 2018-09-11 14:02:45 +02:00
mratsim 3bc75711d5 Finish network simulator 2018-09-11 12:24:46 +02:00
mratsim 03b1f1a4ba Networksim additions + fix agents and normal_distribution types 2018-09-10 12:35:11 +02:00
mratsim 32dbdc860b Mention thread-safety 2018-09-06 18:16:11 +02:00
mratsim 61af4c33c7 Add a normal distribution generator for latency simulations 2018-09-06 12:31:20 +02:00
mratsim e049d9e106 Finish fork choice rule base procs 2018-09-05 12:03:52 +02:00
mratsim 3d76e238e7 Fix slot and proposer type, add initBlock proc 2018-09-04 18:09:28 +02:00
mratsim 0561bf70b7 Switch to proper time datatypes 2018-09-04 17:27:53 +02:00
mratsim 1cb28aecc8 Implement signature and block fork choide rule 2018-09-04 16:22:10 +02:00
mratsim 1f1328d019 Make sense of Ghost node Python spec dynamic polymorphism 2018-09-04 14:48:32 +02:00
mratsim f7e876471e initial impl of fork choice rules. Main types sorted out 2018-09-03 18:42:22 +02:00
mratsim e403e96144 indices_for_slot renaming - aligning to 01abccfdbb 2018-08-24 10:20:15 +02:00
mratsim 14bb9b6efd Revamp per block processing / state transition 2018-08-21 18:21:45 +02:00
mratsim 0b560f7307 Update helpers get_indices_for_slot and get_block_hash following spec fixes, see https://github.com/ethereum/beacon_chain/pull/62 2018-08-21 14:45:35 +02:00
mratsim 9f0fc6817b Update helpers to latest sped, highlight spec bugs 2018-08-17 18:21:25 +02:00
mratsim f203859316 Use Ethereum Foundation naming convention (snake_case + MACRO_CASE) 2018-08-17 18:21:10 +02:00
mratsim f8b2e790e3 sync with latest spec, closes #2 2018-08-16 12:02:59 +02:00
mratsim d65d714c3b Stub Partial crosslink records checks 2018-07-23 18:36:02 +02:00
mratsim 585072ae15 Add getCutoffs helper (buggy) 2018-07-23 16:22:37 +02:00
mratsim 4c6665832b Add the pseudo renadom shuffle 2018-07-23 14:58:41 +02:00
mratsim 2438aaada8 Update everything to latest spec change from July 21 2018-07-23 12:15:56 +02:00
mratsim 65dbb086d1 Add the types used in the beacon chain 2018-07-20 20:18:56 +02:00