Commit Graph

3312 Commits

Author SHA1 Message Date
Hsiao-Wei Wang 4558c7db4e
Reorg the file structure 2020-05-02 02:32:37 +08:00
Hsiao-Wei Wang b43e24acb6
specs/phase1/fraud-proofs.md -> specs/phase1/shard-transition.md 2020-05-02 02:32:37 +08:00
Hsiao-Wei Wang ff85025113
PR feedback from terence 2020-05-02 02:32:37 +08:00
Hsiao-Wei Wang e758fb76c2
Check `head_shard_root` of all `transition_attestations` 2020-05-02 02:32:36 +08:00
Hsiao-Wei Wang 524ba166d1
[squashed] shard chain updates wip
Fix wrong field names

Fix `build_attestation_data` and other PR feedback from Danny and
Terence

1. Rename `get_previous_slot` to `compute_previous_slot`
2. Break down `build_empty_block` into
`get_state_and_beacon_parent_root_at_slot`, use it in
`build_shard_block`
3. Set defult `slot` to `shard_state.slot + 1` in `build_shard_block`

Update `verify_shard_block_message`: check beacon_parent_root at fork
choice rule stage instead of state transition

Fix  `beacon-chain.md`

1. Fix typo `attestation.slot == state.slot` -> `attestation.data.slot == state.slot` in `is_winning_attestation`
2. Check `verify_shard_transition_false_positives` **after** `process_operations`
3. Fix `shard_attestations` filter in `process_crosslinks`: since attestations come from block, should use `attestation.data.slot + MIN_ATTESTATION_INCLUSION_DELAY == state.slot`
4. [TBD] Allow empty `light_client_signature` to make the tests pass
5. [TBD] Add `is_shard_attestation`, filter out empty `ShardTransition()`

Rework `test_process_crosslink`

Add basic phase 1 `test_blocks`

Add more test cases

Revert `is_shard_attestation` and fix test cases backward compatibility.

Remove `test_process_beacon_block_no_shard_transition` and consider it as invalid case.
2020-05-02 02:32:31 +08:00
Hsiao-Wei Wang c8a473ba24
Apply suggestions from code review
Co-Authored-By: Danny Ryan <dannyjryan@gmail.com>
2020-05-02 02:32:30 +08:00
Hsiao-Wei Wang 40483b587b
[squashed] shard chain updates wip
Use `ShardBlock` in `shard_state_transition`

PR feedback

1. Rename `ShardState.data` -> `ShardState.transition_digest`
2. Rename `compute_shard_transition_data` to `compute_shard_transition_digest`
3. Add `assert state.slot > PHASE_1_GENESIS_SLOT` just in case, may move it later

Add `get_post_shard_state` as a pure function wrapper
2020-05-02 02:32:24 +08:00
Hsiao-Wei Wang 85d5a9abaf
[squashed] shard chain updates wip
PR feedback from Danny and some refactor

1. Add stub `PHASE_1_GENESIS_SLOT`
2. Rename `get_updated_gasprice`  to `compute_updated_gasprice`
3. Rename `compute_shard_data_roots` to `compute_shard_body_roots`

Apply shard transition for the skipped slots

Refactor `shard_state_transition`

Get `beacon_parent_root` from offset slot

Add more test

Add `verify_shard_block_message`

Add `> 0`

Keep `beacon_parent_block` unchanged in `is_valid_fraud_proof`

Remove some lines

Fix type

Refactor + simplify skipped slot processing
2020-05-02 02:31:54 +08:00
Hsiao-Wei Wang 9724cb832d
Apply suggestions from code review from @djrtwo
Co-Authored-By: Danny Ryan <dannyjryan@gmail.com>
2020-05-02 02:31:53 +08:00
Hsiao-Wei Wang afa12caf1f
Refactor `get_shard_state_transition_result` 2020-05-02 02:31:53 +08:00
Hsiao-Wei Wang 4e8a7ff115
[squashed] shard transition wip
Fix the wrong `get_shard_proposer_index` parameters order

Phase 1 WIP

Add shard transition basic test

Fix lint error

