Skip to content

Validate transaction size#254

Merged
manuelmauro merged 8 commits intomoonbeam-polkadot-stable2506from
manuel/validate-transaction-size
Mar 5, 2026
Merged

Validate transaction size#254
manuelmauro merged 8 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

@librelois
Copy link

@manuelmauro please update ethereum pin

manuelmauro and others added 4 commits March 2, 2026 17:34
- Inline format args in format!/assert! macros (uninlined_format_args)
- Remove unnecessary borrow on format! result (needless_borrows_for_generic_args)
- Remove useless .into() conversion for u64 (useless_conversion)
- Allow dead_code on JSON_RPC_ERROR_DEFAULT constant
Copy link

@librelois librelois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a commit with comments to clarify intents

@manuelmauro manuelmauro merged commit c28328d into moonbeam-polkadot-stable2506 Mar 5, 2026
2 of 4 checks passed
@librelois librelois deleted the manuel/validate-transaction-size branch March 5, 2026 11:35
manuelmauro added a commit that referenced this pull request Mar 10, 2026
Co-authored-by: Eloïs <c@elo.tf>
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.

3 participants