Staterecovery part 13 blockhash fixes (#675)

staterecovery: fix blockHash opcode and improve performance of blob fetching from L1

---------

Signed-off-by: Pedro Novais <1478752+jpnovais@users.noreply.github.com>
Co-authored-by: Roman Vaseev <4833306+Filter94@users.noreply.github.com>
This commit is contained in:
Pedro Novais
2025-02-20 10:14:38 +00:00
committed by GitHub
parent eb0088a894
commit 3caceed6f6
238 changed files with 2256 additions and 1167 deletions

View File

@@ -269,8 +269,7 @@ contract OpcodeTester {
function storeRollingGlobalVariablesToState() private {
bytes memory fieldsToHashSection1 = abi.encode(
rollingBlockDetailComputations,
blockhash(block.number - 1),
blockhash(block.number),
parentBlocksHashes(),
block.basefee,
block.chainid,
block.coinbase,
@@ -291,4 +290,17 @@ contract OpcodeTester {
bytes.concat(bytes.concat(fieldsToHashSection1, fieldsToHashSection2), fieldsToHashSection3)
);
}
function parentBlocksHashes() private view returns (bytes32[] memory) {
uint256 endLookBack = 256;
if (block.number < 256) {
endLookBack = block.number;
}
bytes32[] memory blocksHashes = new bytes32[](endLookBack + 1);
for (uint256 i = 0; i <= endLookBack; i++) {
blocksHashes[i] = blockhash(block.number - i);
}
return blocksHashes;
}
}