Skip to content

eth/tracers: add tests for debug_standardTraceBadBlockToFile RPC method #31985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

winor30
Copy link

@winor30 winor30 commented Jun 8, 2025

This PR adds test coverage for debug_standardTraceBadBlockToFile method as part of addressing issue #30833.

The new test TestStandardTraceBadBlockToFile covers:

  • Basic bad block tracing with transactions
  • Error handling for non-existent blocks
  • Transaction filtering by hash
  • Bad blocks without transactions
  • Custom tracer configuration

Also adds helper functions createTestTransactions and setupBadBlock for creating test scenarios.

Fixes #30833

@winor30 winor30 requested a review from s1na as a code owner June 8, 2025 17:06
winor30 added 3 commits June 10, 2025 23:42
This commit introduces functions for creating test transactions and setting up bad blocks for testing purposes. It also adds a new test case for standard tracing of bad blocks, ensuring that various scenarios are covered, including tracing with and without transactions, and handling non-existent blocks.

Signed-off-by: katsumata <[email protected]>
This commit refactors the transaction creation logic in `createTestTransactions` to use a range loop for better readability. It also updates the bad block setup to use the latest parent block's properties consistently. Additionally, it removes unused functions and comments to clean up the code.

Signed-off-by: katsumata <[email protected]>
This commit adds a cleanup function to remove temporary files created during the `TestStandardTraceBadBlockToFile` test. The cleanup is performed using `t.Cleanup` to ensure that files are deleted after the test execution, improving resource management and preventing potential file clutter.

Signed-off-by: katsumata <[email protected]>
@winor30 winor30 force-pushed the add-trace-bad-block-to-file branch from c339e5c to 8b3c88c Compare June 10, 2025 15:06
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.

Write tests for debug tracing methods
1 participant