Skip to content

Commit

Permalink
Implement Phoenix EVM and Protocol Upgrades (#434)
Browse files Browse the repository at this point in the history
* remove code related to aztlan fork.

Signed-off-by: Edward Mack <ed@edwardmack.com>

* added genesis config option for Phoenix block

Signed-off-by: Edward Mack <ed@edwardmack.com>

* implement phoenix protocol spec definition

Implement Phoenix EVM and protocol upgrades as per ECIP-1088

Signed-off-by: Edward Mack <ed@edwardmack.com>

* p2p/config: update mordor classic discovery nodes (#29)

Signed-off-by: /raw PONG _GHMoaCXLT <58883403+q9f@users.noreply.github.com>

* remove unnecessary contractCreationProcessorBuilder

remove unnecessary contractCreationProcessorBuilder from Phoenix
ClassicProtocolSpec.

Signed-off-by: Edward Mack <ed@edwardmack.com>

Co-authored-by: /raw PONG _GHMoaCXLT <58883403+q9f@users.noreply.github.com>
  • Loading branch information
edwardmack and q9f committed Mar 9, 2020
1 parent 67a0c79 commit c955f67
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,15 @@ public interface GenesisConfigOptions {
OptionalLong getAghartaBlockNumber();

/**
* Block number for Aztlán fork on Classic network. Aztlán EVM and Protocol Upgrades (Yingchun
* Edition) Enable the outstanding Ethereum Foundation Istanbul network protocol upgrades on the
* Ethereum Classic network without any gas-cost assumptions in a hard-fork code-named Aztlán
* (Yingchun Edition) to enable maximum compatibility across these networks.
* Block number for Phoenix fork on Classic networks. Enable the outstanding Ethereum Foundation
* Istanbul network protocol upgrades on the Ethereum Classic network in a hard-fork code-named
* Phoenix to enable maximum compatibility across these networks.
*
* @see <a
* href="https://ecips.ethereumclassic.org/ECIPs/ecip-1061">https://ecips.ethereumclassic.org/ECIPs/ecip-1061</a>
* @return block number for Atzlan fork on Classic network
* href="https://ecips.ethereumclassic.org/ECIPs/ecip-1088">https://ecips.ethereumclassic.org/ECIPs/ecip-1088</a>
* @return block number of Phoenix fork on Classic networks
*/
OptionalLong getAztlanBlockNumber();
OptionalLong getPhoenixBlockNumber();

Optional<BigInteger> getChainId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ public OptionalLong getAghartaBlockNumber() {
}

@Override
public OptionalLong getAztlanBlockNumber() {
return getOptionalLong("aztlanblock");
public OptionalLong getPhoenixBlockNumber() {
return getOptionalLong("phoenixblock");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions {
private final OptionalLong defuseDifficultyBombBlockNumber = OptionalLong.empty();
private final OptionalLong atlantisBlockNumber = OptionalLong.empty();
private final OptionalLong aghartaBlockNumber = OptionalLong.empty();
private final OptionalLong aztlanBlockNumber = OptionalLong.empty();
private final OptionalLong phoenixBlockNumber = OptionalLong.empty();
private Optional<BigInteger> chainId = Optional.empty();
private OptionalInt contractSizeLimit = OptionalInt.empty();
private OptionalInt stackSizeLimit = OptionalInt.empty();
Expand Down Expand Up @@ -171,8 +171,8 @@ public OptionalLong getAghartaBlockNumber() {
}

@Override
public OptionalLong getAztlanBlockNumber() {
return aztlanBlockNumber;
public OptionalLong getPhoenixBlockNumber() {
return phoenixBlockNumber;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion config/src/main/resources/classic.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"ecip1041Block": 5900000,
"atlantisBlock": 8772000,
"aghartaBlock": 9573000,
"aztlanBlock": 10500839,
"phoenixBlock": 10500839,
"ethash": {

}
Expand Down
2 changes: 1 addition & 1 deletion config/src/main/resources/kotti.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ecip1041Block": 0,
"atlantisBlock": 716617,
"aghartaBlock": 1705549,
"aztlanBlock": 2058191,
"phoenixBlock": 2200013,
"clique":{
"blockperiodseconds":15,
"epochlength":30000
Expand Down
2 changes: 1 addition & 1 deletion config/src/main/resources/mordor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"chainId": 63,
"atlantisBlock": 0,
"aghartaBlock": 301243,
"aztlanBlock": 778507,
"phoenixBlock": 999983,
"ethash": {}
},
"nonce": "0x0000000000000000",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@ public static ProtocolSpecBuilder<Void> aghartaDefinition(
.name("Agharta");
}

public static ProtocolSpecBuilder<Void> aztlanDefinition(
public static ProtocolSpecBuilder<Void> phoenixDefinition(
final Optional<BigInteger> chainId,
final OptionalInt configContractSizeLimit,
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason) {
return aghartaDefinition(
chainId, configContractSizeLimit, configStackSizeLimit, enableRevertReason)
.gasCalculator(AztlanGasCalculator::new)
.gasCalculator(IstanbulGasCalculator::new)
.evmBuilder(
gasCalculator ->
MainnetEvmRegistries.aztlan(gasCalculator, chainId.orElse(BigInteger.ZERO)))
MainnetEvmRegistries.istanbul(gasCalculator, chainId.orElse(BigInteger.ZERO)))
.precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::istanbul)
.name("Aztlan");
.name("Phoenix");
}

private static TransactionReceipt byzantiumTransactionReceiptFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ static EVM istanbul(final GasCalculator gasCalculator, final BigInteger chainId)
return new EVM(registry, gasCalculator);
}

static EVM aztlan(final GasCalculator gasCalculator, final BigInteger chainId) {
final OperationRegistry registry = new OperationRegistry();

registerAztlanOpcodes(registry, gasCalculator, Account.DEFAULT_VERSION, chainId);

return new EVM(registry, gasCalculator);
}

private static void registerFrontierOpcodes(
final OperationRegistry registry,
final GasCalculator gasCalculator,
Expand Down Expand Up @@ -286,18 +278,4 @@ private static void registerIstanbulOpcodes(
new SStoreOperation(gasCalculator, SStoreOperation.EIP_1706_MINIMUM),
Account.DEFAULT_VERSION);
}

private static void registerAztlanOpcodes(
final OperationRegistry registry,
final GasCalculator gasCalculator,
final int accountVersion,
final BigInteger chainId) {
registerConstantinopleOpcodes(registry, gasCalculator, accountVersion);
registry.put(
new ChainIdOperation(gasCalculator, Bytes32.leftPad(Bytes.of(chainId.toByteArray()))),
Account.DEFAULT_VERSION);
registry.put(
new SStoreOperation(gasCalculator, SStoreOperation.EIP_1706_MINIMUM),
Account.DEFAULT_VERSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ public ProtocolSchedule<C> createProtocolSchedule() {
isRevertReasonEnabled));
addProtocolSpec(
protocolSchedule,
config.getAztlanBlockNumber(),
ClassicProtocolSpecs.aztlanDefinition(
config.getPhoenixBlockNumber(),
ClassicProtocolSpecs.phoenixDefinition(
chainId,
config.getContractSizeLimit(),
config.getEvmStackSize(),
Expand Down Expand Up @@ -294,7 +294,7 @@ private void validateClassicForkOrdering() {
"DefuseDifficultyBomb", config.getDefuseDifficultyBombBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Atlantis", config.getAtlantisBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Agharta", config.getAghartaBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Aztlan", config.getAztlanBlockNumber(), lastForkBlock);
lastForkBlock = validateForkOrder("Phoenix", config.getPhoenixBlockNumber(), lastForkBlock);
assert (lastForkBlock >= 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,32 @@ public class DiscoveryConfiguration {
public static List<EnodeURL> MORDOR_BOOTSTRAP_NODES =
Collections.unmodifiableList(
Stream.of(
"enode://2b69a3926f36a7748c9021c34050be5e0b64346225e477fe7377070f6289bd363b2be73a06010fd516e6ea3ee90778dd0399bc007bb1281923a79374f842675a@51.15.116.226:30303",
"enode://a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd@51.158.191.43:38556",
"enode://5a1399e6ba3268721dd7656530cd81230dbeb950570c6e3ec2a45effc50c032f66633c5eaaa1a49c51ba1849db37a7bef6e402779ad12dc9943f117e058d7760@34.69.121.227:30303",
"enode://642cf9650dd8869d42525dbf6858012e3b4d64f475e733847ab6f7742341a4397414865d953874e8f5ed91b0e4e1c533dee14ad1d6bb276a5459b2471460ff0d@157.230.152.87:30303",
"enode://651b484b652c07c72adebfaaf8bc2bd95b420b16952ef3de76a9c00ef63f07cca02a20bd2363426f9e6fe372cef96a42b0fec3c747d118f79fd5e02f2a4ebd4e@51.158.190.99:45678",
"enode://859ed8c19ea04eaea41f1cf17c8d2710e2e0affb97328c8392a79f1764118edf2344f1941299f0d676772fa6054447e6f9b3af96444e350b417442bfd7cc832b@34.68.243.226:30303",
"enode://9b1bf9613d859ac2071d88509ab40a111b75c1cfc51f4ad78a1fdbb429ff2405de0dc5ea8ae75e6ac88e03e51a465f0b27b517e78517f7220ae163a2e0692991@51.158.190.99:30426",
"enode://534d18fd46c5cd5ba48a68250c47cea27a1376869755ed631c94b91386328039eb607cf10dd8d0aa173f5ec21e3fb45c5d7a7aa904f97bc2557e9cb4ccc703f1@51.158.190.99:30303",
"enode://0d70715514674189792de4ad294b658c96d0ec40fe517fbe9cb7949d3792f25f82357ec77d1bd8bed6ec719ca0c1d608bb34cc702bf3d4bb4507f7280f835452@154.5.137.161:61410",
"enode://f50f52b5fe18fd281748905bf5dad5439471f32cc02d99fecf960a983c1f4eba701ffca96afd2f2a68dcf6f97c5d02b566bafce1f361b51717e1a03c1dd9a836@157.230.42.102:30303",
"enode://111bd28d5b2c1378d748383fd83ff59572967c317c3063a9f475a26ad3f1517642a164338fb5268d4e32ea1cc48e663bd627dec572f1d201c7198518e5a506b1@88.99.216.30:45834",
"enode://07fa944c83597d5e935a2abe6194ed40fc7239e86111c971a43537a33d0184d1cd1b3f1291b8dd3bcfaebfbb802de77c843465a00065b39120c338fdd877ca4a@35.238.126.60:51240",
"enode://4ca79bbff7491fed82221259e3f27492e27b95b600594e2f8d5f1fa011123ea267e71873a0db3993e5109845d519d8b849ba2c7e4b48b09bedebb99e1c2ce304@35.238.132.8:30303",
"enode://06fdbeb591d26f53b2e7250025fe955ca013431ded930920cf1e3cd1f0c920e9a5e727949d209bc25a07288327b525279b11c5551315c50ff0db483e69fc159b@34.218.225.178:32000",
"enode://03b133f731049e3f7be827339c3759be92778c05e54a1847d178c0fdb56fa168aa1e7e61fc77791a7afdd0328a00318f73c01212eb3f3bbe919f5ce8f5b4a314@192.227.105.4:32000",
"enode://621e28e529146fd501709194885f50540c494f1a2985d1fb4ec8769226b5cb0b0d1a11545926077821474c2767cdd87888ead8a2509a2c9069dd5584e4b1c3b8@10.28.223.8:30000",
"enode://2592745efd35b4be443b8ee25fd2099de132e037951f9f6d3e8805e0a78f213537f71264b973f1a83a57372f57bbe6acac8d6ae678f39393221c045ccbe3b18c@51.15.116.226:30304",
"enode://a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd@51.15.116.226:30303",
"enode://c0afb552bfe932c72598caa245aef82d55c23555622c5ab946d4e49bb0ab694e46086dcff6793a606527f323ef94d0eb499d01ceb26aefb6fa3f8977105d7dd8@157.230.152.87:52138",
"enode://5a1399e6ba3268721dd7656530cd81230dbeb950570c6e3ec2a45effc50c032f66633c5eaaa1a49c51ba1849db37a7bef6e402779ad12dc9943f117e058d7760@35.225.124.17:39306",
"enode://15b6ae4e9e18772f297c90d83645b0fbdb56667ce2d747d6d575b21d7b60c2d3cd52b11dec24e418438caf80ddc433232b3685320ed5d0e768e3972596385bfc@51.158.191.43:41235",
"enode://5a1399e6ba3268721dd7656530cd81230dbeb950570c6e3ec2a45effc50c032f66633c5eaaa1a49c51ba1849db37a7bef6e402779ad12dc9943f117e058d7760@34.69.121.227:30303",
"enode://f840b007500f50c98ea6f9c9e56dabf4690bbbbb7036d43682c531204341aff8315013547e5bee54117eb22bd3603585ae6bf713d9fa710659533fcab65d5b84@34.69.50.155:42078",
"enode://b45f008ab8ad73966d0c8c0c923c50f47c0ae50c37a9ea05cc28b00cb94802145a4158412a526fdadd7e539db5eaab72f06a9046a34576ecf5a68efc41ba9d01@34.68.40.145:30303",
"enode://014ebf612cd362d87215d8668bd34a6db6c009a5b77c01e05fe638948054ebe91684ce05f1baf384ae9964316b9ac0eaf87dc43edd7e63467fb0b34db0f2c1d7@51.158.190.99:34567",
"enode://1f378945c9b2eeb292d910f461911fd99520a23beda1bc5c8aea12be09e249f8d92615aa3d4d75c938004db5281dabad4a9cf7a0f07ec7c1fc8e7721addc7c85@34.205.41.164:40218",
"enode://2b69a3926f36a7748c9021c34050be5e0b64346225e477fe7377070f6289bd363b2be73a06010fd516e6ea3ee90778dd0399bc007bb1281923a79374f842675a@51.15.116.226:30303",
"enode://a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd@51.158.191.43:38556",
"enode://f840b007500f50c98ea6f9c9e56dabf4690bbbbb7036d43682c531204341aff8315013547e5bee54117eb22bd3603585ae6bf713d9fa710659533fcab65d5b84@35.238.101.58:30303",
"enode://1813e90a0afdd7c1e4892c5376960e3577a9e6c5a4f86fa405a405c7421a4a1608248d77cc90333842f13d8954d82113dec480cfb76b4fef8cb475157cf4d5f2@10.28.224.3:30000",
"enode://06fdbeb591d26f53b2e7250025fe955ca013431ded930920cf1e3cd1f0c920e9a5e727949d209bc25a07288327b525279b11c5551315c50ff0db483e69fc159b@34.218.225.178:32000")
"enode://07fa944c83597d5e935a2abe6194ed40fc7239e86111c971a43537a33d0184d1cd1b3f1291b8dd3bcfaebfbb802de77c843465a00065b39120c338fdd877ca4a@35.238.126.60:30000",
"enode://617a2009783a09085ed0d5d5e7250e2e3c142f73448bf28200284bf4825c5926a80f3e9fb481edf38b89ade2aa0ad5a2f14cc935f3150e36e648eddda674fd70@35.225.5.185:51320")
.map(EnodeURL::fromString)
.collect(toList()));

Expand Down

0 comments on commit c955f67

Please sign in to comment.