Skip to content

fix: match filter criteria return None on contract creation failure#6820

Merged
akaladarshi merged 1 commit intomainfrom
akaladarshi/fix-match-filter-criteria
Mar 31, 2026
Merged

fix: match filter criteria return None on contract creation failure#6820
akaladarshi merged 1 commit intomainfrom
akaladarshi/fix-match-filter-criteria

Conversation

@akaladarshi
Copy link
Copy Markdown
Collaborator

@akaladarshi akaladarshi commented Mar 30, 2026

Summary of changes

Changes introduced in this pull request:

  • Returns None if the create trace doesn't contain any address (failed to deploy contract) instead of error
  • Includes the unit tests for the match_filter_criteria

Reference issue to close (if applicable)

Closes #6739

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Outside contributions

  • I have read and agree to the CONTRIBUTING document.
  • I have read and agree to the AI Policy document. I understand that failure to comply with the guidelines will lead to rejection of the pull request.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed trace filtering behavior when contract creations fail—now correctly reports non-matching results instead of producing errors.
  • Tests

    • Expanded test coverage for contract creation traces, including failed creation scenarios and various filter combinations.

@akaladarshi akaladarshi requested a review from a team as a code owner March 30, 2026 11:26
@akaladarshi akaladarshi requested review from LesnyRumcajs and hanabi1224 and removed request for a team March 30, 2026 11:26
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

Walkthrough

Updated EthTrace::match_filter_criteria to gracefully handle nil addresses in create trace results for failed contract creations. When a create action lacks an address, the method now returns non-matching (if a to_decoded_addresses filter exists) instead of throwing an error, aligning with updated Lotus behavior.

Changes

Cohort / File(s) Summary
Trace filter nil address handling
src/rpc/methods/eth/trace/types.rs
Replaced hard error for TraceAction::Create with None address with conditional logic that returns Ok(false) when to_decoded_addresses filter is provided, or uses zero address otherwise. Added helper constructors (call_trace, create_trace), address-list conversion helper, and new rstest cases covering successful/failed create scenarios and various filter combinations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

RPC

Suggested reviewers

  • hanabi1224
  • LesnyRumcajs
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements the primary requirements from issue #6739: conditional handling of failed creates based on filter presence and unit test coverage, but does not include the required integration test for failed CREATE2 scenarios. Add an integration test covering failed CREATE2 scenarios similar to Lotus's TestFEVMEthTraceFilterFailedCreate as specified in issue #6739.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: handling contract creation failure by returning None instead of erroring when address is absent.
Out of Scope Changes check ✅ Passed All changes are directly related to addressing the filter criteria issue for failed contract creations; no out-of-scope modifications were introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch akaladarshi/fix-match-filter-criteria
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch akaladarshi/fix-match-filter-criteria

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

@akaladarshi akaladarshi force-pushed the akaladarshi/fix-match-filter-criteria branch from 85356c5 to 267edfa Compare March 30, 2026 11:26
Copy link
Copy Markdown
Contributor

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/rpc/methods/eth/trace/types.rs`:
- Around line 1206-1357: Add an integration test that reproduces the Lotus-style
failed CREATE2 scenario (e.g., TestFEVMEthTraceFilterFailedCreate) to verify
end-to-end EthTraceFilter behavior instead of just unit-level
match_filter_criteria checks; implement a test that spins up the minimal
EVM/FEVM test harness used by other integration tests, submits a transaction
that triggers a failing CREATE2 (resulting in no created address and an error),
calls the RPC trace/filter endpoint (or constructs an EthTraceFilter run path)
to collect traces, and assert the returned traces and filtering behavior match
the expected failed-create semantics (use EthTrace, TraceAction::Create,
TraceResult::Create with address=None and error set, and ensure
EthTraceFilter/trace RPC returns/filters it accordingly).
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 87f0ca5a-17f0-4b25-8a87-f3baf913fb43

📥 Commits

Reviewing files that changed from the base of the PR and between 73f9afb and 267edfa.

📒 Files selected for processing (1)
  • src/rpc/methods/eth/trace/types.rs

@akaladarshi akaladarshi enabled auto-merge March 31, 2026 07:29
@akaladarshi akaladarshi added this pull request to the merge queue Mar 31, 2026
@akaladarshi akaladarshi removed this pull request from the merge queue due to a manual request Mar 31, 2026
@akaladarshi akaladarshi added the RPC requires calibnet RPC checks to run on CI label Mar 31, 2026
@akaladarshi akaladarshi added this pull request to the merge queue Mar 31, 2026
Merged via the queue into main with commit d52a294 Mar 31, 2026
61 checks passed
@akaladarshi akaladarshi deleted the akaladarshi/fix-match-filter-criteria branch March 31, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(eth): handle nil address in trace_filter for failed contract creates

2 participants