-
Notifications
You must be signed in to change notification settings - Fork 5
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
New config simple exp function #29
Conversation
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 will have more comments later, but this is my brief look at the configuration.
I agree with @dwightguth on pretty much all his points about the configuration. I think if you add some commits which make those changes and fix any resulting breakages in the rest of the semantics that would be good. I can take a closer look at the rules then. |
By the way, we put |
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 agree with the other reviewers, let's sort these initial things out before moving to more in-depth review of the rules. I left a couple of comments in the meanwhile.
One other thing I'd recommend is this time to start actually using the compiler tests. Rather than using hand-written tests (like the various t1.so
etc.), I think it makes sense to just pick the compiler tests and add those instead; most of them will fail right now because most features are not implemented, but that's OK, as the goal is to gradually add features and fix things so that all tests will eventually pass.
Even at the current state for example, I guess it's possible to find some simple test (from the compiler's tests) that only involves function call and arithmetic.
Reduce #exeStmt in non-function-call to SimpleStatement
…amework/solidity-semantics into NewConfig-SimpleExp-Function
I have revised the configuration accordingly as much as I can. Please proceed to review the semantics rules. Thanks. |
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 see my additional comments.
The error comes from #createStateVars(N,SV) in New-Contract-Instance. To be specific, the error comes from Allocate-State-Variables. Since a bag of the cell "account" is created in New-Contract-Instance, the subcells "context" and "Storage" need to be rewritten in #createStateVars to store state variables. new A() and new B() seem to work because they do not have any state variables to store. In other words, whenever we need to rewrite the subcells in "account" which is created in New-Contract-Instance, the error appears. It seems that rewriting of cell contents is not allowed when Map is used instead of Bag. Is it appropriate to use Map instead of Bag when rewiring of cell contents is necessary? Or how to avoid this problem when Map is used? |
I have fixed the bug of mapping incomplete keys of |
It would be nice to have a style guideline e.g. not using tabs. |
I was looking once again at the compiler tests (https://github.com/ethereum/solidity/blob/develop/test/libsolidity/SolidityEndToEndTest.cpp) and noticed how a simple search for Like this for example:
or this:
I know many of those are not supposed to pass (either because they make use of features you do not support yet, or because there are issues with the current definition), but that's exactly the point of those tests: they give us a goal and a way to figure out when we are "done". |
@dfilaretti tests that only use |
well my comment was only meant to suggest some possible tests to look at, even if we don't have a way to automate it yet. Even if done manually, it can still give us something to play with for the time being. But I agree, in the long term we need to automate, as it's impractical to rewrite them all manually (and keep them up to date as the language evolves). |
I have added the desugaring rules for internal function calls. That is, for internal function calls, we can use exact Solidity syntax now, instead of |
The issue is fixed by adding the strictness to the syntax of `VariableDefinition`.
configuration.k
Outdated
<callStack> .List </callStack> | ||
<interimStates> .K </interimStates> | ||
<touchedAccounts> .K </touchedAccounts> | ||
<currentAccount> #account(#undef_Int,#undef_Id) </currentAccount> |
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 the only place where #undef_Int
and #undef_Id
are used. I would recommend instead creating a value .Account
or #undef_Account
like so:
syntax AccountId ::= Int | "#undef_Account"
You declare #undef_Int
for example here:
syntax Int ::= "#undef_Int"
which means you're adding junk to the Int
sort, which will make reasoning using unification and Z3 very difficult when it comes time to do the proofs. Almost always better to use a super-sort (like the AccountId
super-sort above) and add the extra constants there.
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.
Fixed accordingly.
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.
@shangweilin is it ever the case that it's useful to have an #account
with only one of the entries undefined? Eg: #account(#undef_Int, x)
or #account(3, #undef_Id)
? If not (and I can't see any uses in the semantics of these cases), then instead of adding sorts AccountId
and AccountInt
as you have, I would just add an extra constant #undef_Account
to sort Account
.
syntax Account ::= #account(Int, Id) | "#undef_Account"
If the semantics ever could produce examples like above, then it would make sense, but otherwise would be better to avoid adding super-sorts of builtin sorts (like Int
and Id
) if possible.
Note that this pattern of adding an extra constant to a sort (like #undef_Account
) is like the Maybe
type in Haskell, or the Optional
in Java/Scala.
Delete localCalls and rename Storage to acctStorage
…ef_int and #undef_Id.
Hi, @dfilaretti and @ehildenb. We have addressed all the comments except for the |
Hi, @dfilaretti, @ehildenb, @tomtomjhj, and @dwightguth, I managed to figure out the usage of |
Hi, @ehildenb, @dfilaretti, @tomtomjhj, and @dwightguth, I have fixed the final three issues. Please help to review again, thanks. |
@shangweilin there is still a lot to be improved, but I'll submit a follow-up PR which fixes the formatting issues and some other things. Feel free to merge ASAP. |
Please help to review this branch.
The current version include the following semantics based on the new configuration: