Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add previous and current crosslinks #874

Merged
merged 33 commits into from
Apr 18, 2019
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
529cf42
add previous and current crosslinks
djrtwo Apr 2, 2019
d8df789
simplify get_winning_root logic
djrtwo Apr 2, 2019
39b4ef3
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 3, 2019
1fa88fb
remove previous crosslink check from process_crosslinks
djrtwo Apr 3, 2019
d1af914
Update 0_beacon-chain.md
JustinDrake Apr 3, 2019
a790afa
Update 0_beacon-chain.md
JustinDrake Apr 4, 2019
3e6dc59
Update helpers.py
JustinDrake Apr 4, 2019
dc325f7
clean up a few things from PR
djrtwo Apr 5, 2019
f677af2
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 5, 2019
26df4f4
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 7, 2019
42dc003
add previous_crosslink_root and enforce crosslinks form a chain
djrtwo Apr 7, 2019
e246c3f
source_crosslink_root to previous_crosslink_root
djrtwo Apr 8, 2019
71a28aa
fix tests
djrtwo Apr 8, 2019
0a5a5b7
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 13, 2019
a6b3b11
ensure no reward for crosslinks taht can't form a chain
djrtwo Apr 13, 2019
9489ae5
upate validator guide to new crosslink format
djrtwo Apr 13, 2019
eafcab7
check crosslinks validity root against previous
djrtwo Apr 13, 2019
3555ab8
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 14, 2019
cc68df8
Merge branch 'dev' into prev-cur-crosslinks
hwwhww Apr 17, 2019
ef14396
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 17, 2019
8c5f7a5
Merge branch 'dev' into prev-cur-crosslinks
djrtwo Apr 18, 2019
fbaf771
Update 0_beacon-chain.md
JustinDrake Apr 18, 2019
9ecafb2
Update 0_beacon-chain.md
JustinDrake Apr 18, 2019
40b55cf
More fixes
JustinDrake Apr 18, 2019
cae5c22
Simplify get_crosslink_committee_for_attestation and move to test hel…
JustinDrake Apr 18, 2019
964b4d3
Fix `pyspec/tests/helpers.py`
hwwhww Apr 18, 2019
743193a
nitpicks
hwwhww Apr 18, 2019
4244db9
More cleanups
JustinDrake Apr 18, 2019
2e09f1a
Merge
JustinDrake Apr 18, 2019
172e106
merge
JustinDrake Apr 18, 2019
857d9b2
Merge branch 'dev' into prev-cur-crosslinks
JustinDrake Apr 18, 2019
7a01648
Moar
JustinDrake Apr 18, 2019
741a74a
re-add crosslink tests and ensure pass
djrtwo Apr 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions specs/core/0_beacon-chain.md
Original file line number Diff line number Diff line change
@@ -354,7 +354,7 @@ The types are defined topologically to aid in facilitating an executable version

# Crosslink vote
'shard': 'uint64',
'previous_crosslink': Crosslink,
'source_crosslink': Crosslink,
'crosslink_data_root': 'bytes32',
}
```
@@ -2325,27 +2325,26 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
Process ``Attestation`` operation.
Note that this function mutates ``state``.
"""
assert max(GENESIS_SLOT, state.slot - SLOTS_PER_EPOCH) <= attestation.data.slot
assert attestation.data.slot <= state.slot - MIN_ATTESTATION_INCLUSION_DELAY
data = attestation.data
assert max(GENESIS_SLOT, state.slot - SLOTS_PER_EPOCH) <= data.slot
assert data.slot <= state.slot - MIN_ATTESTATION_INCLUSION_DELAY

# Check target epoch, source epoch, and source root
target_epoch = slot_to_epoch(attestation.data.slot)
assert (target_epoch, attestation.data.source_epoch, attestation.data.source_root) in {
(get_current_epoch(state), state.current_justified_epoch, state.current_justified_root),
(get_previous_epoch(state), state.previous_justified_epoch, state.previous_justified_root),
# Check target epoch, source epoch, source root, and source crosslink
target_epoch = slot_to_epoch(data.slot)
assert (target_epoch, data.source_epoch, data.source_root, data.source_crosslink) in {
(get_current_epoch(state), state.current_justified_epoch, state.current_justified_root, state.current_crosslinks[data.shard]),
(get_previous_epoch(state), state.previous_justified_epoch, state.previous_justified_root, state.previous_crosslinks[data.shard]),
}

# Check crosslink data
assert attestation.data.crosslink_data_root == ZERO_HASH # [to be removed in phase 1]
crosslinks = state.current_crosslinks if slot_to_epoch(attestation.data.slot) == get_current_epoch(state) else state.previous_crosslinks
assert crosslinks[attestation.data.shard] == attestation.data.previous_crosslink
# Check crosslink data root
assert data.crosslink_data_root == ZERO_HASH # [to be removed in phase 1]

# Check signature and bitfields
assert verify_indexed_attestation(state, convert_to_indexed(state, attestation))

# Cache pending attestation
pending_attestation = PendingAttestation(
data=attestation.data,
data=data,
aggregation_bitfield=attestation.aggregation_bitfield,
custody_bitfield=attestation.custody_bitfield,
inclusion_slot=state.slot