ethereum / act

Smart contract specification language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rounding Error Analysis

d-xo opened this issue · comments

commented

Understanding the impact of rounding error in a smart contract is a critical task for secure development.

There are two properties of interest:

  1. The direction of the rounding error (who loses out)
  2. The size of the rounding error (by how much do they lose)

For example in the case of a smart contract that holds a pool of tokens, it is a critical property that any rounding error is always in favour of the pool. If this property does not hold the pool will slowly bleed tokens as it is used.

We can allow users to specify properties relating to rounding by introducing a new operator (exact, or toReal), which would indicate that the numeric expression contained within should be expressed in various backends using Real's instead of Int's.

For a manual example of a very similar procedure, see the uniswap v1 model produced by Runtime Verification.

For a little more discussion relating to some earlier syntax see: #35

I don't get much time to work on this and I really don't understand code, I just need help to access the storage address's, I would like to leave the rest of the assets within the contract because I don't know how to maintain it by myself and I would like it to continue to function as it has been