Skip to content

Commit c153333

Browse files
author
Michał Mrożek
authored
Merge pull request #644 from input-output-hk/etcm-28-petersbug-changes
[ETCM-28] petersburg changes
2 parents 1fd0a07 + 379ff3d commit c153333

File tree

22 files changed

+52
-8
lines changed

22 files changed

+52
-8
lines changed

src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainTestConfig.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ trait BlockchainTestConfig extends BlockchainConfig {
3939
override val atlantisBlockNumber: BigInt = Long.MaxValue
4040
override val aghartaBlockNumber: BigInt = Long.MaxValue
4141
override val phoenixBlockNumber: BigInt = Long.MaxValue
42+
override val petersburgBlockNumber: BigInt = Long.MaxValue
4243
}
4344

4445
object FrontierConfig extends BlockchainTestConfig {

src/it/scala/io/iohk/ethereum/txExecTest/ECIP1017Test.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ECIP1017Test extends FlatSpec with Matchers {
4545
override val atlantisBlockNumber: BigInt = Long.MaxValue
4646
override val aghartaBlockNumber: BigInt = Long.MaxValue
4747
override val phoenixBlockNumber: BigInt = Long.MaxValue
48+
override val petersburgBlockNumber: BigInt = Long.MaxValue
4849
}
4950
val ec = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(4))
5051

src/it/scala/io/iohk/ethereum/txExecTest/ForksTest.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class ForksTest extends FlatSpec with Matchers {
4242
override val atlantisBlockNumber: BigInt = Long.MaxValue
4343
override val aghartaBlockNumber: BigInt = Long.MaxValue
4444
override val phoenixBlockNumber: BigInt = Long.MaxValue
45+
override val petersburgBlockNumber: BigInt = Long.MaxValue
4546
}
4647

4748
val noErrors = a[Right[_, Seq[Receipt]]]

src/main/resources/chains/base.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
# https://github.com/ethereum/pm/issues/53
7171
constantinople-block-number = "1000000000000000000"
7272

73+
# Petersburg fork block number (ETH only)
74+
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1716.md
75+
petersburg-block-number = "1000000000000000000"
76+
7377
# DAO fork configuration (Ethereum HF/Classic split)
7478
# https://blog.ethereum.org/2016/07/20/hard-fork-completed/
7579
dao {

src/main/resources/chains/eth.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# Constantinople fork block number (ETH only)
1414
# https://github.com/ethereum/pm/issues/53
15-
constantinople-block-number = "7080000"
15+
constantinople-block-number = "7280000"
1616

1717
# EIP-170 max code size (Enabled from eip161-block-number)
1818
max-code-size = "24576"
@@ -37,6 +37,10 @@
3737
# https://ecips.ethereumclassic.org/ECIPs/ecip-1088
3838
phoenix-block-number = "1000000000000000000"
3939

40+
# Petersburg fork block number (ETH only)
41+
# https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1716.md
42+
petersburg-block-number = "7280000"
43+
4044
monetary-policy {
4145

4246
# Setting era-duration for eth and ropsten chain to big number is necessery to ensure

src/main/scala/io/iohk/ethereum/extvm/VMServer.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class VMServer(messageHandler: MessageHandler)
188188
accountStartNonce = conf.accountStartNonce,
189189
atlantisBlockNumber = BigInt(8772000), //TODO include atlantis block number in protobuf
190190
aghartaBlockNumber = BigInt(9573000), //TODO include agharta block number in protobuf
191+
petersburgBlockNumber = BigInt(10000000), //TODO include petersburg block number in protobuf
191192
phoenixBlockNumber = BigInt(10500839), //TODO include phoenix block number in protobuf
192193
chainId = 0x3d.toByte //TODO include chainId in protobuf
193194
)

src/main/scala/io/iohk/ethereum/jsonrpc/TestService.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class TestService(
6161

6262
private var etherbase: Address = consensusConfig.coinbase
6363

64+
// scalastyle:off method.length
6465
def setChainParams(request: SetChainParamsRequest): ServiceResponse[SetChainParamsResponse] = {
6566
val newBlockchainConfig = new BlockchainConfig {
6667
override val frontierBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.frontierBlockNumber
@@ -88,7 +89,9 @@ class TestService(
8889
override val atlantisBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.atlantisBlockNumber
8990
override val aghartaBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.aghartaBlockNumber
9091
override val phoenixBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.phoenixBlockNumber
92+
override val petersburgBlockNumber: BigInt = testLedgerWrapper.blockchainConfig.petersburgBlockNumber
9193
}
94+
// scalastyle:on method.length
9295

9396
val genesisData = GenesisData(
9497
nonce = ByteString(Hex.decode("00")),

src/main/scala/io/iohk/ethereum/utils/Config.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ trait BlockchainConfig {
373373
val atlantisBlockNumber: BigInt
374374
val aghartaBlockNumber: BigInt
375375
val phoenixBlockNumber: BigInt
376+
val petersburgBlockNumber: BigInt
376377
}
377378

378379
object BlockchainConfig {
@@ -419,6 +420,8 @@ object BlockchainConfig {
419420
override val aghartaBlockNumber: BigInt = BigInt(blockchainConfig.getString("agharta-block-number"))
420421

421422
override val phoenixBlockNumber: BigInt = BigInt(blockchainConfig.getString("phoenix-block-number"))
423+
424+
override val petersburgBlockNumber: BigInt = BigInt(blockchainConfig.getString("petersburg-block-number"))
422425
}
423426
}
424427
}

src/main/scala/io/iohk/ethereum/vm/BlockchainConfigForEvm.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ case class BlockchainConfigForEvm(
2020
accountStartNonce: UInt256,
2121
atlantisBlockNumber: BigInt,
2222
aghartaBlockNumber: BigInt,
23+
petersburgBlockNumber: BigInt,
2324
phoenixBlockNumber: BigInt,
2425
chainId: Byte
2526
)
@@ -39,6 +40,7 @@ object BlockchainConfigForEvm {
3940
accountStartNonce = accountStartNonce,
4041
atlantisBlockNumber = atlantisBlockNumber,
4142
aghartaBlockNumber = aghartaBlockNumber,
43+
petersburgBlockNumber = petersburgBlockNumber,
4244
phoenixBlockNumber = phoenixBlockNumber,
4345
chainId = chainId
4446
)

src/main/scala/io/iohk/ethereum/vm/EvmConfig.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ object EvmConfig {
3838
blockchainConfig.constantinopleBlockNumber -> ConstantinopleConfigBuilder,
3939
blockchainConfig.atlantisBlockNumber -> AtlantisConfigBuilder,
4040
blockchainConfig.aghartaBlockNumber -> AghartaConfigBuilder,
41+
blockchainConfig.petersburgBlockNumber -> PetersburgConfigBuilder,
4142
blockchainConfig.phoenixBlockNumber -> PhoenixConfigBuilder
4243
)
4344

@@ -96,6 +97,8 @@ object EvmConfig {
9697
opCodeList = ConstantinopleOpCodes
9798
)
9899

100+
val PetersburgConfigBuilder: EvmConfigBuilder = config => ConstantinopleConfigBuilder(config)
101+
99102
// Ethereum classic forks only
100103
val AtlantisConfigBuilder: EvmConfigBuilder = config => PostEIP160ConfigBuilder(config).copy(
101104
feeSchedule = new FeeSchedule.AtlantisFeeSchedule,

0 commit comments

Comments
 (0)