Commit Graph

901 Commits

Author SHA1 Message Date
Zahary Karadjov 589a3f06df Fix an error introduced during rebasing 2020-01-21 01:26:57 +02:00
Zahary Karadjov 4848b12050 Detect and use Lighthouse's boot_enr.yaml files 2020-01-21 01:26:57 +02:00
Zahary Karadjov 07d329acb8 Wire-up the peer dialing loop and introduce --max-peers option 2020-01-21 01:26:57 +02:00
Zahary Karadjov 52878405b7 Integrate Discovery V5 and support ENR bootstrap records 2020-01-21 01:26:57 +02:00
Zahary Karadjov 74fc34eef2 Restore some constants to pass the constants & presets test 2020-01-21 01:26:57 +02:00
Zahary Karadjov 7e356b3fa6 Restore compilation with trace-level logging; Fixes #642 2020-01-21 01:26:57 +02:00
Zahary Karadjov 095b271bd4 Implement a loader for custom const presets
The loader has been tested with the presets published by Lighthouse.
You can try connecting to one of their testnets by running:

cd nim-beacon-chain
./connect-to-testnet lighthouse/testnet0
2020-01-21 01:26:57 +02:00
Jacek Sieka 7a8054d36d clean up block pool
* remove BlockPool.blocksBySlot (unused)
* simplify head pruning condition
* add head list smoke tests
* additional logging
2020-01-21 00:54:23 +02:00
Ștefan Talpalaru 14e1e3af52 LMDB: create db dir 2020-01-20 13:39:37 +00:00
Ștefan Talpalaru 7113259137 lmdb: 32-bit Windows fixes 2020-01-20 13:39:37 +00:00
Jacek Sieka 2a67ac3c05 trie -> kv store
* simplify data storage to key-value, tries are not relevant for NBC
* locked-down version of lmdb dependency
* easier to build / maintain on various platforms
2020-01-20 13:39:37 +00:00
Jacek Sieka d853d7c024
remove SigKey.init (unused, fixes #664) 2020-01-18 10:22:17 +01:00
Jacek Sieka 3439763a9e fix beacon node init
* update forkversion correctly
* ensure supplied state snapshot starts at genesis - we don't support
anything else
* more database sanity checks
2020-01-17 21:26:28 +00:00
Dustin Brody c301e5d42f mark 49 0.9.2/0.9.4 spec functions/data types as 0.10.0 2020-01-15 12:34:16 +00:00
Jacek Sieka 860be026e1 fix block pool init head selection
the head state is not necessarily saved in the database, so we need to
make sure we update things to the correct place
2020-01-15 12:17:49 +00:00
Mamy André-Ratsimbazafy b49003988a Add Epoch Processing to nbench 2020-01-15 10:03:56 +00:00
Dustin Brody 8eaebf7163 update to spec version 0.10.0 2020-01-14 18:17:16 +00:00
Ștefan Talpalaru 2f68ee0ffe
new libp2p API 2020-01-13 20:26:19 +01:00
Ștefan Talpalaru 5d1e20012a
import base58 from stew 2020-01-13 20:02:29 +01:00
Ștefan Talpalaru 7c4d636f83
undo try blocks; that's not the traceback's source 2020-01-13 19:02:38 +01:00
Ștefan Talpalaru 468e0815b3
not a CatchableError 2020-01-13 18:53:59 +01:00
Ștefan Talpalaru 003a4c90be
sendErrorResponse(): don't crash when unable to send to peer 2020-01-13 17:12:49 +01:00
Jacek Sieka 148527c716 slot fixes
* fix slot time navigation, add tests
* skip block proposal if head is more recent already - shouldn't happen
* use correct head when attesting to previous blocks
* log slot start/end processing
2019-12-23 17:56:56 +00:00
Dustin Brody 46de726e3d mark all compatible 0.9.3 functions and data structures as 0.9.4 2019-12-20 17:24:42 +00:00
Mamy Ratsimbazafy 106352aff3
Nbench - Flexible benchmarking of Nimbus internals (#641)
* nbench PoC

* Remove the yaml files from the example scenarios

* update README with current status

* Add an alternative implementation that uses defer

* Forgot to add the old proc body

* slots-processing

* allow benching state_transition failures

* Add Attestations processing (workaround confutils bug:
- https://github.com/status-im/nim-confutils/issues/10
- https://github.com/status-im/nim-confutils/issues/11
- https://github.com/status-im/nim-confutils/issues/12

* Add CLI command in the readme

* Filter report and add notes about CPU cycles

* Report averages

* Add debugecho style time/cycle print

* Report when we skip BLS and state root verification

* Update to 0.9.3

* Generalize scenario parsing

* Support all block processing scenarios

* parallel bench runner PoC

* gitBetter load issues reporting (the load issues were invalid signature and expected to fail)
2019-12-20 17:14:43 +01:00
Dustin Brody 417f96213d fix genesis interop by fixing deposit signature handling; add TRACE-level compilation to CI 2019-12-20 15:26:48 +00:00
Jacek Sieka 746659bdc6
bump stew, fix warnings (#655) 2019-12-20 14:25:33 +01:00
Jacek Sieka b994da78a7 Move some attestation/block logic out of beacon node
* state data cache in block pool
* keep head state around
* more attestation logic in attestation pool
* first fork choice tests (!)
* fix fork choice (it's still likely broken / out of date)
2019-12-19 16:17:45 +00:00
Dustin Brody ea4afd7454 mark 19 more 0.9.2-compatible entities as 0.9.3-compatible 2019-12-19 11:46:30 +00:00
Dustin Brody 350a6c071a mark a couple compatible dozen 0.9.2 functions/data structures as 0.9.3 2019-12-18 16:13:39 +00:00
Dustin Brody 0328cd49bf mark several more functions and data structures as 0.9.3 2019-12-18 10:00:17 +00:00
Dustin Brody 1610981be6 mark several more spec-referencing code/data parts as 0.9.3 2019-12-17 16:51:46 +00:00
Dustin Brody 27bf8908a9 mark a couple dozen functions and data structures as 0.9.3; fix TRACE-level compiling; stop downloading 0.9.2 test vectors; update cosmetic/display spec versions in test suite 2019-12-17 16:51:46 +00:00
Jacek Sieka 22c44d254c
fix decoding for 0.9.3 types 2019-12-17 11:25:36 +01:00
Zahary Karadjov 15f289a281
Temporary switch back to the LibP2P daemon as the default choice 2019-12-17 00:13:51 +02:00
Dustin Brody c824416f56 initial 0.9.3 spec update 2019-12-17 00:06:03 +02:00
Jacek Sieka 8c104a0b94 inspector: add readme entry, decoding option 2019-12-16 16:08:30 +02:00
Jacek Sieka 963f23e5ea
remove obsolete insecure comment 2019-12-16 13:36:39 +01:00
Jacek Sieka c66ca39cee update heads when adding resolved blocks 2019-12-16 12:18:08 +02:00
Jacek Sieka 4e85b50cb6 update head while syncing 2019-12-16 12:18:08 +02:00
Dustin Brody 741570113b properly construct attestation data for selected slot 2019-12-13 09:04:30 +00:00
Dustin Brody fbdb078eb3 fix return type to properly construct AggregateAndProof; check ATTESTATION_PROPAGATION_SLOT_RANGE as required, maintaining consistent slot offset 2019-12-13 09:04:30 +00:00
Dustin Brody 5880fc22ad roadmap rest of naive attestation aggregation 2019-12-13 09:04:30 +00:00
Dustin Brody c4daa726b5 fix AggregateAndProof definition 2019-12-13 09:04:30 +00:00
Dustin Brody e2c68e075f outline general flow of naive attestation aggregation 2019-12-13 09:04:30 +00:00
Dustin Brody 294db6aaca initially implement specified attestation aggregation functions and data structures 2019-12-13 09:04:30 +00:00
tersec cb1bc6cbf1 move attesting up from halfway to one third of the way through slots (#643)
* per honest validator and naïve/simple aggregator attestation specs, move attesting up from halfway to one third of the way through slots

* Update beacon_chain/beacon_node.nim

Co-Authored-By: Jacek Sieka <jacek@status.im>
2019-12-11 14:02:07 +01:00
Jacek Sieka a3145f0f5c cleanups
* move stuff out of beaconnode
* fix use-after-free in query
2019-12-10 14:47:52 +00:00
Zahary Karadjov 10e6d4842f Local sim finalizes with native LibP2P 2019-12-10 15:02:16 +02:00
Zahary Karadjov 98656377a3 Eliminate the code duplication in the LibP2P back-ends 2019-12-10 15:02:16 +02:00
Zahary Karadjov 889031453f The beacon node can be compiled with the LibP2P native back-end
This hasn't been tested yet even in local sim.
2019-12-10 15:02:16 +02:00
Jacek Sieka eea523a89e logging fixes
* don't log out-of-sync when there's no work to do
* small logging fixes
2019-12-10 10:18:30 +00:00
Zahary Karadjov 8ab0248209
Revert "tighten a few imports"
This reverts commit b24a9200d9.
2019-12-10 02:18:47 +02:00
Jacek Sieka b24a9200d9 tighten a few imports 2019-12-09 12:58:28 +00:00
Dustin Brody eef040954c remove unused hasSigningRoot(...); stop running time-consuming-but-stubbed-out tests; add timing for peer connection tests 2019-12-06 16:48:32 +00:00
Dustin Brody 362ef752dc dedeplicate some functions duplicated between libp2p_backend and libp2p_daemon_backend; remove some unused declared variables 2019-12-06 12:55:13 +00:00
Dustin Brody 5729ceb58e rename notice field 2019-12-06 12:12:59 +00:00
Dustin Brody 86f267bc5d switch debug to notice and add some contextual information 2019-12-06 12:12:59 +00:00
Dustin Brody c762c0232d render get_beacon_proposer_index(...) return value an option and remove overly aggressive assertion formerly causing crashes when missing validators (#617)
* render get_beacon_proposer_index(...) return value an option and remove overly aggressive assertion formerly causing crashes when missing validators

* follow addBlock(...) after refactoring

* [skip ci] fix typo
2019-12-04 11:49:59 +01:00
kdeme 3b3a2b10f1 First attempt to have some fuzz tests exported for the fuzzing framework 2019-12-03 14:33:47 +02:00
Zahary Karadjov a1198e5532
web3 fixes suggested by @yglukhov [skip ci] 2019-12-03 14:10:47 +02:00
Jacek Sieka afc0686b36 save ssz dummps during processing (#471) 2019-12-03 11:32:27 +00:00
Jacek Sieka c457904a61 avoid recursion when getting lmd ancestors 2019-12-03 13:24:16 +02:00
Zahary Karadjov a641331448
Reduce the sync-related tracing in the testnets [skip ci] 2019-12-03 13:07:43 +02:00
Zahary Karadjov ee2448b221 Simple validator onboarding
On your very first connection to each testnet, you'll be asked to
become a validator. Please consult our private repo for a Goerli
Eth1 private key that you can use for deposits.

Other changes:

* Added a simple wrapper ./connect-to-testnet script calling the
  nims file in the correct environment. No extension was used to
  make the command the same on Unix and Windows.

* Bumped a number of modules with fixes from this week

* `make testnet0` and `make testnet1` will no longer delete your
  existing database. This is considered a more appropriate behavior
  for testing forward sync.
2019-12-03 02:23:17 +02:00
Ștefan Talpalaru 7682a010a9 remove getCurrentExceptionMsg() 2019-12-02 22:06:42 +02:00
Dustin Brody e88e559caf render visible gradual validator emptying on catchup 2019-12-02 18:24:30 +02:00
Jacek Sieka 90212eed2a avoid producing blocks/attestations when out of sync
this is a temporary measure until we figure something better out - as it
stands, we'll advance with empty slots and crash because all validators
are out.
2019-12-02 15:26:42 +00:00
Jacek Sieka 2a728d9468 fix stack overflow in isAncestor recursion 2019-11-28 17:36:07 +02:00
Jacek Sieka c98a0d28ae add workaround for stack overflow on block add 2019-11-28 17:36:07 +02:00
Dustin Brody 8f2e523d26 remove a few hints and warnings (#603) 2019-11-28 13:50:19 +01:00
Jacek Sieka 63f49eff76
document slot better 2019-11-27 15:14:20 +01:00
Jacek Sieka e6ae9977b2
clarify slot time 2019-11-27 14:59:54 +01:00
Zahary Karadjov 8c3ea1cabf
Handle missing blocks better in block_pool.getBlockRange 2019-11-27 13:45:34 +02:00
Zahary Karadjov 897176761d
even more tracing for testnet1 [skip ci] 2019-11-27 11:21:45 +02:00
Dustin Brody 6f650ca144
avoid pointless stream usage for main basic type in SSZ objects (#596)
* avoid pointless stream usage for uint64 in SSZ objects
2019-11-26 18:22:36 +00:00
cheatfate fa22ba22b9 PeerPool initial commit. 2019-11-26 17:16:55 +00:00
Zahary Karadjov 1099548775
Restore the number of simulation nodes to 4; More block pool tracing [skip ci] 2019-11-26 19:02:56 +02:00
Dustin Brody bde20436e8 ~50% speedup by fast-pathing Eth2Digest merkle hashing 2019-11-26 15:23:27 +00:00
Zahary Karadjov 843c461af6
Remove some debugging output 2019-11-26 02:47:41 +02:00
Zahary Karadjov 8b89bbe391 Fix off-by-one error in syncing 2019-11-26 02:45:25 +02:00
Zahary Karadjov 1d8bfd8c0d Allow overriding the bootstrap node in run_node.sh 2019-11-26 02:45:25 +02:00
Zahary Karadjov 8de4d38e4e More tracing 2019-11-26 02:45:25 +02:00
Zahary Karadjov ff3da4e152 more network traffic tracing 2019-11-26 02:45:25 +02:00
Zahary Karadjov 957645d752 Fix the bulds with json logging enabled 2019-11-26 02:45:25 +02:00
Zahary Karadjov acd490916f Attempt to fix the failing tests in CI 2019-11-26 02:45:25 +02:00
Zahary Karadjov 258f6f6334 detailed tracing in block_pool.getBlockRange 2019-11-26 02:45:25 +02:00
Zahary Karadjov 4c2ded25a6 Add detailed tracing for blocks by range requests 2019-11-26 02:45:25 +02:00
Yuriy Glukhov 777b3f4e29 State/block pruning 2019-11-26 02:45:25 +02:00
Jacek Sieka 76d3e74b02
fix head update message 2019-11-25 18:50:45 +01:00
Jacek Sieka a82869c03d add validators even if they're not in startup state 2019-11-25 18:31:22 +02:00
Dustin Brody 1494bcc262 replace links to Apache and MIT licenses with HTTPS versions (#592) 2019-11-25 16:30:02 +01:00
Dustin Brody 904283e33e make mount(...) public again 2019-11-25 14:48:59 +00:00
Dustin Brody b82328b148 convert hash_tree_roots_prefix(...) to an iterator 2019-11-25 14:48:59 +00:00
Dustin Brody c3d2634b97 re-export beginRecord(...) 2019-11-25 14:48:59 +00:00
Dustin Brody f6de87b80e remove O(n^2) eth1 deposit processing and scaffolding comparing it with O(n) deposit processing; re-enable now-viable-to-run genesis state initialization tests with around 16,384 validators 2019-11-25 14:48:59 +00:00
Dustin Brody fa2a703a17 switch more funcs and procs from global to module scope; create scaffolding for non-O(n^2) eth1 deposit processing with assertions for equivalent functionality; fix a few more shellcheck warnings 2019-11-25 14:48:59 +00:00
Jacek Sieka fd4de5de0f
start untangling beaconnode (#589)
* Move BeaconNode type to its own file (fewer imports)
* disentangle sync protocol/request manager
* fix some old nimisms
* de-fear some logs
* simplify eth1 data production
* add stack tracing to release builds
* drop release compile flag for testnet
2019-11-25 15:36:25 +01:00
Yuriy Glukhov 2e875ea17e Better connection error handling in MainchainMonitor 2019-11-25 13:45:53 +02:00
Dustin Brody a8de94ad05 add validator_leaving logging at debug chronicles level for all call paths to initiate_validator_exit(...) 2019-11-25 09:08:15 +00:00
Dustin Brody 8d9fdb0afd miscellanous cleanups and removing a few funcs/procs from unnecessary global scopes 2019-11-25 09:08:15 +00:00
Mamy Ratsimbazafy 1938379bcd
Automated beacon constant checks (#583)
* Fix SSZ bitlist deserialization super silly bug

* Add an automated sanity checks of the beacon chain constants

* Remove SSZ consensus skipping procs [skip ci]

* Add phase 1 domains

* Fix mainnet constants

* Add missing phase 1 constants on minimal (they are not needed somehow on mainnet)

* Rebase artifact: constants were defined twice
2019-11-22 20:56:39 +01:00
Dustin Brody edfd65fd5d stop download 0.9.1 test vectors; finish 0.9.2 update, primarily via fixing preset constants; remove a couple 0.19.6 shims 2019-11-22 16:41:43 +00:00
Dustin Brody f5b8931fad switch assert(...) to doAssert(...) and minor cleanup 2019-11-22 16:39:05 +00:00
Dustin Brody 41fa377638 mark all non-changed 0.9.1 items as 0.9.2 (#576) 2019-11-22 09:29:04 +01:00
Dustin Brody 85f2596604 re-enable all_tests.nim mainnet tests 2019-11-21 19:40:35 +02:00
Jacek Sieka 7c6d87051a
simplify validator api (#573)
* avoid passing whole state to validator api (easier when it goes
out-of-process)
* clean up some cruft
2019-11-21 10:57:59 +01:00
Dustin Brody c0f009908c
re-enable test_interop based on zcli with 0.9.1 specs and update initialize_beacon_state_from_eth1(...) to 0.9.1 (#569)
* re-enable test_interop based on zcli with 0.9.1 specs and update initialize_beacon_state_from_eth1(...) to 0.9.1

* switch many procs to funcs

* fix import os.nim instead; ospaths is deprecated [Deprecated] warnings
2019-11-21 09:15:10 +00:00
Mamy Ratsimbazafy bb0979f232
Ssz fixes (#566)
* SSZ signature from EF are always opaque blobs (security issue - https://github.com/status-im/nim-beacon-chain/issues/555)
Enable
- Attestation
- Beaconstate (minimal only)
- Deposit
- DepositData
- ProposerSlashing

Updates #518

* mv debug_ssz to helpers

* Small reorg of the list types

* Fix IndexedAttestation, AttesterSlashing and BeaconBlock

* Deactivate on mainnet: AttesterSlashing, BeaconBlockBody, IndexedAttestation, Attestation, BeaconBlock

* Fix Validators on minimal and mainnet
2019-11-19 12:04:51 +01:00
Dustin Brody 2749cb14a6 convert mostly-uncompiled verify_merkle_branch(...) calls to newer is_valid_merkle_branch(...) name; re-enable several lines of deposit testing code and outline roadmap for completion 2019-11-18 17:35:58 +00:00
Dustin Brody d8590bbffc fix several warnings and hints 2019-11-18 17:35:58 +00:00
Dustin Brody 827956b5b3 remove a pre-Nim 0.20.x workaround 2019-11-18 17:35:58 +00:00
Dustin Brody 6f87c8fd89 verify that state_sim is justifying and finalizing; fix 3 more warnings; rename crosslink_committee_cache to beacon_committee_cache; fix O(n^2) usage of get_base_reward(...) 2019-11-18 17:35:58 +00:00
Dustin Brody c7c439ac61
use bounded List[] SSZ type for more hashing consistency with spec 2019-11-18 09:35:17 +01:00
Jacek Sieka 14712bbbdc
random warning fixes 2019-11-15 12:05:18 +01:00
Dustin Brody 3f958d3529
Merge branch 'master' into bat 2019-11-14 19:37:47 +00:00
Dustin Brody 7e70d16da9
remove BeaconStateNew and associated testing scaffolding/infrastructure 2019-11-14 20:03:08 +01:00
Dustin Brody 96dcb1cf95
Remove shard-relating code 2019-11-14 19:48:12 +01:00
Dustin Brody c08698bffe
scaffolding to remove last vestiges of get_committee_count(...), SHARD_COUNT, and rest of that 0.8.x infrastructure; this demonstrates equivalence between two, before discarding old code 2019-11-14 18:37:51 +01:00
Dustin Brody b4850fbb06 remove XDeclaredButNotUsed spam 2019-11-14 15:58:31 +00:00
Dustin Brody df1d00f13a remove UnusedImport spam (#549)
* remove UnusedImport spam

* re-add random import to beacon_node
2019-11-14 11:47:55 +01:00
Dustin Brody 3dcc00779a replace deprecated toSet(...) with toHashSet(...); replace implicit with more explicit default constructor for readability 2019-11-13 13:49:38 +00:00
Dustin Brody 5a54c823d8 update to 0.9.1: don't try to run removed tests; re-add 1.5 tests (one only in minimal); remove bls_verify_multiple(...) and AttestationDataAndCustodyBit; and update process_attester_slashing(...), get_indexed_attestation(...), and is_valid_indexed_attestation(...) 2019-11-13 13:49:38 +00:00
Zahary Karadjov f40675509a Make all testnet env file values optional [skip CI]
Also removes some usages of SHARD_COUNT
2019-11-12 23:43:38 +00:00
Zahary Karadjov 5a93e50b5e Sync-related fixes:
* off-by-one error in the returned range of blocks
* larger request time-outs to deal with non-responsive servers
* fix an unhandled exception when we fail to deliver a response chunk
2019-11-12 23:43:38 +00:00
cheatfate 6e8a518077 Fix getPersistentNetIdentity() do not use daemon anymore.
Fix change PeerInfo to MultiAddress.
2019-11-12 23:43:38 +00:00
Dustin Brody 1f352bf440
fix trace compilation 2019-11-12 16:35:12 +01:00
Dustin Brody fb5d9edb7c keep types consistent 2019-11-12 14:49:26 +00:00
Dustin Brody d5ce142511 fix network sim finalization; remove get_attestation_data_slot(...); remove 2 more get_crosslink_committee(...) calls 2019-11-12 14:49:26 +00:00
Zahary Karadjov 07f0bd9378
Log the executable version at start-up [skip ci] 2019-11-12 00:05:59 +00:00
Zahary Karadjov 47940928a6
Reduce compilation differences between client and server nodes 2019-11-11 23:30:21 +00:00
Zahary Karadjov ac5aabd569 Use the latest confutils 2019-11-11 23:29:36 +00:00
Zahary Karadjov ed9cb274a2 Restore a change mysteriously lost during rebasing 2019-11-11 23:29:36 +00:00
Zahary Karadjov f5e9b9a922 Allow running local nodes without attached validators
The number of user nodes is now specified with `USER_NODES`.

To make the instructions more stable, the "numeric id" of the user
nodes will be starting from 0 (so you can always use `run_node.sh 0`
to start a user node).

If you specify a node index above the total number of nodes, you'll
launch a node without any validators attached (this is useful for
testing the sync for example).
2019-11-11 23:29:36 +00:00
Zahary Karadjov 22591deced Safer testnet restarts; Working CLI queries for inspecting the genesis states
When the connect_to_testnet script is invoked it will first verify that
the genesis file of the testnet hasn't changed. If it has changed, any
previously created database associated with the testnet will be erased.

To facilitate this, the genesis file of each network is written to the
data folder of the beacon node. The beacon node will refuse to start if
it detects a discrepancy between the data folder and any state snapshot
specified on the command-line.

Since the testnet sharing spec requires us to use SSZ snapshots, the Json
support is now phased out. To help with the transition and to preserve the
functionality of the multinet scripts, the beacon node now supports a CLI
query command that can extract any data from the genesis state. This is
based on new developments in the SSZ navigators.
2019-11-11 23:29:36 +00:00
Zahary Karadjov a644839b79 Dynamic SSZ navigator 2019-11-11 23:29:36 +00:00
Dustin Brody d457dfee81 switch all but 4 remaining callers to get_crosslink_committee(...) to get_beacon_committee(...) 2019-11-11 11:46:03 +00:00
Dustin Brody 568fa1dcb9 mark functions, constants, and data structures unchanged by 0.9.1 as such 2019-11-11 10:25:57 +00:00
Dustin Brody 949d735155 fix remaining test 0.9.0 test fixtures and switch back to non-transitiontest setup; remove get_committee_count(...); keep SHARD_COUNT consistent with MAX_COMMITTEES_PER_SLOT 2019-11-11 10:25:57 +00:00
Dustin Brody cb4a86756b update get_seed(...) and get_beacon_proposer_index(...) to 0.9.0, implement compute_proposer_index(...), and render 3 more test fixtures working (#532)
* update get_seed(...) and get_beacon_proposer_index(...) to 0.9.0, implement compute_proposer_index(...), and render 3 more test fixtures working

* rm stray Crosslink reference which prevented static SSZ tests from building

* remove references to removed tests in attestations test fixture; add minimal-preset block sanity test, plus all but one of mainnet tests for block sanity to transition fixtures
2019-11-10 01:03:41 +01:00
Ștefan Talpalaru c1a63035b9 beacon_node: "--version" option [skip ci]
fixes #466
2019-11-09 17:43:42 +00:00
Dustin Brody e984b2c932 mark is_valid_merkle_branch(...), process_justification_and_finalization(...), and process_rewards_and_penalties(...) as 0.9.0; update check_attestation(...) to 0.9.0; add 11 working test fixtures, having updated SSZ fixture directory to 0.9.0 2019-11-08 13:23:08 +00:00
Dustin Brody 275fb22c00 flip targeted spec version and ssz test fixtures to 0.9.0; almost completely update BeaconState to 0.9.0; update minimal and mainnet preset constants to 0.9.0; update process_proposer_slashing(...), get_attestation_deltas(...), and get_matching_head_attestations(...) to 0.9.0; mark process_final_updates(...) as 0.9.0 2019-11-08 13:23:08 +00:00
Dustin Brody 3bb95f571f remove remaining Crosslink and CompactCommittee vestiges 2019-11-08 13:23:08 +00:00
Dustin Brody 61c2cf9415 rm get_compact_committees_root(...), Transfer, and references to 0.9-removed BeaconState.{active_index_roots,compact_committees_roots; temporarily disable genesis interop test pending 0.9 BeaconState 2019-11-08 13:23:08 +00:00
Dustin Brody 68654848cb update get_attesting_indices(...) to 0.9.0; remove Crosslink from AttestationData to update AttestationData to 0.9.0; rm get_winning_crosslink_and_attesting_indices(...) and get_crosslink_deltas(...) 2019-11-08 13:23:08 +00:00
Dustin Brody cb5454c4eb double-check that one can back-infer shard/epoch from slot/committee-index, in preparation for removing crosslink from AttestationData 2019-11-08 13:23:08 +00:00
Dustin Brody 13e662c8dd remove scaffolding and make get_crosslink_committee(...) a purer wrapper around get_beacon_committee(...) 2019-11-08 13:23:08 +00:00
Dustin Brody c2ebe482a5 temporarily disable SSZ tests, which fail when trying to read AttestationData or structures which embed it; implemenet get_committee_count_at_slot(...) and get_beacon_committee(...); express get_crosslink_committee(...) in terms of get_beacon_committee(...) and ensure that results are identical 2019-11-08 13:23:08 +00:00
Ștefan Talpalaru 6a1d287652 beacon_node: print name, version and Git revision [skip ci] (#527) 2019-11-08 10:33:16 +00:00
cheatfate 97878566b8
Add peers monitoring.
Add broadcasters monitoring.
Resolve broadcasters to ids/addresses.
Add ability to switch between FloodSub and GossipSub.
2019-11-08 01:19:35 +02:00
Yuriy Glukhov 568e669b1c Fixed deposit/contract 2019-11-07 17:23:06 +00:00
Mamy André-Ratsimbazafy 5f6d60abce remove a lot of XDeclaredButNotUsed spam from SSZ 2019-11-07 15:22:04 +00:00
Dustin Brody a1f5f3512b
add sanity check for SIGFPE crashes (#524) 2019-11-06 15:50:12 +00:00
Dustin Brody 0073555752
transition deposit operation fixtures to 0.9.0 (#515)
* transition deposit operations fixture to 0.9.0

* mark slash_validator(...) as 0.9.0

* switch remaining non-ref objects to ref objects to maybe avoid crashes in CI

* remove unused helpers/debug_state imports
2019-11-06 15:02:06 +00:00
Yuriy Glukhov 9b39c792d0 Revert f79f9deeb3 a0fbf5464a 94a9c51d8a (#523) 2019-11-06 16:56:54 +02:00
cheatfate f79f9deeb3
Set wasDialed.
Add more logging information.
2019-11-06 16:41:24 +02:00
cheatfate a0fbf5464a
Add logscope.
Add more information to logs.
2019-11-06 16:41:24 +02:00
cheatfate 94a9c51d8a
Initial commit. 2019-11-06 16:41:23 +02:00
Ștefan Talpalaru e2b3f0dadb
announcedAddresses: fix logic error 2019-11-05 23:56:10 +01:00
Ștefan Talpalaru 03f57aab43
bump vendor/nim-libp2p 2019-11-05 23:31:01 +01:00
Ștefan Talpalaru a417edb5ff
sync_protocol.nim: better error message [skip ci] 2019-11-05 16:02:26 +01:00
Zahary Karadjov 14374504cf
Finalization experiements
* Switched to FloodSub
* Testnet0 switched to the minimal preset. All validators deployed on the master node.
2019-11-05 03:13:16 +02:00
Dustin Brody 63e621c27d
initial 0.9.0 spec sync (#509)
* rename compute_epoch_of_slot(...) to compute_epoch_at_slot(...)

* remove some unnecessary imports; remove some crosslink-related code and tests; complete renaming of compute_epoch_of_slot(...) to compute_epoch_at_slot(...)

* rm more transfer-related code and tests; rm more unnecessary strutils imports

* rm remaining unused imports

* remove useless get_empty_per_epoch_cache(...)/compute_start_slot_of_epoch(...) calls

* rename compute_start_slot_of_epoch(...) to compute_start_slot_at_epoch(...)

* rename ACTIVATION_EXIT_DELAY to MAX_SEED_LOOKAHEAD

* update domain types to 0.9.0

* mark AttesterSlashing, IndexedAttestation, AttestationDataAndCustodyBit, DepositData, BeaconBlockHeader, Fork, integer_squareroot(...), and process_voluntary_exit(...) as 0.9.0

* mark increase_balance(...), decrease_balance(...), get_block_root(...), CheckPoint, Deposit, PendingAttestation, HistoricalBatch, is_active_validator(...), and is_slashable_attestation_data(...) as 0.9.0

* mark compute_activation_exit_epoch(...), bls_verify(...), Validator, get_active_validator_indices(...), get_current_epoch(...), get_total_active_balance(...), and get_previous_epoch(...) as 0.9.0

* mark get_block_root_at_slot(...), ProposerSlashing, get_domain(...), VoluntaryExit, mainnet preset Gwei values, minimal preset max operations, process_block_header(...), and is_slashable_validator(...) as 0.9.0

* mark makeWithdrawalCredentials(...), get_validator_churn_limit(...), get_total_balance(...), is_valid_indexed_attestation(...), bls_aggregate_pubkeys(...), initial genesis value/constants, Attestation, get_randao_mix(...), mainnet preset max operations per block constants, minimal preset Gwei values and time parameters, process_eth1_data(...), get_shuffled_seq(...), compute_committee(...), and process_slots(...) as 0.9.0; partially update get_indexed_attestation(...) to 0.9.0 by removing crosslink refs and associated tests

* mark initiate_validator_exit(...), process_registry_updates(...), BeaconBlock, Eth1Data, compute_domain(...), process_randao(...), process_attester_slashing(...), get_base_reward(...), and process_slot(...) as 0.9.0
2019-10-30 19:41:19 +00:00
Yuriy Glukhov abbe4075fa Fixed deposit contract deployment 2019-10-30 17:23:34 +02:00
Zahary Karadjov 72c42838cb
Fix a typo in start.sh; Display the full slot number in the statusbar [skip ci] 2019-10-29 21:48:32 +02:00
Zahary Karadjov 6664f1689f
Use SSZ genesis files
Multi-client testing requires more portable formats, and SSZ is
much better specified than our flavour of Json.

Tools like ncli and zcli can be now used to inspect the contents
of the SSZ files.
2019-10-29 19:16:32 +02:00
Zahary Karadjov 1ef9f458ac
Remove hard-coded variables from the manage_testnet_hosts script 2019-10-29 19:16:32 +02:00
Zahary Karadjov 831b562435
Make the use of dynamic Chronicles outputs more optional 2019-10-29 19:16:32 +02:00
Zahary Karadjov f1ea0cec32
Add support for testnets with mixed quickstart/random deposits 2019-10-29 19:16:32 +02:00
Zahary Karadjov 136a11f681
Fix the build when the Chronicles dynamic output is not used
close #504
2019-10-29 03:43:52 +02:00
Zahary Karadjov f3252a8391
Fix the error 'output device not set for a chonicles dynamic sink' 2019-10-29 03:05:43 +02:00
Zahary Karadjov 734ab64da8
Unix-style command-line params for the 'deposit_contract' binary 2019-10-29 02:20:47 +02:00
Zahary Karadjov ba0037738b
Removed all code related to the old network metadata files
Also switched to a more "standard" naming convention for the
command-line parameters.
2019-10-29 01:04:52 +02:00
Yuriy Glukhov 9d3889cbab
WIP Goerli testnet 2019-10-28 15:51:17 +02:00
Zahary Karadjov 43b70c0330
Restore the ability to run tests/simulation/start.sh manually 2019-10-28 15:28:45 +02:00
Zahary Karadjov fb220ee600
Preparations for introducing the native libp2p back-end 2019-10-28 15:00:25 +02:00
Zahary Karadjov dfe3a6f0fb
Switch to Nim v1.0.2 2019-10-28 15:00:25 +02:00
Zahary Karadjov a6f65cd37e Add lower-level metrics for the number of gossipsub messages sent/received 2019-10-26 16:37:36 +03:00
Dustin Brody a9fcaf16a6
stop double-counting attestation-topic attestations (#501) 2019-10-25 14:00:55 +00:00
Jacek Sieka 363f918f7b
remove obsolete docs (this is covered in honest validator guide) 2019-10-25 13:55:19 +02:00
Jacek Sieka ee5d1c1467
minimize imports, specially for spec - cuts 2/3 of ncli build time (#500)
* minimize imports, specially for spec - cuts 2/3 of ncli build time
* ptr_arith->ptrops
2019-10-25 12:59:56 +02:00
Dustin Brody 700e7d921b
update to beacon chain phase 0 spec version 0.8.4; no substantive changes (#494) 2019-10-24 13:36:36 +00:00
Dustin Brody c9d2815480 implement metrics to count send/received blocks/attestations, to detect network loss 2019-10-24 11:48:56 +03:00
Ștefan Talpalaru 3a2fc249a2
simulation: metric visualisation 2019-10-23 20:57:59 +02:00
Zahary Karadjov 021661180b
Use the latest nim-eth 2019-10-23 19:37:06 +03:00
Jacek Sieka e8206a7489
fix datadir 2019-10-22 23:18:45 +02:00
Jacek Sieka bdb70ebe2c
log data dir at startup (fixes #229) 2019-10-22 22:53:58 +02:00
Dustin Brody 43f353e665 implement beacon_reorgs_total metric (#491) 2019-10-22 13:57:34 +02:00
Dustin Brody 3da4c02bb3 implement beacon_current_live_validators and beacon_previous_live_validators metrics 2019-10-21 20:58:08 +09:00
Jacek Sieka 360afe48a3 fix two races when producing block
there be more dragons around
2019-10-08 23:52:50 +09:00
Jacek Sieka b7f9d9e4be fix BlsValue inits 2019-10-08 23:52:50 +09:00
Zahary Karadjov c23b011c77 Cosmetic improvements to the status bar; Attempt to fix the CI 2019-10-07 23:56:34 +09:00
Zahary Karadjov f72a58595f Initial version of status bar 2019-10-07 23:56:34 +09:00
Zahary Karadjov d3f88929da Integrate nim-prompt 2019-10-07 23:56:34 +09:00
Dustin Brody 4c0b2a9a32
implement beacon_pending_deposits, beacon_processed_deposits_total, beacon_previous_validators, and beacon_current_validators metrics (#478)
* implement additional beacon_current_validators and beacon_previous_validators metrics

* tentatively implement beacon_pending_deposits additional metric

* implement beacon_processed_deposits_total additional metric
2019-10-06 04:31:50 +00:00
Dustin Brody 1a62c122d8
Finish remaining required interop metrics (#477)
* implement beacon_finalized_root, beacon_current_justified_root, and beacon_previous_justified_root interop metrics
2019-10-03 18:16:25 +00:00
Dustin Brody 255980c9f6 fix issue #367 and remove too-small range type usage for ValidatorIndex 2019-10-03 16:41:25 +03:00
Dustin Brody 2122bb44c9
implement beacon_finalized_epoch, beacon_current_justified_epoch, and beacon_previous_justified_epoch (#476) 2019-10-03 10:36:31 +00:00
Yuriy Glukhov 2b7b7b1471 Deposit contract script additions (#455)
* Deposit contract script additions

* Cleanup/cosmetics
2019-10-03 09:21:28 +00:00
Jacek Sieka f111a6a444 fix attestation being added twice to block (fixes #361) 2019-10-02 12:27:51 +03:00
Jacek Sieka b8ddb776ca fix attestation selection when calculating rewards and penalties
Previously, the we'd use the first source attestation regardless if it
matches the filter or not leading to the wrong minimum being used
2019-10-02 12:17:02 +03:00
Jacek Sieka 3e3ed79874 sign the right attestation data 2019-10-02 12:11:47 +03:00
Zahary Karadjov 806836714a Add an accidentally forgotten fix 2019-10-01 17:50:13 +03:00
Eugene Kabanov 13bde5aee3 Add gossipsub messages monitoring tool. (#458)
* Add gossipsub messages monitoring tool.

* Add support of bootstrap nodes file.

* Move topic constants to spec/network.nim.

* Add ability to monitor custom topics.
2019-10-01 15:52:28 +02:00
Mamy Ratsimbazafy 48d22d53dc
Ensure that we use the interop deposit signatures (#467)
* Ensure that we use the interop deposit signatures

* Add all interop keys to the test
2019-10-01 15:44:38 +02:00
Jacek Sieka 66f03f491f
log raw incoming gossip data 2019-09-28 21:20:09 +02:00
Zahary Karadjov 66984c44ce Another innocent fix from the interop branch 2019-09-27 23:29:58 +03:00
Zahary Karadjov a336285922 Fix a potential OOB error in SSZ deserialization 2019-09-27 23:29:58 +03:00
Zahary Karadjov c39d4f1817 Fix an overflow in the justification bits processing 2019-09-27 23:29:58 +03:00
Zahary Karadjov 1555efd9d8
Implement the latest modification of the spec 2019-09-27 19:10:37 +03:00
Zahary Karadjov 37043f0d91
Handle gracefully a pre-mature closing of a libp2p stream by another peer 2019-09-27 19:10:24 +03:00
Zahary Karadjov b5fad0c9e8
Add more diagnostic for crashes during SSZ serialization 2019-09-27 19:07:22 +03:00
Zahary Karadjov 2bbe2cb23c
Implement the outputBootstrapNodes option (taken from the interop branch) 2019-09-27 19:05:17 +03:00
Zahary Karadjov b56c96a4fd
Support downloading SSZ genesis files with curl 2019-09-27 18:59:28 +03:00
Zahary Karadjov 5152c42c8e
Don't crash hard on P2P daemon errors during the initial connection 2019-09-27 18:58:51 +03:00
Zahary Karadjov 0eaa433e84
Automated scripts for resetting the Status testnets
For detailed instructions, please see

https://github.com/status-im/nimbus-private/blob/master/testnets-maintenance.md
2019-09-26 18:58:51 +03:00
Mamy André-Ratsimbazafy 90b20fab52 Domain is now array[8, byte] instead of uint64 2019-09-26 17:53:59 +03:00
Mamy Ratsimbazafy a7a1f78499
Fix TRACE chronicles_log_level (#451) 2019-09-23 17:00:10 +02:00
Mamy Ratsimbazafy b100ceef56
Add detailed finalization and justification debug logs (#449)
* Add detailed finalization and justification debug logs

* log was wrongfully reporting rule 123 instead of rule 12
2019-09-23 15:48:26 +02:00
Mamy Ratsimbazafy 0b68f3dc63
[Interop branch] Log improvements - part 1 (#439)
* use service/category/process for blockpool logs
Only track fork choice logs in block pool (vs beacon_node)
Reduce verbosity on usual event in block pool

* rework beacon node logs

* log for attestations in blockpool

* log - att pool improvement

* use logScope and topics cf review and discussion

* use 7 letters for beacon_node

[log] report peers at slot start + fix bracket prefix [Block pool] Attestation sent
2019-09-23 11:35:41 +02:00
Jacek Sieka 42a469603d
simplify startup, describe a few startup tricks 2019-09-11 20:29:57 -04:00
Jacek Sieka 65ff8f2886
remove networkId (unused) 2019-09-11 20:29:57 -04:00
Jacek Sieka ab2cce3951
add quickStart option that avoids network metadata 2019-09-11 20:29:57 -04:00
mratsim c619b9557a
Validator pool update to use BLS domain 2019-09-11 20:29:57 -04:00
Zahary Karadjov 2aee749ead
Save a genesis SSZ file 2019-09-11 20:29:57 -04:00
Mamy Ratsimbazafy 988a13b872 Official operations - deposits unit test (#408)
* [Test] Official operations - deposits unit test

* Allow ignoring deposits with invalid signature

* We need stacktraces to debug windows 64 issue https://github.com/status-im/nim-beacon-chain/pull/408#issuecomment-529236359

* fix naming of unit test proc

* Revert "We need stacktraces to debug windows 64 issue https://github.com/status-im/nim-beacon-chain/pull/408#issuecomment-529236359"

This reverts commit 04b8b05162.

* skip windows-64 in CI #435

* proposer slashing started to crash as well on win-64 #435
2019-09-11 21:10:54 +00:00
Mamy Ratsimbazafy 3dc2b87e6a Transfer - split process_transfer/processTransfers + tests + fixes (#422)
* Prepare test suite for transfers

* split API process_transfer / processTransfers

* Add range checks on transfer

* Fix invalid transfer conditions

* don't test on windows 64-bit #435
2019-09-11 20:29:00 +00:00
Mamy Ratsimbazafy 8676bbf388 Add proposer slashing tests (#431)
* Add proposer slashing tests

* typo in import
2019-09-11 07:50:07 +00:00
Mamy Ratsimbazafy 6be2e24a8f
Attester slashing - split process_attester_slashing/processAttesterSlashings + tests (#424)
* attester slashing tests - pending #415

* split process_attester_slashing/processAttesterSlashings

* Add logs to attester_slashing

* deactivate bls tests for now (https://github.com/status-im/nim-beacon-chain/issues/429) and cherry-pick from 60f2437dd2
2019-09-10 18:03:06 -04:00
Dustin Brody f72de67f63 Proposer slashing is 0.8.3 (#425)
* minimal refactor of proposer slashings to 0.8.3; no semantic difference

* actually mark spec
2019-09-10 11:29:46 -04:00
Zahary Karadjov f583135a39
The --stateSnapshot option now accepts ssz files as well 2019-09-10 10:13:49 -04:00
Jacek Sieka e470bbb52e
don't sign libp2p messages 2019-09-10 10:13:02 -04:00
Zahary Karadjov c3adac44f2
Use Secp256k1 keys in accordance to the interop spec 2019-09-10 10:11:56 -04:00
Zahary Karadjov cdff79ec6d More sync fixes
* Fix IncompleteData issues brought by the new spec-compliant stream closing
* Fix logic errors in the sync algorithms
2019-09-10 09:49:54 -04:00
Zahary Karadjov 886b92319f Implement the response size limits 2019-09-10 09:49:54 -04:00
Jacek Sieka 86fc9a1f9e fix nil access to mainchainMonitor 2019-09-10 09:49:54 -04:00
Zahary Karadjov a83aa83644 Working BeaconSync
Changes:

* Do not send separate network packets for response codes and msg
  len prefixes

* Close streams according to the spec

* Implement more timeouts according to the spec

* Make hello requests during syncing to update our knowledge of
  the head block of the other peer.
2019-09-10 09:49:54 -04:00
Zahary Karadjov 4a54fb4103 Cleaned up obsolete BeaconSync code; Added some open questions regarding fetchAncestorBlocks 2019-09-10 09:49:54 -04:00
Zahary Karadjov 9dec05f9c9 Sending chunked responses 2019-09-10 09:49:54 -04:00
Zahary Karadjov b120a60493 Reading chunked responses 2019-09-10 09:49:54 -04:00
Zahary Karadjov 2bbfa8c877 Changes related to the new ETH interop spec
* Hello is no longer a handshake message
  (all handshakes related code was deleted for clarity)

* Deal with the single-parameter inlining defined in the new spec
2019-09-10 09:49:54 -04:00
Mamy Ratsimbazafy 81b47f35d1 Voluntary exit - split single + multiple exits proc & tests (#421)
* add test suite for voluntary exit

* update API to process_voluntary_exit

* Add range check of validator_index for voluntary exits

* Revert to dual single + multiple voluntary exits API + enable in test suite

* no cache or mocking needed
2019-09-10 00:14:03 +00:00
Mamy Ratsimbazafy 061b6e0ddf
Test block headers (#418)
* Block headers tests

* Skip invalid_parent_root test due to https://github.com/status-im/nim-beacon-chain/issues/407

* Fix bls_verify with invalid sig. Activate block header tests
2019-09-09 14:40:59 -04:00
Yuriy Glukhov d4c480ff5f
Eth1 validators (#393) 2019-09-09 18:59:02 +03:00
Dustin Brody a4b4c89539 remove incorrect exit condition in get_attestation_details(...) (#416)
* remove incorrect exit condition in get_attestation_details(...)

* enable historical batch unit test, which now passes
2019-09-09 09:10:03 -04:00
Mamy Ratsimbazafy 3f446e6383
Attestations EF tests + Proper Real/Opaque BlsValue deserialization (#410)
* Add attestation unit test

* process_attestation doesn't throw exceptions

* Allow SSZ deserialization of both real and invalid signatures

* Add new process_attestation checks - pass all process_attestation tests

* Add sanity check for #361

* Fix SSZ testing after fromBytes/fromSSZBytes changes
2019-09-08 23:33:24 -04:00
Jacek Sieka 5f58af2112
fix ssz list, protocol names (#405) 2019-09-08 16:54:31 +02:00
Eugene Kabanov bb0e9de09d [WIP] Sync which using latest network specification. (#390)
* Fixed getBeaconBlocks() and getRecentBeaconBlocks() to use BlockPool, not db.

* Got the sync_protocol to compiling state; Removed all obsolete RPC calls
2019-09-08 15:08:44 +02:00
Mamy Ratsimbazafy 82b9e008d6
Fix genesis blockheader zero signature (supercedes #395) (#400) 2019-09-07 20:56:24 -04:00