Skip to content

Commit

Permalink
Improve BLOCKHASH Short Circuit (#8171)
Browse files Browse the repository at this point in the history
* Improve BLOCKHASH Short Circuit
Signed-off-by: Danno Ferrin <[email protected]>
Co-authored-by: Justin Florentine <[email protected]>
  • Loading branch information
shemnon authored Jan 30, 2025
1 parent 98bed38 commit 6af23ea
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public OperationResult execute(final MessageFrame frame, final EVM evm) {
final long currentBlockNumber = blockValues.getNumber();
final BlockHashLookup blockHashLookup = frame.getBlockHashLookup();

// If the current block is the genesis block or the sought block is
// not within the lookback window, zero is returned.
if (currentBlockNumber == 0
// If the sought block is negative, a future block, the current block, or not in the
// lookback window, zero is returned.
if (soughtBlock < 0
|| soughtBlock >= currentBlockNumber
|| soughtBlock < (currentBlockNumber - blockHashLookup.getLookback())) {
frame.pushStackItem(Bytes32.ZERO);
Expand Down

0 comments on commit 6af23ea

Please sign in to comment.