Skip to content

Validate transaction size#254

Open
manuelmauro wants to merge 3 commits intomoonbeam-polkadot-stable2506from
manuel/validate-transaction-size
Open

Validate transaction size#254
manuelmauro wants to merge 3 commits intomoonbeam-polkadot-stable2506from
manuel/validate-transaction-size

Conversation

@manuelmauro
Copy link

@manuelmauro manuelmauro commented Feb 25, 2026

Summary

  • Add transaction size validation to eth_sendTransaction and eth_sendRawTransaction RPC endpoints
  • Reject transactions exceeding 128 KiB (matching geth/reth txMaxSize limit)
  • Prevents DoS attacks via oversized transactions with large access lists

Changes

  • Add encoded_length() and validate_size() methods to TransactionRequest
  • Add TX_SLOT_BYTE_SIZE (32 KiB) and DEFAULT_MAX_TX_INPUT_BYTES (128 KiB) constants
  • Validate size early in send_transaction before signing
  • Validate raw transaction bytes in send_raw_transaction before decoding

References

Note

Depends on: moonbeam-foundation/ethereum#2

Uses a temporary patch for the ethereum crate to access encoded_len(). This should be removed once the changes are released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants