diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java index 507bca6d50..c373f155f0 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestEnv.java @@ -50,7 +50,7 @@ public class ReferenceTestEnv extends BlockHeader { @JsonCreator public ReferenceTestEnv( @JsonProperty("currentCoinbase") final String coinbase, - @JsonProperty("currentDifficulty") final String difficulty, + @JsonProperty(value = "currentDifficulty", required = false) final String difficulty, @JsonProperty("currentGasLimit") final String gasLimit, @JsonProperty("currentNumber") final String number, @JsonProperty(value = "currentBaseFee", required = false) final String baseFee, @@ -63,7 +63,7 @@ public class ReferenceTestEnv extends BlockHeader { Hash.EMPTY, // transactionsRoot Hash.EMPTY, // receiptsRoot new LogsBloomFilter(), - Difficulty.fromHexString(difficulty), + Optional.ofNullable(difficulty).map(Difficulty::fromHexString).orElse(Difficulty.ZERO), Long.decode(number), Long.decode(gasLimit), 0L, diff --git a/ethereum/referencetests/src/reference-test/external-resources b/ethereum/referencetests/src/reference-test/external-resources index a380655e5f..638da7ca7b 160000 --- a/ethereum/referencetests/src/reference-test/external-resources +++ b/ethereum/referencetests/src/reference-test/external-resources @@ -1 +1 @@ -Subproject commit a380655e5ffab1a5ea0f4d860224bdb19013f06a +Subproject commit 638da7ca7b2ca371ebb33d7d7d2562981aafd9b2 diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java index ab69151b05..9db8268594 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java @@ -62,6 +62,21 @@ public class DifficultyCalculatorTests { .getConfigOptions(), EvmConfiguration.DEFAULT) ), + Arguments.of( + "/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierForkBlock.json", + MainnetProtocolSchedule.fromConfig( + new StubGenesisConfigOptions().grayGlacierBlock(15050000)) + ), + Arguments.of( + "/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierTimeDiff1.json", + MainnetProtocolSchedule.fromConfig( + new StubGenesisConfigOptions().grayGlacierBlock(15050000)) + ), + Arguments.of( + "/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierTimeDiff2.json", + MainnetProtocolSchedule.fromConfig( + new StubGenesisConfigOptions().grayGlacierBlock(15050000)) + ), Arguments.of( "/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierForkBlock.json", MainnetProtocolSchedule.fromConfig(