clean gas cost modification

Signed-off-by: Karim Taam <karim.t2am@gmail.com>
pull/7004/head
Karim Taam 7 months ago committed by garyschulte
parent 229b867c95
commit dd893219ef
  1. 1
      evm/src/main/java/org/hyperledger/besu/evm/EVM.java
  2. 16
      evm/src/main/java/org/hyperledger/besu/evm/operation/CodeSizeOperation.java

@ -234,6 +234,7 @@ public class EVM {
case 0x19 -> NotOperation.staticOperation(frame);
case 0x1a -> ByteOperation.staticOperation(frame);
case 0x50 -> PopOperation.staticOperation(frame);
case 0x56 -> JumpOperation.staticOperation(frame);
case 0x57 -> JumpiOperation.staticOperation(frame);
case 0x5b -> JumpDestOperation.JUMPDEST_SUCCESS;
case 0x5f ->

@ -21,7 +21,7 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.Words;
/** The Code size operation. */
public class CodeSizeOperation extends AbstractOperation {
public class CodeSizeOperation extends AbstractFixedCostOperation {
/**
* Instantiates a new Code size operation.
@ -29,19 +29,15 @@ public class CodeSizeOperation extends AbstractOperation {
* @param gasCalculator the gas calculator
*/
public CodeSizeOperation(final GasCalculator gasCalculator) {
super(0x38, "CODESIZE", 0, 1, gasCalculator);
super(0x38, "CODESIZE", 0, 1, gasCalculator, gasCalculator.getBaseTierGasCost());
}
protected long cost(final MessageFrame frame) {
return gasCalculator().extCodeSizeOperationGasCost(frame);
}
@Override
public Operation.OperationResult execute(
final MessageFrame frame, final EVM evm) {
public Operation.OperationResult executeFixedCostOperation(
final MessageFrame frame, final EVM evm) {
final Code code = frame.getCode();
frame.pushStackItem(Words.intBytes(code.getSize()));
return new OperationResult(cost(frame),null);
return successResponse;
}
}

Loading…
Cancel
Save