-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: use both indexed and unindexed params when decoding logs #6174
Conversation
/// Restore the order of the params of a decoded event, | ||
/// as Alloy returns the indexed and unindexed params separately. | ||
fn reconstruct_params(event: &Event, decoded: &DecodedEvent) -> Vec<DynSolValue> { | ||
let mut indexed = 0; | ||
let mut unindexed = 0; | ||
let mut inputs = vec![]; | ||
for input in event.inputs.iter() { | ||
if input.indexed { | ||
inputs.push(decoded.indexed[indexed].clone()); | ||
indexed += 1; | ||
} else { | ||
inputs.push(decoded.body[unindexed].clone()); | ||
unindexed += 1; | ||
} | ||
} | ||
|
||
inputs | ||
} |
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.
I feel like this should be supported by DecodedEvent perhaps
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.
Yep definitely, we should be able to do this through a method rather than manually
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
error unrelated? |
Yeah? Seems unrelated, from an external integration test that probably changed |
Fixes #6121.
This bug happened because we were only adding labels for unindexed params. We now need to restore the order of the indexed and unindexed params as alloy returns them separately, to be able to assign the labels properly.