Skip to content
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

debug_api: Implement debug_traceBlockByHash API endpoint #63

Closed
4 tasks
MexicanAce opened this issue Aug 19, 2023 · 0 comments · Fixed by #168
Closed
4 tasks

debug_api: Implement debug_traceBlockByHash API endpoint #63

MexicanAce opened this issue Aug 19, 2023 · 0 comments · Fixed by #168
Labels
challenging 🏴‍☠️ Indicates a difficult item debug_api 🔍 Indicates debug namespace api tasks p2 🟡 Indicates moderately high priority item

Comments

@MexicanAce
Copy link
Collaborator

MexicanAce commented Aug 19, 2023

Description:

The debug_traceBlockByHash endpoint needs to be implemented. The purpose of this endpoint is to return structured traces for operations within the block of the specified block hash.

// Interface in the `trait`
#[rpc(name = "debug_traceBlockByHash")]
fn trace_block_by_hash(
    &self,
    hash: H256,
    options: Option<TracerConfig>,
) -> BoxFuture<Result<Vec<ResultDebugCall>>>;

// Actual code in the `impl`
fn trace_block_by_hash(
    &self,
    hash: H256,
    options: Option<TracerConfig>,
) -> BoxFuture<Result<Vec<ResultDebugCall>>> {
    // TODO: Solution here
}

Expected response

Command returns proper response:

curl -X POST http://localhost:8011 \
     -H "Content-Type: application/json" \
     --data '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "debug_traceBlockByHash",
       "params": ["0x0000000000000000000000000000000000000000000000000000000000000000"]
     }'

Requirements:

  1. Implement the API:

    • The endpoint should return a populated Vec<ResultDebugCall>.
    • Ensure the method executes the call reliably and efficiently.
    • Ensure errors are properly returned (with revert reasons and data).
  2. Unit Tests:

    • Write unit tests to verify the functionality of the trace_block_by_hash method.
    • Ensure coverage for multiple edge-case scenarios.
  3. Documentation:

    • Add inline Rust documentation (/// comments) detailing the method's purpose, return values, and any potential edge cases or error scenarios.
    • Update SUPPORTED_APIS.md with updated documentation and examples.
    • (Optional) Add request to test_endpoints.http for easier manual verification.

Task Checklist:

  • Implement the trace_block_by_hash method.
  • Write unit tests for the trace_block_by_hash method.
  • Add inline documentation for the debug_traceBlockByHash endpoint.
  • Update documentation for the debug_traceBlockByHash endpoint in SUPPORTED_APIS.md.

Additional Notes:

If you're an external contributor looking to take on this issue, please comment below to let us know you're working on it. If you need further clarification on the requirements or need assistance with anything related to the implementation, feel free to ask!

@MexicanAce MexicanAce added debug_api 🔍 Indicates debug namespace api tasks p2 🟡 Indicates moderately high priority item challenging 🏴‍☠️ Indicates a difficult item labels Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenging 🏴‍☠️ Indicates a difficult item debug_api 🔍 Indicates debug namespace api tasks p2 🟡 Indicates moderately high priority item
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant