ETC Mystique hard fork (#3256)

* Add missing Magneto ETC hard fork entry in test

This corresponds to 61bf0d9ca

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Change ETC bootnode public keys

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Add ETC Mystique hard fork spec (ECIP-1104)

Signed-off-by: Diego López León <dieguitoll@gmail.com>
pull/3269/head
Diego López León 3 years ago committed by GitHub
parent df3c9ac8f2
commit b964e9098f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 15
      besu/src/test/java/org/hyperledger/besu/ForkIdsTest.java
  3. 4
      besu/src/test/java/org/hyperledger/besu/ethereum/p2p/config/DefaultDiscoveryConfiguration.java
  4. 9
      config/src/main/java/org/hyperledger/besu/config/GenesisConfigOptions.java
  5. 7
      config/src/main/java/org/hyperledger/besu/config/JsonGenesisConfigOptions.java
  6. 12
      config/src/main/java/org/hyperledger/besu/config/StubGenesisConfigOptions.java
  7. 5
      config/src/main/resources/classic.json
  8. 1
      config/src/main/resources/kotti.json
  9. 1
      config/src/main/resources/mordor.json
  10. 2
      config/src/test/resources/all_forks.json
  11. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/AdminNodeInfoTest.java
  12. 33
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java
  13. 11
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java
  14. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java

@ -13,6 +13,7 @@
### Additions and Improvements
- Re-order external services (e.g JsonRpcHttpService) to start before blocks start processing [#3118](https://github.com/hyperledger/besu/pull/3118)
- Stream JSON RPC responses to avoid creating big JSON strings in memory [#3076](https://github.com/hyperledger/besu/pull/3076)
- Ethereum Classic Mystique Hard Fork [#3256](https://github.com/hyperledger/besu/pull/3256)
### Bug Fixes
- Make 'to' field optional in eth_call method according to the spec [#3177](https://github.com/hyperledger/besu/pull/3177)

@ -120,8 +120,9 @@ public class ForkIdsTest {
new ForkId(Bytes.ofUnsignedInt(0x604f6ee1L), 999983L),
new ForkId(Bytes.ofUnsignedInt(0xf42f5539L), 2520000L),
new ForkId(Bytes.ofUnsignedInt(0x66b5c286L), 3985893),
new ForkId(Bytes.ofUnsignedInt(0x92b323e0L), 0),
new ForkId(Bytes.ofUnsignedInt(0x92b323e0L), 0))
new ForkId(Bytes.ofUnsignedInt(0x92b323e0L), 5520000L),
new ForkId(Bytes.ofUnsignedInt(0x8c9b1797L), 0L),
new ForkId(Bytes.ofUnsignedInt(0x8c9b1797L), 0L))
},
new Object[] {
NetworkName.KOTTI,
@ -130,8 +131,9 @@ public class ForkIdsTest {
new ForkId(Bytes.ofUnsignedInt(0xa3270822L), 1705549L),
new ForkId(Bytes.ofUnsignedInt(0x8f3698e0L), 2200013L),
new ForkId(Bytes.ofUnsignedInt(0x6f402821L), 4368634),
new ForkId(Bytes.ofUnsignedInt(0xf03e54e7L), 0),
new ForkId(Bytes.ofUnsignedInt(0xf03e54e7L), 0))
new ForkId(Bytes.ofUnsignedInt(0xf03e54e7L), 5578000L),
new ForkId(Bytes.ofUnsignedInt(0xc5459816L), 0L),
new ForkId(Bytes.ofUnsignedInt(0xc5459816L), 0L))
},
new Object[] {
NetworkName.CLASSIC,
@ -148,8 +150,9 @@ public class ForkIdsTest {
new ForkId(Bytes.ofUnsignedInt(0x7ba22882L), 10500839L),
new ForkId(Bytes.ofUnsignedInt(0x9007bfccL), 11700000L),
new ForkId(Bytes.ofUnsignedInt(0xdb63a1caL), 13189133),
new ForkId(Bytes.ofUnsignedInt(0x0f6bf187L), 0),
new ForkId(Bytes.ofUnsignedInt(0x0f6bf187L), 0))
new ForkId(Bytes.ofUnsignedInt(0x0f6bf187L), 14525000L),
new ForkId(Bytes.ofUnsignedInt(0x7fd1bb25L), 0L),
new ForkId(Bytes.ofUnsignedInt(0x7fd1bb25L), 0L))
});
}