Fix
2020-05-02 02:31:10 +08:00
Hsiao-Wei Wang 849d3f83bf
Apply @terencechain 's review feedback
Co-Authored-By: terence tsao <terence@prysmaticlabs.com>
2020-05-02 02:31:09 +08:00
Hsiao-Wei Wang 247a6c8fca
Add `verify_fraud_proof` function 2020-05-02 02:31:09 +08:00
Hsiao-Wei Wang be50020bf8
Refactor `get_light_client_committee` to similar to
`get_shard_committee`
2020-05-02 02:31:08 +08:00
Hsiao-Wei Wang 5f69afea38
Make `shard_state_transition` more like beacon state_transition function 2020-05-02 02:31:08 +08:00
Hsiao-Wei Wang e9f1e4186d
Add `proposer_index` to shard block 2020-05-02 02:31:08 +08:00
Hsiao-Wei Wang feb27a14be
beacon-chain.md: Replace block wrapper with signable pattern 2020-05-02 02:31:08 +08:00
Danny Ryan c2c27791c5
Merge branch 'dev' into rewards-rework 2020-05-01 10:52:19 -06:00
protolambda 09cae4b3cc
Handle empty-aggregation-bits case, and add tests. See #1713 2020-05-01 15:17:41 +02:00
Danny Ryan 4b4fc32f9c
Merge pull request #1755 from paulhauner/patch-23
Fork choice: Remove redundant check in validate_on_attestation
2020-04-30 11:06:29 -06:00
Paul Hauner 2dc5156651
Add message about delaying consideration 2020-04-30 16:27:02 +10:00
Danny Ryan 6a40f71a31
add note about beacon committees not going into attnets 2020-04-29 20:29:48 -06:00
Danny Ryan cd27e5e045
add tests for source, target, head 2020-04-29 10:23:12 -06:00
Danny Ryan 5f18dd778c
add baseline get_target_deltas tests 2020-04-28 19:26:14 -06:00
Danny Ryan 4a086fba5c
Merge branch 'dev' into rewards-rework 2020-04-28 17:24:45 -06:00
Danny Ryan 87586837c3
remove interop from phase 0 p2p specs 2020-04-27 17:39:39 -06:00
Danny Ryan d128400da5
remove interop from header and gossip sections in network spec 2020-04-27 17:39:31 -06:00
Danny Ryan 553a33cd2d
Merge pull request #1766 from ethereum/dev
backport dev to v012x
2020-04-27 17:35:28 -06:00
Diederik Loerakker 9d39c292e0
Merge pull request #1763 from ethereum/master
Backport v0.11.2 hotfixes from master to dev
2020-04-28 00:18:52 +02:00
Danny Ryan dae623b097
Merge pull request #1756 from byz-f/q9-genesis-eth1
genesis: clarify that eth1 timestamp can be less than min genesis time
2020-04-27 10:15:18 -06:00
Hsiao-Wei Wang 2dbc333270
Make `compute_new_state_root` a pure function 2020-04-27 22:18:43 +08:00
Hsiao-Wei Wang 4d980aec71
Fix validator guide
1. Avoid negative computation in `is_candidate_block`
2. Fix `get_block_signature`: avoid extra casting; it's simpler to use BeaconBlock instead of
BeaconHeader
2020-04-27 21:47:24 +08:00
Raw Pong Ghmoa c841aa102b
genesis: clarify that eth1 timestamp can be less than min genesis time 2020-04-26 10:09:22 +02:00
Paul Hauner 1a81c873af
Remove redundant check in fork choice 2020-04-26 16:24:16 +10:00
Aditya Asgaonkar 9acea51938 Simplified by re-using get_ancestor() 2020-04-25 14:17:28 -07:00
protolambda 0c67aaa68e
Include fork digest in example gossip topic name 2020-04-25 00:05:37 +02:00
Danny Ryan fde9b410f0
Merge pull request #1752 from ethereum/dev
sync v0.11.2 to `v012x`
2020-04-24 11:36:17 -06:00
Paul Hauner bf806b9efa
Require "seen" aggregates to be valid 2020-04-24 15:01:18 +10:00
Danny Ryan 7612667bbe
minor feedback and fixes on rewards/penalites proposal
Co-Authored-By: Hsiao-Wei Wang <hwwang156@gmail.com>
2020-04-23 11:13:09 -06:00
Danny Ryan fe13bab338
rework rewards/penalties to be more granular 2020-04-23 10:26:34 -06:00
Danny Ryan 11d164748c
add 'valid' when de-deduplication of attestations on gossip subnets 2020-04-22 14:45:01 -06:00
Danny Ryan d8662d49ea
Merge pull request #1730 from ethereum/bootnode-enr
add note about distributing bootnode ENRs prior to genesis
2020-04-22 14:38:38 -06:00
Danny Ryan 3d4122a2f6
add note about distributing bootnode ENRs prior to genesis 2020-04-22 14:33:57 -06:00
Aditya Asgaonkar 9bbac0d2cc Added consistency check for FFG & LMD vote in validate_on_atttestation(), fixes #1636, fixes #1456, fixes #1408 2020-04-21 23:56:44 -07:00
Justin 5929aac799
Cosmetic changes from #1737 2020-04-22 11:40:10 +08:00
Danny Ryan a6b2679cb0
Merge pull request #1739 from ethereum/JustinDrake-patch-4
Partial fix for #1701
2020-04-21 08:44:22 -06:00
Justin 3436021e72
Update beacon-chain.md 2020-04-21 15:34:55 +01:00
Danny Ryan ebf888bcf7
Merge pull request #1736 from status-im/rannge-req
simplify block range request description
2020-04-21 08:21:57 -06:00
Justin e2a320ef32
Partial fix for #1701
Clarify that state transitions with `uint64` overflows are invalid.
2020-04-21 08:59:53 +01:00
Justin 508811d641
Fix #1735—remove redundant check
As per #1735 the check `if not len(indices) <= MAX_VALIDATORS_PER_COMMITTEE: return False` is redundant. As such this PR should be purely cosmetic.
2020-04-21 08:50:42 +01:00
Jacek Sieka 4915014a19
simplify block range request description
There's room for ambiguity as to what `count` means - this clarifies
that it always relates to the slot, and not the number of blocks in the
response which allows clients to request ranges epoch by epoch (for
example) without worrying about overlaps caused by empty slots.
2020-04-20 20:03:15 +02:00
Hsiao-Wei Wang 6fdee75475
Fix phase0 types 2020-04-17 23:55:25 +08:00
Danny Ryan e58cfedb68
clarify ssz_snappy for gossip 2020-04-16 11:12:24 -06:00
Danny Ryan 4a94200c0b
Merge pull request #1712 from ethereum/hwwhww/inactivity_penalty_quotient_bug
Fix `INACTIVITY_PENALTY_QUOTIENT`
2020-04-14 11:53:43 -06:00
Hsiao-Wei Wang b2f6325db3
Fix `compute_committee` 2020-04-09 17:50:23 +08:00
Hsiao-Wei Wang 890c27d091
The input parameter `index` in `compute_shuffled_index` is the position of the given list, not `ValidatorIndex` 2020-04-09 17:33:14 +08:00
Hsiao-Wei Wang c10e59bdf7
Fix `INACTIVITY_PENALTY_QUOTIENT`
The amount of inactivity penalty was adjusted to half since we were applying penalty for missing FFG target and source. But now we only apply it for missing target, so `INACTIVITY_PENALTY_QUOTIENT` should be `2**24`.
2020-04-08 10:32:16 +08:00
Danny Ryan 2a36f366ef
Merge pull request #1710 from paulhauner/patch-20
Tighten aggregate attn propogation condition
2020-04-07 18:56:04 -06:00
Danny Ryan 26492651b6
Merge pull request #1706 from paulhauner/patch-19
Redefine attestation propogation condition
2020-04-07 18:55:41 -06:00
Paul Hauner c96a3366fa
Tighten aggregate attn propogation condition 2020-04-07 16:07:41 +10:00
Paul Hauner 616385a094
Fix spelling mistake 2020-04-07 07:45:15 +10:00
Paul Hauner 021cb98dbb
Use epoch for attestation subnet seen-ness. 2020-04-07 07:05:51 +10:00
Danny Ryan bdf087d7f3
add notes about how to handle peer discovery and gossip topics prior to genesis 2020-04-06 09:57:23 -06:00
Paul Hauner 7d4b97240b
Redefine attestation propogation condition 2020-04-06 17:46:33 +10:00
Danny Ryan e86c5ef41d
final PR nitpicks 2020-04-03 10:29:35 -06:00
Danny Ryan c3e5ddaabc
Merge branch 'dev' into phase1-tests 2020-04-03 09:54:34 -06:00
Danny Ryan 246b46771e
address @hwwhww feedback 2020-04-03 09:46:57 -06:00
Danny Ryan f2c2da95ed
add compute_offset_slots 2020-04-03 09:19:56 -06:00
Danny Ryan 613f368c00
fix call to get_beacon_committee in process_crosslink_for_shard 2020-04-01 12:20:32 -06:00
Danny Ryan 16208790a5
Merge pull request #1699 from ethereum/hwwhww/unpack_compact_validator
Add `unpack_compact_validator` back
2020-03-31 10:40:45 -06:00
Hsiao-Wei Wang f82cdb7e68
beacon-chain.md: add `unpack_compact_validator` for `light-client-sync.md` 2020-03-31 22:13:48 +08:00
Hsiao-Wei Wang 071f6b5126
Gasprice rework: use `MIN_GASPRICE` as the initial gasprice and change `MIN_GASPRICE` to 8 gwei 2020-03-31 22:09:20 +08:00
Paul Hauner 2daa26442b
Tighten restriction on a "seen" attestation
Declares that only a verified block can stop an attestation from being propagated.

