Skip to content

Fix p2p module in mempooloracle#12

Draft
tcrypt25519 wants to merge 8 commits intomempoolfrom
fix-p2p-mempooloracle-14553192464981682387
Draft

Fix p2p module in mempooloracle#12
tcrypt25519 wants to merge 8 commits intomempoolfrom
fix-p2p-mempooloracle-14553192464981682387

Conversation

@tcrypt25519
Copy link
Copy Markdown
Owner

Fixes various errors and warnings in mempooloracle's p2p module and examples:

  • Correctly retrieves the connection direction from network_handle.get_peer_by_id rather than a non-existent field on SessionInfo.
  • Conditionally exposes the connect_with_config function when the reth-p2p feature is enabled and returns a FeatureDisabled error otherwise.
  • Handles unused imports by moving them inside the module scope, removing them, or hiding behind cfg flags.
  • Fixes cargo test failures related to the feature not being enabled by default. cargo test --features reth-p2p,consensus-p2p now compiles and runs completely successfully.
  • Fixes a compilation error in cli_tool that omitted a ttfpt: bool argument by hardcoding false (default for that argument since it doesn't do anything).
  • Simplified clippy code issues (such as iter().flatten(), collapsible if blocks, unused variables).

PR created automatically by Jules for task 14553192464981682387 started by @tcrypt25519

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented Apr 20, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/mempooloracle/src/transport/p2p.rs  94% smaller
  crates/mempooloracle/src/runtime.rs  92% smaller
  crates/mempooloracle/examples/cli_tool.rs  91% smaller
  crates/mempooloracle/src/lib.rs  89% smaller
  crates/bulkmail/src/adapter/solana.rs  67% smaller
  crates/mempooloracle/tests/mempool_oracle.rs  51% smaller
  .github/workflows/ci.yml  28% smaller

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces conditional compilation for the reth-p2p feature, removes unused imports, and refactors several conditional blocks. A critical issue was identified regarding the use of let_chains (combining if let with &&), which is an unstable Rust feature and will cause compilation failures on stable toolchains. These instances should be reverted to nested if statements to maintain compatibility.

I am having trouble creating individual review comments. Click here to see my feedback.

crates/mempooloracle/src/lib.rs (387-390)

high

The use of let_chains (combining if let with &&) is an unstable Rust feature. This will break compilation on stable Rust toolchains. It is recommended to use nested if statements to maintain compatibility. This issue occurs in multiple places throughout the PR.

                    if let Ok(age) = now.duration_since(tx.seen_at) {
                        if age > one_hour {
                            keep = true;
                        }
                    }

crates/mempooloracle/src/transport/p2p.rs (718-722)

high

This is another instance of unstable let_chains usage. Please revert to nested if statements or use stable alternatives like is_some_and to ensure the code compiles on stable Rust.

                            if let Some(observed) = observed_block_from_beacon_block(block, peer_id) {
                                if let Some(last) = state.last_emitted_number {
                                    if observed.number > last {
                                        state.buffered.entry(observed.number).or_insert(observed);
                                    }
                                }
                            }

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