-
Notifications
You must be signed in to change notification settings - Fork 49
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
Keccak improvements #406
Keccak improvements #406
Conversation
ded2a21
to
bf76fa8
Compare
ba2277f
to
e989bd7
Compare
e989bd7
to
098a93a
Compare
Co-authored-by: Zoe Paraskevopoulou <[email protected]>
OK, I think I managed to improve this a bit :) |
NOTE: I now know why we can't concretize earlier -- we could miss information that |
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.
just one more small nit, but apart from that lgtm :)
Description
This change pushes the Keccak concretization to the very END of the steps we do. We don't concretize keccak (i.e. execute SHA3) during interpretation unless necessary (e.g. to do an RPC call). This allows us to take advantage of the fancy pattern matching in
readStorage
more often, hence making it more effective. In particular, this for example passes the newtransfer-dapp
test instantly that previously Z3 struggled with.This improvement required quite a bit of change in the way we handle Keccak. The most hairy parts are:
symbolic
value in ourVMOpts
to know if we are doing concrete or symbolic execution. Concrete exeKeccak.hs
now requires a bit more care, as we need to do some concretization as wellconcKeccakSimp True/False
to BOTH concretize and simplify (or not) the expression. This is basically a beefed-upsimplify
. This is sometimes needed, rather than puresimplify
.EVM.hs
theaccessStorage
function had to be changed slightly so we can check whether we get aNothing
either with or without concretization. If we get a Nothing with either of the two, we do an rpc call. This is necessary, or we would never look up the rpc.I also added a more thorough
Add
+Sub
simplification. This is more complete than what we had. It was needed for one of the debugging sessions I was doing and so while it's unrelated, I think it should be OK(?) Let me know if you need it separately :)Checklist