-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Properly check data location in inheritance. #12850
Conversation
8b9e0b7
to
255cb42
Compare
Patch for openzeppelin (only one contract affected): OpenZeppelin/openzeppelin-contracts#3293 |
Blog post: ethereum/solidity-blog#173 |
Patch for Gnosis Safe: safe-global/safe-smart-account#394 (also only one contract affected) And Bleeps is only affected through the |
I just pushed a commit with a workaround for this issue in Gnosis, Zeppelin and Bleeps. It's a simple replacement of the affected lines. We can just drop it from the PR if they fix the problem quickly or merge it if they don't. |
Tests are failing. Is it just rebase or are there problems in the PR? |
As for external tests, they are failing because this change is technically not backwards-compatible (we're treating it as a bugfix). @chriseth took care of submitting fixes to OZ and ENS (ensdomains/ens-contracts#65), I did Gnosis. Bleeps breakage turned out to be coming from the OZ dependency. The only reason why Gnosis, OZ and Bleeps passed here was that I added a quick and dirty workaround in case this does not get fixed upstream quickly. I did not do ENS because I did not investigate that one. Anyway, looks like OZ and ENS merged our PRs. The only remaining one is Gnosis (zero reaction so far). So I guess I'll remove the workarounds for everything except Gnosis and ext tests should pass. Other than that, this still needs the fix for |
dd68761
to
52d2b04
Compare
I just reverted workarounds for OZ and Bleeps. Looks like my PR will be merged in Gnosis soon and then we'll be able to remove that one too. |
Looks like for ENS we'll actually have to switch to the And for Bleeps we'll have to wait for an OZ release (or hard-code it to use a pre-release). A new OZ release is currently in an open review period, which will end around April 22nd. |
cac39b5
to
aeeede5
Compare
{ | ||
return std::visit(GenericVisitor{ | ||
[&](FunctionDefinition const* _item) { return TypeProvider::function(*_item); }, | ||
[&](VariableDeclaration const*) -> FunctionType const* { solAssert(false, "Requested specifig function type of variable."); return nullptr; }, |
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.
"specifig" -> "specific"
Current status regarding external tests:
|
3ab96c4
to
c45e4dc
Compare
The ext tests should all be passing now. I restored the ENS and Gnosis workarounds and added a new one for Brink (also submitted a PR upstream: brinktrade/brink-core#52). For Bleeps it turns out that updating to OZ 4.6.0 and patching the single compilation error that appears after that makes a ton of other compilation errors pop up. So I gave up, kept it at OZ 4.3.2 and just copied the patch command we had here for OZ formerly. |
c45e4dc
to
2d5e30c
Compare
ENS is now failing. My commit updates it to the latest version and in that version apparently they have some low-level functions for doing reverts (
bool result = LowLevelCallUtils.functionStaticCall(target, data);
uint256 size = LowLevelCallUtils.returnDataSize();
if(result) {
return LowLevelCallUtils.readReturnData(0, size);
} So apparently #12860 does break some things (though in their case fix is trivial, just make these functions |
Just to be clear, this is not caused directly by this PR, merging #12860 broke it. It only shows up here due to the ENS update (which we do to get an upstream fix for the override issue and avoid having to do even more patching in external tests). |
2d5e30c
to
c7d88cb
Compare
docs/bugs.json
Outdated
"description": "TODO", | ||
"link": "TODO", |
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.
Those still need to be filled in I guess - apart from that the fix generally looks good.
Since we plan to revert #12860 that should fix the ens test breakage. |
fda987b
to
41e1d2b
Compare
_overriding.isFunction() && | ||
!returnTypesDifferAlready && | ||
_super.visibility() != Visibility::External && | ||
_overriding.functionKind() != Token::Fallback |
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.
Is this really necessary? Doesn't fallback imply external visibility (both of _overriding
and of _super
)?
Not that it hurts in any case.
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.
Yes, maybe, but we can also just leave it in...
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.
I have a few more suggestions but overall the PR seems correct. I haven't found any serious problems so I'm approving already.
test/libsolidity/syntaxTests/inheritance/dataLocation/return_type_data_location_illegal.sol
Outdated
Show resolved
Hide resolved
test/libsolidity/syntaxTests/inheritance/dataLocation/memory_calldata_public.sol
Outdated
Show resolved
Hide resolved
test/libsolidity/syntaxTests/inheritance/dataLocation/memory_calldata_internal.sol
Outdated
Show resolved
Hide resolved
test/libsolidity/syntaxTests/inheritance/dataLocation/memory_calldata_internal.sol
Outdated
Show resolved
Hide resolved
c200c89
to
bb13124
Compare
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.
Looks fine overall. There's just one last small inconsistency in #12850 (comment)
bb13124
to
e91548e
Compare
You can rebase this on #13027 if you want to be sure all external tests pass. |
e91548e
to
f95015f
Compare
Rebased, so please don't merge before #13027 |
778a127
to
adf3eaa
Compare
f95015f
to
f427247
Compare
Depends on #13027. Merged.Fixes #10900
Note that the bug is also relevant for the return types.