teku
teku copied to clipboard
Handle invalid blocks with no payload more smoothly
Description
After Bellatrix activates if Teku receives an Altair block it correctly refuses to import it but considers it an internal failure rather than an invalid block:
2022-08-04 22:26:01.899 | beaconchain-async-0 | ERROR | BlockImporter | Internal error while importing block: aa8201004942d3b246b51b1793ca5d5d49251c980d16c372f29cd65d4b3b6dd4 (3592325)
java.util.concurrent.CompletionException: java.util.NoSuchElementException: No value present
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1159) ~[?:?]
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?]
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147) ~[?:?]
at tech.pegasys.teku.dataproviders.generators.CachingTaskQueue.lambda$completePendingTask$9(CachingTaskQueue.java:199) ~[classes/:?]
at tech.pegasys.teku.infrastructure.async.SafeFuture.fromRunnable(SafeFuture.java:154) ~[classes/:?]
at tech.pegasys.teku.infrastructure.async.AsyncRunner.lambda$runAsync$0(AsyncRunner.java:23) ~[classes/:?]
at tech.pegasys.teku.infrastructure.async.SafeFuture.of(SafeFuture.java:73) ~[classes/:?]
at tech.pegasys.teku.infrastructure.async.ScheduledExecutorAsyncRunner.lambda$createRunnableForAction$1(ScheduledExecutorAsyncRunner.java:119) ~[classes/:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.util.NoSuchElementException: No value present
at java.util.Optional.orElseThrow(Optional.java:377) ~[?:?]
at tech.pegasys.teku.spec.logic.versions.bellatrix.block.BlockProcessorBellatrix.processBlock(BlockProcessorBellatrix.java:92) ~[classes/:?]
at tech.pegasys.teku.spec.logic.common.block.AbstractBlockProcessor.lambda$processUnsignedBlock$7(AbstractBlockProcessor.java:300) ~[classes/:?]
at tech.pegasys.teku.spec.datastructures.state.beaconstate.common.AbstractBeaconState.updated(AbstractBeaconState.java:64) ~[classes/:?]
at tech.pegasys.teku.spec.logic.common.block.AbstractBlockProcessor.processUnsignedBlock(AbstractBlockProcessor.java:298) ~[classes/:?]
at tech.pegasys.teku.spec.logic.common.block.AbstractBlockProcessor.processAndValidateBlock(AbstractBlockProcessor.java:158) ~[classes/:?]
at tech.pegasys.teku.spec.logic.common.block.AbstractBlockProcessor.processAndValidateBlock(AbstractBlockProcessor.java:133) ~[classes/:?]
at tech.pegasys.teku.statetransition.forkchoice.ForkChoice.onBlock(ForkChoice.java:270) ~[classes/:?]
at tech.pegasys.teku.statetransition.forkchoice.ForkChoice.lambda$onBlock$7(ForkChoice.java:231) ~[classes/:?]
at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ~[?:?]
... 10 more
The Altair block gossip channel is still active for an epoch or two after Bellatrix updates so we may receive Altair blocks that pass the initial network validation.
One good option may be to check at the network layer that the slot/epoch of the message is correct for the milestone the topic is for (I thought we already did but seems not...)