Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing validation of tx size according the max size allowed for a tx #2984

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class TxPendingValidator {
private static final Logger logger = LoggerFactory.getLogger("txpendingvalidator");

private static final long TX_MAX_SIZE = 128L * 1024; // 128KB
public static final long TX_MAX_SIZE = 128L * 1024; // 128KB

private final List<TxValidatorStep> validatorSteps = new LinkedList<>();

Expand Down
3 changes: 2 additions & 1 deletion rskj-core/src/main/java/co/rsk/net/messages/MessageType.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.List;

import static co.rsk.net.handler.TxPendingValidator.TX_MAX_SIZE;
import static org.ethereum.util.ByteUtil.byteArrayToInt;

/**
Expand Down Expand Up @@ -280,6 +281,6 @@ public static MessageType valueOfType(int type) {
}

private static boolean validTransactionLength(byte[] data) {
return data.length <= 1 << 19; /* 512KB */
return data.length <= TX_MAX_SIZE; /* 128KB */
}
}
Loading