From dd893219ef5c602ad02d0077e56d703cbdd893fa Mon Sep 17 00:00:00 2001 From: Karim Taam Date: Tue, 23 Apr 2024 18:30:27 +0200 Subject: [PATCH] clean gas cost modification Signed-off-by: Karim Taam --- .../main/java/org/hyperledger/besu/evm/EVM.java | 1 + .../besu/evm/operation/CodeSizeOperation.java | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/evm/src/main/java/org/hyperledger/besu/evm/EVM.java b/evm/src/main/java/org/hyperledger/besu/evm/EVM.java index 1b061e89c8..e42eb7f632 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/EVM.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/EVM.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 -> diff --git a/evm/src/main/java/org/hyperledger/besu/evm/operation/CodeSizeOperation.java b/evm/src/main/java/org/hyperledger/besu/evm/operation/CodeSizeOperation.java index 3c1d0de7df..8284b72ec5 100644 --- a/evm/src/main/java/org/hyperledger/besu/evm/operation/CodeSizeOperation.java +++ b/evm/src/main/java/org/hyperledger/besu/evm/operation/CodeSizeOperation.java @@ -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; } }