Remove Berlin Feature Flag (#1898)

Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
pull/1918/head
Ratan (Rai) Sur 4 years ago committed by GitHub
parent dede2c6d1e
commit f2669df10e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGELOG.md
  2. 19
      config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java
  3. 2
      config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java
  4. 10
      config/src/main/java/org/hyperledger/besu/config/experimental/ExperimentalEIPs.java
  5. 20
      config/src/test/java/org/hyperledger/besu/config/GenesisConfigOptionsTest.java
  6. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java
  7. 24
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java
  8. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java
  9. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/GeneralStateReferenceTestTools.java
  10. 7
      ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java

@ -15,6 +15,10 @@
- [Fast sync when running Besu on cloud providers](KNOWN_ISSUES.md#fast-sync-when-running-besu-on-cloud-providers)
- [Privacy users with private transactions created using v1.3.4 or earlier](KNOWN_ISSUES.md#privacy-users-with-private-transactions-created-using-v134-or-earlier)
## 21.1.0-RC2
### Additions and Improvements
* Support for the Berlin Network Upgrade, although the block number must be set manually with `--override-genesis-config=berlinBlock=<blocknumber>`. This is because the block numbers haven't been determined yet. The next release will include the number in the genesis file so it will support Berlin with no intervention. [\#1898](https://github.com/hyperledger/besu/pull/1898)
## 21.1.0-RC1
### 21.1.0 Breaking Changes

@ -226,19 +226,16 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
@Override
public OptionalLong getBerlinBlockNumber() {
if (ExperimentalEIPs.berlinEnabled) {
final OptionalLong berlinBlock = getOptionalLong("berlinblock");
final OptionalLong yolov3Block = getOptionalLong("yolov3block");
if (yolov3Block.isPresent()) {
if (berlinBlock.isPresent()) {
throw new RuntimeException(
"Genesis files cannot specify both berlinblock and yoloV2Block.");
}
return yolov3Block;
final OptionalLong berlinBlock = getOptionalLong("berlinblock");
final OptionalLong yolov3Block = getOptionalLong("yolov3block");
if (yolov3Block.isPresent()) {
if (berlinBlock.isPresent()) {
throw new RuntimeException(
"Genesis files cannot specify both berlinblock and yoloV2Block.");
}
return berlinBlock;
return yolov3Block;
}
return OptionalLong.empty();
return berlinBlock;
}
@Override

@ -151,7 +151,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions {
@Override
public OptionalLong getBerlinBlockNumber() {
return ExperimentalEIPs.berlinEnabled ? berlinBlockNumber : OptionalLong.empty();
return berlinBlockNumber;
}
@Override

@ -31,16 +31,6 @@ public class ExperimentalEIPs {
arity = "1")
public static boolean eip1559Enabled = EIP1559_ENABLED_DEFAULT_VALUE;
// To make it easier for tests to reset the value to default
public static final boolean BERLIN_ENABLED_DEFAULT_VALUE = false;
@Option(
hidden = true,
names = {"--Xberlin-enabled"},
description = "Enable non-finalized Berlin features (default: ${DEFAULT-VALUE})",
arity = "1")
public static boolean berlinEnabled = BERLIN_ENABLED_DEFAULT_VALUE;
public static void eip1559MustBeEnabled() {
if (!eip1559Enabled) {
throw new RuntimeException("EIP-1559 feature flag must be enabled --Xeip1559-enabled");

@ -163,24 +163,14 @@ public class GenesisConfigOptionsTest {
@Test
public void shouldGetBerlinBlockNumber() {
try {
ExperimentalEIPs.berlinEnabled = true;
final GenesisConfigOptions config = fromConfigOptions(singletonMap("berlinBlock", 1000));
assertThat(config.getBerlinBlockNumber()).hasValue(1000);
} finally {
ExperimentalEIPs.berlinEnabled = ExperimentalEIPs.BERLIN_ENABLED_DEFAULT_VALUE;
}
final GenesisConfigOptions config = fromConfigOptions(singletonMap("berlinBlock", 1000));
assertThat(config.getBerlinBlockNumber()).hasValue(1000);
}
@Test
public void shouldGetYoloV2BlockNumber() {
try {
ExperimentalEIPs.berlinEnabled = true;
final GenesisConfigOptions config = fromConfigOptions(singletonMap("yoloV3Block", 1000));
assertThat(config.getBerlinBlockNumber()).hasValue(1000);
} finally {
ExperimentalEIPs.berlinEnabled = ExperimentalEIPs.BERLIN_ENABLED_DEFAULT_VALUE;
}
public void shouldGetYoloV3BlockNumber() {
final GenesisConfigOptions config = fromConfigOptions(singletonMap("yoloV3Block", 1000));
assertThat(config.getBerlinBlockNumber()).hasValue(1000);
}
@Test

@ -412,9 +412,6 @@ public abstract class MainnetProtocolSpecs {
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final boolean quorumCompatibilityMode) {
if (!ExperimentalEIPs.berlinEnabled) {
throw new RuntimeException("Berlin feature flag must be enabled --Xberlin-enabled");
}
return muirGlacierDefinition(
chainId,
contractSizeLimit,

@ -188,17 +188,15 @@ public class ProtocolScheduleBuilder {
isRevertReasonEnabled,
quorumCompatibilityMode));
if (ExperimentalEIPs.berlinEnabled) {
addProtocolSpec(
protocolSchedule,
config.getBerlinBlockNumber(),
MainnetProtocolSpecs.berlinDefinition(
chainId,
config.getContractSizeLimit(),
config.getEvmStackSize(),
isRevertReasonEnabled,
quorumCompatibilityMode));
}
addProtocolSpec(
protocolSchedule,
config.getBerlinBlockNumber(),
MainnetProtocolSpecs.berlinDefinition(
chainId,
config.getContractSizeLimit(),
config.getEvmStackSize(),
isRevertReasonEnabled,
quorumCompatibilityMode));
if (ExperimentalEIPs.eip1559Enabled) {
final Optional<TransactionPriceCalculator> transactionPriceCalculator =
@ -366,9 +364,7 @@ public class ProtocolScheduleBuilder {
lastForkBlock = validateForkOrder("Istanbul", config.getIstanbulBlockNumber(), lastForkBlock);
lastForkBlock =
validateForkOrder("MuirGlacier", config.getMuirGlacierBlockNumber(), lastForkBlock);
if (ExperimentalEIPs.berlinEnabled) {
lastForkBlock = validateForkOrder("Berlin", config.getBerlinBlockNumber(), lastForkBlock);
}
lastForkBlock = validateForkOrder("Berlin", config.getBerlinBlockNumber(), lastForkBlock);
assert (lastForkBlock >= 0);
}

@ -16,7 +16,6 @@ package org.hyperledger.besu.ethereum.vm;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Block;
@ -79,10 +78,7 @@ public class BlockchainReferenceTestTools {
// Don't do time consuming tests
params.ignore("CALLBlake2f_MaxRounds.*");
// Berlin isn't finalized
if (!ExperimentalEIPs.berlinEnabled) {
params.ignore(".*[_-]Berlin");
}
params.ignore(".*[_-]Berlin");
}
public static Collection<Object[]> generateTestParametersForConfig(final String[] filePath) {

@ -16,7 +16,6 @@ package org.hyperledger.besu.ethereum.vm;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
import org.hyperledger.besu.ethereum.core.Account;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Hash;
@ -103,10 +102,7 @@ public class GeneralStateReferenceTestTools {
// Don't do time consuming tests
params.ignore("CALLBlake2f_MaxRounds.*");
// Berlin isn't finalized
if (!ExperimentalEIPs.berlinEnabled) {
params.ignore(".*[_-]Berlin");
}
params.ignore(".*[_-]Berlin");
}
public static Collection<Object[]> generateTestParametersForConfig(final String[] filePath) {

@ -17,7 +17,6 @@ package org.hyperledger.besu.ethereum.referencetests;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.config.StubGenesisConfigOptions;
import org.hyperledger.besu.config.experimental.ExperimentalEIPs;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder;
@ -62,10 +61,8 @@ public class ReferenceTestProtocolSchedules {
builder.put("Petersburg", createSchedule(new StubGenesisConfigOptions().petersburgBlock(0)));
builder.put("Istanbul", createSchedule(new StubGenesisConfigOptions().istanbulBlock(0)));
builder.put("MuirGlacier", createSchedule(new StubGenesisConfigOptions().muirGlacierBlock(0)));
if (ExperimentalEIPs.berlinEnabled) {
builder.put("Berlin", createSchedule(new StubGenesisConfigOptions().berlinBlock(0)));
builder.put("YOLOv3", createSchedule(new StubGenesisConfigOptions().berlinBlock(0)));
}
builder.put("Berlin", createSchedule(new StubGenesisConfigOptions().berlinBlock(0)));
builder.put("YOLOv3", createSchedule(new StubGenesisConfigOptions().berlinBlock(0)));
return new ReferenceTestProtocolSchedules(builder.build());
}

Loading…
Cancel
Save