Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After changing Seth logic to debug event using all ABIs I’ve noticed an intermitently failing Seth smoke test, which turned out to be caused by event signature collision. Two contracts have events with the same name and parameters, but one of them has the last parameter non-indexed. And when that contract’s ABI is selected for decoding, then the test fails.
Comparing signature of the whole event is complicated due to various data types, so I will apply a simpler fix:
if we know what contract is at given address, we know its ABI and we don’t need to iterate overall ABIs
if we don’t then we will iterate over all, but apart from signature also check whether number of indexed parameter matches the log (that’s an easy check)
Below is a summarization created by an LLM (gpt-4-0125-preview). Be mindful of hallucinations and verify accuracy.
Why
The changes improve contract log decoding by optimizing the event matching process and fixing minor issues in function parameters and comments. These changes aim to enhance performance, accuracy in event log decoding, and clarity in the codebase.
What
seth/client.go
reflect
package import for deep equality checks.decodeContractLogs
to use a precomputed map (sigMap
) of event signatures to their possible events and ABIs, improving efficiency by avoiding redundant ABI iterations.buildEventSignatureMap
function to create a signature to event and ABI mapping, facilitating faster event log decoding.seth/contract_map.go
GetContractAddress
to accurately reflect its purpose, enhancing code readability and maintainability.tools/breakingchanges/cmd/main.go
getLatestTag
to improve code documentation and readability.