Commit Graph

1106 Commits

Author SHA1 Message Date
blacktemplar
01054ecf2f Use SignatureBytes and PublicKeyBytes for deposits (#472)
* Replace deposit signatures with SignatureBytes, a struct which lazyly parsers signatures only on demand.

* check byte length when parsing SignatureBytes

* add comment to struct

* distinguish BadSignature and BadSignatureBytes in verify_deposit_signature

* add test for valid signature

* Implements TryInto<Signature> for &SignatureBytes and From<Signature> for &SignatureBytes

* add and use PublicKeyBytes + fix formatting

* fix compiler warning + docs for macro generated structs

* adds tests to ensure correct byte lengths

* small style improvement as suggested by michaelsproul
2019-08-06 13:49:11 +10:00
Paul Hauner
845f336a59
Interop chain start strategies (#479)
* Implement more flexible beacon chain genesis

* Fix compile issues from rebase on master

* Rename CLI flag

* Adds initial documentation for TOML files

* Update docs readme

* Add first version of cli_util

* Dont write cache fields in serde

* Tidy cli_util

* Add code to load genesis YAML file

* Move serde_utils out of tests in `types`

* Update logging text

* Fix serde YAML for Fork

* Make yaml hex decoding more strict

* Update deterministic key generate for interop

* Set deposit count on testing genesis state

* Make some fixes for deposit count

* Remove code fragements

* Large restructure of docs

* Tidy docs

* Fix readme link

* Add interop docs

* Tidy README
2019-08-06 13:29:27 +10:00
Michael Sproul
0374e31907 Disallow extra bytes in Bitfield from_bytes (#488) 2019-08-06 11:05:35 +10:00
Paul Hauner
4f45bf2255
Tree hash benches (#486)
* Add initial tree hash benches

* Add tree hash example

* Use lazy static in tree hash benches
2019-08-05 18:06:50 +10:00
Michael Sproul
65c18ddc60 Fix Bitfield from_bytes empty vec bug (#487)
Credit to @kirk-baird for finding the bug with the fuzzer.

Co-authored-by: Kirk Baird <baird.k@outlook.com>
2019-08-05 18:06:24 +10:00
Paul Hauner
e21d3fed05
Revert "Tidy ancestor iterators"
This reverts commit 5079c25bb2.

Accidental push to master.. my bad!
2019-08-05 16:27:55 +10:00
Paul Hauner
5079c25bb2
Tidy ancestor iterators 2019-08-05 16:25:21 +10:00
Paul Hauner
7738d51a72
Add cargo fmt to .travis.yml (#474)
* Run cargo fmt

* Add cargo fmt to travis.yml
2019-07-31 14:45:09 +10:00
blacktemplar
309b10c4a8 add logging functionality for aligning key value pairs after message (#461)
* add logging functionality for aligning key value pairs after the main messages

* move to own crate, change default message width to 40

* use FullFormat in validator_client (CompactFormat is not compatible with aligning)

* move logging to eth2/utils/logging
2019-07-31 09:06:53 +10:00
Paul Hauner
81a089aa8b
Remove old benches (#465)
* Remove cached_tree_hash benches

* Remove state_processing benches
2019-07-30 17:19:03 +10:00
Michael Sproul
eb669ab40f
Add v0.8 genesis tests (#466)
Closes #452
2019-07-30 17:02:38 +10:00
Michael Sproul
a236003a7b Update to frozen spec ❄️ (v0.8.1) (#444)
* types: first updates for v0.8

* state_processing: epoch processing v0.8.0

* state_processing: block processing v0.8.0

* tree_hash_derive: support generics in SignedRoot

* types v0.8: update to use ssz_types

* state_processing v0.8: use ssz_types

* ssz_types: add bitwise methods and from_elem

* types: fix v0.8 FIXMEs

* ssz_types: add bitfield shift_up

* ssz_types: iterators and DerefMut for VariableList

* types,state_processing: use VariableList

* ssz_types: fix BitVector Decode impl

Fixed a typo in the implementation of ssz::Decode for BitVector, which caused it
to be considered variable length!

* types: fix test modules for v0.8 update

* types: remove slow type-level arithmetic

* state_processing: fix tests for v0.8

* op_pool: update for v0.8

* ssz_types: Bitfield difference length-independent

Allow computing the difference of two bitfields of different lengths.

* Implement compact committee support

* epoch_processing: committee & active index roots

* state_processing: genesis state builder v0.8

* state_processing: implement v0.8.1

* Further improve tree_hash

* Strip examples, tests from cached_tree_hash

* Update TreeHash, un-impl CachedTreeHash

* Update bitfield TreeHash, un-impl CachedTreeHash

* Update FixedLenVec TreeHash, unimpl CachedTreeHash

* Update update tree_hash_derive for new TreeHash

* Fix TreeHash, un-impl CachedTreeHash for ssz_types

* Remove fixed_len_vec, ssz benches

SSZ benches relied upon fixed_len_vec -- it is easier to just delete
them and rebuild them later (when necessary)

* Remove boolean_bitfield crate

* Fix fake_crypto BLS compile errors

* Update ef_tests for new v.8 type params

* Update ef_tests submodule to v0.8.1 tag

* Make fixes to support parsing ssz ef_tests

* `compact_committee...` to `compact_committees...`

* Derive more traits for `CompactCommittee`

* Flip bitfield byte-endianness

* Fix tree_hash for bitfields

* Modify CLI output for ef_tests

* Bump ssz crate version

* Update ssz_types doc comment

* Del cached tree hash tests from ssz_static tests

* Tidy SSZ dependencies

* Rename ssz_types crate to eth2_ssz_types

* validator_client: update for v0.8

* ssz_types: update union/difference for bit order swap

* beacon_node: update for v0.8, EthSpec

* types: disable cached tree hash, update min spec

* state_processing: fix slot bug in committee update

* tests: temporarily disable fork choice harness test

See #447

* committee cache: prevent out-of-bounds access

In the case where we tried to access the committee of a shard that didn't have a committee in the
current epoch, we were accessing elements beyond the end of the shuffling vector and panicking! This
commit adds a check to make the failure safe and explicit.

* fix bug in get_indexed_attestation and simplify

There was a bug in our implementation of get_indexed_attestation whereby
incorrect "committee indices" were used to index into the custody bitfield. The
bug was only observable in the case where some bits of the custody bitfield were
set to 1. The implementation has been simplified to remove the bug, and a test
added.

* state_proc: workaround for compact committees bug

https://github.com/ethereum/eth2.0-specs/issues/1315

* v0.8: updates to make the EF tests pass

* Remove redundant max operation checks.
* Always supply both messages when checking attestation signatures -- allowing
  verification of an attestation with no signatures.
* Swap the order of the fork and domain constant in `get_domain`, to match
  the spec.

* rustfmt

* ef_tests: add new epoch processing tests

* Integrate v0.8 into master (compiles)

* Remove unused crates, fix clippy lints

* Replace v0.6.3 tags w/ v0.8.1

* Remove old comment

* Ensure lmd ghost tests only run in release

* Update readme
2019-07-30 12:44:51 +10:00
John Adler
1b26a36ebc Verify transfer now checks for amount + fees. (#457) 2019-07-29 12:17:04 +10:00
Paul Hauner
7458022fcf
Fork choice bug fixes (#449)
* Change reduced tree for adding weightless node

* Add more comments for reduced tree fork choice

* Small refactor on reduced tree for readability

* Move test_harness forking logic into itself

* Add new `AncestorIter` trait to store

* Add unfinished tests to fork choice

* Make `beacon_state.genesis_block_root` public

* Add failing lmd_ghost fork choice tests

* Extend fork_choice tests, create failing test

* Implement Debug for generic ReducedTree

* Add lazy_static to fork choice tests

* Add verify_integrity fn to reduced tree

* Fix bugs in reduced tree

* Ensure all reduced tree tests verify integrity

* Slightly alter reduce tree test params

* Add (failing) reduced tree test

* Fix bug in fork choice

Iter ancestors was not working well with skip slots

* Put maximum depth for common ancestor search

Ensures that we don't search back past the finalized root.

* Add basic finalization tests for reduced tree

* Change fork choice to use beacon_block_root

Previously it was using target_root, which was wrong

* Make ancestor iter return option

* Disable fork choice test when !debug_assertions

* Fix type, removed code fragment

* Tidy some borrow-checker evading

* Lower reduced tree random test iterations
2019-07-29 12:08:52 +10:00
Pawan Dhananjay
db094022b9 Remove unused dependencies (#456) 2019-07-29 09:55:57 +10:00
John Adler
fec7168512
Fix lots of typos. 2019-07-26 15:26:06 -04:00
Kirk Baird
0513559252 Fix syncing bugs by recursively attempting to process parents in the … (#429)
* Fix syncing bugs by recursively attempting to process parents in the import queue, change BlockRootsIterator

* Swap from crossbeam channel to tokio mpsc

* Recursion fix

* Remove exess block processing

* Fix network lag, correct attestation topic

* Correct network poll logic

* Overhaul of SimpleSync and modify BlockRootsIterator to return start_slot

* Fix bug in tests relating to StateRootsIterator

* Remove old, commented-out heartbeat code.

* Tidy docs on import queue enum

* Change source logging msg in simple sync

* Rename function parameter in simple sync

* Use `BestBlockRootsIterator` in `reduced_tree`

* Update comments for `BestBlockRootsIterator`

* Fix duplicate dep in cargo.toml
2019-07-16 17:28:15 +10:00
Paul Hauner
88c6d15c32
Padding efficent merkle root algo (#436)
* Add initial work on padding efficent merkle roots

* Improve merklize_padded

* Improve tree_hash crate -- fix bugs, docs

* Update codebase for tree_hash API change

* Remove dbg statements, fix import error

* Fix clippy lints, doc error

* Tidy tree hash comments

* Increase tree_hash max tree height

* Fix PR review comments

* Fix typos

* Fix cache access off-by-one in tree hash

* Set max tree depth to 48 (from 64)
2019-07-16 14:40:56 +10:00
Paul Hauner
fcd3da81bf
Merge pull request #426 from sigp/ssz-types
Add ssz_types crate
2019-07-11 16:53:32 +10:00
Paul Hauner
561cec0bf6
Move many bitfield Options to Results 2019-07-11 13:19:38 +10:00
Paul Hauner
61406b34bc
Resolve issues raised from @michaelsproul review 2019-07-11 12:45:34 +10:00
Paul Hauner
2c1afcc2d6
Rename marker structs for Bitfield 2019-07-11 12:40:37 +10:00
Paul Hauner
08868a6e7a
Merge pull request #425 from sigp/ssz-v0.8
Changes for publishing ssz to crates.io
2019-07-11 09:22:07 +10:00
Paul Hauner
5e1a2ebf25
Uncomment broken tree hash impl for variable list 2019-07-09 20:30:29 +10:00
Paul Hauner
bb3b3fd8b9
Fix bug around single-byte for 0-bits 2019-07-09 20:29:10 +10:00
Paul Hauner
daa8916e6b
Add comments after self-review 2019-07-09 20:28:19 +10:00
Paul Hauner
090133b088
Add more comments to bitfield 2019-07-09 17:31:34 +10:00
Paul Hauner
734aa3b8bd
Satisfy clippy lint in SSZ 2019-07-09 17:01:37 +10:00
Paul Hauner
7283fdff15
Fix clippy lints in ssz_types 2019-07-09 16:58:53 +10:00
Paul Hauner
57cc946018
Add bitvector tests 2019-07-09 16:37:09 +10:00
Paul Hauner
000d941e2e
Add tests for BitList 2019-07-09 16:03:02 +10:00
Paul Hauner
e4ef0fc9d4
Add crate-level docs to ssz_types 2019-07-09 11:00:40 +10:00
Paul Hauner
94265272b4
Tidy bitfield docs 2019-07-09 09:28:22 +10:00
Paul Hauner
5a7c44ed37
Add failing doc tests 2019-07-08 18:53:25 +10:00
Paul Hauner
1484773cd1
Refactor to use Bitfield struct with type variants 2019-07-08 18:41:43 +10:00
Paul Hauner
93cd38da55
Progress further on Bitfield struct 2019-07-08 16:27:08 +10:00
Paul Hauner
bbcc58dca3
Start building new bitfield struct 2019-07-08 16:07:40 +10:00
Paul Hauner
636ebb0d4e
Add progress on bitfields 2019-07-08 11:54:47 +10:00
Paul Hauner
ecb0bf11c7
Move bitlist and bitvector into own files 2019-07-08 09:36:52 +10:00
Paul Hauner
c8c5c8ff16
Collect errors into a single error 2019-07-06 15:57:11 +10:00
Paul Hauner
2b7d5560ad
Refactor SSZ types bitfield
Removes superfulous `Bitfield` struct
2019-07-06 15:51:15 +10:00
Paul Hauner
5943e176cf
Add ssz_types crate 2019-07-05 17:33:20 +10:00
Age Manning
af28d5e20c
Add persistent network identification 2019-07-04 14:14:27 +10:00
Age Manning
6ee2b4df34
Complete merging of network addition branch 2019-07-04 14:14:26 +10:00
Age Manning
c7e17c8641
Updates for latest master 2019-07-04 14:14:26 +10:00
Age Manning
64abd0bc5b
Removes network parameters from chain spec 2019-07-04 14:07:26 +10:00
Age Manning
4e24c8e651
Add topics to chain id 2019-07-04 14:07:26 +10:00
Paul Hauner
4dc274858e
Update SSZ for publishing to crates.io 2019-07-04 13:34:54 +10:00
Paul Hauner
54bda210e2
Update ssz_derive for publishing to crates.io 2019-07-04 13:22:33 +10:00
Paul Hauner
027f0a539d
Prepare ssz for publishing on crates.io 2019-07-03 16:06:20 +10:00
Michael Sproul
a04b1f981e
op_pool: remove SszPair 2019-07-01 16:25:57 +10:00
Michael Sproul
44ed3228b9
ssz: implement Encode and Decode for tuples 2019-07-01 14:54:34 +10:00
Michael Sproul
73c4171b52
op_pool: finish persistence support 2019-07-01 10:55:55 +10:00
Michael Sproul
7fe458af45
op_pool: re-jig deposit handling (needs more work) 2019-07-01 10:55:55 +10:00
Michael Sproul
604fe2d97f
op_pool: partial persistence support 2019-07-01 10:55:55 +10:00
Michael Sproul
38d2d03e3a
op_pool: use max cover algorithm, refactor 2019-07-01 10:55:54 +10:00
Paul Hauner
9a356a00c2
Merge pull request #405 from c-o-l-o-r/wasm-ssz
Make SSZ compatible with `wasm32` targets
2019-06-27 13:31:18 +10:00
Matt Garnett
e93fb94e7a calculate MAX_LENGTH_VALUE for 32-bit and 64-bit targets 2019-06-25 10:12:49 -04:00
Matt Garnett
db9dd3dffe fix encoding impl for usize on 32-bit architectures 2019-06-25 09:59:50 -04:00
Paul Hauner
8afe8b3569
Implement fixes from PR review 2019-06-24 15:31:36 +10:00
Paul Hauner
3a196f3fdc
Tidy, fix clippy lints 2019-06-24 09:34:56 +10:00
Paul Hauner
075c989375
Remove old fork_choice crate 2019-06-24 09:34:56 +10:00
Paul Hauner
77fba0b98e
Fix bugs in fork choice, add more tests 2019-06-24 09:34:56 +10:00
Paul Hauner
7a4c3e26ac
Fix bug in reduced tree fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
0b2ad4d0a1
Mark reduced_tree fork choice as incomplete 2019-06-24 09:34:54 +10:00
Paul Hauner
d0037f49d8
Add progress on debugging fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
5a8cde0598
Change "canonical_root" of block to be signed root 2019-06-24 09:34:54 +10:00
Paul Hauner
e485f3ee75
Fix bug in reduced tree fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
85b23f9f1b
Add incomplete progress on fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
5a98502ad6
Fix bug in epoch trans. finalization 2019-06-24 09:34:53 +10:00
Paul Hauner
55196dff64
Remove iter mod from beacon chain
Now the iter mod in store is the only implementation
2019-06-24 09:34:53 +10:00
Paul Hauner
952e08ba38
Add state roots iter to store 2019-06-24 09:34:53 +10:00
Paul Hauner
2b5c70711d
Cover edge case in reduced tree 2019-06-24 09:34:53 +10:00
Paul Hauner
fd384e54f4
Add weightless blocks to reduced tree, fix bugs 2019-06-24 09:34:53 +10:00
Paul Hauner
9c2bbb6c05
Add stubbed-out block processing to fork choice 2019-06-24 09:34:52 +10:00
Paul Hauner
8fb6ffffe2
Add new beacon chain test harness 2019-06-24 09:34:52 +10:00
Paul Hauner
f4621a9f1a
Improve reduced tree fork choice 2019-06-24 09:34:52 +10:00
Paul Hauner
7756a658a7
Update fork choice find head fn 2019-06-24 09:34:51 +10:00
Paul Hauner
2ee71aa808
Add new fork choice struct to beacon chain 2019-06-24 09:34:51 +10:00
Paul Hauner
c43bbfe183
Rename fork_choice_2 to lmd_ghost 2019-06-24 09:34:51 +10:00
Paul Hauner
8f44402691
Add RwLock to reduced tree 2019-06-24 09:34:51 +10:00
Paul Hauner
a62c571133
Fix compile errors in reduced tree 2019-06-24 09:34:51 +10:00
Paul Hauner
4a3d54761a
Add progress on reduced tree fork choice 2019-06-24 09:34:51 +10:00
Paul Hauner
4b4c9a98df
Copy-paste reduced-tree code 2019-06-24 09:34:50 +10:00
Paul Hauner
e6747094c8
Merge pull request #386 from vlopes11/ssz-ambiguous
`ssz` is ambiguous (name vs any other name during import resolution)
2019-06-24 07:56:50 +10:00
Matt Garnett
87e681c617 make ssz crate wasm compatible 2019-06-22 14:37:07 -04:00
Matt Garnett
2a50550b87 make hashing crate wasm compatible 2019-06-22 14:36:59 -04:00
Paul Hauner
25e93f60fd
Tidy comments 2019-06-17 10:01:23 -04:00
Michael Sproul
9cec5dc073
process slashings: fix subtraction overflow 2019-06-17 17:22:48 +10:00
Michael Sproul
03c50354f4
v0.6: update all spec version comments 2019-06-17 17:22:48 +10:00
Michael Sproul
1823378bfa
v0.6: remove some FIXMEs 2019-06-17 17:22:48 +10:00
Paul Hauner
28b89f3fdd
Run rustfmt with updated cargo 2019-06-17 15:24:13 +10:00
Michael Sproul
660a35991f
update minimal spec, fix all tests 2019-06-17 15:21:03 +10:00
Paul Hauner
a71f05066b
Merge branch 'docker-env' into v0.6.1 2019-06-13 10:37:35 -04:00
Michael Sproul
4686542e10
bls: fix unused import warning 2019-06-12 16:56:57 +10:00
Michael Sproul
0da63a0e65
shuffling: delete old yaml test 2019-06-12 16:56:33 +10:00
Michael Sproul
ea43515eb0
committee cache: fix a test for shard delta changes 2019-06-12 16:55:59 +10:00
Michael Sproul
9e51a04139
Delete unused fished_yates_shuffle crate 2019-06-12 16:55:01 +10:00
Michael Sproul
88790e6abe
bls: debugging utils and fake sig fix
There was a discrepancy between the is_empty fields of fake signatures during testing, so I've added
a small hack to set the is_empty field of a fake signature based on the byte content.
Alternatively, we could just make it so that any fake signature is defined to be equal to any other.
2019-06-12 15:44:23 +10:00
Michael Sproul
64dca6fba7
committee cache: avoid spurious recomputes
Check that the committeee cache matches the absolute epoch for the relative epoch, rather than
always checking the previous epoch.
2019-06-12 15:41:20 +10:00