Skip to content

feat(node-tests): add proptest fuzzing support for transactions and blocks#81

Open
init4samwise wants to merge 1 commit intomainfrom
feat/fuzz-testing-eng-301
Open

feat(node-tests): add proptest fuzzing support for transactions and blocks#81
init4samwise wants to merge 1 commit intomainfrom
feat/fuzz-testing-eng-301

Conversation

@init4samwise
Copy link
Contributor

Summary

Add structurally aware fuzzing infrastructure using proptest crate for use in integration tests.

What Changed

Fuzzing Strategies (src/fuzz.rs)

  • Primitive strategies: arb_address, arb_b256, arb_u256, arb_tx_kind, arb_input_bytes, arb_access_list
  • Transaction strategies for all types:
    • arb_tx_legacy - Legacy (pre-EIP-2718) transactions
    • arb_tx_eip1559 - EIP-1559 fee market transactions
    • arb_tx_eip2930 - EIP-2930 access list transactions
    • arb_tx_eip4844 - EIP-4844 blob transactions
    • arb_transaction - Any supported transaction variant
  • Block strategies:
    • arb_header - Block headers
    • arb_block_body - Block bodies (with 0-8 transactions)
    • arb_block - Complete blocks (header + body)
  • Configurable via PROPTEST_CASES env var (default: 64)

Property-Based Tests (tests/fuzz.rs)

  • RLP encoding roundtrip tests for all transaction types
  • Transaction type preservation verification
  • Block header sealing/unsealing roundtrips
  • Block body transaction count validation
  • Complete block construction tests
  • Zenith coder compatibility tests (non-4844 pass, 4844 rejected)
  • RLP encoding roundtrips for headers

Why

Enables structurally aware fuzzing for integration tests, catching edge cases and invariant violations through randomized inputs. This satisfies the requirements for ENG-301.

Testing

Run fuzz tests with:

# Default (64 cases per test)
cargo test --package signet-node-tests --test fuzz

# Reduced cases for CI
PROPTEST_CASES=10 cargo test --package signet-node-tests --test fuzz

Closes ENG-301

…locks

Add structurally aware fuzzing infrastructure using proptest crate:

## Fuzzing Strategies (src/fuzz.rs)
- Primitive strategies: arb_address, arb_b256, arb_u256, arb_tx_kind
- Transaction strategies for all types: Legacy, EIP-1559, EIP-2930, EIP-4844
- Block strategies: arb_header, arb_block_body, arb_block
- Configurable via PROPTEST_CASES env var (default: 64)

## Property-Based Tests (tests/fuzz.rs)
- RLP encoding roundtrip tests for all transaction types
- Transaction type preservation verification
- Block header sealing/unsealing roundtrips
- Block body transaction count validation
- Complete block construction tests
- Zenith coder compatibility tests
- RLP encoding roundtrips for headers

This enables structurally aware fuzzing for integration tests, catching
edge cases and invariant violations through randomized inputs.

Closes ENG-301
@init4samwise init4samwise requested a review from a team as a code owner February 16, 2026 22:08
// ── Primitive strategies ────────────────────────────────────────────

/// Strategy for an arbitrary [`Address`].
pub fn arb_address() -> impl Strategy<Value = Address> {
Copy link
Member

Choose a reason for hiding this comment

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

this already exists in alloy with the arbitrary feature

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