@ -103,8 +103,8 @@ public class DefaultDiscoveryConfiguration {
Stream.of(
// ETC Cooperative
"enode://8e73168affd8d445edda09c561d607081ca5d7963317caae2702f701eb6546b06948b7f8687a795de576f6a5f33c44828e25a90aa63de18db380a11e660dd06f@159.203.37.80:30303",
"enode://1d9aef3350a712ca90cabdf7b94a6f29e7df390c083d39d739c58cdba8708c4fbeb7784e2c8ae7a9086141e31c7df193c5a247d40264d040e6ac02d316c2fcfb@67.207.93.100:30303",
"enode://506e4f07e736a6415aac813d5f2365f6359a9877844b02799819d185571908188c8ddd855897c814583f5f36f30e5cb76472e13108e6ecb0fc1901d71f0df8e2@128.199.160.131:30303",
"enode://2b1ef75e8b7119b6e0294f2e51ead2cf1a5400472452c199e9587727ada99e7e2b1199e36adcad6cbae65dce2410559546e4d83d8c93d45a559e723e56444c03@67.207.93.100:30303",
"enode://40b37d729fdc2c29620bbecc61264f450c3e849b5e60d1a362e6af04d84ae36e15120573498bcf56f97aeec18e530113a4d0b55b18e6a6523de8cf5a45e1db23@128.199.160.131:30303",
"enode://84e70a981a436efd7d6ae80b5d7ecb82636de77029635a2fb25ccf5d02106172d1cafdd7d8171a136d3fd545e5df94f4d63299eda7f8aec79967aa568ddaa71e@165.22.202.207:30303",
"enode://6ec7ac618a7147d8b0e41bc1e63080abfd56a48f50f06095c112e30f72cd5eee262b06aa168cb46ab470d56885f842a1ae44a3714bfb029ced83dab461852062@164.90.218.200:30303",
"enode://feba6c4bd757efce4fec0fa5775780d2c209e86231553a72738c2c4e95d0cfd7ac2189f6d30d3c059dd25d93ea060ca28f9936b564f7d04c4270bb60e8e1487b@178.128.171.230:30303",

@ -205,6 +205,15 @@ public interface GenesisConfigOptions {
*/
OptionalLong getMagnetoBlockNumber();
/**
* Block number to activate Mystique on Classic networks.
*
* @return block number of Mystique fork on Classic networks
* @see <a
* href="https://ecips.ethereumclassic.org/ECIPs/ecip-1104">https://ecips.ethereumclassic.org/ECIPs/ecip-1104</a>
*/
OptionalLong getMystiqueBlockNumber();
/**
* Block number to activate ECIP-1049 on Classic networks. Changes the hashing algorithm to
* keccak-256.

@ -339,6 +339,11 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
return getOptionalLong("magnetoblock");
}
@Override
public OptionalLong getMystiqueBlockNumber() {
return getOptionalLong("mystiqueblock");
}
@Override
public OptionalLong getEcip1049BlockNumber() {
return getOptionalLong("ecip1049block");
@ -429,6 +434,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
getPhoenixBlockNumber().ifPresent(l -> builder.put("phoenixBlock", l));
getThanosBlockNumber().ifPresent(l -> builder.put("thanosBlock", l));
getMagnetoBlockNumber().ifPresent(l -> builder.put("magnetoBlock", l));
getMystiqueBlockNumber().ifPresent(l -> builder.put("mystiqueBlock", l));
getEcip1049BlockNumber().ifPresent(l -> builder.put("ecip1049Block", l));
getContractSizeLimit().ifPresent(l -> builder.put("contractSizeLimit", l));
@ -532,6 +538,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
getPhoenixBlockNumber(),
getThanosBlockNumber(),
getMagnetoBlockNumber(),
getMystiqueBlockNumber(),
getEcip1049BlockNumber());
// when adding forks add an entry to ${REPO_ROOT}/config/src/test/resources/all_forks.json

@ -55,6 +55,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions {
private OptionalLong phoenixBlockNumber = OptionalLong.empty();
private OptionalLong thanosBlockNumber = OptionalLong.empty();
private OptionalLong magnetoBlockNumber = OptionalLong.empty();
private OptionalLong mystiqueBlockNumber = OptionalLong.empty();
private OptionalLong ecip1049BlockNumber = OptionalLong.empty();
private Optional<BigInteger> chainId = Optional.empty();
private OptionalInt contractSizeLimit = OptionalInt.empty();
@ -261,6 +262,11 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions {
return magnetoBlockNumber;
}
@Override
public OptionalLong getMystiqueBlockNumber() {
return mystiqueBlockNumber;
}
@Override
public OptionalLong getEcip1049BlockNumber() {
return ecip1049BlockNumber;
@ -324,6 +330,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions {
getPhoenixBlockNumber().ifPresent(l -> builder.put("phoenixBlock", l));
getThanosBlockNumber().ifPresent(l -> builder.put("thanosBlock", l));
getMagnetoBlockNumber().ifPresent(l -> builder.put("magnetoBlock", l));
getMystiqueBlockNumber().ifPresent(l -> builder.put("mystiqueBlock", l));
getEcip1049BlockNumber().ifPresent(l -> builder.put("ecip1049Block", l));
getContractSizeLimit().ifPresent(l -> builder.put("contractSizeLimit", l));
@ -504,6 +511,11 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions {
return this;
}
public StubGenesisConfigOptions mystique(final long blockNumber) {
mystiqueBlockNumber = OptionalLong.of(blockNumber);
return this;
}
public StubGenesisConfigOptions ecip1049(final long blockNumber) {
ecip1049BlockNumber = OptionalLong.of(blockNumber);
return this;

@ -12,14 +12,15 @@
"phoenixBlock": 10500839,
"thanosBlock": 11700000,
"magnetoBlock": 13189133,
"mystiqueBlock": 14525000,
"ethash": {
},
"discovery" : {
"bootnodes" : [
"enode://8e73168affd8d445edda09c561d607081ca5d7963317caae2702f701eb6546b06948b7f8687a795de576f6a5f33c44828e25a90aa63de18db380a11e660dd06f@159.203.37.80:30303",
"enode://1d9aef3350a712ca90cabdf7b94a6f29e7df390c083d39d739c58cdba8708c4fbeb7784e2c8ae7a9086141e31c7df193c5a247d40264d040e6ac02d316c2fcfb@67.207.93.100:30303",
"enode://506e4f07e736a6415aac813d5f2365f6359a9877844b02799819d185571908188c8ddd855897c814583f5f36f30e5cb76472e13108e6ecb0fc1901d71f0df8e2@128.199.160.131:30303",
"enode://2b1ef75e8b7119b6e0294f2e51ead2cf1a5400472452c199e9587727ada99e7e2b1199e36adcad6cbae65dce2410559546e4d83d8c93d45a559e723e56444c03@67.207.93.100:30303",
"enode://40b37d729fdc2c29620bbecc61264f450c3e849b5e60d1a362e6af04d84ae36e15120573498bcf56f97aeec18e530113a4d0b55b18e6a6523de8cf5a45e1db23@128.199.160.131:30303",
"enode://84e70a981a436efd7d6ae80b5d7ecb82636de77029635a2fb25ccf5d02106172d1cafdd7d8171a136d3fd545e5df94f4d63299eda7f8aec79967aa568ddaa71e@165.22.202.207:30303",
"enode://6ec7ac618a7147d8b0e41bc1e63080abfd56a48f50f06095c112e30f72cd5eee262b06aa168cb46ab470d56885f842a1ae44a3714bfb029ced83dab461852062@164.90.218.200:30303",
"enode://feba6c4bd757efce4fec0fa5775780d2c209e86231553a72738c2c4e95d0cfd7ac2189f6d30d3c059dd25d93ea060ca28f9936b564f7d04c4270bb60e8e1487b@178.128.171.230:30303",

@ -6,6 +6,7 @@
"aghartaBlock": 1705549,
"phoenixBlock": 2200013,
"magnetoBlock": 4368634,
"mystiqueBlock": 5578000,
"clique":{
"blockperiodseconds":15,
"epochlength":30000

@ -7,6 +7,7 @@
"ecip1017EraRounds": 2000000,
"thanosBlock": 2520000,
"magnetoBlock": 3985893,
"mystiqueBlock": 5520000,
"ethash": {},
"discovery": {
"bootnodes": [

@ -21,6 +21,8 @@
"aghartaBlock": 107,
"phoenixBlock": 108,
"thanosBlock": 109,
"magnetoBlock": 110,
"mystiqueBlock": 111,
"ecip1049Block": 199
}
}

@ -370,7 +370,8 @@ public class AdminNodeInfoTest {
.phoenix(8)
.thanos(9)
.magneto(10)
.ecip1049(11);
.ecip1049(11)
.mystique(12);
final AdminNodeInfo methodClassic =
new AdminNodeInfo(
@ -397,6 +398,7 @@ public class AdminNodeInfoTest {
"thanosBlock", 9L,
"magnetoBlock", 10L));
expectedConfig.put("ecip1049Block", 11L);
expectedConfig.put("mystiqueBlock", 12L);
final JsonRpcResponse response = methodClassic.response(request);
assertThat(response).isInstanceOf(JsonRpcSuccessResponse.class);

@ -24,10 +24,12 @@ import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.evm.MainnetEVMs;
import org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule;
import org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule;
import org.hyperledger.besu.evm.frame.MessageFrame;
import org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator;
import org.hyperledger.besu.evm.gascalculator.DieHardGasCalculator;
import org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator;
import org.hyperledger.besu.evm.gascalculator.LondonGasCalculator;
import org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator;
import org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator;
import org.hyperledger.besu.evm.gascalculator.TangerineWhistleGasCalculator;
@ -39,6 +41,7 @@ import org.hyperledger.besu.plugin.data.TransactionType;
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.OptionalInt;
import java.util.OptionalLong;
@ -356,4 +359,34 @@ public class ClassicProtocolSpecs {
: MainnetProtocolSpecs::berlinTransactionReceiptFactory)
.name("Magneto");
}
public static ProtocolSpecBuilder mystiqueDefinition(
final Optional<BigInteger> chainId,
final OptionalInt configContractSizeLimit,
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final boolean quorumCompatibilityMode,
final EvmConfiguration evmConfiguration) {
final int contractSizeLimit =
configContractSizeLimit.orElse(MainnetProtocolSpecs.SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
return magnetoDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
quorumCompatibilityMode,
evmConfiguration)
.gasCalculator(LondonGasCalculator::new)
.contractCreationProcessorBuilder(
(gasCalculator, evm) ->
new ContractCreationProcessor(
gasCalculator,
evm,
true,
List.of(MaxCodeSizeRule.of(contractSizeLimit), PrefixCodeRule.of()),
1))
.name("Mystique");
}
}

@ -257,6 +257,17 @@ public class MainnetProtocolSpecFactory {
evmConfiguration);
}
public ProtocolSpecBuilder mystiqueDefinition() {
return ClassicProtocolSpecs.mystiqueDefinition(
chainId,
contractSizeLimit,
evmStackSize,
isRevertReasonEnabled,
ecip1017EraRounds,
quorumCompatibilityMode,
evmConfiguration);
}
public ProtocolSpecBuilder ecip1049Definition() {
return ClassicProtocolSpecs.ecip1049Definition(
chainId,

@ -250,6 +250,7 @@ public class ProtocolScheduleBuilder {
create(config.getPhoenixBlockNumber(), specFactory.phoenixDefinition()),
create(config.getThanosBlockNumber(), specFactory.thanosDefinition()),
create(config.getMagnetoBlockNumber(), specFactory.magnetoDefinition()),
create(config.getMystiqueBlockNumber(), specFactory.mystiqueDefinition()),
create(config.getEcip1049BlockNumber(), specFactory.ecip1049Definition()))
.stream()
.filter(Optional::isPresent)
@ -346,6 +347,7 @@ public class ProtocolScheduleBuilder {
lastForkBlock = validateForkOrder("Phoenix", config.getPhoenixBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Thanos", config.getThanosBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Magneto", config.getMagnetoBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Mystique", config.getMystiqueBlockNumber(), lastForkBlock);
assert (lastForkBlock >= 0);
}
}

Loading…
Cancel
Save