From c2d95934965f5fed5172bfcbcedd092c277c0962 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Thu, 21 Nov 2019 16:04:11 -0700 Subject: [PATCH 1/8] EIP2384 - Ice Age Adustment around Istanbul Add support for EIP2384 * Current placeholder is "EIP2384Block" because Icestanbul seemed a little too silly. * Add difficulty calculator tests from the reference tests Signed-off-by: Danno Ferrin --- .../besu/config/GenesisConfigOptions.java | 2 + .../besu/config/JsonGenesisConfigOptions.java | 6 + .../besu/config/StubGenesisConfigOptions.java | 24 ++- .../besu/config/GenesisConfigOptionsTest.java | 7 + .../mainnet/MainnetDifficultyCalculators.java | 15 +- .../mainnet/MainnetProtocolSpecs.java | 10 ++ .../mainnet/ProtocolScheduleBuilder.java | 9 ++ .../mainnet/DifficultyCalculatorTests.java | 149 ++++++++++++++++++ .../retesteth/methods/TestSetChainParams.java | 1 + 9 files changed, 213 insertions(+), 10 deletions(-) create mode 100644 ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java diff --git a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java index 4634797252b..51c160796d6 100644 --- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java @@ -56,6 +56,8 @@ public interface GenesisConfigOptions { OptionalLong getIstanbulBlockNumber(); + OptionalLong getEIP2384BlockNumber(); + /** * Block number for the Dao Fork, this value is used to tell node to connect with peer that did * NOT accept the Dao Fork and instead continued as what is now called the classic network diff --git a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java index d84323320f0..8fdf8a99ddd 100644 --- a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java @@ -195,6 +195,11 @@ public OptionalLong getIstanbulBlockNumber() { return getOptionalLong("istanbulblock"); } + @Override + public OptionalLong getEIP2384BlockNumber() { + return getOptionalLong("eip2384block"); + } + @Override public OptionalLong getClassicForkBlock() { return getOptionalLong("classicforkblock"); @@ -268,6 +273,7 @@ public Map asMap() { getConstantinopleBlockNumber().ifPresent(l -> builder.put("constantinopleBlock", l)); getConstantinopleFixBlockNumber().ifPresent(l -> builder.put("constantinopleFixBlock", l)); getIstanbulBlockNumber().ifPresent(l -> builder.put("istanbulBlock", l)); + getEIP2384BlockNumber().ifPresent(l -> builder.put("EIP2384Block", l)); getContractSizeLimit().ifPresent(l -> builder.put("contractSizeLimit", l)); getEvmStackSize().ifPresent(l -> builder.put("evmstacksize", l)); if (isClique()) { diff --git a/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java b/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java index 88637177c36..78aa8b43625 100644 --- a/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java +++ b/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java @@ -32,12 +32,13 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions { private OptionalLong constantinopleBlockNumber = OptionalLong.empty(); private OptionalLong constantinopleFixBlockNumber = OptionalLong.empty(); private OptionalLong istanbulBlockNumber = OptionalLong.empty(); - private OptionalLong classicForkBlock = OptionalLong.empty(); - private OptionalLong ecip1015BlockNumber = OptionalLong.empty(); - private OptionalLong diehardBlockNumber = OptionalLong.empty(); - private OptionalLong gothamBlockNumber = OptionalLong.empty(); - private OptionalLong defuseDifficultyBombBlockNumber = OptionalLong.empty(); - private OptionalLong atlantisBlockNumber = OptionalLong.empty(); + private OptionalLong eip2384BlockNumber = OptionalLong.empty(); + private final OptionalLong classicForkBlock = OptionalLong.empty(); + private final OptionalLong ecip1015BlockNumber = OptionalLong.empty(); + private final OptionalLong diehardBlockNumber = OptionalLong.empty(); + private final OptionalLong gothamBlockNumber = OptionalLong.empty(); + private final OptionalLong defuseDifficultyBombBlockNumber = OptionalLong.empty(); + private final OptionalLong atlantisBlockNumber = OptionalLong.empty(); private Optional chainId = Optional.empty(); private OptionalInt contractSizeLimit = OptionalInt.empty(); private OptionalInt stackSizeLimit = OptionalInt.empty(); @@ -127,6 +128,11 @@ public OptionalLong getIstanbulBlockNumber() { return istanbulBlockNumber; } + @Override + public OptionalLong getEIP2384BlockNumber() { + return eip2384BlockNumber; + } + @Override public OptionalLong getClassicForkBlock() { return classicForkBlock; @@ -194,6 +200,7 @@ public Map asMap() { getConstantinopleBlockNumber().ifPresent(l -> builder.put("constantinopleBlock", l)); getConstantinopleFixBlockNumber().ifPresent(l -> builder.put("constantinopleFixBlock", l)); getIstanbulBlockNumber().ifPresent(l -> builder.put("istanbulBlock", l)); + getEIP2384BlockNumber().ifPresent(l -> builder.put("eip2384Block", l)); getContractSizeLimit().ifPresent(l -> builder.put("contractSizeLimit", l)); getEvmStackSize().ifPresent(l -> builder.put("evmStackSize", l)); if (isClique()) { @@ -256,6 +263,11 @@ public StubGenesisConfigOptions istanbulBlock(final long blockNumber) { return this; } + public StubGenesisConfigOptions eip2384Block(final long blockNumber) { + eip2384BlockNumber = OptionalLong.of(blockNumber); + return this; + } + public StubGenesisConfigOptions chainId(final BigInteger chainId) { this.chainId = Optional.ofNullable(chainId); return this; diff --git a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java index f9b6d10d186..794d36508a5 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java @@ -133,6 +133,12 @@ public void shouldGetIstanbulBlockNumber() { assertThat(config.getIstanbulBlockNumber()).hasValue(1000); } + @Test + public void shouldGetEIP2384BlockNumber() { + final GenesisConfigOptions config = fromConfigOptions(singletonMap("EIP2384Block", 1000)); + assertThat(config.getEIP2384BlockNumber()).hasValue(1000); + } + @Test public void shouldNotReturnEmptyOptionalWhenBlockNumberNotSpecified() { final GenesisConfigOptions config = fromConfigOptions(emptyMap()); @@ -144,6 +150,7 @@ public void shouldNotReturnEmptyOptionalWhenBlockNumberNotSpecified() { assertThat(config.getConstantinopleBlockNumber()).isEmpty(); assertThat(config.getConstantinopleFixBlockNumber()).isEmpty(); assertThat(config.getIstanbulBlockNumber()).isEmpty(); + assertThat(config.getEIP2384BlockNumber()).isEmpty(); } @Test diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java index 232ff25e727..e1c26f3b603 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java @@ -20,6 +20,7 @@ import java.math.BigInteger; +import com.google.common.annotations.VisibleForTesting; import com.google.common.primitives.Ints; /** Provides the various difficultly calculates used on mainnet hard forks. */ @@ -37,6 +38,7 @@ public abstract class MainnetDifficultyCalculators { private static final long BYZANTIUM_FAKE_BLOCK_OFFSET = 2_999_999L; private static final long CONSTANTINOPLE_FAKE_BLOCK_OFFSET = 4_999_999L; + private static final long EIP2384_FAKE_BLOCK_OFFSET = 8_999_999L; private MainnetDifficultyCalculators() {} @@ -67,15 +69,20 @@ private MainnetDifficultyCalculators() {} return periodCount > 1 ? adjustForPeriod(periodCount, difficulty) : difficulty; }; + @VisibleForTesting public static DifficultyCalculator BYZANTIUM = (time, parent, protocolContext) -> - calculateByzantiumDifficulty(time, parent, BYZANTIUM_FAKE_BLOCK_OFFSET); + calculateThawedDifficulty(time, parent, BYZANTIUM_FAKE_BLOCK_OFFSET); - public static DifficultyCalculator CONSTANTINOPLE = + static DifficultyCalculator CONSTANTINOPLE = (time, parent, protocolContext) -> - calculateByzantiumDifficulty(time, parent, CONSTANTINOPLE_FAKE_BLOCK_OFFSET); + calculateThawedDifficulty(time, parent, CONSTANTINOPLE_FAKE_BLOCK_OFFSET); - private static BigInteger calculateByzantiumDifficulty( + static DifficultyCalculator EIP2384 = + (time, parent, protocolContext) -> + calculateThawedDifficulty(time, parent, EIP2384_FAKE_BLOCK_OFFSET); + + private static BigInteger calculateThawedDifficulty( final long time, final BlockHeader parent, final long fakeBlockOffset) { final BigInteger parentDifficulty = difficulty(parent.getDifficulty()); final boolean hasOmmers = !parent.getOmmersHash().equals(Hash.EMPTY_LIST_HASH); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index 6b2f0be1290..3533a26be0e 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -314,6 +314,16 @@ public static ProtocolSpecBuilder istanbulDefinition( .name("Istanbul"); } + static ProtocolSpecBuilder eip2384Definition( + final Optional chainId, + final OptionalInt contractSizeLimit, + final OptionalInt configStackSizeLimit, + final boolean enableRevertReason) { + return istanbulDefinition(chainId, contractSizeLimit, configStackSizeLimit, enableRevertReason) + .difficultyCalculator(MainnetDifficultyCalculators.EIP2384) + .name("EIP2384"); + } + private static TransactionReceipt frontierTransactionReceiptFactory( final TransactionProcessor.Result result, final WorldState worldState, final long gasUsed) { return new TransactionReceipt( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java index cafdf214400..a2d5726f96c 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java @@ -151,6 +151,14 @@ public ProtocolSchedule createProtocolSchedule() { config.getContractSizeLimit(), config.getEvmStackSize(), isRevertReasonEnabled)); + addProtocolSpec( + protocolSchedule, + config.getEIP2384BlockNumber(), + MainnetProtocolSpecs.eip2384Definition( + chainId, + config.getContractSizeLimit(), + config.getEvmStackSize(), + isRevertReasonEnabled)); // specs for classic network config @@ -252,6 +260,7 @@ private void validateEthereumForkOrdering() { validateForkOrder( "ConstantinopleFix", config.getConstantinopleFixBlockNumber(), lastForkBlock); lastForkBlock = validateForkOrder("Istanbul", config.getIstanbulBlockNumber(), lastForkBlock); + lastForkBlock = validateForkOrder("EIP2384", config.getEIP2384BlockNumber(), lastForkBlock); assert (lastForkBlock >= 0); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java new file mode 100644 index 00000000000..61d7c3c131e --- /dev/null +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java @@ -0,0 +1,149 @@ +/* + * Copyright ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * + */ + +package org.hyperledger.besu.ethereum.mainnet; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.hyperledger.besu.config.GenesisConfigFile; +import org.hyperledger.besu.config.JsonUtil; +import org.hyperledger.besu.ethereum.core.Address; +import org.hyperledger.besu.ethereum.core.BlockHeader; +import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; +import org.hyperledger.besu.ethereum.core.Hash; +import org.hyperledger.besu.ethereum.core.LogsBloomFilter; +import org.hyperledger.besu.util.bytes.BytesValue; +import org.hyperledger.besu.util.uint.UInt256; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.List; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.common.io.Resources; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +@RunWith(Parameterized.class) +public class DifficultyCalculatorTests { + + private final String testFile; + private final ProtocolSchedule protocolSchedule; + + public DifficultyCalculatorTests( + final String testFile, final ProtocolSchedule protocolSchedule) { + this.testFile = testFile; + this.protocolSchedule = protocolSchedule; + } + + @Parameters(name = "TestFile: {0}") + public static Collection getTestParametersForConfig() throws IOException { + return List.of( + new Object[] { + "/BasicTests/difficultyMainNetwork.json", + MainnetProtocolSchedule.fromConfig(GenesisConfigFile.mainnet().getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyRopsten.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig( + Resources.toString( + GenesisConfigFile.class.getResource("/ropsten.json"), + StandardCharsets.UTF_8)) + .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyFrontier.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\": {\"frontierBlock\":0}}") + .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyHomestead.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\": {\"homesteadBlock\":0}}") + .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyByzantium.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\": {\"byzantiumBlock\":0}}") + .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyConstantinople.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\": {\"constantinopleBlock\":0}}") + .getConfigOptions()) + // }, + // new Object[] { + // "/BasicTests/difficultyEIP2384_random.json", + // MainnetProtocolSchedule.fromConfig( + // GenesisConfigFile.fromConfig("{\"config\": {\"Eip2384Block\":0}}") + // .getConfigOptions()) + }); + } + + @Test + public void testDifficultyCalculation() throws IOException { + MainnetBlockHeaderFunctions blockHeaderFunctions = new MainnetBlockHeaderFunctions(); + final ObjectNode testObject = + JsonUtil.objectNodeFromString( + Resources.toString( + DifficultyCalculatorTests.class.getResource(testFile), StandardCharsets.UTF_8)); + final var fields = testObject.fields(); + while (fields.hasNext()) { + final var entry = fields.next(); + final JsonNode value = entry.getValue(); + final long currentBlockNumber = extractLong(value, "currentBlockNumber"); + final BlockHeader testHeader = + BlockHeaderBuilder.create() + .parentHash(Hash.EMPTY) + .coinbase(Address.ZERO) + .gasLimit(Long.MAX_VALUE) + .stateRoot(Hash.EMPTY) + .transactionsRoot(Hash.EMPTY) + .receiptsRoot(Hash.EMPTY) + .logsBloom(new LogsBloomFilter()) + .gasUsed(0) + .extraData(BytesValue.of()) + .mixHash(Hash.EMPTY) + .nonce(0) + .blockHeaderFunctions(blockHeaderFunctions) + .timestamp(extractLong(value, "parentTimestamp")) + .difficulty(UInt256.fromHexString(value.get("parentDifficulty").asText())) + .ommersHash(Hash.fromHexString(value.get("parentUncles").asText())) + .number(currentBlockNumber) + .buildBlockHeader(); + final long currentTime = extractLong(value, "currentTimestamp"); + final UInt256 currentDifficulty = + UInt256.fromHexString(value.get("currentDifficulty").asText()); + final var spec = protocolSchedule.getByBlockNumber(currentBlockNumber); + final var calculator = spec.getDifficultyCalculator(); + assertThat(UInt256.of(calculator.nextDifficulty(currentTime, testHeader, null))) + .describedAs("File %s Test %s", testFile, entry.getKey()) + .isEqualTo(currentDifficulty); + } + } + + private long extractLong(final JsonNode node, final String name) { + return Long.decode(node.get(name).asText()); + } +} diff --git a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java index 4bf05779f3b..ee801dc74df 100644 --- a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java +++ b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java @@ -119,6 +119,7 @@ private static String modifyGenesisFile(final String initialGenesis) { maybeMoveToNumber(params, "constantinopleForkBlock", config, "constantinopleBlock"); maybeMoveToNumber(params, "constantinopleFixForkBlock", config, "constantinopleFixBlock"); maybeMoveToNumber(params, "istanbulForkBlock", config, "istanbulBlock"); + maybeMoveToNumber(params, "eip2384ForkBlock", config, "eip2384Block"); maybeMoveToNumber(params, "chainID", config, "chainId", 1); maybeMove(genesis, "author", chainParamsJson, "coinbase"); maybeMove(genesis, "difficulty", chainParamsJson, "difficulty"); From 79cd27bd85655cf76ca01f998c39597a373e2439 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 2 Dec 2019 15:16:16 -0700 Subject: [PATCH 2/8] EIP2384 - Ice Age Adustment around Istanbul * update to new name * add fork block numbers * update reference tests Signed-off-by: Danno Ferrin --- .../besu/config/GenesisConfigOptions.java | 2 +- .../besu/config/JsonGenesisConfigOptions.java | 6 ++--- config/src/main/resources/mainnet.json | 4 ++-- config/src/main/resources/ropsten.json | 1 + .../besu/config/StubGenesisConfigOptions.java | 12 +++++----- .../besu/config/GenesisConfigOptionsTest.java | 8 +++---- .../mainnet/MainnetDifficultyCalculators.java | 6 ++--- .../mainnet/MainnetProtocolSpecs.java | 6 ++--- .../mainnet/ProtocolScheduleBuilder.java | 7 +++--- .../mainnet/DifficultyCalculatorTests.java | 24 ++++++++++++++----- .../mainnet/MainnetProtocolScheduleTest.java | 4 +++- ethereum/referencetests/src/test/resources | 2 +- .../retesteth/methods/TestSetChainParams.java | 2 +- 13 files changed, 50 insertions(+), 34 deletions(-) diff --git a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java index 51c160796d6..8a4b70ee18c 100644 --- a/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java @@ -56,7 +56,7 @@ public interface GenesisConfigOptions { OptionalLong getIstanbulBlockNumber(); - OptionalLong getEIP2384BlockNumber(); + OptionalLong getMuirGlacierBlockNumber(); /** * Block number for the Dao Fork, this value is used to tell node to connect with peer that did diff --git a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java index 8fdf8a99ddd..d02a3e94e29 100644 --- a/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java +++ b/config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java @@ -196,8 +196,8 @@ public OptionalLong getIstanbulBlockNumber() { } @Override - public OptionalLong getEIP2384BlockNumber() { - return getOptionalLong("eip2384block"); + public OptionalLong getMuirGlacierBlockNumber() { + return getOptionalLong("muirglacierblock"); } @Override @@ -273,7 +273,7 @@ public Map asMap() { getConstantinopleBlockNumber().ifPresent(l -> builder.put("constantinopleBlock", l)); getConstantinopleFixBlockNumber().ifPresent(l -> builder.put("constantinopleFixBlock", l)); getIstanbulBlockNumber().ifPresent(l -> builder.put("istanbulBlock", l)); - getEIP2384BlockNumber().ifPresent(l -> builder.put("EIP2384Block", l)); + getMuirGlacierBlockNumber().ifPresent(l -> builder.put("muirGlacierBlock", l)); getContractSizeLimit().ifPresent(l -> builder.put("contractSizeLimit", l)); getEvmStackSize().ifPresent(l -> builder.put("evmstacksize", l)); if (isClique()) { diff --git a/config/src/main/resources/mainnet.json b/config/src/main/resources/mainnet.json index f23d41cd3d8..cb3b4f7be1d 100644 --- a/config/src/main/resources/mainnet.json +++ b/config/src/main/resources/mainnet.json @@ -11,9 +11,9 @@ "byzantiumBlock": 4370000, "constantinopleBlock": 7280000, "constantinopleFixBlock": 7280000, - "istanbulBlock": 9069000, + "istanbulBlock": 9069000, + "muirGlacierBlock": 9200000, "ethash": { - } }, "nonce": "0x42", diff --git a/config/src/main/resources/ropsten.json b/config/src/main/resources/ropsten.json index 0cb152fe0a7..8c1600de8f5 100644 --- a/config/src/main/resources/ropsten.json +++ b/config/src/main/resources/ropsten.json @@ -9,6 +9,7 @@ "constantinopleBlock": 4230000, "constantinopleFixBlock": 4939394, "istanbulBlock": 6485846, + "icetanbulBlock": 7117117, "ethash": { } }, diff --git a/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java b/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java index 78aa8b43625..4b63507271c 100644 --- a/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java +++ b/config/src/test-support/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java @@ -32,7 +32,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions { private OptionalLong constantinopleBlockNumber = OptionalLong.empty(); private OptionalLong constantinopleFixBlockNumber = OptionalLong.empty(); private OptionalLong istanbulBlockNumber = OptionalLong.empty(); - private OptionalLong eip2384BlockNumber = OptionalLong.empty(); + private OptionalLong muirGlacierBlockNumber = OptionalLong.empty(); private final OptionalLong classicForkBlock = OptionalLong.empty(); private final OptionalLong ecip1015BlockNumber = OptionalLong.empty(); private final OptionalLong diehardBlockNumber = OptionalLong.empty(); @@ -129,8 +129,8 @@ public OptionalLong getIstanbulBlockNumber() { } @Override - public OptionalLong getEIP2384BlockNumber() { - return eip2384BlockNumber; + public OptionalLong getMuirGlacierBlockNumber() { + return muirGlacierBlockNumber; } @Override @@ -200,7 +200,7 @@ public Map asMap() { getConstantinopleBlockNumber().ifPresent(l -> builder.put("constantinopleBlock", l)); getConstantinopleFixBlockNumber().ifPresent(l -> builder.put("constantinopleFixBlock", l)); getIstanbulBlockNumber().ifPresent(l -> builder.put("istanbulBlock", l)); - getEIP2384BlockNumber().ifPresent(l -> builder.put("eip2384Block", l)); + getMuirGlacierBlockNumber().ifPresent(l -> builder.put("muirGlacierBlock", l)); getContractSizeLimit().ifPresent(l -> builder.put("contractSizeLimit", l)); getEvmStackSize().ifPresent(l -> builder.put("evmStackSize", l)); if (isClique()) { @@ -263,8 +263,8 @@ public StubGenesisConfigOptions istanbulBlock(final long blockNumber) { return this; } - public StubGenesisConfigOptions eip2384Block(final long blockNumber) { - eip2384BlockNumber = OptionalLong.of(blockNumber); + public StubGenesisConfigOptions muirGlacierBlock(final long blockNumber) { + muirGlacierBlockNumber = OptionalLong.of(blockNumber); return this; } diff --git a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java index 794d36508a5..f0d36d25af7 100644 --- a/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java +++ b/config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java @@ -134,9 +134,9 @@ public void shouldGetIstanbulBlockNumber() { } @Test - public void shouldGetEIP2384BlockNumber() { - final GenesisConfigOptions config = fromConfigOptions(singletonMap("EIP2384Block", 1000)); - assertThat(config.getEIP2384BlockNumber()).hasValue(1000); + public void shouldGetMuirGlacierBlockNumber() { + final GenesisConfigOptions config = fromConfigOptions(singletonMap("muirGlacierBlock", 1000)); + assertThat(config.getMuirGlacierBlockNumber()).hasValue(1000); } @Test @@ -150,7 +150,7 @@ public void shouldNotReturnEmptyOptionalWhenBlockNumberNotSpecified() { assertThat(config.getConstantinopleBlockNumber()).isEmpty(); assertThat(config.getConstantinopleFixBlockNumber()).isEmpty(); assertThat(config.getIstanbulBlockNumber()).isEmpty(); - assertThat(config.getEIP2384BlockNumber()).isEmpty(); + assertThat(config.getMuirGlacierBlockNumber()).isEmpty(); } @Test diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java index e1c26f3b603..79c00c3ad5a 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetDifficultyCalculators.java @@ -38,7 +38,7 @@ public abstract class MainnetDifficultyCalculators { private static final long BYZANTIUM_FAKE_BLOCK_OFFSET = 2_999_999L; private static final long CONSTANTINOPLE_FAKE_BLOCK_OFFSET = 4_999_999L; - private static final long EIP2384_FAKE_BLOCK_OFFSET = 8_999_999L; + private static final long MUIR_GLACIER_FAKE_BLOCK_OFFSET = 8_999_999L; private MainnetDifficultyCalculators() {} @@ -78,9 +78,9 @@ private MainnetDifficultyCalculators() {} (time, parent, protocolContext) -> calculateThawedDifficulty(time, parent, CONSTANTINOPLE_FAKE_BLOCK_OFFSET); - static DifficultyCalculator EIP2384 = + static DifficultyCalculator MUIR_GLACIER = (time, parent, protocolContext) -> - calculateThawedDifficulty(time, parent, EIP2384_FAKE_BLOCK_OFFSET); + calculateThawedDifficulty(time, parent, MUIR_GLACIER_FAKE_BLOCK_OFFSET); private static BigInteger calculateThawedDifficulty( final long time, final BlockHeader parent, final long fakeBlockOffset) { diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index 3533a26be0e..0a21b49b2b5 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -314,14 +314,14 @@ public static ProtocolSpecBuilder istanbulDefinition( .name("Istanbul"); } - static ProtocolSpecBuilder eip2384Definition( + static ProtocolSpecBuilder muirGlacierDefinition( final Optional chainId, final OptionalInt contractSizeLimit, final OptionalInt configStackSizeLimit, final boolean enableRevertReason) { return istanbulDefinition(chainId, contractSizeLimit, configStackSizeLimit, enableRevertReason) - .difficultyCalculator(MainnetDifficultyCalculators.EIP2384) - .name("EIP2384"); + .difficultyCalculator(MainnetDifficultyCalculators.MUIR_GLACIER) + .name("MuirGlacier"); } private static TransactionReceipt frontierTransactionReceiptFactory( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java index a2d5726f96c..774a745d5be 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java @@ -153,8 +153,8 @@ public ProtocolSchedule createProtocolSchedule() { isRevertReasonEnabled)); addProtocolSpec( protocolSchedule, - config.getEIP2384BlockNumber(), - MainnetProtocolSpecs.eip2384Definition( + config.getMuirGlacierBlockNumber(), + MainnetProtocolSpecs.muirGlacierDefinition( chainId, config.getContractSizeLimit(), config.getEvmStackSize(), @@ -260,7 +260,8 @@ private void validateEthereumForkOrdering() { validateForkOrder( "ConstantinopleFix", config.getConstantinopleFixBlockNumber(), lastForkBlock); lastForkBlock = validateForkOrder("Istanbul", config.getIstanbulBlockNumber(), lastForkBlock); - lastForkBlock = validateForkOrder("EIP2384", config.getEIP2384BlockNumber(), lastForkBlock); + lastForkBlock = + validateForkOrder("MuirGlacier", config.getMuirGlacierBlockNumber(), lastForkBlock); assert (lastForkBlock >= 0); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java index 61d7c3c131e..c25b9dad332 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java @@ -92,12 +92,24 @@ public static Collection getTestParametersForConfig() throws IOExcepti MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig("{\"config\": {\"constantinopleBlock\":0}}") .getConfigOptions()) - // }, - // new Object[] { - // "/BasicTests/difficultyEIP2384_random.json", - // MainnetProtocolSchedule.fromConfig( - // GenesisConfigFile.fromConfig("{\"config\": {\"Eip2384Block\":0}}") - // .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyEIP2384.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\":{\"muirGlacierBlock\":0}}") + .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyEIP2384_random.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\":{\"muirGlacierBlock\":0}}") + .getConfigOptions()) + }, + new Object[] { + "/BasicTests/difficultyEIP2384_random_to20M.json", + MainnetProtocolSchedule.fromConfig( + GenesisConfigFile.fromConfig("{\"config\":{\"muirGlacierBlock\":0}}") + .getConfigOptions()) }); } diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java index b00e11836a8..9e58b26b883 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java @@ -43,7 +43,9 @@ public void shouldReturnDefaultProtocolSpecsWhenCustomNumbersAreNotUsed() { Assertions.assertThat(sched.getByBlockNumber(7_280_000L).getName()) .isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(9_069_000L).getName()).isEqualTo("Istanbul"); - Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); + Assertions.assertThat(sched.getByBlockNumber(9_200_000L).getName()).isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) + .isEqualTo("MuirGlacier"); } @Test diff --git a/ethereum/referencetests/src/test/resources b/ethereum/referencetests/src/test/resources index 0327d9f76ce..73bfbcc213e 160000 --- a/ethereum/referencetests/src/test/resources +++ b/ethereum/referencetests/src/test/resources @@ -1 +1 @@ -Subproject commit 0327d9f76ce2a292a99e7a9dfc93627368ce589e +Subproject commit 73bfbcc213efd7cabe678a46c83596024e85e2e2 diff --git a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java index ee801dc74df..0f057a720e4 100644 --- a/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java +++ b/ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/methods/TestSetChainParams.java @@ -119,7 +119,7 @@ private static String modifyGenesisFile(final String initialGenesis) { maybeMoveToNumber(params, "constantinopleForkBlock", config, "constantinopleBlock"); maybeMoveToNumber(params, "constantinopleFixForkBlock", config, "constantinopleFixBlock"); maybeMoveToNumber(params, "istanbulForkBlock", config, "istanbulBlock"); - maybeMoveToNumber(params, "eip2384ForkBlock", config, "eip2384Block"); + maybeMoveToNumber(params, "muirGlacierForkBlock", config, "muirGlacierBlock"); maybeMoveToNumber(params, "chainID", config, "chainId", 1); maybeMove(genesis, "author", chainParamsJson, "coinbase"); maybeMove(genesis, "difficulty", chainParamsJson, "difficulty"); From 72e9b6e9631d3926be45955df6daeac088acad2b Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Mon, 2 Dec 2019 15:39:03 -0700 Subject: [PATCH 3/8] Missed an Icetanbul Signed-off-by: Danno Ferrin --- config/src/main/resources/ropsten.json | 2 +- .../besu/ethereum/mainnet/MainnetProtocolScheduleTest.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/src/main/resources/ropsten.json b/config/src/main/resources/ropsten.json index 8c1600de8f5..88aac50a0ae 100644 --- a/config/src/main/resources/ropsten.json +++ b/config/src/main/resources/ropsten.json @@ -9,7 +9,7 @@ "constantinopleBlock": 4230000, "constantinopleFixBlock": 4939394, "istanbulBlock": 6485846, - "icetanbulBlock": 7117117, + "muirGlacierBlock": 7117117, "ethash": { } }, diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java index 9e58b26b883..7d1a5659d94 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java @@ -103,7 +103,9 @@ public void shouldCreateRopstenConfig() throws Exception { Assertions.assertThat(sched.getByBlockNumber(4_939_394L).getName()) .isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(6_485_846L).getName()).isEqualTo("Istanbul"); - Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); + Assertions.assertThat(sched.getByBlockNumber(7_117_117L).getName()).isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) + .isEqualTo("MuirGlacier"); } @Test From 6c7c6e9499bd99b3a86d5b2ce988c9e662b57fde Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 3 Dec 2019 09:12:41 -0700 Subject: [PATCH 4/8] Don't auto-activate until last call closes (2019-12-12) Signed-off-by: Danno Ferrin --- config/src/main/resources/mainnet.json | 1 - config/src/main/resources/ropsten.json | 1 - .../mainnet/MainnetProtocolScheduleTest.java | 16 ++++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config/src/main/resources/mainnet.json b/config/src/main/resources/mainnet.json index cb3b4f7be1d..5a7d9bcbf6c 100644 --- a/config/src/main/resources/mainnet.json +++ b/config/src/main/resources/mainnet.json @@ -12,7 +12,6 @@ "constantinopleBlock": 7280000, "constantinopleFixBlock": 7280000, "istanbulBlock": 9069000, - "muirGlacierBlock": 9200000, "ethash": { } }, diff --git a/config/src/main/resources/ropsten.json b/config/src/main/resources/ropsten.json index 88aac50a0ae..0cb152fe0a7 100644 --- a/config/src/main/resources/ropsten.json +++ b/config/src/main/resources/ropsten.json @@ -9,7 +9,6 @@ "constantinopleBlock": 4230000, "constantinopleFixBlock": 4939394, "istanbulBlock": 6485846, - "muirGlacierBlock": 7117117, "ethash": { } }, diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java index 7d1a5659d94..6ff19486aff 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java @@ -43,9 +43,11 @@ public void shouldReturnDefaultProtocolSpecsWhenCustomNumbersAreNotUsed() { Assertions.assertThat(sched.getByBlockNumber(7_280_000L).getName()) .isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(9_069_000L).getName()).isEqualTo("Istanbul"); - Assertions.assertThat(sched.getByBlockNumber(9_200_000L).getName()).isEqualTo("MuirGlacier"); - Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) - .isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); + // TODO (2019-12-12) add activation blocks + // Assertions.assertThat(sched.getByBlockNumber(9_200_000L).getName()).isEqualTo("MuirGlacier"); + // Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) + // .isEqualTo("MuirGlacier"); } @Test @@ -103,9 +105,11 @@ public void shouldCreateRopstenConfig() throws Exception { Assertions.assertThat(sched.getByBlockNumber(4_939_394L).getName()) .isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(6_485_846L).getName()).isEqualTo("Istanbul"); - Assertions.assertThat(sched.getByBlockNumber(7_117_117L).getName()).isEqualTo("MuirGlacier"); - Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) - .isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); + // TODO (2019-12-12) add activation blocks + // Assertions.assertThat(sched.getByBlockNumber(7_117_117L).getName()).isEqualTo("MuirGlacier"); + // Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) + // .isEqualTo("MuirGlacier"); } @Test From 49a1aa629b1ceca518fafffc701065dfc3ea5c75 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 3 Dec 2019 09:55:50 -0700 Subject: [PATCH 5/8] bump integration test to XL container Signed-off-by: Danno Ferrin --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bc982162775..253b2ac9602 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,7 +95,7 @@ jobs: - capture_test_results integrationTests: - executor: besu_executor_med + executor: besu_executor_xl steps: - prepare - attach_workspace: From e462b8bb1693efb2858d1dfc8d37898ccdd519a1 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Tue, 3 Dec 2019 10:30:00 -0700 Subject: [PATCH 6/8] move difficulty test into reference tests Signed-off-by: Danno Ferrin --- ethereum/core/build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ethereum/core/build.gradle b/ethereum/core/build.gradle index 766aef04cd0..8065a4adb86 100644 --- a/ethereum/core/build.gradle +++ b/ethereum/core/build.gradle @@ -90,10 +90,11 @@ task testJar (type: Jar) { } test { + exclude 'org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.class' + exclude 'org/hyperledger/besu/ethereum/core/TransactionTest.class' exclude 'org/hyperledger/besu/ethereum/vm/**ReferenceTest.class' exclude 'org/hyperledger/besu/ethereum/vm/blockchain/**.class' exclude 'org/hyperledger/besu/ethereum/vm/generalstate/**.class' - exclude 'org/hyperledger/besu/ethereum/core/TransactionTest.class' } def generateTestFiles(FileTree jsonPath, File templateFile, String pathstrip, String destination, String namePrefix) { @@ -185,10 +186,11 @@ task referenceTests(type: Test, dependsOn: [ } scanForTestClasses = false enableAssertions = true + include 'org/hyperledger/besu/ethereum/core/TransactionTest.class' + include 'org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.class' include 'org/hyperledger/besu/ethereum/vm/**ReferenceTest.class' include 'org/hyperledger/besu/ethereum/vm/blockchain/**.class' include 'org/hyperledger/besu/ethereum/vm/generalstate/**.class' - include 'org/hyperledger/besu/ethereum/core/TransactionTest.class' } artifacts { From 194d1c77cc0451f67234f9ed27a31e93dbe45ca5 Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Wed, 4 Dec 2019 07:17:08 -0700 Subject: [PATCH 7/8] Per Ethereum hard fork co-ordinator ship ASAP https: //gitter.im/ethereum/AllCoreDevs?at=5de7b410d64a052fb6b3fa8d Signed-off-by: Danno Ferrin --- config/src/main/resources/mainnet.json | 1 + config/src/main/resources/ropsten.json | 1 + .../mainnet/MainnetProtocolScheduleTest.java | 16 ++++++---------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/config/src/main/resources/mainnet.json b/config/src/main/resources/mainnet.json index 5a7d9bcbf6c..cb3b4f7be1d 100644 --- a/config/src/main/resources/mainnet.json +++ b/config/src/main/resources/mainnet.json @@ -12,6 +12,7 @@ "constantinopleBlock": 7280000, "constantinopleFixBlock": 7280000, "istanbulBlock": 9069000, + "muirGlacierBlock": 9200000, "ethash": { } }, diff --git a/config/src/main/resources/ropsten.json b/config/src/main/resources/ropsten.json index 0cb152fe0a7..88aac50a0ae 100644 --- a/config/src/main/resources/ropsten.json +++ b/config/src/main/resources/ropsten.json @@ -9,6 +9,7 @@ "constantinopleBlock": 4230000, "constantinopleFixBlock": 4939394, "istanbulBlock": 6485846, + "muirGlacierBlock": 7117117, "ethash": { } }, diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java index 6ff19486aff..7d1a5659d94 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java @@ -43,11 +43,9 @@ public void shouldReturnDefaultProtocolSpecsWhenCustomNumbersAreNotUsed() { Assertions.assertThat(sched.getByBlockNumber(7_280_000L).getName()) .isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(9_069_000L).getName()).isEqualTo("Istanbul"); - Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); - // TODO (2019-12-12) add activation blocks - // Assertions.assertThat(sched.getByBlockNumber(9_200_000L).getName()).isEqualTo("MuirGlacier"); - // Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) - // .isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(9_200_000L).getName()).isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) + .isEqualTo("MuirGlacier"); } @Test @@ -105,11 +103,9 @@ public void shouldCreateRopstenConfig() throws Exception { Assertions.assertThat(sched.getByBlockNumber(4_939_394L).getName()) .isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(6_485_846L).getName()).isEqualTo("Istanbul"); - Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Istanbul"); - // TODO (2019-12-12) add activation blocks - // Assertions.assertThat(sched.getByBlockNumber(7_117_117L).getName()).isEqualTo("MuirGlacier"); - // Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) - // .isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(7_117_117L).getName()).isEqualTo("MuirGlacier"); + Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) + .isEqualTo("MuirGlacier"); } @Test From 33bf65b994e01aa073c89c8ef676b075ed1f1cdd Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Wed, 4 Dec 2019 14:18:06 -0700 Subject: [PATCH 8/8] Add MuirGlacier to reference tests set Signed-off-by: Danno Ferrin --- .../besu/ethereum/vm/ReferenceTestProtocolSchedules.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/ReferenceTestProtocolSchedules.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/ReferenceTestProtocolSchedules.java index eb0e733d8c1..99c4deadd86 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/ReferenceTestProtocolSchedules.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/ReferenceTestProtocolSchedules.java @@ -54,6 +54,7 @@ public static ReferenceTestProtocolSchedules create() { "ConstantinopleFix", createSchedule(new StubGenesisConfigOptions().constantinopleFixBlock(0))); builder.put("Istanbul", createSchedule(new StubGenesisConfigOptions().istanbulBlock(0))); + builder.put("MuirGlacier", createSchedule(new StubGenesisConfigOptions().muirGlacierBlock(0))); return new ReferenceTestProtocolSchedules(builder.build()); }