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

Change how addLibraryAddresses replaces the library addresses from the recompiled bytecode #981

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

marcocastignoli
Copy link
Member

@marcocastignoli marcocastignoli commented Apr 17, 2023

Instead of replacing the library using a regular expression, use split.

Thanks to @Hellobloc and @samczsun for reporting the problem. I will add more information after we deploy.

View in Huly HI-705

…e template

* instead of using regex use replace
@marcocastignoli
Copy link
Member Author

marcocastignoli commented Apr 17, 2023

This is the actual Solidity way of generating the template for the libraries:

...35565b005b73__$a31769e258f964750f88ed70973ed7c298$__63874f33a160...

Before using the keccak256 as the placeholder of the library the format was

__{COMPLETE_PATH_FILE}:{CONTRACT_NAME}__

But if "{COMPLETE_PATH_FILE}:{CONTRACT_NAME}" is longer than 40 bytes the string is stripped.

...50565b600073__contracts/LibAAAAAAAAAAAAAAAAAAAAAAA__636d4ce63c60...

The proposed solution is to not parse the placeholder in a RegExp, instead we can use a fixed length of 40 starting from __.

@codecov-commenter
Copy link

Codecov Report

Patch coverage has no change and project coverage change: -2.62 ⚠️

Comparison is base (fc21cba) 77.94% compared to head (2f1d74f) 75.33%.

Additional details and impacted files
@@             Coverage Diff             @@
##           staging     #981      +/-   ##
===========================================
- Coverage    77.94%   75.33%   -2.62%     
===========================================
  Files           29       36       +7     
  Lines         1374     2007     +633     
  Branches       254      392     +138     
===========================================
+ Hits          1071     1512     +441     
- Misses         177      288     +111     
- Partials       126      207      +81     
Flag Coverage Δ
lib-sourcify 69.66% <ø> (?)
server 77.94% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 9 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kuzdogan kuzdogan merged commit 09ed7ad into staging Apr 19, 2023
@kuzdogan kuzdogan deleted the fix-addLibraryAddresses-regex branch May 10, 2023 14:37
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.

3 participants