This achieves two things:

1. Ensures that clients don't need to scan invalid blocks for attestations and then modify their state based upon them.
1. Disallows "muting" attestations by sending around a junk block with that attestation in it.
2020-03-30 10:44:46 +11:00
Danny Ryan 073f78efa1
Merge branch 'dev' into phase1-tests 2020-03-29 17:04:25 -06:00
Danny Ryan d07aa00307
Merge pull request #1692 from ethereum/master
Backport v0.11.1 to dev
2020-03-29 16:38:50 -06:00
Danny Ryan d42e08a6e1
verify proposer sig before proposer shuffling in p2p block gossip conditions 2020-03-26 11:43:32 -06:00
Danny Ryan c46fe86839
Merge branch 'v011x' into publish-vs-subscribe 2020-03-26 10:48:23 -06:00
Danny Ryan a83e7a5ecc
proto PR feedback 2020-03-26 10:46:06 -06:00
Danny Ryan 050b42806d
Merge pull request #1684 from ethereum/enr-ping
MetaData and Ping
2020-03-26 10:40:46 -06:00
Danny Ryan ee45cf77ef
proto feedback on MetaData 2020-03-26 07:47:20 -06:00
Danny Ryan 7af6a3afa4
do not require non-aggregating validators to subscribe to attestation subnet for beacon committee duties 2020-03-25 15:56:26 -06:00
Danny Ryan d5a9af6469
update ping protocol to use MetaData 2020-03-25 12:08:27 -06:00
Danny Ryan b8d25dc5b4
Merge pull request #1682 from ethereum/reward-acc-bug
Attestation reward bug
2020-03-24 19:36:23 -06:00
Paul Hauner 88fddf2379
Remove unneccessary clock disparity check
There is no need to mention clock disparity when comparing two static slot values (assuming the clock disparity is less than a slot, even then I don't think that's the intention).
2020-03-24 08:13:36 -06:00
Michael Sproul 1c49f99094
Fix bug in attestation reward calculation 2020-03-24 07:40:58 -06:00
Age Manning f227e026fa
Draft PING and ENR rpc protocol 2020-03-24 15:10:47 +11:00
Age Manning cf20a7ae3e
Shift some ENR fields to MAY 2020-03-24 15:07:43 +11:00
Danny Ryan 2978f21a39
minor edit to validator get_attestation_signature 2020-03-19 15:17:06 -06:00
Jacek Sieka 759af67345
Normalize attestation signature getter name 2020-03-19 15:13:59 -06:00
Danny Ryan 2b8c32a347
Merge pull request #1664 from ethereum/div-zero-total-balance
avoid div by zero in extreme balance case
2020-03-19 08:50:09 -06:00
Danny Ryan 0a9b306d60
PR feedback from @hwwhww 2020-03-18 09:55:09 -06:00
Danny Ryan e6998a61cd
remove IK handshake from noise spec (removed in core libp2p specs) 2020-03-17 10:54:48 -06:00
Danny Ryan e2ef4365e2
min total balance is now EFFECTIVE_BALANCE_INCREMENT. update testing 2020-03-16 11:19:21 -06:00
Danny Ryan d299b06a1c
fix custody bit calculation format 2020-03-16 09:52:27 -06:00
Danny Ryan 5315f3db35
clarify proposer_index must be from expected shuffling when validating block gossip 2020-03-13 12:00:34 -06:00
Dankrad Feist 9b7e0ab2be
Fix error in custody bit computation 2020-03-13 17:15:25 +00:00
Danny Ryan 1293320675
Merge branch 'dev' into phase1-tests 2020-03-12 07:12:41 -06:00
Danny Ryan c894f5ecec
fork choice error note 2020-03-11 16:41:27 -06:00
Danny Ryan a612df1119
minor typos and clarifications in fork choice 2020-03-11 16:11:42 -06:00
Danny Ryan 47bbffa0d6
'get_checkpoint_store' -> 'get_forkchoice_store' typo 2020-03-11 15:03:14 -06:00