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_traceCall API endpoint #61

Closed
4 tasks
MexicanAce opened this issue Aug 19, 2023 · 1 comment
Closed
4 tasks

debug_api: Implement debug_traceCall API endpoint #61

MexicanAce opened this issue Aug 19, 2023 · 1 comment
Labels
debug_api 🔍 Indicates debug namespace api tasks medium 🚩 Indicates moderately difficult item p2 🟡 Indicates moderately high priority item

Comments

@MexicanAce
Copy link
Collaborator

MexicanAce commented Aug 19, 2023

Description:

The debug_traceCall endpoint needs to be implemented. The purpose of this endpoint is to perform a call and return structured traces of the execution.

// Interface in the `trait`
#[rpc(name = "debug_traceCall")]
fn trace_call(
    &self,
    request: CallRequest,
    block: Option<BlockId>,
    options: Option<TracerConfig>,
) -> BoxFuture<Result<DebugCall>>;

// Actual code in the `impl`
fn trace_call(
    &self,
    request: CallRequest,
    block: Option<BlockId>,
    options: Option<TracerConfig>,
) -> BoxFuture<Result<DebugCall>> {
    // 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_traceCall",
       "params": [{
          "to": "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049",
          "data": "0x0000",
          "from": "0xa61464658AfeAf65CccaaFD3a512b69A83B77618",
          "gas": "0x0000",
          "gasPrice": "0x0000",
          "value": "0x0000",
          "nonce": "0x0000"
        }]
     }'

Requirements:

  1. Implement the API:

    • The endpoint should return a populated DebugCall.
    • 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_call method.
    • Ensure coverage for scenarios where the call executes properly, reverts with a reason, has both Call and Create in the DebugCall traces.
  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_call method.
  • Write unit tests for the trace_call method.
  • Add inline documentation for the debug_traceCall endpoint.
  • Update documentation for the debug_traceCall 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 medium 🚩 Indicates moderately difficult item and removed challenging 🏴‍☠️ Indicates a difficult item labels Aug 19, 2023
@MexicanAce
Copy link
Collaborator Author

MexicanAce commented Oct 9, 2023

Implemented in #151 by @grw-ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug_api 🔍 Indicates debug namespace api tasks medium 🚩 Indicates moderately difficult item p2 🟡 Indicates moderately high priority item
Projects
None yet
Development

No branches or pull requests

1 participant