-
Notifications
You must be signed in to change notification settings - Fork 38
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
SMT checks of spec validity #14
Comments
@MrChico I am not sure that using a direct encoding into SMTLIB syntax (this the example state_machine.{act,smt2}) is the best way to go. There are lots of techniques that are mature in the software verification community and it could be good to leverage them to build real trustworthy distributed systems. Regarding the specs that are malformed, this is a valid point. But bear in mind that
|
@franck44 I'm not sure I get the first part of your comment. We're not reinventing the wheel: There are several tools out there that translate Solidity to some language which already has verification tooling. That's not the goal here. Act has nothing to do with Solidity (besides copying its storage layout). |
thanks @leonardoalt
I'd be interested to know what kind of tooling, and which target language is used.
On the one hand, I think writing a spec in SMTLIB2 syntax may not be the most readable way to convey the intent. SMTLIB2 is a standard for the input syntax of SMT-solvers. Specification/implementation and verification that an implementation satisfies a spec dates back to the 60's (Hoare). I don't really understand what kind of modularity is achieved here and Hoare triples or pre/post-conditions are probably an established way of writing specification. Some starting points (a few examples of what technology is currently available):
|
Please check https://github.com/leonardoalt/ethereum_formal_verification_overview for a list of projects doing +- that. Note that many of these projects do employ state of the art formal verification techniques.
It looks like there might be some misunderstandings here: we're not writing specs in smtlib2. We are writing Act, and exporting proof obligations generated from analyzing the Act specification.
The specification is independent of the implementation, that's exactly the point of exporting proof obligations from the spec alone.
Again, looks like a misunderstanding. One of the things Act allows you to do is exactly write pre and post conditions, so I don't know why you think we're not using that. I agree with you that it is probably an established way of writing specs, and we are doing that, but I disagree that other options should be disregarded just because of that. The modularity that I mean is for example, proving the post conditions written in the spec from the specs of storage update, and proving contract invariants as a separate step.
Everyone working on Act has a background in formal methods, so I am very puzzled why you assume we are not aware of program verification and the decades of work on it, or why you think we're ignoring it. |
Thanks for the link I am happy to see that there is a lot of activity in the space of verifying smart contracts.
I think this is how some program verification tools (e.g. Dafny) operates, as well as other verification tools. Building summaries with pre and post-conditions (the spec) for each function and using/combining summaries enables modular verification. I am not sure there is anything new here.
I am not assuming anything here, and certainly nothing about anyone's background, but from the terminology used in the previous comments, it was not clear to me that we were on the same page. If I understand well, the objective here is to provide better guarantees (absence of outOfbounds and so on) for the (Solidity) code. And to make it clear, I strongly support all the work on using formal methods :-) particularly on critical infrastructure like blockchains. |
@franck44 I think we're still not on the same page haha. We only recently updated our README, so I'm not sure you've had a chance to look into it (or maybe it's just badly written), but it could help to clarify some apparent misunderstandings.
Completely agree, but Act doesn't do program verification, so we're not doing any of the techniques from the first sentence. SMT solvers are used as one of the proof backends to prove particular statements, but are not expected at all to be the full solution.
Yes, I agree with you. I didn't claim there is anything new in terms of verification techniques, that's exactly the point: To apply already existing concepts/ideas to the context of an Ethereum smart contract specification language, a feature we feel is missing in the ecosystem. Note that even Act itself isn't new, it is an extension of the previous Act specification format, which has been used to specify and verify important mainnet contracts.
Of course, I didn't think otherwise :) |
Even after a simple type checking, there are a number of ways in which specs can be malformed, possibly leading to crashes in different prover back ends.
There are a few checks that I think can be implemented quite straightforwardly with the assistance of an SMT checker, for example using the sbv library:
Bound checking of expressions
Can the expression assigned to a particular type fall out of the bounds of that type? Throw warning to suggest that the expression be further constrained to be bound.
Case exhaustiveness / redundancy
Throw warning if cases are not exhaustive, or if a case is redundant
Array / mapping collisions
In the classic token example:
if
CALLER == to
, the same expression has been assigned to distinct values, and the spec doesn't make any sense. Specs like this should not be accepted.The text was updated successfully, but these errors were encountered: