mirror of
https://github.com/vacp2p/linea-monorepo.git
synced 2026-01-09 23:47:55 -05:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user