Search in sources :

Example 1 with BaseFeeOperation

use of org.hyperledger.besu.evm.operation.BaseFeeOperation in project besu by hyperledger.

the class BaseFeeOperationTest method shouldReturnGasCost.

@Test
public void shouldReturnGasCost() {
    final MessageFrame frame = createMessageFrame(100, Optional.of(Wei.of(5L)));
    final Operation operation = new BaseFeeOperation(gasCalculator);
    final OperationResult result = operation.execute(frame, null);
    assertThat(result.getGasCost().isPresent()).isTrue();
    assertThat(result.getGasCost().getAsLong()).isEqualTo(gasCalculator.getBaseTierGasCost());
    assertSuccessResult(result);
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation) OperationResult(org.hyperledger.besu.evm.operation.Operation.OperationResult) Operation(org.hyperledger.besu.evm.operation.Operation) BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation) Test(org.junit.Test)

Example 2 with BaseFeeOperation

use of org.hyperledger.besu.evm.operation.BaseFeeOperation in project besu by hyperledger.

the class BaseFeeOperationTest method shouldHaltIfNoBaseFeeInBlockHeader.

@Test
public void shouldHaltIfNoBaseFeeInBlockHeader() {
    final MessageFrame frame = createMessageFrame(100, Optional.empty());
    final Operation operation = new BaseFeeOperation(gasCalculator);
    final OperationResult result = operation.execute(frame, null);
    assertExceptionalHalt(result, ExceptionalHaltReason.INVALID_OPERATION);
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation) OperationResult(org.hyperledger.besu.evm.operation.Operation.OperationResult) Operation(org.hyperledger.besu.evm.operation.Operation) BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation) Test(org.junit.Test)

Example 3 with BaseFeeOperation

use of org.hyperledger.besu.evm.operation.BaseFeeOperation in project besu by hyperledger.

the class BaseFeeOperationTest method shouldWriteBaseFeeToStack.

@Test
public void shouldWriteBaseFeeToStack() {
    final MessageFrame frame = createMessageFrame(100, Optional.of(Wei.of(5L)));
    final Operation operation = new BaseFeeOperation(gasCalculator);
    final OperationResult result = operation.execute(frame, null);
    verify(frame).pushStackItem(eq(UInt256.fromBytes(Bytes32.leftPad(Bytes.ofUnsignedLong(5L)))));
    assertSuccessResult(result);
}
Also used : MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation) OperationResult(org.hyperledger.besu.evm.operation.Operation.OperationResult) Operation(org.hyperledger.besu.evm.operation.Operation) BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation) Test(org.junit.Test)

Example 4 with BaseFeeOperation

use of org.hyperledger.besu.evm.operation.BaseFeeOperation in project besu by hyperledger.

the class MainnetEVMs method registerLondonOperations.

public static void registerLondonOperations(final OperationRegistry registry, final GasCalculator gasCalculator, final BigInteger chainId) {
    registerIstanbulOperations(registry, gasCalculator, chainId);
    registry.put(new BaseFeeOperation(gasCalculator));
}
Also used : BaseFeeOperation(org.hyperledger.besu.evm.operation.BaseFeeOperation)

Aggregations

BaseFeeOperation (org.hyperledger.besu.evm.operation.BaseFeeOperation)4 MessageFrame (org.hyperledger.besu.evm.frame.MessageFrame)3 Operation (org.hyperledger.besu.evm.operation.Operation)3 OperationResult (org.hyperledger.besu.evm.operation.Operation.OperationResult)3 Test (org.junit.Test)3