Skip to content

Commit

Permalink
ReturnDataLoad is an EOF only operation
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 committed Sep 23, 2024
1 parent 0d63955 commit a174b9a
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 a174b9a

Please sign in to comment.