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

Fix Off By One Attestation Bug #1619

Merged
merged 26 commits into from
Feb 17, 2019
Merged
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e696c11
fixed epoch_processing
terencechain Feb 6, 2019
6af6231
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 7, 2019
034231c
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 8, 2019
bb42c8a
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 8, 2019
b03e09c
test p2p
terencechain Feb 8, 2019
1adeb3d
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 8, 2019
5572732
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 9, 2019
c298f74
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 9, 2019
37142e1
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 9, 2019
bb7ed7b
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 11, 2019
7600889
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 11, 2019
d2c6b5b
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 12, 2019
998387d
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 13, 2019
4853002
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 13, 2019
61b09ee
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 13, 2019
ea6daf3
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 14, 2019
536ab1d
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 14, 2019
974c2ed
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 14, 2019
d8f74b8
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 15, 2019
caf1c20
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 15, 2019
306769f
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 16, 2019
43def08
Merge branch 'master' of github.com:prysmaticlabs/prysm
terencechain Feb 16, 2019
902586c
fixed
terencechain Feb 16, 2019
f050428
Merge branch 'fix-off-by-one-attestation-issue-627' of github.com:pry…
terencechain Feb 16, 2019
9cfcd57
Merge branch 'master' into fix-off-by-one-attestation-issue-627
rauljordan Feb 16, 2019
e3e0c0c
Merge branch 'master' into fix-off-by-one-attestation-issue-627
rauljordan Feb 17, 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
12 changes: 6 additions & 6 deletions beacon-chain/core/blocks/block_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ func isSurroundVote(data1 *pb.AttestationData, data2 *pb.AttestationData) bool {
// For each attestation in block.body.attestations:
// Verify that attestation.data.slot <= state.slot - MIN_ATTESTATION_INCLUSION_DELAY <
// attestation.data.slot + EPOCH_LENGTH.
// Verify that attestation.data.justified_epoch is equal to state.justified_epoch
// if attestation.data.slot >= get_epoch_start_slot(get_current_epoch(state)) else state.previous_justified_epoch.
// Verify that `attestation.data.justified_epoch` is equal to `state.justified_epoch
// if slot_to_epoch(attestation.data.slot + 1) >= get_current_epoch(state) else state.previous_justified_epoch`.
// Verify that attestation.data.justified_block_root is equal to
// get_block_root(state, get_epoch_start_slot(attestation.data.justified_epoch)).
// Verify that either attestation.data.latest_crosslink_root or
Expand Down Expand Up @@ -400,10 +400,10 @@ func verifyAttestation(beaconState *pb.BeaconState, att *pb.Attestation, verifyS
beaconState.Slot,
)
}
// Verify that attestation.data.justified_epoch is equal to state.justified_epoch
// if attestation.data.slot >= get_epoch_start_slot(get_current_epoch(state))
// else state.previous_justified_epoch.
if att.Data.Slot >= helpers.StartSlot(helpers.SlotToEpoch(beaconState.Slot)) {
// Verify that `attestation.data.justified_epoch` is equal to `state.justified_epoch
// if slot_to_epoch(attestation.data.slot + 1) >= get_current_epoch(state)
// else state.previous_justified_epoch`.
if helpers.SlotToEpoch(att.Data.Slot+1) >= helpers.CurrentEpoch(beaconState) {
if att.Data.JustifiedEpoch != beaconState.JustifiedEpoch {
return fmt.Errorf(
"expected attestation.JustifiedEpoch == state.JustifiedEpoch, received %d == %d",
Expand Down