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

relax BlockRef database assumptions #3472

Merged
merged 1 commit into from
Mar 11, 2022
Merged

relax BlockRef database assumptions #3472

merged 1 commit into from
Mar 11, 2022

Conversation

arnetheduck
Copy link
Member

  • remove getForkedBlock(BlockRef) which assumes block data exists but
    doesn't support archive/backfilled blocks
  • fix REST /eth/v1/beacon/headers request not returning
    archive/backfilled blocks
  • avoid re-encoding in REST block SSZ requests (using getBlockSSZ)

@github-actions
Copy link

github-actions bot commented Mar 7, 2022

Unit Test Results

     12 files  ±0     821 suites  ±0   30m 33s ⏱️ + 2m 44s
1 672 tests ±0  1 625 ✔️ ±0    47 💤 ±0  0 ±0 
9 759 runs  ±0  9 655 ✔️ ±0  104 💤 ±0  0 ±0 

Results for commit 07e2df4. ± Comparison against base commit aaa5a5a.

♻️ This comment has been updated with latest results.

@arnetheduck arnetheduck force-pushed the rm-gfbbr branch 3 times, most recently from daf4993 to 8df2abb Compare March 8, 2022 10:31
* remove `getForkedBlock(BlockRef)` which assumes block data exists but
doesn't support archive/backfilled blocks
* fix REST `/eth/v1/beacon/headers` request not returning
archive/backfilled blocks
* avoid re-encoding in REST block SSZ requests (using `getBlockSSZ`)
@@ -198,7 +198,7 @@ func toBlockSlotId*(bs: BlockSlot): BlockSlotId =

func isProposed*(bid: BlockId, slot: Slot): bool =
## Return true if `bid` was proposed in the given slot
bid.slot == slot
bid.slot == slot and not bid.root.isZero
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test for that? Or in which situation do we get a 0 block id (backfill?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zero is returned if the block is not found (should probably change that to Option at some point but .. ) - there were tests but they didn't cover zero

data.signature.toRaw() != signed_beacon_block.signature.toRaw():
return errIgnore("BeaconBlock: already proposed in the same slot")
let curBlock = dag.getForkedBlock(slotBlock.blck.bid)
if curBlock.isOk():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing happens if the curBlock is an error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing - we don't have the block so there's nothing to compare with (should typically not happen, except in weird timing scenarios)

@arnetheduck arnetheduck merged commit 4363215 into unstable Mar 11, 2022
@arnetheduck arnetheduck deleted the rm-gfbbr branch March 11, 2022 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants