Skip to content

Verifying Reentrant Computation #108

Description

@DavePearce

To verify reentrant computation relies on a two state predicate which summarises the effect making one (or more) reentrant calls into a method could have on local state. For example, consider this:

int state = 0

public method inc()
modifies state
ensures old(state) +1 == state:
   state = state + 1

The necessary two-state predicate is actually old(state) < state for inc() since we can call inc() arbitrarily many times from external code. What we need is a way to either infer such a specification or (perhaps easier) to check such a specification is already transitive.

Syntax

There are various ways we could try to encode the logic we need. One approach might be to impose constraints on how global data could be modified. For example:

type uiint256 is (uint256 v)
varies old(v) < v

Actually the varies clauses is perhaps similar or identical to Liskov and Wing's constraint clause.

References

  • Rich Specifications for Ethereum Smart Contract Verification (link)
  • See 2Vyper Github Repo here
  • Behavoural Notion of Subtyping, Liskov and Wing, 1994 (link]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions