This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 310
Formally check custom Solidity assertions #144
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… but we can know the upmost one.
…previous block. Felt better like that.
…as functions in ASM.
This is awesome. Thanks a lot @leonardoalt . @inian and @luongnt95 please check this PR and merge. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains my initial code to verify any Solidity assertion. Currently
assert
is represented by the opcode0xfe
, which might change in the next compiler's version. What this code does is consider0xfe
asASSERTFAIL
, and whenever a path hits this instruction this means an assertion fails.I do hope
assert
gets its own opcode (asrequire
has0xfd
) because there are cases where0xfe
is used (asINVALID
) without being connected to any assertion (as a genericINVALID
).I did rule out some of those cases that would lead to false positives (
INVALID
s that are not assertion failures), but there might be others, so do not consider this code error-free and final. In order to keep Oyente's functionalities the way they are, the assertion checks are considered only if the option-a
is used.If the assertion is indeed not true, the model given by z3 is printed. In the future I hope to somehow trace the model back to Solidity variables.