|
|
@ -21,7 +21,7 @@ import org.hyperledger.besu.evm.gascalculator.GasCalculator; |
|
|
|
import org.hyperledger.besu.evm.internal.Words; |
|
|
|
import org.hyperledger.besu.evm.internal.Words; |
|
|
|
|
|
|
|
|
|
|
|
/** The Code size operation. */ |
|
|
|
/** The Code size operation. */ |
|
|
|
public class CodeSizeOperation extends AbstractOperation { |
|
|
|
public class CodeSizeOperation extends AbstractFixedCostOperation { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Instantiates a new Code size operation. |
|
|
|
* Instantiates a new Code size operation. |
|
|
@ -29,19 +29,15 @@ public class CodeSizeOperation extends AbstractOperation { |
|
|
|
* @param gasCalculator the gas calculator |
|
|
|
* @param gasCalculator the gas calculator |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public CodeSizeOperation(final GasCalculator gasCalculator) { |
|
|
|
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 |
|
|
|
@Override |
|
|
|
public Operation.OperationResult execute( |
|
|
|
public Operation.OperationResult executeFixedCostOperation( |
|
|
|
final MessageFrame frame, final EVM evm) { |
|
|
|
final MessageFrame frame, final EVM evm) { |
|
|
|
final Code code = frame.getCode(); |
|
|
|
final Code code = frame.getCode(); |
|
|
|
frame.pushStackItem(Words.intBytes(code.getSize())); |
|
|
|
frame.pushStackItem(Words.intBytes(code.getSize())); |
|
|
|
return new OperationResult(cost(frame),null); |
|
|
|
|
|
|
|
|
|
|
|
return successResponse; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|