Skip to content
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

perf: LocalTraceIdentifier optimization #7105

Closed
wants to merge 2 commits into from

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Feb 13, 2024

I believe that it's safe to assume that after compilation artifact deployed bytecode will not decrease its size, and in most of the cases, artifact bytecode length exactly matches the deployed on-chain bytecode.

Thus, the new impl iterates over artifacts with bytecode length less than or equal in descending order. Artifact with exact same length as the on-chain code will always be checked first, and if it's diff_score < 0.1, we will exit early.

Not sure about 0.1 magic constant, but we are using it in find_by_code and it seems fine

I've tested it on several codebase and haven't noticed any regression, some contracts even got identified more correctly

@klkvr klkvr mentioned this pull request Feb 13, 2024
@klkvr
Copy link
Member Author

klkvr commented Feb 13, 2024

Closing in favor of #7091

@klkvr klkvr closed this Feb 13, 2024
DaniPopes added a commit that referenced this pull request Feb 14, 2024
Implementation modified from #7105,
see that PR for more information.

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
DaniPopes added a commit that referenced this pull request Feb 14, 2024
* perf: improve LocalTraceIdentifier performance

Implementation modified from #7105,
see that PR for more information.

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>

* docs

* fix: account for multiple matches

* feat: search len*0.9 .. len*1.1

* perf: start searching at same code length for common case

* fix: oob

---------

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant