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

Support for user-defined preconditions #662

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

palinatolmach
Copy link
Collaborator

@palinatolmach palinatolmach commented Jul 2, 2024

Draft implementation for #650.

This PR adds a new src/kontrol/solidity folder that contains an antlr4 grammar for a subset of Solidity we want to use in NatSpec comments specifying preconditions.

It also adds a Precondition class (to be refactored further) that contains a to_kapply property, which translates the parsed string to a KApply term representing the constraint. For example, the following test passes

    /// @custom:kontrol-precondition x <= 14,
    function testPrecondition(uint256 x) public pure {
        assert(x <= 14);
    }

because the following constraint get added to the initial term:

#And ( { true #Equals VV0_x_114b9705:Int <Int 14 }

@palinatolmach palinatolmach changed the title CSE: support for user-defined preconditions Support for user-defined preconditions Aug 1, 2024
@palinatolmach palinatolmach self-assigned this Aug 2, 2024
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.

1 participant