|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|