-
Notifications
You must be signed in to change notification settings - Fork 236
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
[Bug] recursion limit exceeded when deserialization #1156
Comments
These might be related and helpful: ethereum/go-ethereum#22857 and serde-rs/json#509 |
If you want to deserialize that kind of heavily nested structure, enable the serde_json "disable_recursion_limit" feature yourself. This is not suitable to enable in Alloy itself. |
I ran into the same issue not too long ago. The problem with using the It would be good if alloy could somehow at least expose the option to the outside without the need of forking the project. After all this effectively currently disables the ability to work with certain transactions on the blockchain. |
There is nothing that we need to expose, you have to add |
The let mut deserializer = serde_json::Deserializer::from_str(&json);
deserializer.disable_recursion_limit(); Since the deserializer is instantiated inside the |
The possible modification of /// Attempt to deserialize the `Ok(_)` variant of an [`RpcResult`].
pub fn try_deserialize_ok<'a, J, T, E, ErrResp>(
result: RpcResult<J, E, ErrResp>,
) -> RpcResult<T, E, ErrResp>
where
J: Borrow<RawValue> + 'a,
T: RpcReturn,
ErrResp: RpcReturn,
{
let json = result?;
let json = json.borrow().get();
trace!(ty=%std::any::type_name::<T>(), json, "deserializing response");
let mut deserializer = serde_json::Deserializer::from_str(&json);
deserializer.disable_recursion_limit();
let deserializer = serde_stacker::Deserializer::new(&mut deserializer);
T::deserialize(deserializer)
.inspect(|response| trace!(?response, "deserialized response"))
.inspect_err(|err| trace!(?err, "failed to deserialize response"))
.map_err(|err| RpcError::deser_err(err, json))
} |
Ah I see, I thought it would be removed by enabling the feature alone |
Component
network, json-rpc
What version of Alloy are you on?
alloy v0.2.1
Operating System
Linux
Describe the bug
The function
try_deserialize_ok
will return a deserialization error when recursion limit exceeded.Reproduce Example
Using
debug_trace_block_by_number
withCallTracer
option to trace Block 15413811Code
Result
Reason
The recursion limit is not large enough to handle call traces of these two transactions tx1 and tx2 inside.
The text was updated successfully, but these errors were encountered: