-
Notifications
You must be signed in to change notification settings - Fork 23
added Ranger repo #395
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
Open
urikirsh
wants to merge
37
commits into
master
Choose a base branch
from
uri/add_ranger_docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
added Ranger repo #395
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
fba3aae
added Ranger repo
9bb35c8
added an md besides the index page
9879092
added Ranger to top level toc tree
2247e56
adding all files under ranger docs
2e139a0
forgot to add content
bcfcbd2
base text for Ranger
821c409
first round of upgrades
41a7e8b
trying ref and term tags
6cd89a5
improving links
f21b182
text improvements on intro
4056511
fixing link to CVL
669da9b
first version of Ranger user guide
4af3d41
fixing titles
fb12791
minor improvements to Ranger getting started
dafa026
shorter title for Ranger index page
28ff991
Merge remote-tracking branch 'origin/master' into uri/add_ranger_docs
1b686eb
ranger now also checks rules
c7a4b6e
Merge remote-tracking branch 'origin/master' into uri/add_ranger_docs
03f3c08
added note about using either --rule or --split_rules
22e5da9
{warn} -> {warning}
6f1bcfd
Yoav/cert 8890 ranger cli docs (#397)
yoav-el-certora bdef21d
Merge remote-tracking branch 'origin/master' into uri/add_ranger_docs
834dcd9
trying a new markdown comment style
4be35a0
trying a different style of comment
d7d4c2a
trying one big multi-line comment
eaed893
spelling
c937873
fixing title sizes under ranger_linet.md
48de033
removing code tags from title
860d84e
certora-cli instead of certora Python package
22967ae
Johannes' CR part 1
ab2f870
isn't -> is not
0f5f5b4
removing mentions of requuiring invariants
8f4a1ca
removing ranger failure limit
1a388e9
added note for no Ranger support for multi_example to test how it looks
5c0cf4b
added notes on all flags Ranger doesn't support
8f41e0e
Merge remote-tracking branch 'origin/master' into uri/add_ranger_docs
b7ff08e
merge from master after v8 changes
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # How Ranger Works | ||
|
|
||
| **Ranger** is a bounded model checker. This means that, in contrast with "full" | ||
| formal verification, its initial state is not arbitrary, but is instead reached | ||
| by a sequence of legal function calls. | ||
|
|
||
| (the-initial-state)= | ||
| ## The Initial State | ||
|
|
||
| Ranger starts by initializing all storage to 0, assuming all ghosts' | ||
| `init_state` {ref}`axioms <ghost-axioms>`, and then calling the constructors | ||
| of all the contracts in the {term}`scene`. Additionally, if the .spec file has a | ||
| `function setup()` declared then it will run right after the constructors. | ||
|
|
||
| ## Sequences | ||
|
|
||
| In Ranger's terminology, a sequence refers to setting the | ||
| {ref}`initial state <the-initial-state>` followed by a series of contract | ||
| function calls. The depth or range of a sequence is the number of functions the | ||
| sequence calls. Note that a sequence can call the same function twice, and they | ||
| are counted as two distinct calls. | ||
|
|
||
| ## Ranger's flow | ||
|
|
||
| When a Ranger job starts, for each rule/invariant that's to be run it does the | ||
| following: | ||
|
|
||
| 1. Verify that the initial state rule/invariant holds right after the | ||
| {ref}`initial state <the-initial-state>` (it could also hold vacuously, that's | ||
| fine in this case). | ||
| 2. For each range `1 <= i <= N` (`N` is determined by the {ref}`--range` | ||
| option), create a sequence of `i` functions from the scene (could be from any | ||
| contract and could have duplicates), then call them providing each function with | ||
| independent and arbitrary input. Finally, call the rule/invariant and check that | ||
| it holds. | ||
| * In the invariant case, before each function call we insert an assumption | ||
| that the invariant is true. This is done for optimization reasons. | ||
|
|
||
| For each sequence `f_1 -> ... -> f_n` we first check the subsequence | ||
| `f_1 -> ... -> f_n-1` and only if it verifies will we continue to check the | ||
| longer sequence. This promises that if a violation is found it is the shortest | ||
| sequence with these functions that violates the rule/invariant. | ||
|
|
||
| ```{note} | ||
| While in principle for a provided range N there are \sum_{i=0}^N a_i sequences, | ||
| in practice Ranger has several optimizations that prune a significant portion of | ||
| these sequences. | ||
| ``` | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| (ranger-intro)= | ||
| Ranger | ||
| ====== | ||
|
|
||
| Text | ||
|
|
||
| ```{toctree} | ||
| :maxdepth: 2 | ||
|
|
||
| ranger_intro.md | ||
| starting_with_ranger.md | ||
| how_ranger_works.md | ||
| ranger_client.md | ||
| ``` | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # The Ranger Client | ||
|
|
||
| Ranger introduces a new CLI entry point: `certoraRanger`. | ||
|
|
||
| This command is part of the `certora-cli` Python package and provides a streamlined interface for bounded model checking, | ||
| specifically designed for exploring concrete execution paths up to a limited range. | ||
| It comes with new defaults and additional under-approximations to make finding concrete counterexamples easier and faster. | ||
|
|
||
| The `certoraRanger` client submits jobs to the Certora cloud, just like the Prover. You'll receive a dashboard link with the results once the job is submitted | ||
|
|
||
| Ranger uses the same input format and job flow as `certoraRun`, allowing teams to reuse existing configuration and spec files. | ||
|
|
||
| ## Ranger-specific flags | ||
|
|
||
| (--range)= | ||
| ### `range` | ||
|
|
||
| **What does it do?** | ||
| Sets the maximal length of function call sequences to check (0 ≤ K). | ||
| This flag controls how deep Ranger explores function call sequences from the initial state. | ||
| Higher values can uncover deeper bugs but may increase analysis time. | ||
|
|
||
| When not assigned, the default value is defined as 5 | ||
|
|
||
| **When to use it?** | ||
| When you wish to assign a different value than the default one. | ||
| Increasing this flag will execute longer sequences, or decreasing when you wish to execute faster runs. | ||
|
|
||
| **Example** | ||
|
|
||
| ```sh | ||
| certoraRanger ranger.conf --range K | ||
| ``` | ||
|
|
||
|
|
||
| ## Default Under-approximations | ||
|
|
||
| By default, `certoraRanger` enables the following Prover flags to favor usability over full soundness: | ||
|
|
||
| {ref}`--optimistic_loop` | ||
|
|
||
| {ref}`--loop_iter` 3 | ||
|
|
||
| {ref}`--optimistic_fallback` | ||
|
|
||
| {ref}`--optimistic_hashing` | ||
|
|
||
| {ref}`--auto_dispatcher` | ||
|
|
||
| These options help prune unrealistic paths, reduce false positives, and improve performance. | ||
|
|
||
| Unresolved calls will be treated as nondeterministic. | ||
|
|
||
| You can override any of these defaults in your .conf file or via the CLI. Ranger will never fail due to unsupported overrides—it will simply continue and print a warning if needed. | ||
|
|
||
|
|
||
| ## Unsupported Prover flags | ||
|
|
||
|
|
||
| The following `certoraRun` flags are not supported in Ranger: | ||
|
|
||
| {ref}`--project_sanity` | ||
|
|
||
| {ref}`--rule_sanity` | ||
|
|
||
| {ref}`--coverage_info` | ||
|
|
||
| {ref}`--multi_example` | ||
|
|
||
| {ref}`--foundry` | ||
|
|
||
| {ref}`--independent_satisfy` | ||
|
|
||
| {ref}`--multi_assert_check` | ||
|
|
||
| If any of these are used, Ranger will emit a warning, ignore the flag, and continue the job. | ||
|
|
||
|
|
||
| ## Config file compatibility | ||
|
|
||
| Ranger supports the same `.conf` format as the Certora Prover. | ||
| You can reuse your existing `.conf` files without changes. | ||
|
|
||
| - Ranger will ignore Prover-only flags in the config file. | ||
| - Prover will ignore Ranger-only flags, like {ref}`--range`. | ||
|
|
||
| This ensures that a single configuration file can work for both tools, enabling easier integration and faster iteration across your workflows. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Introduction | ||
|
|
||
| **Ranger** is Certora’s bounded model checker for smart contracts. It complements formal verification by offering a lightweight, developer-friendly approach for quickly identifying violations of contract expected behaviors defined with [CVL](/docs/cvl/index). | ||
|
|
||
| Unlike the [Certora Prover](/docs/user-guide/index), which explores all program states, Ranger starts from a specific initial state and explores all function call sequences up to a bounded depth. This ensures that every violation corresponds to a realistic execution path, removing the need to filter out spurious counterexamples. | ||
|
|
||
| --- | ||
|
|
||
| ## Why Ranger? | ||
|
|
||
| Formal Verification provides strong correctness guarantees and checks more program states, but it can be slow, complex, and prone to false positives from unreachable states. {term}`fuzzing`, on the other hand, is faster, but has a lower coverage as it only checks for specific inputs per run. | ||
|
|
||
| Ranger offers a practical middle ground: | ||
|
|
||
| - ✅ **Realistic counterexamples**: All violations are reachable from the initial state. | ||
| - ✅ **Faster time to value**: Minimal setup required to get useful results. | ||
| - ✅ **Fewer false positives**: No need to precondition rules to filter out invalid states. | ||
| - ✅ **High coverage**: Tests all function call sequences on symbolic inputs from the initial state up to a certain range. | ||
|
|
||
| --- | ||
|
|
||
| ## Scope and Limitations | ||
|
|
||
| Ranger is in active development and currently supports only Solidity contracts. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Getting Started | ||
|
|
||
| This guide will help you run your first Ranger job using a Solidity contract and a [CVL](/docs/cvl/index) `.spec` file. | ||
|
|
||
| Ranger uses the same installation process, configuration files, and spec files as the [Certora Prover](/docs/user-guide/index). If you're already familiar with the Prover, getting started with Ranger will feel familiar. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That Ranger uses CVL could be stated also
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| --- | ||
|
|
||
| ## 1. Install Certora Tools | ||
|
|
||
| Ranger is part of the `certora-cli` Python package. You can install or upgrade it using `pip`: | ||
|
|
||
| ```bash | ||
| pip install certora-cli | ||
| ``` | ||
| For full installation instructions and troubleshooting, see the Certora Prover [installation guide](/docs/user-guide/install). | ||
|
|
||
| ## 2. Prepare Your Files | ||
| You'll need three files: | ||
|
|
||
| - A compiled Solidity contract (e.g. `MyContract.sol`) | ||
| - A CVL `.spec` file | ||
| - A configuration file (e.g. `ranger.conf`) | ||
|
|
||
| Example `ranger.conf`: | ||
|
|
||
| ```json | ||
| { | ||
| "files": ["MyContract.sol"], | ||
| "verify": "MyContract:MyContract.spec" | ||
| } | ||
| ``` | ||
|
|
||
| ## 3. Run Ranger | ||
| Use the `certoraRanger` command to launch the job: | ||
|
|
||
| ```bash | ||
| certoraRanger ranger.conf | ||
| ``` | ||
|
|
||
| This will start the Ranger process. A link to the Ranger Job Report in the dashboard will be pasted into your command line when the job is submitted. | ||
|
|
||
| ```{warning} | ||
| Ranger is compute-intensive: It performs symbolic exploration of many function call sequences. For faster feedback, avoiding timeouts, and better resource usage, consider one of the following: | ||
|
|
||
| 1. Use {ref}`--rule` to focus on a single invariant or rule. | ||
|
|
||
| 2. Use {ref}`--split_rules` to automatically run each invariant/rule in a separate job. | ||
| ``` | ||
|
|
||
|
|
||
| ## 4. View the Results | ||
| A link to the Ranger Job Report in the dashboard will be pasted in your command line | ||
| when the job is submitted. | ||
| You can explore the results in the web-based Ranger Report by following the link. | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.