Skip to content

test: add txpool config upstream regression tests - #266

Open
NikhilSharmaWe wants to merge 3 commits into
berachain:mainfrom
NikhilSharmaWe:pool-config
Open

test: add txpool config upstream regression tests#266
NikhilSharmaWe wants to merge 3 commits into
berachain:mainfrom
NikhilSharmaWe:pool-config

Conversation

@NikhilSharmaWe

@NikhilSharmaWe NikhilSharmaWe commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Adds upstream regression tests for txpool configuration (closes #88).

Pinned limits - subpool sizes, account slots, price bumps, gas limit, max tx input bytes, and queued lifetime are defined in src/pool/config.rs and compared against Reth v1.11.4 exported constants. Tests fail on dependency bumps so we explicitly choose to adopt or override.

Unpinned inherited fields - validation tasks, buffer sizes, local tx flags, and backup settings are still inherited from Reth; separate tests catch drift there too.

Runtime wiring - main.rs calls berachain_txpool_defaults().try_init() before CLI parsing (same pattern as engine defaults). Integration tests cover the try_init -> TxPoolArgs::default() path and live upstream max_batch_size.

Pool builder - BERACHAIN_ACCEPTS_EIP7594 replaces hardcoded .no_eip7594() (BRIP-0010 policy).

Test plan

  • cargo test --lib pool::config
  • cargo test --test txpool_defaults
  • cargo test --test reth_txpool_upstream

Summary by CodeRabbit

  • New Features

    • Added Berachain-specific transaction pool defaults, applied earlier during startup to ensure consistent initialization.
    • Exposed and applied Berachain-pinned transaction pool limits and fee/gas parameters.
  • Bug Fixes

    • Updated transaction pool behavior for EIP-7594 handling to follow the Berachain “disabled” setting.
  • Tests

    • Added regression tests verifying Berachain-pinned and inherited upstream transaction pool defaults match expected values.

Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
Copilot AI review requested due to automatic review settings June 25, 2026 18:36
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59520122-b3aa-4e03-a84c-da7ad818f478

📥 Commits

Reviewing files that changed from the base of the PR and between 551d65c and 12d9da3.

📒 Files selected for processing (2)
  • src/pool/config.rs
  • src/pool/mod.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/pool/config.rs
  • src/pool/mod.rs

📝 Walkthrough

Walkthrough

Adds Berachain txpool defaults, initializes them during startup, routes pool EIP-7594 handling through config, and adds regression tests for pinned and inherited txpool arguments.

Changes

Txpool defaults and validation pinning

Layer / File(s) Summary
Pinned constants and default builder
src/pool/config.rs
Defines Berachain txpool constants and derives DefaultTxPoolValues from them.
Startup and pool wiring
src/main.rs, src/pool/mod.rs, tests/txpool_defaults.rs
Exports the config module, initializes txpool defaults before CLI parsing, sets pool EIP-7594 behavior from the new flag, and exercises the startup path in an integration test.
Assertions and regression tests
src/pool/config.rs, tests/reth_txpool_upstream.rs
Adds helpers and tests that compare pinned txpool fields and inherited defaults against upstream Reth values.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant main_fn as "main()"
  participant defaults_fn as "berachain_txpool_defaults()"
  participant engine as "DefaultEngineValues"
  participant build_fn as "build_pool()"
  participant config as "pool::config"
  main_fn->>defaults_fn: create txpool defaults
  defaults_fn-->>main_fn: DefaultTxPoolValues
  main_fn->>engine: try_init(DefaultTxPoolValues) before CLI parsing
  build_fn->>config: set_eip7594(BERACHAIN_ACCEPTS_EIP7594)
Loading

Possibly related PRs

  • berachain/bera-reth#227: Also initializes DefaultEngineValues early in src/main.rs, which shares the same startup-default path extended here with txpool defaults.
  • berachain/bera-reth#248: Adjusts pool-side EIP-7594 handling, which is directly related to the new set_eip7594(BERACHAIN_ACCEPTS_EIP7594) wiring in src/pool/mod.rs.

Suggested reviewers: calbera, fridrik01

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: adding txpool config regression tests.
Linked Issues check ✅ Passed The PR adds regression checks for pinned and inherited txpool values so upstream drift will fail tests, matching issue #88.
Out of Scope Changes check ✅ Passed The code changes are all supporting the txpool regression testing and config pinning goals, with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds txpool configuration regression coverage and wires Berachain-specific txpool defaults into the node startup path, so upstream Reth default changes surface as test failures that require an explicit adopt/override decision.

Changes:

  • Add integration tests that validate the berachain_txpool_defaults().try_init()TxPoolArgs::default() path and track upstream drift.
  • Introduce src/pool/config.rs with pinned txpool limits plus assertions for inherited/unpinned defaults.
  • Replace hardcoded .no_eip7594() with a policy constant (BERACHAIN_ACCEPTS_EIP7594) when building the txpool validator.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/txpool_defaults.rs Integration test ensuring txpool defaults are initialized before TxPoolArgs::default() and match pinned + inherited expectations.
tests/reth_txpool_upstream.rs Integration test validating an inherited default (max_batch_size) against live upstream TxPoolArgs::default().
src/pool/mod.rs Uses a single policy constant to control EIP-7594 acceptance when building the txpool validator.
src/pool/config.rs Defines pinned Berachain txpool defaults and regression assertions vs upstream constants.
src/main.rs Initializes Berachain txpool defaults via try_init() before CLI parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pool/config.rs
Comment on lines +23 to +26
/// Inherited from reth v1.11.4 (`DefaultTxPoolValues::default().max_batch_size`).
/// No upstream named constant; validated live in `tests/txpool_defaults.rs`.
#[doc(hidden)]
pub const INHERITED_TXPOOL_MAX_BATCH_SIZE: usize = 1;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

resolved in 750213f

Comment thread src/pool/config.rs Outdated
Comment on lines +17 to +18
/// Inherited from reth v1.11.4 (`MIN_PROTOCOL_BASE_FEE`). Berachain chain min is 1 gwei.
pub const MINIMAL_PROTOCOL_BASEFEE: u64 = 7;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

resolved in 750213f

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/reth_txpool_upstream.rs (1)

1-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Test correctness depends on this remaining the only test in the binary.

The module doc correctly notes that TxPoolArgs::default() must observe upstream values before any try_init runs. Since this isolation is enforced only by a comment, a future contributor adding a second test (or one that triggers try_init) into this binary could silently invalidate the assertion. Consider asserting the invariant defensively or keeping a prominent marker so the constraint isn't lost.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/reth_txpool_upstream.rs` around lines 1 - 12, The test binary currently
relies on a comment-only invariant that
`inherited_max_batch_size_matches_reth_upstream` remains the only test so
`TxPoolArgs::default()` is checked before any `try_init` runs. Add a defensive
guard in this test module to enforce that isolation explicitly, or introduce a
clear marker/structure around `inherited_max_batch_size_matches_reth_upstream`
so future additions that could trigger `try_init` are prevented from silently
breaking the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pool/config.rs`:
- Around line 17-18: Confirm whether MINIMAL_PROTOCOL_BASEFEE in
src/pool/config.rs is intentionally set to 7 wei despite the Berachain chain
minimum being 1 gwei, and clarify the surrounding doc comment accordingly. If
the 7-wei inherited value is deliberate, update the comment near
MINIMAL_PROTOCOL_BASEFEE to explain that it is the txpool’s protocol floor from
Reth and separate it from the chain/block minimum; if not, adjust the constant
to match the intended pool policy. Refer to MINIMAL_PROTOCOL_BASEFEE and the
comment text so the distinction is explicit.

---

Nitpick comments:
In `@tests/reth_txpool_upstream.rs`:
- Around line 1-12: The test binary currently relies on a comment-only invariant
that `inherited_max_batch_size_matches_reth_upstream` remains the only test so
`TxPoolArgs::default()` is checked before any `try_init` runs. Add a defensive
guard in this test module to enforce that isolation explicitly, or introduce a
clear marker/structure around `inherited_max_batch_size_matches_reth_upstream`
so future additions that could trigger `try_init` are prevented from silently
breaking the assertion.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 87f5c386-036b-4373-90ab-ba60ed88b8bf

📥 Commits

Reviewing files that changed from the base of the PR and between 9352f11 and 551d65c.

📒 Files selected for processing (5)
  • src/main.rs
  • src/pool/config.rs
  • src/pool/mod.rs
  • tests/reth_txpool_upstream.rs
  • tests/txpool_defaults.rs

Comment thread src/pool/config.rs Outdated
Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>
@NikhilSharmaWe

Copy link
Copy Markdown
Author

@calbera PTAL, thanks

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.

test: regression tests for pool configuration

2 participants