-
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
Fixing missing concKeccakSimpExpr
for wordToAddr
, maybeLitByte
, etc.
#619
Conversation
concKeccakSimpExpr
for wordToAddr
, maybeLitByte
, etc.
d194e0b
to
2ecc994
Compare
This should alleviate issues with symbolic expression errors
2ecc994
to
5f4e14d
Compare
concKeccakSimpExpr
for wordToAddr
, maybeLitByte
, etc.concKeccakSimpExpr
for wordToAddr
, maybeLitByte
, etc.
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.
Are you sure the maybe
methods are the place where simplification should happen?
Shouldn't these methods stay trivial, and shouldn't the simplification happen in somewhere else?
@blishko Hmmmm I found it cleaner this way. I would need to add it to, at least:
And that's just But maybe I'm wrong. I just see it to be a larger diff, and hence more clutter. But it's not such a big deal, I can be convinced the other way. If you think it's better, I'll adjust this PR to use |
I see your point. I don't know the codebase well enough, but my opinion is that you are quite drastically changing the meaning of these functions. Maybe you can introduce a new functions where it would be explicit that they are applying simplifications first? Having a quick look at But I do not want to force my viewpoint onto you. Feel free to ignore me :) |
Yeah, renaming of the functions is a very good idea, actually, thanks! Misleading without it.
-- TODO: make this smarter, probably we will need to use the solver here?
wordToAddr :: Expr EWord -> Maybe (Expr EAddr)
wordToAddr e = case (concKeccakSimpExpr e) of
[...] And I actually agree with this idea In fact, we'd need that here: #581 In order to remove that symbolic jump issue, we'd need to run an SMT solver, and get out all possible jump destinations, and explore the execution with all. That's a bit of a more involved case. For that to work, we will need to rewrite some of the places where these functions are used, because if the number of solution is limited (like in #581 where it's limited to the number of functions in the contracts), then we should try all -- and of course in these cases neither Let me rename the functions, let's see if that helps :) |
@blishko I renamed them. I had a look, I didn't see a reason why I would use a non-simplified version of the functions in the places where it's being used, so I left them-as is. Even at the formatting, it seems like it's used to print some kind of visual clue/information to the user, and so if we have a , "arguments: "
, indent 2 $ T.unlines . fmap formatSomeExpr $ args
+ , "simplified arguments: "
+ , indent 2 $ T.unlines . fmap formatSomeExprSimp $ args Where What do you think? |
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 guess also maybeLitByte
should have the Simp
suffix?
Thanks @blishko for catching this!
It's about holidays time, but when you are back, I'd be grateful for a review, @blishko :) Happy holidays in the meanwhile! |
Yesss, thanks, I added it! Can you perhaps review in the coming days? Also, if you could review #625 that's on top of this that'd 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.
Seems OK now. Although, you might need to rebase to resolve the conflicts.
Thanks! Resolved the conflicts, thankfully they were quite minimal :) |
Description
It turns out that as per #618 we ran
simplify
instead of runconcKeccakSimpExpr
onwordToAddr
. Furthermore, we should runconcKeccakSimpExpr
onmaybeLitByte
,maybeLitAddr
etc. so more things can run concretely.Also added
hexStringToByteString
to test.hs, which makes it a LOT easier to createConcreteBuf
-s via e.g.ConcreteBuf (hexStringToByteString "0a0056")
. It's been really painful to try to debug without this.Added a test case to verify that indeed the caase in #618 is fixed.
Checklist