Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions AllTests-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ AllTests-mainnet
```diff
+ Don't re-download unviable blocks OK
+ Keep downloading parent chain even if we hit missing limit OK
+ No new missing/orphans while processing OK
+ Recursive missing parent OK
+ Unviable smoke test OK
```
Expand Down
5 changes: 3 additions & 2 deletions beacon_chain.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ license = "MIT or Apache License 2.0"

requires(
"nim == 2.2.4",
"https://github.com/status-im/NimYAML",
"bearssl",
"blscurve",
"chronicles",
Expand All @@ -28,6 +27,7 @@ requires(
"libbacktrace",
"libp2p",
"metrics",
"minilru",
"nat_traversal",
"nimcrypto",
"normalize",
Expand All @@ -41,11 +41,12 @@ requires(
"stint",
"taskpools",
"testutils",
"toml_serialization",
"unicodedb >= 0.10",
"unittest2",
"yaml",
"web3",
"zlib",
"toml_serialization",
"https://github.com/status-im/nim-kzg4844.git",
"zxcvbn"
)
Expand Down
22 changes: 13 additions & 9 deletions beacon_chain/consensus_object_pools/attestation_pool.nim
Original file line number Diff line number Diff line change
Expand Up @@ -953,19 +953,23 @@ proc getBeaconHead*(
proc selectOptimisticHead*(
pool: var AttestationPool, wallTime: BeaconTime): Opt[BeaconHead] =
## Trigger fork choice and returns the new head block.
let newHeadRoot = pool.forkChoice.get_head(pool.dag, wallTime)
if newHeadRoot.isErr:
error "Couldn't select head", err = newHeadRoot.error
return err()
let newHeadRoot = pool.forkChoice.get_head(pool.dag, wallTime).valueOr:
error "Couldn't select head", err = error
return Opt.none(BeaconHead)

let headBlock = pool.dag.getBlockRef(newHeadRoot.get()).valueOr:
let headBlock = pool.dag.getBlockRef(newHeadRoot).valueOr:
# This should normally not happen, but if the chain dag and fork choice
# get out of sync, we'll need to try to download the selected head - in
# the meantime, return nil to indicate that no new head was chosen
warn "Fork choice selected unknown head, trying to sync",
root = newHeadRoot.get()
pool.quarantine[].addMissing(newHeadRoot.get())
return err()

pool.quarantine[].addMissing(newHeadRoot).isOkOr:
# The newly selected head is unviable for some reason - the only way out
# here is that fork choice gets information about some other head
warn "Fork choice selected unviable head - cannot sync", newHeadRoot, err = error
return Opt.none(BeaconHead)

warn "Fork choice selected unknown head, trying to sync", newHeadRoot
return Opt.none(BeaconHead)

ok pool.getBeaconHead(headBlock)

Expand Down
7 changes: 1 addition & 6 deletions beacon_chain/consensus_object_pools/blob_quarantine.nim
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,6 @@ proc popSidecars*(
## If some of the blob sidecars are missing Opt.none() is returned.
## If block do not have any blob sidecars Opt.some([]) is returned.

when blck is gloas.SignedBeaconBlock:
quarantine.remove(blockRoot)
return Opt.some(default(seq[ref BlobSidecar]))

let sidecarsCount = len(blck.message.body.blob_kzg_commitments)
if sidecarsCount == 0:
# Block does not have any blob sidecars.
Expand Down Expand Up @@ -596,8 +592,7 @@ proc popSidecars*(

proc popSidecars*(
quarantine: var BlobQuarantine,
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock |
fulu.SignedBeaconBlock | gloas.SignedBeaconBlock
blck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock
): Opt[seq[ref BlobSidecar]] =
## Alias for `popSidecars()`.
popSidecars(quarantine, blck.root, blck)
Expand Down
Loading
Loading