Add EXTCODE* unit Tests (#7374)

Add unit tests to the EXTCODE* series operations.
Also, put all EVM operations tests in the proper package.

Signed-off-by: Danno Ferrin <danno@numisight.com>
pull/7380/head
Danno Ferrin 4 months ago committed by GitHub
parent e68a6c6a52
commit e57c811e47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      evm/src/main/java/org/hyperledger/besu/evm/MainnetEVMs.java
  2. 18
      evm/src/main/java/org/hyperledger/besu/evm/operation/ExtCodeCopyOperation.java
  3. 18
      evm/src/main/java/org/hyperledger/besu/evm/operation/ExtCodeHashOperation.java
  4. 18
      evm/src/main/java/org/hyperledger/besu/evm/operation/ExtCodeSizeOperation.java
  5. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/BaseFeeOperationTest.java
  6. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/BlobHashOperationTest.java
  7. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/BlockHashOperationTest.java
  8. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/CallFOperationTest.java
  9. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/ChainIdOperationTest.java
  10. 2
      evm/src/test/java/org/hyperledger/besu/evm/operation/ConstantinopleSStoreOperationGasCostTest.java
  11. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/Create2OperationTest.java
  12. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/CreateOperationTest.java
  13. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/DataCopyOperationTest.java
  14. 2
      evm/src/test/java/org/hyperledger/besu/evm/operation/EofCreateOperationTest.java
  15. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCallOperationTest.java
  16. 245
      evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCodeCopyOperationTest.java
  17. 54
      evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCodeHashOperationTest.java
  18. 183
      evm/src/test/java/org/hyperledger/besu/evm/operation/ExtCodeSizeOperationTest.java
  19. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/ExtDelegateCallOperationTest.java
  20. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/ExtStaticCallOperationTest.java
  21. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/JumpFOperationTest.java
  22. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/JumpOperationTest.java
  23. 2
      evm/src/test/java/org/hyperledger/besu/evm/operation/LondonSStoreOperationGasCostTest.java
  24. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/MCopyOperationTest.java
  25. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/PrevRanDaoOperationTest.java
  26. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/Push0OperationTest.java
  27. 6
      evm/src/test/java/org/hyperledger/besu/evm/operation/RelativeJumpOperationTest.java
  28. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/RetFOperationTest.java
  29. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/RevertOperationTest.java
  30. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/SStoreOperationTest.java
  31. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/SarOperationTest.java
  32. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/SelfDestructOperationTest.java
  33. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/ShlOperationTest.java
  34. 3
      evm/src/test/java/org/hyperledger/besu/evm/operation/ShrOperationTest.java
  35. 4
      evm/src/test/java/org/hyperledger/besu/evm/operation/TStoreOperationTest.java

@ -240,8 +240,8 @@ public class MainnetEVMs {
registry.put(new CodeSizeOperation(gasCalculator));
registry.put(new CodeCopyOperation(gasCalculator));
registry.put(new GasPriceOperation(gasCalculator));
registry.put(new ExtCodeCopyOperation(gasCalculator));
registry.put(new ExtCodeSizeOperation(gasCalculator));
registry.put(new ExtCodeCopyOperation(gasCalculator, false));
registry.put(new ExtCodeSizeOperation(gasCalculator, false));
registry.put(new BlockHashOperation(gasCalculator));
registry.put(new CoinbaseOperation(gasCalculator));
registry.put(new TimestampOperation(gasCalculator));
@ -478,7 +478,7 @@ public class MainnetEVMs {
registry.put(new SarOperation(gasCalculator));
registry.put(new ShlOperation(gasCalculator));
registry.put(new ShrOperation(gasCalculator));
registry.put(new ExtCodeHashOperation(gasCalculator));
registry.put(new ExtCodeHashOperation(gasCalculator, false));
}
/**
@ -1114,6 +1114,11 @@ public class MainnetEVMs {
registry.put(new SwapNOperation(gasCalculator));
registry.put(new ExchangeOperation(gasCalculator));
// EIP-3540 EOF Aware EXTCODE* operations
registry.put(new ExtCodeCopyOperation(gasCalculator, true));
registry.put(new ExtCodeHashOperation(gasCalculator, true));
registry.put(new ExtCodeSizeOperation(gasCalculator, true));
// EIP-4200 relative jump
registry.put(new RelativeJumpOperation(gasCalculator));
registry.put(new RelativeJumpIfOperation(gasCalculator));

@ -34,13 +34,26 @@ public class ExtCodeCopyOperation extends AbstractOperation {
/** This is the "code" legacy contracts see when copying code from an EOF contract. */
public static final Bytes EOF_REPLACEMENT_CODE = Bytes.fromHexString("0xef00");
private final boolean enableEIP3540;
/**
* Instantiates a new Ext code copy operation.
*
* @param gasCalculator the gas calculator
*/
public ExtCodeCopyOperation(final GasCalculator gasCalculator) {
this(gasCalculator, false);
}
/**
* Instantiates a new Ext code copy operation.
*
* @param gasCalculator the gas calculator
* @param enableEIP3540 enable EIP-3540 semantics (don't copy EOF)
*/
public ExtCodeCopyOperation(final GasCalculator gasCalculator, final boolean enableEIP3540) {
super(0x3C, "EXTCODECOPY", 4, 0, gasCalculator);
this.enableEIP3540 = enableEIP3540;
}
/**
@ -82,7 +95,10 @@ public class ExtCodeCopyOperation extends AbstractOperation {
final Account account = frame.getWorldUpdater().get(address);
final Bytes code = account != null ? account.getCode() : Bytes.EMPTY;
if (code.size() >= 2 && code.get(0) == EOFLayout.EOF_PREFIX_BYTE && code.get(1) == 0) {
if (enableEIP3540
&& code.size() >= 2
&& code.get(0) == EOFLayout.EOF_PREFIX_BYTE
&& code.get(1) == 0) {
frame.writeMemory(memOffset, sourceOffset, numBytes, EOF_REPLACEMENT_CODE);
} else {
frame.writeMemory(memOffset, sourceOffset, numBytes, code);

@ -34,13 +34,26 @@ public class ExtCodeHashOperation extends AbstractOperation {
// // 0x9dbf3648db8210552e9c4f75c6a1c3057c0ca432043bd648be15fe7be05646f5
static final Hash EOF_REPLACEMENT_HASH = Hash.hash(ExtCodeCopyOperation.EOF_REPLACEMENT_CODE);
private final boolean enableEIP3540;
/**
* Instantiates a new Ext code hash operation.
*
* @param gasCalculator the gas calculator
*/
public ExtCodeHashOperation(final GasCalculator gasCalculator) {
this(gasCalculator, false);
}
/**
* Instantiates a new Ext code copy operation.
*
* @param gasCalculator the gas calculator
* @param enableEIP3540 enable EIP-3540 semantics (don't copy EOF)
*/
public ExtCodeHashOperation(final GasCalculator gasCalculator, final boolean enableEIP3540) {
super(0x3F, "EXTCODEHASH", 1, 1, gasCalculator);
this.enableEIP3540 = enableEIP3540;
}
/**
@ -71,7 +84,10 @@ public class ExtCodeHashOperation extends AbstractOperation {
frame.pushStackItem(Bytes.EMPTY);
} else {
final Bytes code = account.getCode();
if (code.size() >= 2 && code.get(0) == EOFLayout.EOF_PREFIX_BYTE && code.get(1) == 0) {
if (enableEIP3540
&& code.size() >= 2
&& code.get(0) == EOFLayout.EOF_PREFIX_BYTE
&& code.get(1) == 0) {
frame.pushStackItem(EOF_REPLACEMENT_HASH);
} else {
frame.pushStackItem(account.getCodeHash());

@ -32,13 +32,26 @@ public class ExtCodeSizeOperation extends AbstractOperation {
static final Bytes EOF_SIZE = Bytes.of(2);
private final boolean enableEIP3540;
/**
* Instantiates a new Ext code size operation.
*
* @param gasCalculator the gas calculator
*/
public ExtCodeSizeOperation(final GasCalculator gasCalculator) {
this(gasCalculator, false);
}
/**
* Instantiates a new Ext code size operation.
*
* @param gasCalculator the gas calculator
* @param enableEIP3540 enable EIP-3540 semantics (EOF is size 2)
*/
public ExtCodeSizeOperation(final GasCalculator gasCalculator, final boolean enableEIP3540) {
super(0x3B, "EXTCODESIZE", 1, 1, gasCalculator);
this.enableEIP3540 = enableEIP3540;
}
/**
@ -70,7 +83,10 @@ public class ExtCodeSizeOperation extends AbstractOperation {
codeSize = Bytes.EMPTY;
} else {
final Bytes code = account.getCode();
if (code.size() >= 2 && code.get(0) == EOFLayout.EOF_PREFIX_BYTE && code.get(1) == 0) {
if (enableEIP3540
&& code.size() >= 2
&& code.get(0) == EOFLayout.EOF_PREFIX_BYTE
&& code.get(1) == 0) {
codeSize = EOF_SIZE;
} else {
codeSize = Words.intBytes(code.size());

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -26,8 +26,6 @@ import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.operation.BaseFeeOperation;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import java.util.Optional;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -25,8 +25,6 @@ import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.CancunGasCalculator;
import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator;
import org.hyperledger.besu.evm.operation.BlobHashOperation;
import org.hyperledger.besu.evm.operation.Operation;
import java.util.ArrayList;
import java.util.Arrays;

@ -12,14 +12,13 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator;
import org.hyperledger.besu.evm.operation.BlockHashOperation;
import org.hyperledger.besu.evm.operation.BlockHashOperation.BlockHashLookup;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.testutils.OperationsTestUtils.mockCode;
@ -24,8 +24,6 @@ import org.hyperledger.besu.evm.code.CodeSection;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.ReturnStack;
import org.hyperledger.besu.evm.operation.CallFOperation;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.apache.tuweni.bytes.Bytes;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -20,7 +20,6 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.operation.ChainIdOperation;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import java.util.List;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.MainnetEVMs.DEV_NET_CHAIN_ID;
@ -35,7 +35,6 @@ import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.log.Log;
import org.hyperledger.besu.evm.operation.Create2Operation;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.processor.ContractCreationProcessor;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.MainnetEVMs.DEV_NET_CHAIN_ID;
@ -34,7 +34,6 @@ import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.log.Log;
import org.hyperledger.besu.evm.operation.CreateOperation;
import org.hyperledger.besu.evm.processor.ContractCreationProcessor;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.tracing.OperationTracer;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
@ -24,8 +24,6 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.operation.DataCopyOperation;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import java.util.Arrays;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.fail;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@ -29,8 +29,6 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.operation.AbstractExtCallOperation;
import org.hyperledger.besu.evm.operation.ExtCallOperation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;

@ -0,0 +1,245 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.toy.ToyWorld;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
import java.util.Arrays;
import java.util.Collection;
import org.apache.tuweni.bytes.Bytes;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
class ExtCodeCopyOperationTest {
private static final Address REQUESTED_ADDRESS = Address.fromHexString("0x22222222");
private final ToyWorld toyWorld = new ToyWorld();
private final WorldUpdater worldStateUpdater = toyWorld.updater();
@Mock EVM evm;
static Collection<Object[]> extCodeCopyTestVector() {
return Arrays.asList(
new Object[][] {
{
"Copy after, no overlap",
Bytes.fromHexString("0123456789abcdef000000000000000000000000000000000000000000000000"),
32,
0,
8,
Bytes.fromHexString(
"00000000000000000000000000000000000000000000000000000000000000000123456789abcdef"),
false,
2609L
},
{
"copy from uninitialized memory",
Bytes.EMPTY,
0,
24,
16,
Bytes.fromHexString(
"0x000000000000000000000000000000000000000000000000000000000000000000"),
false,
2606L
},
{
"copy from initialized + uninitialized memory",
Bytes.fromHexString(
"0x0000000000000000000000000000000000000000000000000123456789abcdef"),
64,
24,
16,
Bytes.fromHexString(
"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456789abcdef000000000000000000000000000000000000000000000000"),
false,
2612L
},
{
"overlapping src < dst",
Bytes.fromHexString(
"0x0123456789abcdef000000000000000000000000000000000000000000000000"),
4,
0,
8,
Bytes.fromHexString(
"0x000000000123456789abcdef0000000000000000000000000000000000000000"),
false,
2606L
},
{
"overlapping src > dst",
Bytes.fromHexString(
"0x00112233445566778899aabbccddeeff00000000000000000000000000000000"),
0,
4,
8,
Bytes.fromHexString(
"0x445566778899aabb000000000000000000000000000000000000000000000000"),
false,
2606L
},
{
"overlapping src == dst",
Bytes.fromHexString(
"0x00112233445566778899aabbccddeeff00000000000000000000000000000000"),
4,
4,
8,
Bytes.fromHexString(
"0x00000000445566778899aabb0000000000000000000000000000000000000000"),
false,
2606L
},
{
"EOF-reserved pre-eof",
Bytes.fromHexString("0xEF009f918bf09f9fa9"),
0,
0,
9,
Bytes.fromHexString("0xEF009f918bf09f9fa9"),
false,
2606L
},
{
"EOF-reserved post-epf",
Bytes.fromHexString("0xEF009f918bf09f9fa9"),
0,
0,
9,
Bytes.fromHexString("0xEF000000000000000000"),
true,
2606L
},
{
"EF-reserved pre-epf",
Bytes.fromHexString("0xEFF09f918bf09f9fa9"),
0,
0,
9,
Bytes.fromHexString("0xEFF09f918bf09f9fa9"),
false,
2606L
},
{
"EOF-reserved post-eof",
Bytes.fromHexString("0xEFF09f918bf09f9fa9"),
0,
0,
9,
Bytes.fromHexString("0xEFF09f918bf09f9fa9"),
true,
2606L
}
});
}
@SuppressWarnings("unused")
@ParameterizedTest(name = "{0}")
@MethodSource("extCodeCopyTestVector")
void testExtCodeCopy(
final String name,
final Bytes code,
final long dst,
final long src,
final long len,
final Bytes expected,
final boolean eof,
final long gasCost) {
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
ExtCodeCopyOperation subject = new ExtCodeCopyOperation(new PragueGasCalculator(), eof);
MessageFrame frame =
new TestMessageFrameBuilder()
.worldUpdater(worldStateUpdater)
.pushStackItem(Bytes.ofUnsignedLong(len))
.pushStackItem(Bytes.ofUnsignedLong(src))
.pushStackItem(Bytes.ofUnsignedLong(dst))
.pushStackItem(REQUESTED_ADDRESS)
.build();
Operation.OperationResult result = subject.execute(frame, evm);
assertThat(frame.readMemory(0, expected.size())).isEqualTo(expected);
assertThat(frame.memoryWordSize()).isEqualTo((expected.size() + 31) / 32);
assertThat(result.getGasCost()).isEqualTo(gasCost);
}
@Test
void testExtCodeCopyCold() {
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
Bytes code = Bytes.fromHexString("0xEFF09f918bf09f9fa9");
account.setCode(code);
ExtCodeCopyOperation subject = new ExtCodeCopyOperation(new PragueGasCalculator(), false);
MessageFrame frame =
new TestMessageFrameBuilder()
.worldUpdater(worldStateUpdater)
.pushStackItem(Bytes.ofUnsignedLong(9))
.pushStackItem(Bytes.ofUnsignedLong(0))
.pushStackItem(Bytes.ofUnsignedLong(0))
.pushStackItem(REQUESTED_ADDRESS)
.build();
frame.warmUpAddress(REQUESTED_ADDRESS);
Operation.OperationResult result = subject.execute(frame, evm);
assertThat(frame.readMemory(0, 9)).isEqualTo(code);
assertThat(frame.memoryWordSize()).isEqualTo(1);
assertThat(result.getGasCost()).isEqualTo(106);
}
@Test
void testExtCodeEOFDirtyMemory() {
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
Bytes code = Bytes.fromHexString("0xEF009f918bf09f9fa9");
account.setCode(code);
ExtCodeCopyOperation subject = new ExtCodeCopyOperation(new PragueGasCalculator(), true);
MessageFrame frame =
new TestMessageFrameBuilder()
.worldUpdater(worldStateUpdater)
.pushStackItem(Bytes.ofUnsignedLong(9))
.pushStackItem(Bytes.ofUnsignedLong(0))
.pushStackItem(Bytes.ofUnsignedLong(0))
.pushStackItem(REQUESTED_ADDRESS)
.build();
frame.writeMemory(0, 15, Bytes.fromHexString("0x112233445566778899aabbccddeeff"));
Operation.OperationResult result = subject.execute(frame, evm);
assertThat(frame.readMemory(0, 16))
.isEqualTo(Bytes.fromHexString("0xEF0000000000000000aabbccddeeff00"));
assertThat(frame.memoryWordSize()).isEqualTo(1);
assertThat(result.getGasCost()).isEqualTo(2603);
}
}

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
@ -24,8 +24,8 @@ import org.hyperledger.besu.evm.frame.BlockValues;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator;
import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.operation.ExtCodeHashOperation;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
@ -44,9 +44,11 @@ class ExtCodeHashOperationTest {
private final WorldUpdater worldStateUpdater = toyWorld.updater();
private final ExtCodeHashOperation operation =
new ExtCodeHashOperation(new ConstantinopleGasCalculator());
new ExtCodeHashOperation(new ConstantinopleGasCalculator(), false);
private final ExtCodeHashOperation operationIstanbul =
new ExtCodeHashOperation(new IstanbulGasCalculator());
new ExtCodeHashOperation(new IstanbulGasCalculator(), false);
private final ExtCodeHashOperation operationEOF =
new ExtCodeHashOperation(new PragueGasCalculator(), true);
@Test
void shouldCharge400Gas() {
@ -113,6 +115,50 @@ class ExtCodeHashOperationTest {
assertThat(frame.getStackItem(0)).isEqualTo(Hash.hash(code));
}
@Test
void shouldGetNonEOFHash() {
final Bytes code = Bytes.fromHexString("0xEFF09f918bf09f9fa9");
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
final UInt256 value =
UInt256.fromBytes(Words.fromAddress(REQUESTED_ADDRESS))
.add(UInt256.valueOf(2).pow(UInt256.valueOf(160)));
final MessageFrame frame = createMessageFrame(value);
operation.execute(frame, null);
assertThat(frame.getStackItem(0)).isEqualTo(Hash.hash(code));
final MessageFrame frameIstanbul = createMessageFrame(value);
operationIstanbul.execute(frameIstanbul, null);
assertThat(frameIstanbul.getStackItem(0)).isEqualTo(Hash.hash(code));
final MessageFrame frameEOF = createMessageFrame(value);
operationEOF.execute(frameEOF, null);
assertThat(frameEOF.getStackItem(0)).isEqualTo(Hash.hash(code));
}
@Test
void shouldGetEOFHash() {
final Bytes code = Bytes.fromHexString("0xEF009f918bf09f9fa9");
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
final UInt256 value =
UInt256.fromBytes(Words.fromAddress(REQUESTED_ADDRESS))
.add(UInt256.valueOf(2).pow(UInt256.valueOf(160)));
final MessageFrame frame = createMessageFrame(value);
operation.execute(frame, null);
assertThat(frame.getStackItem(0)).isEqualTo(Hash.hash(code));
final MessageFrame frameIstanbul = createMessageFrame(value);
operationIstanbul.execute(frameIstanbul, null);
assertThat(frameIstanbul.getStackItem(0)).isEqualTo(Hash.hash(code));
final MessageFrame frameEOF = createMessageFrame(value);
operationEOF.execute(frameEOF, null);
assertThat(frameEOF.getStackItem(0)).isEqualTo(Hash.hash(Bytes.fromHexString("0xef00")));
}
private Bytes executeOperation(final Address requestedAddress) {
final MessageFrame frame = createMessageFrame(requestedAddress);
operation.execute(frame, null);

@ -0,0 +1,183 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.frame.BlockValues;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator;
import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.toy.ToyWorld;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256;
import org.junit.jupiter.api.Test;
class ExtCodeSizeOperationTest {
private static final Address REQUESTED_ADDRESS = Address.fromHexString("0x22222222");
private final ToyWorld toyWorld = new ToyWorld();
private final WorldUpdater worldStateUpdater = toyWorld.updater();
private final ExtCodeSizeOperation operation =
new ExtCodeSizeOperation(new ConstantinopleGasCalculator(), false);
private final ExtCodeSizeOperation operationIstanbul =
new ExtCodeSizeOperation(new IstanbulGasCalculator(), false);
private final ExtCodeSizeOperation operationEOF =
new ExtCodeSizeOperation(new PragueGasCalculator(), true);
@Test
void shouldCharge700Gas() {
final OperationResult result = operation.execute(createMessageFrame(REQUESTED_ADDRESS), null);
assertThat(result.getGasCost()).isEqualTo(700L);
}
@Test
void istanbulShouldCharge700Gas() {
final OperationResult result =
operationIstanbul.execute(createMessageFrame(REQUESTED_ADDRESS), null);
assertThat(result.getGasCost()).isEqualTo(700L);
}
@Test
void shouldReturnZeroWhenAccountDoesNotExist() {
final Bytes result = executeOperation(REQUESTED_ADDRESS);
assertThat(result.trimLeadingZeros()).isEqualTo(Bytes.EMPTY);
}
@Test
void shouldReturnSizeOfEmptyDataWhenAccountExistsButDoesNotHaveCode() {
worldStateUpdater.getOrCreate(REQUESTED_ADDRESS).setBalance(Wei.of(1));
assertThat(executeOperation(REQUESTED_ADDRESS).toInt()).isZero();
}
@Test
void shouldReturnZeroWhenAccountExistsButIsEmpty() {
worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
assertThat(executeOperation(REQUESTED_ADDRESS).trimLeadingZeros()).isEqualTo(Bytes.EMPTY);
}
@Test
void shouldReturnZeroWhenPrecompiledContractHasNoBalance() {
assertThat(executeOperation(Address.ECREC).trimLeadingZeros()).isEqualTo(Bytes.EMPTY);
}
@Test
void shouldReturnEmptyCodeSizeWhenPrecompileHasBalance() {
// Sending money to a precompile causes it to exist in the world state archive.
worldStateUpdater.getOrCreate(Address.ECREC).setBalance(Wei.of(10));
assertThat(executeOperation(Address.ECREC).toInt()).isZero();
}
@Test
void shouldGetSizeOfAccountCodeWhenCodeIsPresent() {
final Bytes code = Bytes.fromHexString("0xabcdef");
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
assertThat(executeOperation(REQUESTED_ADDRESS).toInt()).isEqualTo(3);
}
@Test
void shouldZeroOutLeftMostBitsToGetAddress() {
// If EXTCODESIZE of A is X, then EXTCODESIZE of A + 2**160 is X.
final Bytes code = Bytes.fromHexString("0xabcdef");
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
final UInt256 value =
UInt256.fromBytes(Words.fromAddress(REQUESTED_ADDRESS))
.add(UInt256.valueOf(2).pow(UInt256.valueOf(160)));
final MessageFrame frame = createMessageFrame(value);
operation.execute(frame, null);
assertThat(frame.getStackItem(0).toInt()).isEqualTo(3);
}
@Test
void shouldGetNonEOFSize() {
final Bytes code = Bytes.fromHexString("0xEFF09f918bf09f9fa9");
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
final UInt256 value =
UInt256.fromBytes(Words.fromAddress(REQUESTED_ADDRESS))
.add(UInt256.valueOf(2).pow(UInt256.valueOf(160)));
final MessageFrame frame = createMessageFrame(value);
operation.execute(frame, null);
assertThat(frame.getStackItem(0).toInt()).isEqualTo(9);
final MessageFrame frameIstanbul = createMessageFrame(value);
operationIstanbul.execute(frameIstanbul, null);
assertThat(frame.getStackItem(0).toInt()).isEqualTo(9);
final MessageFrame frameEOF = createMessageFrame(value);
operationEOF.execute(frameEOF, null);
assertThat(frame.getStackItem(0).toInt()).isEqualTo(9);
}
@Test
void shouldGetEOFSize() {
final Bytes code = Bytes.fromHexString("0xEF009f918bf09f9fa9");
final MutableAccount account = worldStateUpdater.getOrCreate(REQUESTED_ADDRESS);
account.setCode(code);
final UInt256 value =
UInt256.fromBytes(Words.fromAddress(REQUESTED_ADDRESS))
.add(UInt256.valueOf(2).pow(UInt256.valueOf(160)));
final MessageFrame frame = createMessageFrame(value);
operation.execute(frame, null);
assertThat(frame.getStackItem(0).toInt()).isEqualTo(9);
final MessageFrame frameIstanbul = createMessageFrame(value);
operationIstanbul.execute(frameIstanbul, null);
assertThat(frameIstanbul.getStackItem(0).toInt()).isEqualTo(9);
final MessageFrame frameEOF = createMessageFrame(value);
operationEOF.execute(frameEOF, null);
assertThat(frameEOF.getStackItem(0).toInt()).isEqualTo(2);
}
private Bytes executeOperation(final Address requestedAddress) {
final MessageFrame frame = createMessageFrame(requestedAddress);
operation.execute(frame, null);
return frame.getStackItem(0);
}
private MessageFrame createMessageFrame(final Address requestedAddress) {
final UInt256 stackItem = Words.fromAddress(requestedAddress);
return createMessageFrame(stackItem);
}
private MessageFrame createMessageFrame(final UInt256 stackItem) {
final BlockValues blockValues = new FakeBlockValues(1337);
final MessageFrame frame =
new TestMessageFrameBuilder()
.worldUpdater(worldStateUpdater)
.blockValues(blockValues)
.build();
frame.pushStackItem(stackItem);
return frame;
}
}

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@ -29,8 +29,6 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.operation.AbstractExtCallOperation;
import org.hyperledger.besu.evm.operation.ExtDelegateCallOperation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@ -29,8 +29,6 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.PragueEOFGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.operation.AbstractExtCallOperation;
import org.hyperledger.besu.evm.operation.ExtStaticCallOperation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.testutils.OperationsTestUtils.mockCode;
@ -23,8 +23,6 @@ import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.code.CodeSection;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.operation.JumpFOperation;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.apache.tuweni.bytes.Bytes;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
@ -24,7 +24,6 @@ import org.hyperledger.besu.evm.frame.ExceptionalHaltReason;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.operation.JumpOperation;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;

@ -12,15 +12,13 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.CancunGasCalculator;
import org.hyperledger.besu.evm.operation.MCopyOperation;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import java.util.Arrays;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -23,8 +23,6 @@ import org.hyperledger.besu.evm.EVM;
import org.hyperledger.besu.evm.frame.BlockValues;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.PrevRanDaoOperation;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -24,9 +24,7 @@ import org.hyperledger.besu.evm.frame.BlockValues;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.operation.Push0Operation;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import java.util.Optional;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.testutils.OperationsTestUtils.mockCode;
@ -23,10 +23,6 @@ import org.hyperledger.besu.evm.Code;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.RelativeJumpIfOperation;
import org.hyperledger.besu.evm.operation.RelativeJumpOperation;
import org.hyperledger.besu.evm.operation.RelativeJumpVectorOperation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.apache.tuweni.bytes.Bytes;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.testutils.OperationsTestUtils.mockCode;
@ -24,8 +24,6 @@ import org.hyperledger.besu.evm.code.CodeSection;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.ReturnStack;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.RetFOperation;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.apache.tuweni.bytes.Bytes;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyLong;
@ -20,7 +20,6 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.operation.RevertOperation;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.frame.ExceptionalHaltReason.INSUFFICIENT_GAS;
@ -25,7 +25,6 @@ import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.operation.SStoreOperation;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import org.hyperledger.besu.evm.testutils.TestMessageFrameBuilder;
import org.hyperledger.besu.evm.toy.ToyWorld;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -22,7 +22,6 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator;
import org.hyperledger.besu.evm.operation.SarOperation;
import java.util.List;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.atLeast;
@ -31,8 +31,6 @@ import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.internal.Words;
import org.hyperledger.besu.evm.operation.Operation;
import org.hyperledger.besu.evm.operation.SelfDestructOperation;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
import org.apache.tuweni.bytes.Bytes;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -22,7 +22,6 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator;
import org.hyperledger.besu.evm.operation.ShlOperation;
import java.util.Arrays;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@ -22,7 +22,6 @@ import static org.mockito.Mockito.when;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator;
import org.hyperledger.besu.evm.operation.ShrOperation;
import java.util.Arrays;

@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.evm.operations;
package org.hyperledger.besu.evm.operation;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.evm.frame.ExceptionalHaltReason.INSUFFICIENT_GAS;
@ -26,8 +26,6 @@ import org.hyperledger.besu.evm.gascalculator.CancunGasCalculator;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.evm.operation.Operation.OperationResult;
import org.hyperledger.besu.evm.operation.TLoadOperation;
import org.hyperledger.besu.evm.operation.TStoreOperation;
import org.hyperledger.besu.evm.testutils.ByteCodeBuilder;
import org.hyperledger.besu.evm.testutils.FakeBlockValues;
import org.hyperledger.besu.evm.testutils.TestCodeExecutor;
Loading…
Cancel
Save