Skip to content

Conversation

d4mr
Copy link
Member

@d4mr d4mr commented Sep 11, 2025

Summary by CodeRabbit

  • New Features
    • Automatic Flashblocks support enabled for Base Mainnet and Base Sepolia, improving pending-state handling and transaction count retrieval for faster, more reliable confirmations.
  • Chores
    • Minor code cleanup to remove an unused import.

- Introduced a new extension trait `FlashblocksSupport` for `RpcWithBlock` to automatically select the appropriate block tag based on the chain ID.
- Updated the `EoaExecutorWorker` to utilize the new `with_flashblocks_support` method when fetching the transaction count, enhancing compatibility with specific chains.

These changes improve the flexibility and functionality of the RPC provider in handling flashblocks support.
Copy link

linear bot commented Sep 11, 2025

Copy link

coderabbitai bot commented Sep 11, 2025

Walkthrough

Adds a FlashblocksSupport extension trait to adapt RPC block tags for specific chain IDs and integrates it into the EOA confirmation path for get_transaction_count. Also removes an unused import in the EIP-7702 executor confirm module. No public API removals.

Changes

Cohort / File(s) Summary
Flashblocks support trait and integration
executors/src/lib.rs, executors/src/eoa/worker/confirm.rs
Adds public trait FlashblocksSupport with with_flashblocks_support(chain_id) for alloy::providers::RpcWithBlock. For chain IDs 8453 and 84532, switches to pending() block tag; otherwise no-op. Applies this extension to the provider get_transaction_count call in EOA confirm worker.
Import cleanup
executors/src/eip7702_executor/confirm.rs
Removes unused import alloy::transports::RpcError. No functional changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant CW as ConfirmWorker (EOA)
  participant P as Provider
  participant R as RpcWithBlock
  participant FB as FlashblocksSupport
  participant N as Node

  CW->>P: get_transaction_count(address)
  P->>R: build RPC call (with block tag)
  R->>FB: with_flashblocks_support(chain_id)
  alt chain_id ∈ {8453, 84532}
    FB-->>R: apply pending()
  else other chains
    FB-->>R: no-op (keep default)
  end
  R->>N: eth_getTransactionCount (with selected block tag)
  N-->>R: result
  R-->>P: count
  P-->>CW: count
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks (3 passed, 1 warning, 1 inconclusive)

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Linked Issues Check ❓ Inconclusive The PR partially addresses linked issue BLD-236 by adding FlashblocksSupport and applying it to the get_transaction_count RPC path (enabling pending/block-tag selection for Base chain IDs 8453 and 84532), which is a required building block for Base preconfirmations; however, it does not implement the full "base preconfirmations" flow, an execution-mode flag, Engine Core/Cloud migration work, or accompanying tests and documentation requested by the issue, so the overall issue objectives are not fully met. Recommend continuing by implementing the full preconfirmation flow or an execution-mode flag, adding tests and documentation, and clarifying migration/compatibility expectations so the linked issue can be considered implemented.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Flashblocks Support" is concise and accurately describes the primary change in this PR (adding a FlashblocksSupport trait/impl and using it to select pending block behavior for specific Base chain IDs), so it clearly communicates the main intent to a reviewer scanning history.
Out of Scope Changes Check ✅ Passed Changes appear in-scope for the stated goal of enabling flashblocks/preconfirm-related behavior: the addition of FlashblocksSupport, its impl, and its usage are directly related, and the only other change is removal of an unused import (harmless cleanup); the notable side-effect is that a new public trait is exported from the crate root, which modifies the crate's public API and should be intentional.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BLD-236

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
executors/src/lib.rs (2)

21-26: Centralize chain IDs and make behavior easier to extend

Inline literals make it easy to miss future network additions. Consider a small refactor to centralize supported chain IDs.

Apply this diff:

-    fn with_flashblocks_support(self, chain_id: u64) -> Self {
-        match chain_id {
-            8453 | 84532 => self.pending(), // Base Mainnet | Base Sepolia
-            _ => self,
-        }
-    }
+    fn with_flashblocks_support(self, chain_id: u64) -> Self {
+        const CHAINS_WITH_FLASHBLOCKS: &[u64] = &[8453, 84532]; // Base Mainnet, Base Sepolia
+        if CHAINS_WITH_FLASHBLOCKS.contains(&chain_id) {
+            self.pending()
+        } else {
+            self
+        }
+    }

10-13: Minor: document semantics more explicitly

Add a note that this intentionally selects the “pending” tag to count preconfirmed/pool nonces on Base, which can return values ahead of latest/safe. This helps readers understand why confirmation logic may see higher nonces.

executors/src/eoa/worker/confirm.rs (1)

36-41: Using pending nonce on Base aligns with preconfirmations; consider a safety toggle + observability

The placement before .await is correct so the provider call uses the pending tag on Base chains. Two optional enhancements:

  • Add a config/feature flag to flip this quickly if providers regress (aligns with “execution mode flag” in the issue).
  • Emit a trace when pending is used to aid debugging spikes in “fetched lower than cached” warnings caused by pending vs latest differences.

Example (conceptual):

-            .get_transaction_count(self.eoa)
-            .with_flashblocks_support(self.chain.chain_id())
+            .get_transaction_count(self.eoa)
+            .with_flashblocks_support(self.chain.chain_id())

Plus (elsewhere): plumb an enable_preconfirmations option and guard the call, and add a tracing::trace! indicating the chosen block tag.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5f8cefd and 09341a4.

📒 Files selected for processing (3)
  • executors/src/eip7702_executor/confirm.rs (0 hunks)
  • executors/src/eoa/worker/confirm.rs (2 hunks)
  • executors/src/lib.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • executors/src/eip7702_executor/confirm.rs
🧰 Additional context used
🧬 Code graph analysis (1)
executors/src/lib.rs (2)
core/src/chain.rs (2)
  • chain_id (31-31)
  • chain_id (74-76)
core/src/execution_options/mod.rs (1)
  • chain_id (179-181)
🔇 Additional comments (3)
executors/src/lib.rs (1)

15-27: Clean extension and correct generics; approach looks solid

Implementing a local extension trait over RpcWithBlock to inject .pending() conditionally is clean and composes well with the builder API. The generic bounds look appropriate (Map: Clone is needed for .pending() to clone the mapper).

executors/src/eoa/worker/confirm.rs (2)

5-18: Importing the extension trait is required for method resolution — good catch

Bringing crate::FlashblocksSupport into scope ensures .with_flashblocks_support(..) is available on the RPC builder.


36-41: Sanity-check other call sites for consistency

Found get_transaction_count calls that do NOT chain .with_flashblocks_support(...):

  • eip7702-core/src/delegated_account.rs:93
  • eip7702-core/tests/integration_tests.rs:431, 507, 625

Confirm whether omission is intentional; if not, add .with_flashblocks_support(self.chain.chain_id()) to avoid divergent nonce behavior.

@d4mr d4mr merged commit 1453e7a into main Sep 11, 2025
3 checks passed
@d4mr d4mr deleted the BLD-236 branch September 11, 2025 15:48
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.

1 participant