Skip to content
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

feat(core): Introduce Graph Invariant checks #87

Merged
merged 13 commits into from
Jul 12, 2024

Conversation

brockelmore
Copy link
Contributor

This introduces is_representation_ok which iterates through the graph ensuring that each context and its variables satisfy a set of invariants. The current invariants are basically placeholders.

It also introduces the ability to do inline test commands in solidity of the form:

contract A {
    function a(uint24 y) public pure {
        "pyro::variable::y::range::[0, 16777216]";
    }
}

This would perform a check that the variable y in this context has the provided range. Available test commands currently:

  1. Variable
    • "range"
      • "pyro::variable::::range::[min,max]"
  2. Coverage
    • "unreachable"
      - "pyro::coverage::unreachable"
    • "onlyPath" (this context should have no siblings - note: if you have a nested if statement (i.e. if (x ? y : false) {...}) it breaks)
      - "pyro::coverage::onlyPath"
  3. Constraint
    • "constraint" - ensures the context has a constraint with the name provided
      - "pyro::constraint::(x != 0)"

Supercedes #85

@brockelmore brockelmore merged commit 90b03bb into master Jul 12, 2024
1 check passed
@brockelmore brockelmore deleted the brock/graph_invariants branch July 12, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants