argotorg / argotorg/act

Rounding Error Analysis

Open
#112 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
279
Forks
51
Avg merge
17h 42m
Merged PRs (30d)
1

Description

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)
1. 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](https://github.com/runtimeverification/verified-smart-contracts/blob/uniswap/uniswap/x-y-k.pdf) produced by Runtime Verification.

For a little more discussion relating to some earlier syntax see: https://github.com/ethereum/act/pull/35

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the linked Uniswap v1 model and the discussion in pull request #35 to understand the proposed rounding properties and syntax. Then locate how numeric expressions are represented across the project’s backends; done means agreeing on the operator semantics and supporting the requested rounding direction and size analysis without leaving backend behavior unspecified.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
blockchain, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.