Skip to content

Commit

Permalink
ReturnDataLoad is an EOF only operation (#7670)
Browse files Browse the repository at this point in the history
Update ReturnDataLoadOperation to fail when called from legacy.

Signed-off-by: Danno Ferrin <danno@numisight.com>
  • Loading branch information
shemnon authored Oct 3, 2024
1 parent 8cf20ed commit 63b9ec9
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static org.hyperledger.besu.evm.internal.Words.clampedToInt;

import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
Expand All @@ -37,6 +38,11 @@ public ReturnDataLoadOperation(final GasCalculator gasCalculator) {

@Override
public OperationResult execute(final MessageFrame frame, final EVM evm) {
Code code = frame.getCode();
if (code.getEofVersion() == 0) {
return InvalidOperation.INVALID_RESULT;
}

final int offset = clampedToInt(frame.popStackItem());
Bytes returnData = frame.getReturnData();
int retunDataSize = returnData.size();
Expand Down

0 comments on commit 63b9ec9

Please sign in to comment.