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);
}
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);
}
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);
}
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));
}
Aggregations