docs for safeCasting and uncheckedOverflow builtin rules#447
Merged
yoav-rodeh merged 6 commits intomasterfrom Feb 5, 2026
Merged
docs for safeCasting and uncheckedOverflow builtin rules#447yoav-rodeh merged 6 commits intomasterfrom
yoav-rodeh merged 6 commits intomasterfrom
Conversation
jar-ben
reviewed
Feb 4, 2026
docs/cvl/builtin.md
Outdated
|
|
||
| The `safeCasting` built-in rule is there to catch cases where an explicit cast in solidity is actually out of bounds. | ||
| For example, if an `uint` is cast to a `uint64`, the rule will fail if there is some external function in the contract, that can be called | ||
| in such a way, that the value being cast is larger than `2^64 - 1`. Casting between signed and unsigned values are also checked. So if an `uint` is cast to an `int`, and the cast value is larger than `2^255 - 1`. the rule will fail. |
Contributor
There was a problem hiding this comment.
. the rule will fail. has . at the beginning - should be ,.
docs/cvl/builtin.md
Outdated
| ```cvl | ||
| use builtin rule safeCasting; | ||
| ``` | ||
| in a spec file. In addition, the line `safe_casting_builtin : true` must be added to the conf file. |
Contributor
There was a problem hiding this comment.
Does safe_casting_builtin : true work? I thought it has to be "safe_casting_builtin" : true
Contributor
Author
There was a problem hiding this comment.
both work, but I think they somehow prefer the brackets, i'll add it.
| ``` | ||
| This will fail the builtin rule, because the multiplication is a `uint128` multiplication (even if it's later considered as a `uint`). | ||
|
|
||
| This rule can be enabled by including |
Contributor
There was a problem hiding this comment.
I suppose you also have to set unchecked_overflow_builtin in the .conf file?
Contributor
Author
There was a problem hiding this comment.
oh yah, i forgot. Added.
jar-ben
approved these changes
Feb 5, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
as the title says