-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: checks on upper bounds of contract storage sizes #169
base: main
Are you sure you want to change the base?
Conversation
} | ||
} | ||
|
||
if gcx.sess.storage_sz_ub { |
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.
let's call it like "print-contract-storage-sizes"
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.
We only check the upper bound of storage size, so I'm afraid that wouldn't be accurate depiction of what users are looking for.
for example:
If there's
contract C {
int128 a;
int128 b;
}
Currently, this totals to "2", which is less than 2^256 so passes the check. (this check is pre-condition to make sure the slot allocation algorithm will work properly later)
Whereas someone wanting to print storage size would expect 128 + 128 = 256 bits so 1
slot. (because of how solidity allocates the slots)
If we go with this, do we make another flag for the actual contract storage size then?
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.
@DaniPopes isn't this more like "print-contract-max-storage-sizes" ?
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.
@DaniPopes isn't this more like "print-contract-max-storage-sizes" ?
sure
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.
If we go with this, do we make another flag for the actual contract storage size then?
This probably will go with the actual storage implementation later on, the "storage-layout" output
@@ -138,6 +138,9 @@ pub struct UnstableFeatures { | |||
#[cfg(test)] | |||
#[arg(long)] | |||
test_value: Option<usize>, | |||
|
|||
#[arg(long)] | |||
pub storage_sz_ub: bool, |
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.
please move to above help
https://github.com/ethereum/solidity/blob/03e2739809769ae0c8d236a883aadc900da60536/libsolidity/analysis/ContractLevelChecker.cpp#L556C1-L570C2