diff --git a/besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java b/besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java index ecd6eb2d38d..f840cd30273 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/BlockSimulatorServiceImpl.java @@ -48,6 +48,7 @@ public class BlockSimulatorServiceImpl implements BlockSimulationService { * @param miningConfiguration the mining configuration * @param transactionSimulator the transaction simulator * @param protocolSchedule the protocol schedule + * @param blockchain the blockchain */ public BlockSimulatorServiceImpl( final WorldStateArchive worldStateArchive, diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/BlockSimulatorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/BlockSimulatorTest.java index 1acc658862e..bb1225107ec 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/BlockSimulatorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/transaction/BlockSimulatorTest.java @@ -196,39 +196,41 @@ public void shouldApplyStateOverridesCorrectly() { @Test public void shouldApplyBlockHeaderOverridesCorrectly() { - BlockOverrides blockOverrides = mock(BlockOverrides.class); ProtocolSpec protocolSpec = mock(ProtocolSpec.class); - var expectedTimestamp = Optional.of(1L); - var expectedBlockNumber = Optional.of(2L); - var expectedFeeRecipient = Optional.of(Address.fromHexString("0x1")); - var expectedBaseFeePerGas = Optional.of(Wei.of(7L)); - var expectedGasLimit = Optional.of(5L); - var expectedDifficulty = Optional.of(BigInteger.ONE); - var expectedMixHashOrPrevRandao = Optional.of(Hash.hash(Bytes.fromHexString("0x01"))); - var expectedExtraData = Optional.of(Bytes.fromHexString("0x02")); - - when(blockOverrides.getTimestamp()).thenReturn(expectedTimestamp); - when(blockOverrides.getBlockNumber()).thenReturn(expectedBlockNumber); - when(blockOverrides.getFeeRecipient()).thenReturn(expectedFeeRecipient); - when(blockOverrides.getBaseFeePerGas()).thenReturn(expectedBaseFeePerGas); - when(blockOverrides.getGasLimit()).thenReturn(expectedGasLimit); - when(blockOverrides.getDifficulty()).thenReturn(expectedDifficulty); - when(blockOverrides.getMixHashOrPrevRandao()).thenReturn(expectedMixHashOrPrevRandao); - when(blockOverrides.getExtraData()).thenReturn(expectedExtraData); + var expectedTimestamp = 1L; + var expectedBlockNumber = 2L; + var expectedFeeRecipient = Address.fromHexString("0x1"); + var expectedBaseFeePerGas = Wei.of(7L); + var expectedGasLimit = 5L; + var expectedDifficulty = BigInteger.ONE; + var expectedMixHashOrPrevRandao = Hash.hash(Bytes.fromHexString("0x01")); + var expectedExtraData = Bytes.fromHexString("0x02"); + + BlockOverrides blockOverrides = + BlockOverrides.builder() + .timestamp(expectedTimestamp) + .blockNumber(expectedBlockNumber) + .feeRecipient(expectedFeeRecipient) + .baseFeePerGas(expectedBaseFeePerGas) + .gasLimit(expectedGasLimit) + .difficulty(expectedDifficulty) + .mixHashOrPrevRandao(expectedMixHashOrPrevRandao) + .extraData(expectedExtraData) + .build(); BlockHeader result = blockSimulator.applyBlockHeaderOverrides(blockHeader, protocolSpec, blockOverrides); assertNotNull(result); - assertEquals(expectedTimestamp.get(), result.getTimestamp()); - assertEquals(expectedBlockNumber.get(), result.getNumber()); - assertEquals(expectedFeeRecipient.get(), result.getCoinbase()); - assertEquals(expectedBaseFeePerGas, result.getBaseFee()); - assertEquals(expectedGasLimit.get(), result.getGasLimit()); - assertThat(result.getDifficulty()).isEqualTo(Difficulty.of(expectedDifficulty.get())); - assertEquals(expectedMixHashOrPrevRandao.get(), result.getMixHash()); - assertEquals(expectedExtraData.get(), result.getExtraData()); + assertEquals(expectedTimestamp, result.getTimestamp()); + assertEquals(expectedBlockNumber, result.getNumber()); + assertEquals(expectedFeeRecipient, result.getCoinbase()); + assertEquals(Optional.of(expectedBaseFeePerGas), result.getBaseFee()); + assertEquals(expectedGasLimit, result.getGasLimit()); + assertThat(result.getDifficulty()).isEqualTo(Difficulty.of(expectedDifficulty)); + assertEquals(expectedMixHashOrPrevRandao, result.getMixHash()); + assertEquals(expectedExtraData, result.getExtraData()); } @Test diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index eec5c5b414c..070313150eb 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -71,7 +71,7 @@ Calculated : ${currentHash} tasks.register('checkAPIChanges', FileStateChecker) { description = "Checks that the API for the Plugin-API project does not change without deliberate thought" files = sourceSets.main.allJava.files - knownHash = 'np8ChmBg/Fc8DiWlTn5PgRJbnuHtjbJGNIfaQgXv/tM=' + knownHash = '+YR9PYN+gPCvXzK2w52ypz9dZ0FOy0G3I1PljZasOkU=' } check.dependsOn('checkAPIChanges')