diff --git a/rskj-core/src/main/java/org/ethereum/config/Constants.java b/rskj-core/src/main/java/org/ethereum/config/Constants.java index 984c335d53d..a15186f4f8d 100644 --- a/rskj-core/src/main/java/org/ethereum/config/Constants.java +++ b/rskj-core/src/main/java/org/ethereum/config/Constants.java @@ -48,6 +48,9 @@ public class Constants { private static final long DEFAULT_MAX_TIMESTAMPS_DIFF_IN_SECS = 5L * 60; // 5 mins private static final long TESTNET_MAX_TIMESTAMPS_DIFF_IN_SECS = 120L * 60; // 120 mins + private static final int MAX_CONTRACT_SIZE = 0x6000; + private static final int MAX_INITCODE_SIZE = 2 * MAX_CONTRACT_SIZE; + private final byte chainId; private final boolean seedCowAccounts; @@ -214,7 +217,11 @@ public static BigInteger getTransactionGasCap() { } public static int getMaxContractSize() { - return 0x6000; + return MAX_CONTRACT_SIZE; + } + + public static int getMaxInitCodeSize() { + return MAX_INITCODE_SIZE; } public static int getMaxAddressByteLength() { diff --git a/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java b/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java index 72b787537ea..36ae79b5ebf 100644 --- a/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java +++ b/rskj-core/src/main/java/org/ethereum/config/blockchain/upgrades/ConsensusRule.java @@ -94,7 +94,8 @@ public enum ConsensusRule { RSKIP415("rskip415"), RSKIP417("rskip417"), RSKIP428("rskip428"), - RSKIP434("rskip434") + RSKIP434("rskip434"), + RSKIP438("rskip438") ; private String configKey; diff --git a/rskj-core/src/main/resources/expected.conf b/rskj-core/src/main/resources/expected.conf index 5b440a1367e..8596343733f 100644 --- a/rskj-core/src/main/resources/expected.conf +++ b/rskj-core/src/main/resources/expected.conf @@ -96,7 +96,8 @@ blockchain = { rskip417 = rskip428 = rskip434 = - } + rskip438 = + } } gc = { enabled = diff --git a/rskj-core/src/main/resources/reference.conf b/rskj-core/src/main/resources/reference.conf index 8228aa620d1..62b99aee98e 100644 --- a/rskj-core/src/main/resources/reference.conf +++ b/rskj-core/src/main/resources/reference.conf @@ -81,6 +81,7 @@ blockchain = { rskip417 = arrowhead600 rskip428 = lovell700 rskip434 = arrowhead631 + rskip438 = lovell700 } } gc = { diff --git a/rskj-core/src/test/java/org/ethereum/config/ConstantsTest.java b/rskj-core/src/test/java/org/ethereum/config/ConstantsTest.java index 50b46d84520..db56f1b260e 100644 --- a/rskj-core/src/test/java/org/ethereum/config/ConstantsTest.java +++ b/rskj-core/src/test/java/org/ethereum/config/ConstantsTest.java @@ -81,4 +81,14 @@ void rskip297ActivationTest() { assertEquals(300, Constants.testnet(activationConfig).getMaxTimestampsDiffInSecs(preRskip297Config)); assertEquals(7200, Constants.testnet(activationConfig).getMaxTimestampsDiffInSecs(postRskip297Config)); } + + @Test + void maxInitcodeSizeTest() { + //given + int maxInitCodeSizeExpected = 49152; + //when + int maxInitCodeSize = Constants.getMaxInitCodeSize(); + //then + assertEquals(maxInitCodeSizeExpected, maxInitCodeSize); + } } diff --git a/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java b/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java index 0593855f481..cff14eb6cef 100644 --- a/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java +++ b/rskj-core/src/test/java/org/ethereum/config/blockchain/upgrades/ActivationConfigTest.java @@ -123,6 +123,7 @@ class ActivationConfigTest { " rskip417: arrowhead600", " rskip434: arrowhead631", " rskip428: lovell700", + " rskip438: lovell700", "}" ));