-
Notifications
You must be signed in to change notification settings - Fork 428
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
AutoKey
produces inconsistent values
#1825
Comments
This is expected behaviour, the |
This implies that devs working with multi-contract projects with the same storage layout need to define keys for all fields manually. Is this desirable behaviour? What is the motivation behind this design decision? |
How did you come to these conclusions @SkymanOne (i.e. that devs working with multi-contract projects need to define keys manually) ? |
|
@SkymanOne , I just don't understand why you came to this conclusion. Why having |
@deuszx see #1825 (comment) from Hernando. Having an identical storage layout is required for delegate calls when contract B delegates to operate on contract A's storage. In this case, contract B must have an identical storage layout for layout-full storage and matching keys for the |
Background
I had been working on the example for
delegate_call()
when stumbled across a "bug" that, given two identical storage layouts with the same field names and order, the automatically generated keys forMapping
appear to be different.Problem
Look at two different contracts with different names, but same storage layouts:
When compiling both contracts in release mode. The metadata shows that
Mapping
have different keys:From delegatecall-bug:
From key-reproducer:
Potential Solutiom
My intuition is that the name of the storage plays a role in the auto key generation, but for Solidity devs this behaviour is unexpected and can be a footgun in the future.
The text was updated successfully, but these errors were encountered: