use of org.hyperledger.besu.evm.operation.PrevRanDaoOperation in project besu by hyperledger.
the class MainnetEVMs method registerPreMergeForkOperations.
public static void registerPreMergeForkOperations(final OperationRegistry registry, final GasCalculator gasCalculator, final BigInteger chainID) {
registerLondonOperations(registry, gasCalculator, chainID);
registry.put(new PrevRanDaoOperation(gasCalculator));
}
use of org.hyperledger.besu.evm.operation.PrevRanDaoOperation in project besu by hyperledger.
the class PrevRanDaoOperationTest method pushesPrevRandaoWhenDifficultyZero.
@Test
public void pushesPrevRandaoWhenDifficultyZero() {
PrevRanDaoOperation op = new PrevRanDaoOperation(new LondonGasCalculator());
MessageFrame messageFrame = mock(MessageFrame.class);
BlockValues blockHeader = mock(BlockValues.class);
Bytes32 prevRandao = Bytes32.fromHexString("0xb0b0face");
when(blockHeader.getDifficultyBytes()).thenReturn(UInt256.ZERO);
when(blockHeader.getMixHashOrPrevRandao()).thenReturn(prevRandao);
when(messageFrame.getBlockValues()).thenReturn(blockHeader);
EVM evm = mock(EVM.class);
Operation.OperationResult r = op.executeFixedCostOperation(messageFrame, evm);
assertThat(r.getHaltReason()).isNotPresent();
verify(messageFrame).pushStackItem(prevRandao);
}
use of org.hyperledger.besu.evm.operation.PrevRanDaoOperation in project besu by hyperledger.
the class MainnetEVMs method registerParisOperations.
public static void registerParisOperations(final OperationRegistry registry, final GasCalculator gasCalculator, final BigInteger chainID) {
registerLondonOperations(registry, gasCalculator, chainID);
registry.put(new PrevRanDaoOperation(gasCalculator));
}
use of org.hyperledger.besu.evm.operation.PrevRanDaoOperation in project besu by hyperledger.
the class PrevRanDaoOperationTest method pushesDifficultyWhenPresent.
@Test
public void pushesDifficultyWhenPresent() {
PrevRanDaoOperation op = new PrevRanDaoOperation(new LondonGasCalculator());
MessageFrame messageFrame = mock(MessageFrame.class);
BlockValues blockHeader = mock(BlockValues.class);
Bytes32 prevRandao = Bytes32.fromHexString("0xb0b0face");
Bytes difficulty = Bytes.random(32);
when(blockHeader.getDifficultyBytes()).thenReturn(difficulty);
when(blockHeader.getMixHashOrPrevRandao()).thenReturn(prevRandao);
when(messageFrame.getBlockValues()).thenReturn(blockHeader);
EVM evm = mock(EVM.class);
Operation.OperationResult r = op.executeFixedCostOperation(messageFrame, evm);
assertThat(r.getHaltReason()).isNotPresent();
verify(messageFrame).pushStackItem(difficulty);
}
Aggregations