- 
                Notifications
    You must be signed in to change notification settings 
- Fork 292
[rpc] Prestate and statediff tracers #2273
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements prestate and statediff tracers for Ethereum debug tracing functionality. The implementation replaces the previous boolean trace parameter with a more sophisticated MonadTracer enum that supports different tracing modes including call tracing, prestate tracing, and state diff tracing.
Key changes include:
- Introduction of MonadTracerenum with support for NoopTracer, CallTracer, PreStateTracer, and StateDiffTracer
- Enhanced tracer configuration with diff mode support for prestate tracer
- Updated debug trace call functionality to handle different tracer output formats (RLP for call tracer, CBOR for prestate/statediff tracers)
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description | 
|---|---|
| monad-ethcall/src/lib.rs | Adds MonadTracer enum and updates eth_call function to use tracer instead of boolean trace parameter | 
| monad-rpc/src/handlers/eth/call.rs | Updates call handling to support different tracer types and output formats with CBOR decoding | 
| monad-rpc/src/handlers/eth/gas.rs | Updates gas estimation to use MonadTracer::NoopTracer instead of boolean false | 
| monad-rpc/src/handlers/debug.rs | Enhances TracerObject with TracerConfig supporting diff_mode and only_top_call options | 
| monad-rpc/Cargo.toml | Adds serde_cbor dependency for CBOR serialization support | 
| Cargo.toml | Adds serde_cbor workspace dependency | 
| monad-cxx/monad-execution | Updates submodule commit reference | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // TODO(dhil): Bizarrely substituting this type alias in below causes a type error. | ||
| type BoxRawValue = Box<RawValue>; | ||
| // error[E0107]: missing generics for struct `Box` | ||
| // --> monad-rpc/src/handlers/eth/call.rs:743:20 | ||
| // | | ||
| // 743 | ) -> JsonRpcResult<Box<RawValue>> { | ||
| // | ^^^ expected at least 1 generic argument | 
    
      
    
      Copilot
AI
    
    
    
      Sep 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This TODO comment with error message should be removed as it's just documenting a compiler error that doesn't provide value to future maintainers. If the type alias cannot be used due to compiler limitations, either use the full type directly or find an alternative solution.
| }) | ||
| } | ||
|  | ||
| MonadTracer::NoopTracer => Ok(Box::<RawValue>::default()), | 
    
      
    
      Copilot
AI
    
    
    
      Sep 3, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using Box::<RawValue>::default() creates an empty RawValue which may not be the intended behavior for a noop tracer. This could cause issues when the response is serialized. Consider returning a valid JSON value like serde_json::value::to_raw_value(&serde_json::Value::Null) instead.
| MonadTracer::NoopTracer => Ok(Box::<RawValue>::default()), | |
| MonadTracer::NoopTracer => serde_json::value::to_raw_value(&serde_json::Value::Null) | |
| .map_err(|e| JsonRpcError::internal_error(format!("json serialization error: {}", e))), | 
| Moved to #2275. | 
No description provided.