Commit Graph

1189 Commits

Author SHA1 Message Date
Hsiao-Wei Wang ae67e9513b
Fix type hinting and add docstrings 2019-03-22 12:56:54 +08:00
Hsiao-Wei Wang 512ceff1bb
Merge branch 'dev' into vbuterin-patch-20 2019-03-22 11:58:32 +08:00
Danny Ryan 64e3db09d4
Merge branch 'dev' into JustinDrake-patch-19 2019-03-21 16:25:31 -06:00
Danny Ryan d8ad56f759
Merge pull request #828 from ethereum/vbuterin-patch-20-1
Small cosmetic change to slashable attestations
2019-03-21 15:50:08 -06:00
vbuterin 3ece05ccc1
Small cosmetic change to slashable attestations 2019-03-21 16:36:31 -05:00
vbuterin 3b403909e8
Cosmetic improvement to reward/penalty functions 2019-03-21 16:29:14 -05:00
vbuterin 38a5c3640b
Re-added some penalization in case of failure to finalize 2019-03-21 15:13:13 -05:00
vbuterin d1d1b73fb1
Simplify justification and finalization accounting logic
Much of the simplification is cosmetic. The following changes are substantive:

* Inactivity leak penalty specifically on missing the target, not both the target and the source
* Even outside of quadratic leak scenarios, slashing victims suffer offline penalties
2019-03-21 15:11:05 -05:00
Danny Ryan f6da42ffb3
fix markdown issues 2019-03-21 10:04:20 -06:00
Danny Ryan c99fe3fb38
Merge branch 'dev' into vbuterin-patch-3 2019-03-21 08:47:19 -06:00
Danny Ryan fd6d80fcb6
remove get_split_offset from phase 1 doc 2019-03-21 08:24:26 -06:00
vbuterin fdcfc91008
Add docstring into get_split_offset 2019-03-21 07:38:25 -05:00
Hsiao-Wei Wang 2215988415
Merge branch 'dev' into JustinDrake-patch-19 2019-03-20 21:59:40 +08:00
vbuterin fff76749d2
Merge branch 'dev' into vbuterin-patch-3 2019-03-20 08:05:22 -04:00
Justin 833691b8af
Update 0_beacon-chain.md 2019-03-20 08:16:39 +00:00
Danny Ryan a8e2b8cd1d
Merge branch 'dev' into vbuterin-patch-11 2019-03-19 16:06:33 -06:00
Danny Ryan acd7fdd762
add a few voluntary exit tests 2019-03-19 16:00:27 -06:00
Danny Ryan 9d7c2b264e
Merge branch 'dev' into JustinDrake-patch-20 2019-03-19 15:06:36 -06:00
Danny Ryan 2afbd8a02d
Merge branch 'dev' into JustinDrake-patch-8 2019-03-19 14:44:25 -06:00
Justin b664453a34
Update 0_beacon-chain.md 2019-03-19 20:43:05 +00:00
Danny Ryan ef0b3d2948
Merge branch 'dev' into JustinDrake-patch-20 2019-03-19 14:26:38 -06:00
Danny Ryan be13fa8ec3
Merge branch 'dev' into JustinDrake-patch-14 2019-03-19 14:20:12 -06:00
Danny Ryan 574fd8d63c
Merge branch 'dev' into JustinDrake-patch-18 2019-03-19 14:14:35 -06:00
Danny Ryan 23ef802da5
fix small bug in sytax 2019-03-19 13:25:34 -06:00
Danny Ryan cf06cb59c3
Merge branch 'dev' into JustinDrake-patch-13 2019-03-19 12:40:58 -06:00
Danny Ryan 054a1e3126
Merge branch 'dev' into JustinDrake-patch-12 2019-03-19 12:25:50 -06:00
Danny Ryan bdfc01cf93
Merge branch 'dev' into JustinDrake-patch-11 2019-03-19 12:13:42 -06:00
Danny Ryan f7fab30772
minor adjustment to not repeat committe count calc 2019-03-19 11:40:24 -06:00
Danny Ryan f5826e7f1c
small lint 2019-03-19 11:34:49 -06:00
Danny Ryan c8e9073414
define get_split_offset and squash a couple of bugs 2019-03-19 11:24:36 -06:00
Danny Ryan 009563b2c3
fix a few bugs in testing compute_committee 2019-03-19 11:15:51 -06:00
Justin b50e148642
Update 0_beacon-chain.md 2019-03-19 17:13:25 +00:00
Danny Ryan 0737494694
Merge branch 'dev' into vbuterin-patch-16 2019-03-19 11:04:11 -06:00
vbuterin c5ee74d5e0
Justin fixes 2019-03-19 11:21:17 -05:00
vbuterin db92235d9e
Removed some no-longer-necessary functions 2019-03-19 09:34:37 -05:00
vbuterin dd39d25c86
Replace committee exponential backoff with max progress
Removes the mechanism that only rotates committees if blocks have been finalized and every shard has been crosslinked or at exponentially decreasing intervals, and replaces it with a rule that shard committees can only progress a maximum of 64 epochs at a time to preserve the invariant that maximum possible work required per epoch for a validator is O(1).
2019-03-19 09:32:06 -05:00
Justin 78f47f2069
Avoid underflow in voluntary exits 2019-03-19 12:23:17 +00:00
Justin e91036cfc9
Update 0_beacon-chain.md 2019-03-19 11:12:50 +00:00
Justin 0c383ce4a1
Update 0_beacon-chain.md 2019-03-19 11:11:18 +00:00
Justin 2b454d57f1
Update 0_beacon-chain.md 2019-03-19 11:08:17 +00:00
Justin dc4b652f72
Only slash active validators
This is to prevent a spam/DoS attack where validators with zero balance get "slashed" but no validator loses any balance.
2019-03-19 11:03:42 +00:00
Justin 0039613628
Simplify exit_validator
Minor cleanup
2019-03-18 19:08:41 +00:00
Justin d25c18b320
Update 0_beacon-chain.md 2019-03-17 11:48:47 +00:00
Hsiao-Wei Wang 6b82f5e999 Set `GENESIS_FORK_VERSION` to a `bytes4` constant (#792)
* Set `GENESIS_FORK_VERSION` to a `bytes4` constant

* Update 0_beacon-chain.md
2019-03-17 11:33:42 +00:00
vbuterin 506fdf4042 Added FixedSizeList wrappers (#777)
* Added FixedSizeList wrappers

Requires corresponding changes to the spec pythonizer.

* FixedSizeList -> Vector
2019-03-17 11:33:19 +00:00
Sören Steiger 65162e0371 Update 0_beacon-chain.md (#791) 2019-03-16 20:56:10 +00:00
Sören Steiger 919b99e0ae Add missing word (#788) 2019-03-16 12:46:45 +00:00
Justin e5ff0d59ad
Update 0_beacon-chain.md 2019-03-16 11:23:41 +00:00
Sören Steiger 6b118d2398 Add trailing comma (#789) 2019-03-16 12:16:47 +08:00
Justin 709e0df39f
Update 0_beacon-chain.md 2019-03-15 13:54:33 +00:00
Justin 1236e8e1fa
Update 0_beacon-chain.md 2019-03-15 13:53:24 +00:00
Justin 4b461838d2
`GENESIS_EPOCH - 1` for `previous_shuffling_epoch` and `previous_justified_epoch`
See item 26 in #675.
2019-03-15 13:32:24 +00:00
Justin e912ed7fca
Include recently slashed churn in churn queue
Addresses #527 in combination with #784.
2019-03-15 13:12:03 +00:00
Justin 4a8d748c55
Milder ejections
See item 22 in https://github.com/ethereum/eth2.0-specs/issues/675. Also partially addresses https://github.com/ethereum/eth2.0-specs/issues/527.
2019-03-15 13:05:46 +00:00
Justin d8d653dd94
Update 0_beacon-chain.md 2019-03-15 12:51:46 +00:00
Justin 96ab535704
Simplify and cleanup process_attestation
Improve readability and testability (by avoiding untriggerable `assert`). Fix #753.
2019-03-15 12:40:52 +00:00
Justin 58603f276e
Update 0_beacon-chain.md 2019-03-15 11:28:55 +00:00
Justin dac43eb564
Simplify deposits
Fix #760
2019-03-15 11:18:06 +00:00
Justin 4a5ef98813
Move to SHA256
SHA256 is de facto blockchain standard. Standardisation of the hash function is a prerequisite for [full standardisation of BLS12-381 signatures](https://github.com/ethereum/eth2.0-specs/issues/605). Blockchain projects are likely to provide a cheap SHA256 opcods/precompile, and unlikely to provide a Keccak256 equivelent. (Even WASM-enabled blockchains are likely to provide a SHA256 opcode/precompile since WASM does *not* natively support optimised SHA256 CPU instructions.) With Ethereum 2.0 embracing SHA256 the wider industry is more likely to converge towards a unified cross-blockchain communication scheme via Merkle receipts.

There are no security blockers with SHA256 (see comments by Dan Boneh [here](https://github.com/ethereum/eth2.0-specs/issues/612#issuecomment-470452562)).
2019-03-15 10:51:08 +00:00
Justin 68d1c74784
Update 0_beacon-chain.md 2019-03-15 09:45:20 +00:00
Justin 5d327b6364
Update 0_beacon-chain.md 2019-03-15 09:43:38 +00:00
Hsiao-Wei Wang 16123685af
Merge branch 'dev' into vbuterin-patch-3 2019-03-15 11:22:15 +08:00
vbuterin 24468de23b
Change get_shuffling to compute_committee
See #729 and #774 

The behavior now is that the first committee will consist of `get_permuted_index(0..n-1)`, the second committee `get_permuted_index(n....2n-1)`, etc.
2019-03-14 20:28:44 -05:00
Justin bbc5139115
Update 0_beacon-chain.md
Assuming `epoch % i` is a bug, and you meant `epoch + i`. @vbuterin
2019-03-14 19:01:32 +00:00
Justin 23d15f51a7
Update 0_beacon-chain.md 2019-03-14 18:57:17 +00:00
vbuterin 4442dfffb9
Fair proposer selection probability
Note that as a side effect, proposer selection becomes less predictable, but I don't feel like this is a large downside.
2019-03-13 21:42:49 -05:00
Alex Stokes 9774a3d581
Helper function returns correct type of `Gwei` instead of indices 2019-03-13 17:01:47 -07:00
Danny Ryan e8a5cd0747
fix up for tests 2019-03-12 12:32:11 -06:00
Danny Ryan 6e04b2118c
Merge branch 'dev' into store-justified-root 2019-03-12 12:08:59 -06:00
Danny Ryan acf0f76d60
Merge branch 'dev' into JustinDrake-patch-1 2019-03-12 11:48:05 -06:00
Danny Ryan a68b050053
set fork values in genesis as bytes4 2019-03-12 11:35:59 -06:00
Danny Ryan 7b829227ee
Merge branch 'dev' into JustinDrake-patch-4 2019-03-12 11:28:33 -06:00
Danny Ryan 25f6647ef2
minor formatting 2019-03-12 11:07:20 -06:00
Danny Ryan bdaba00a58
Merge branch 'dev' into JustinDrake-patch-7 2019-03-12 10:56:22 -06:00
Justin 0a349f8bdc
Update 0_beacon-chain.md 2019-03-12 15:58:31 +00:00
Hsiao-Wei Wang 0f120415b5
Update specs/core/0_beacon-chain.md
Co-Authored-By: JustinDrake <drakefjustin@gmail.com>
2019-03-12 16:49:04 +01:00
Justin d8a3048f2c
Update 0_beacon-chain.md 2019-03-12 12:36:09 +00:00
Justin 64ba3a3107
Epoch-based proposer slashing
See #675 item 25.
2019-03-12 12:24:37 +00:00
Justin 6c35934060
Update 0_beacon-chain.md 2019-03-12 10:34:24 +00:00
Justin addf7b77ab
Update 0_beacon-chain.md 2019-03-12 10:26:34 +00:00
Justin 578bf02b6f
Update 0_beacon-chain.md 2019-03-12 10:17:34 +00:00
Justin a7544864d5
Update 0_beacon-chain.md 2019-03-12 10:02:52 +00:00
vbuterin 4410a55c4d
Mandatory deposits
Resolves #675 point 5.
2019-03-11 23:30:08 -05:00
Danny Ryan 3916643ef6
only update justified epoch/root if changed 2019-03-11 18:23:17 -06:00
Justin 3459ea0838
Check proposer is not slashed 2019-03-11 22:07:34 +00:00
Danny Ryan f06a3b82e7
cache current and previous justified root in state 2019-03-11 14:38:10 -06:00
Danny Ryan bf6bdbb021
cleanup minor var errors 2019-03-11 12:38:11 -06:00
Danny Ryan 36efb4498f
Merge branch 'dev' into vbuterin-patch-3 2019-03-11 10:44:18 -06:00
Justin 0704297480
Update 0_beacon-chain.md 2019-03-11 17:28:39 +01:00
Danny Ryan 9c2d34d876
Merge branch 'dev' into min-time-to-exit 2019-03-11 09:45:39 -06:00
Danny Ryan 2c7c48a4e0
Merge pull request #751 from ethereum/JustinDrake-patch-8
Disallow duplicate voluntary exits
2019-03-11 09:09:53 -06:00
Justin 2d3d7e33b3
Weaken criterion for attestation inclusion
The invariant that `get_current_epoch(state) in [get_current_epoch(state), get_previous_epoch(state)]` is preserved, as well as symmetry/fairness across blocks.
2019-03-10 21:58:32 +01:00
Danny Ryan 641bfc2f2c
Merge pull request #744 from ethereum/empty-attestation-bug
minor execution bugs
2019-03-10 08:26:21 -06:00
Justin d425ea26e2
Update 0_beacon-chain.md 2019-03-10 13:50:28 +01:00
Justin b7376aea5c
Disallow duplicate voluntary exits
Stricter processing of voluntary exits to remove an edge case
2019-03-10 13:49:37 +01:00
Justin 02428ec252
Do not check withdrawal credentials for existing validators
We should not invalidate blocks that contain a deposit with an inconsistent withdrawal credential as that would stall the chain.
2019-03-10 13:25:57 +01:00
Danny Ryan 902e65e072
add min persistent committee period resitriction on exits 2019-03-08 15:16:06 -07:00
Danny Ryan 0f3e0ef2ad
Merge pull request #743 from ethereum/JustinDrake-patch-9
Minor cleanups
2019-03-08 14:59:39 -07:00
Danny Ryan 30e64d7de6
fix get_inactivity_penalty function signature 2019-03-08 12:14:21 -07:00
Danny Ryan f88db44e81
skip proposer bonus if no attestation for v index 2019-03-08 12:07:57 -07:00
Danny Ryan f72e856620
Merge branch 'dev' into JustinDrake-patch-7 2019-03-08 10:46:36 -07:00
Danny Ryan 29014d554e
Merge branch 'dev' into JustinDrake-patch-9 2019-03-08 10:39:26 -07:00
Justin f253feeacf
Update 0_beacon-chain.md 2019-03-08 18:34:51 +01:00
Justin f180eb5e9e
Update 0_beacon-chain.md 2019-03-08 18:14:00 +01:00
Justin de60533d72
Update 0_beacon-chain.md 2019-03-08 18:13:05 +01:00
Danny Ryan f081f23c31
cache more than just state root at start of state transition 2019-03-08 09:48:46 -07:00
Justin ecd93468a2
Update 0_beacon-chain.md 2019-03-08 17:38:19 +01:00
Justin 3aedf1226a
Update 0_beacon-chain.md
Did I get the type casting OK @hwwhww?
2019-03-08 17:36:58 +01:00
Justin 1141467349
Update 0_beacon-chain.md 2019-03-08 17:28:00 +01:00
Danny Ryan 9b598c91b7
Merge branch 'dev' into JustinDrake-patch-7 2019-03-08 09:10:08 -07:00
Danny Ryan 7dc61c6126
Merge branch 'dev' into epoch-start 2019-03-08 08:51:19 -07:00
Justin a51d7d5db5
Update 0_beacon-chain.md 2019-03-08 10:50:45 +01:00
Justin 12695425c9
Use hash_tree_root everywhere
And get rid of merkle_root. This is possible because of SSZ tuples.
2019-03-08 10:32:40 +01:00
vbuterin 8dcc1ba930 Break LMD GHOST ties in favor of higher hash tree roots (#737) 2019-03-08 09:58:38 +01:00
Justin 1f147486fc
Semantic fork versions and signature domains
Fix #706
2019-03-08 09:57:09 +01:00
Justin e74c79e353
Update 0_beacon-chain.md 2019-03-08 09:08:30 +01:00
Justin 33a05109ea
Fair proposer sampling
I think we want `first_committee[epoch % len(first_committee)]` as opposed to `first_committee[slot % len(first_committee)]`. The reason is that if the shuffling happens infrequently and `len(first_committee)` is a multiple of `SLOTS_PER_EPOCH` then the proposers will not be sampled fairly.

Taking this logic further, we may want to avoiding always picking the proposer from `first_committee`, e.g.:

```
    validators_at_slot = []
    for crosslink_committee, _ in get_crosslink_committees_at_slot(state, slot, registry_change):
        validators_at_slot.append(crosslink_committee)

    return validators_at_slot[epoch % len(validators_at_slot)]
```
2019-03-07 23:56:03 +01:00
Justin 339a7fb63b
Update 0_beacon-chain.md 2019-03-07 23:14:47 +01:00
Justin 2d9724dbfc
Update 0_beacon-chain.md 2019-03-07 23:13:06 +01:00
Danny Ryan e57bfaab7c
clean up state transition notes 2019-03-07 13:36:22 -07:00
Danny Ryan d00353534d
Merge branch 'dev' into epoch-start 2019-03-07 13:32:15 -07:00
Danny Ryan 6cf14884a8
epoch transition at start of epoch 2019-03-07 12:05:34 -07:00
Danny Ryan 8dec7d805c
reorder ssz types topologically 2019-03-07 11:02:13 -07:00
Hsiao-Wei Wang 250455a67e
Apply suggestions from code review
Co-Authored-By: djrtwo <dannyjryan@gmail.com>
2019-03-07 10:03:25 -07:00
Danny Ryan 987c741bea
fix state types 2019-03-07 09:44:55 -07:00
Danny Ryan b1baea2d28
Merge branch 'dev' into vbuterin-patch-7 2019-03-07 08:56:29 -07:00
vbuterin f9a07f7653
Fixed MIN_DEPOSIT_AMOUNT 2019-03-07 04:04:05 -06:00
vbuterin be4b912373
Added underflow checking to decrease_balance 2019-03-07 04:02:53 -06:00
vbuterin 0759e170a7
High/low balance separation
See #685 for reasoning
2019-03-07 01:38:03 -06:00
vbuterin ec12460b8b
Make wthdrawn validators immune to inactivity leak 2019-03-07 01:21:17 -06:00
vbuterin 663bc489b6
Added lexicographic tiebreaking 2019-03-06 22:54:52 -06:00
Danny Ryan 175dde7cf7
Merge branch 'dev' into patch-1 2019-03-06 15:56:35 -07:00
Danny Ryan 2f6e560e30
Merge branch 'dev' into vbuterin-patch-7 2019-03-06 15:07:20 -07:00
Alex Stokes ee2fbd0df7
Fix calls of `signed_root` 2019-03-06 13:48:06 -08:00
Dankrad Feist 81f48ea1c3 Also fix length of Deposit.proof 2019-03-06 21:11:50 +01:00
Dankrad Feist 9d175c9dc9 Merge branch 'dev' into patch-1 2019-03-06 17:28:09 +01:00
Carl Beekhuizen b4779cd83d
Apply suggestions from code review
Co-Authored-By: djrtwo <dannyjryan@gmail.com>
2019-03-06 08:55:39 -07:00
Carl Beekhuizen c9e06d31f3
Apply suggestions from code review
base_reward -> get_base_reward

Co-Authored-By: djrtwo <dannyjryan@gmail.com>
2019-03-06 07:29:06 -07:00
dankrad 776196e66d
Add tuple lengths
Adding tuple lengths in BeaconState objects (this changes merkleization/serialization as no length mixin required)
2019-03-06 14:46:52 +01:00
Danny Ryan b36e70040b
fix call to union 2019-03-05 16:18:41 -07:00
Danny Ryan b5f0509595
fix proposal slashing minor bugs 2019-03-05 11:29:40 -07:00
Danny Ryan be1cb4a850
Merge pull request #718 from ethereum/empty-base-reward
handle get_base_reward when no previous balance
2019-03-05 09:24:12 -07:00
Danny Ryan 0eacabc273
fix minor typo 2019-03-05 08:51:34 -07:00
Danny Ryan 99da6fe141
fix advance_slot ordering issue 2019-03-05 08:50:51 -07:00
Danny Ryan e2a0452108 fix previous root (#716) 2019-03-05 14:07:00 +01:00
Hsiao-Wei Wang ecb76420ec
`1e9` is float in Python, change it to `10**9`. 2019-03-05 17:30:42 +08:00
Danny Ryan d2f7fa9a7e
fix call to get_current_epoch 2019-03-04 19:09:31 -07:00
Danny Ryan bd936fa6ab
add missing return for justification/finalization reward deltas 2019-03-04 19:07:24 -07:00
Danny Ryan 02e8e89740
handle get_base_reward when no previous balance 2019-03-04 19:05:00 -07:00
Danny Ryan 0fdfbc473e
minor variable issues in helpers 2019-03-04 18:53:31 -07:00