Avoid blowing the stack with serde_stacker#4617
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Claude finished @MartinquaXD's task in 2m 25s —— View job PR Review: Avoid blowing the stack with
|
There was a problem hiding this comment.
Code Review
This pull request integrates serde_stacker to deserialize transaction call frames directly into the domain CallFrame struct, preventing stack overflows on deeply nested call stacks. A critical compilation error was identified in crates/autopilot/src/infra/blockchain/mod.rs where the error type returned by serde_stacker does not match the expected serde_json::Error in Error::DeserializationFailed. A code suggestion has been provided to map the error types correctly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // deserialize into the domain type. | ||
| /// Call frames of a transaction. | ||
| #[derive(Clone, Debug, Default)] | ||
| #[derive(Clone, Debug, Default, Deserialize)] |
There was a problem hiding this comment.
Now that CallFrame derives Deserialize and is deserialized directly, the From<alloy::rpc::types::trace::geth::CallFrame> impl below (lines 26–35) becomes dead code — its only caller was the GethTrace::CallTracer(call_frame) => call_frame.into() arm that this PR removes. Nothing else in the workspace uses it (the settlement tests build CallFrame { .. } struct literals directly). Since it's a trait impl on public types the compiler won't flag it, so it'll silently rot. Suggest removing it.
Description
Follow up to #4615 (comment).
While the concerns about blowing the stack limit are very likely non-issues protecting against the panic is also not very hard so let's be on the safe side.
Changes
use
serde_stacker::Deserializerwhich manages the serde's stack while recursing through the object in a growableVecinstead of using the stack directly.How to test
Used the not-checked in test again to see that everything deserializes correctly. This surfaced that we need
#[serde(default)]on thecallsfield.