Skip to content

Commit

Permalink
Merge branch 'feature/introduce_initcode_size_limit' into feature/ini…
Browse files Browse the repository at this point in the history
…tcode_size_limit_using_transaction_creations
  • Loading branch information
fmacleal committed Sep 6, 2024
2 parents ca9b5ce + f5da98a commit 2a0a10b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions rskj-core/src/main/java/org/ethereum/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ 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 static final long MAX_CONTRACT_SIZE = 0x6000;
private static final long MAX_INITCODE_SIZE = 2 * MAX_CONTRACT_SIZE;

private final byte chainId;
private final boolean seedCowAccounts;
Expand Down Expand Up @@ -215,11 +215,11 @@ public static BigInteger getTransactionGasCap() {
return TRANSACTION_GAS_CAP;
}

public static int getMaxContractSize() {
public static long getMaxContractSize() {
return MAX_CONTRACT_SIZE;
}

public static int getMaxInitCodeSize() {
public static long getMaxInitCodeSize() {
return MAX_INITCODE_SIZE;
}

Expand Down
4 changes: 2 additions & 2 deletions rskj-core/src/main/java/org/ethereum/vm/program/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -1643,11 +1643,11 @@ public static StackTooSmallException tooSmallStack(@Nonnull Program program, int
return new StackTooSmallException("Expected stack size %d but actual %d, tx: %s", expectedSize, actualSize, extractTxHash(program));
}

public static RuntimeException tooLargeContractSize(@Nonnull Program program, int maxSize, int actualSize) {
public static RuntimeException tooLargeContractSize(@Nonnull Program program, long maxSize, long actualSize) {
return new RuntimeException(format("Maximum contract size allowed %d but actual %d, tx: %s", maxSize, actualSize, extractTxHash(program)));
}

public static RuntimeException tooLargeInitCodeSize(@Nonnull Program program, int maxSize, int actualSize) {
public static RuntimeException tooLargeInitCodeSize(@Nonnull Program program, long maxSize, long actualSize) {
return new RuntimeException(format("Maximum initcode size allowed %d but actual was %d, tx: %s", maxSize, actualSize, extractTxHash(program)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ void rskip297ActivationTest() {
@Test
void maxInitcodeSizeTest() {
//given
int maxInitCodeSizeExpected = 49152;
long maxInitCodeSizeExpected = 49152L;
//when
int maxInitCodeSize = Constants.getMaxInitCodeSize();
long maxInitCodeSize = Constants.getMaxInitCodeSize();
//then
assertEquals(maxInitCodeSizeExpected, maxInitCodeSize);
}
Expand Down

0 comments on commit 2a0a10b

Please sign in to comment.