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
Annotate internal function IDs #14050
Conversation
6858ace
to
9d39d00
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.
This is a fairly large test case, which in turn generates an even larger AST JSON. Could this be split into multiple test cases? (I'm fine with also leaving this one as an all encompassing one as well, but additional smaller test cases would be nice)
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.
This test was extracted from:
BOOST_AUTO_TEST_CASE(indirect_calls) |
But I'm not sure how to split it, I mean, the test is only to check it the internalFunctionID
is exported for internal functions, but I'm not really sure of all the cases that this will be trigger, do you have any suggestions of corner cases?
I could also just simplify it and have only (f)();
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'm not even talking about edge cases per se - e.g. you could have a separate case with just a free function (like free1
in the current test case), which would yield a much smaller AST. Same thing goes for a minimal contract with one internal function, and one public/external, where the AST will again be quite small, and the internal function will have the internalFunctionID
member, whereas the public/external won't. And so on, and so on.
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.
Actually, for the current AST tests we have, any new tests comes with like 1000 lines of boilerplate, so splitting this up into several cases actually makes things even worse :-). In the future, we should really have targetted AST tests that just selectively check for a subset of fields - me being too lazy to write something like that is actually the blocker on nice stuff like #13378...
So if you're up for it, you can just do that for this PR - but I'm also fine with keeping the large test case here and dealing with that separately (it should be a separate PR no matter what anyways). Maybe better to move this forward like it is and then build a nicer way to test json ASTs only afterwards to be sure to finally get this out in the next release (Truffle has been asking for these function IDs for ages now).
bcb97dd
to
2f957ac
Compare
Apart from the comments above, this is mostly ready I think and mainly missing a changelog entry. |
We can also try and draw @haltman-at's attention to the binaries in this PR, resp. to the AST in https://github.com/ethereum/solidity/blob/96dee72fe5b5fb6e68fbe25cdf00c3470a2ce794/test/libsolidity/ASTJSON/ast_internal_function_id_export.json (and the |
1fa878d
to
8c048e1
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.
I think we can squash this and then merge this (although I'd wait for a bit to see if @haltman-at is around for confirming that this in fact solves #13425 for them). Also nice that pregenerating the IDs like this actually ends up being much simpler than what we used to do on-the-fly.
… dispatch. Co-authored-by: Daniel <daniel@ekpyron.org>
8c048e1
to
a0e62bb
Compare
@haltman-at we would love to hear your comments on this before merging. If the PR indeed fixes the issue for your use case. |
I think this should solve the issue, so I'm merging this. |
(FWIW, I was on sabbatical for a few weeks and so didn't have a chance to test this out, but I'll assume you all know what you're doing. :) Will still try to test it before release still if I have a chance I guess...) |
fixes #13425