fix: cache slot in check_block_relevancy to prevent TOCTOU (#8776)

Co-Authored-By: radik878 <radikpadik76@gmail.com>
This commit is contained in:
radik878
2026-02-12 01:45:50 +02:00
committed by GitHub
parent d7c78a7f89
commit 711971f269

View File

@@ -1798,10 +1798,12 @@ pub fn check_block_relevancy<T: BeaconChainTypes>(
) -> Result<Hash256, BlockError> {
let block = signed_block.message();
let present_slot = chain.slot()?;
// Do not process blocks from the future.
if block.slot() > chain.slot()? {
if block.slot() > present_slot {
return Err(BlockError::FutureSlot {
present_slot: chain.slot()?,
present_slot,
block_slot: block.slot(),
});
}