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

Mismatch between Finalized Block And Epoch #5827

Closed
nisdas opened this issue May 12, 2020 · 8 comments · Fixed by #7364
Closed

Mismatch between Finalized Block And Epoch #5827

nisdas opened this issue May 12, 2020 · 8 comments · Fixed by #7364
Assignees
Labels
Bug Something isn't working Priority: Medium Medium priority item

Comments

@nisdas
Copy link
Member

nisdas commented May 12, 2020

🐞 Bug Report

Description

Currently there is a mismatch between finalized epochs and their related blocks. The finalized
epoch does not exactly match the one provided by the slot in the block.

Has this worked before in a previous version?

Before #5811

🔬 Minimal Reproduction

Run the node and look at the handshake errors from it from other peers.

🔥 Error

[2020-05-12 20:19:13]  WARN sync: Failed to handle p2p RPC error=invalid epoch peer=16Uiu2HAmDstiv2UPX3pRgnTWuVgfoDZvkaUp7jbfoVi43nGsPt6P topic=/eth2/beacon_chain/req/status/1/ssz_snappy

What version of Prysm are you running? (Which release)

baf9ec6

@nisdas nisdas added Bug Something isn't working Priority: Medium Medium priority item labels May 12, 2020
@terencechain
Copy link
Member

This worries me. I wonder how it could happen

@nisdas
Copy link
Member Author

nisdas commented May 13, 2020

Yeah it is off in a few places,
Ex:

	if helpers.SlotToEpoch(blk.Block.Slot) != msg.FinalizedEpoch {
		return errInvalidEpoch
	}

is there anything wrong with doing this ? @terencechain . I feel like I might be missing something, I was looking at our code for indexing finalized blocks in the db, and it seems like there are quite a few gotchas on determining which block is finalized and for what epoch it is finalized.

@terencechain
Copy link
Member

terencechain commented May 13, 2020

@nisdas that won't work if there's skip slot. You have to account for skip slot scenario similar to this:

fBlkSlot := helpers.SlotToEpoch(blk.Block.Slot)
fEpochStartSlot := helpers.StartSlot(msg.FinalizedEpoch)
if fEpochStartSlot > fBlkSlot {
  filter := filters.NewFilter().SetStartSlot(fBlkSlot).SetEndSlot(fEpochStartSlot)
  blks, err := s.beaconDB.Blocks(ctx, filter)
  if len(blks) != empty {
     // Should be empty if skipped.
     return errInvalidEpoch
  }
}
...

Probably best to write a test for this

@rauljordan
Copy link
Contributor

Is this still an issue @terencechain and @nisdas ?

@rauljordan
Copy link
Contributor

Bump @terencechain @nisdas have we observed this since?

@nisdas
Copy link
Member Author

nisdas commented Aug 2, 2020

Still an issue @rauljordan , we still need to verify it.

@protolambda
Copy link

This is actually quite important, can someone take a look at this please?

@nisdas
Copy link
Member Author

nisdas commented Sep 28, 2020

@protolambda been on my todo list for too long, will take a look at it today. Thanks for the reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Priority: Medium Medium priority item
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants