Skip to content

Commit ce2dc29

Browse files
committed
minor edits
1 parent f20b76d commit ce2dc29

File tree

1 file changed

+40
-37
lines changed

1 file changed

+40
-37
lines changed

erc20.md

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
1-
ERC20: Formal Executable Specification
2-
======================================
1+
ERC20-K: Formal Executable Specification of ERC20
2+
=================================================
33

44
Authors: [Philip Daian](http://pdaian.com/) and [Grigore Rosu](http://fsl.cs.illinois.edu/grosu)
55

66
Date: November 28, 2017
77

8-
**Acknowledgments:** Warm thanks to the K team who defined the
8+
**Acknowledgments:** Warmest thanks to the K team who defined the
99
[KEVM](https://github.com/kframework/evm-semantics) semantics
1010
(see
11-
[our technical report](https://www.ideals.illinois.edu/handle/2142/97207), too)
11+
[technical report](https://www.ideals.illinois.edu/handle/2142/97207), too)
1212
and verified smart contracts for ERC20 compliance.
1313
It is their effort that inevitably led to the quest for a formal specification
1414
of ERC20.
1515
We also thank [IOHK](http://iohk.io) for their generous support
16-
of the [KEVM](https://github.com/kframework/evm-semantics) and
17-
[IELE](https://github.com/runtimeverification/iele-semantics)
18-
projects; the latter, in particular, led to the question of whether
19-
the ERC20 specification can be defined in a way that does not depend on
20-
the EVM and thus can be used in combination with other computational
21-
infrastructures.
16+
of both [KEVM](https://github.com/kframework/evm-semantics) and
17+
[IELE](https://github.com/runtimeverification/iele-semantics);
18+
IELE, in particular, led to the question of whether the ERC20 specification
19+
can be defined in a more abstract way that does not depend on the EVM, and
20+
thus can also be used in combination with other computational infrastructures.
2221

2322
## Abstract
2423

@@ -27,39 +26,43 @@ is one of the most important standards for the implementation of tokens
2726
within Ethereum smart contracts.
2827
ERC20 provides basic functionality to transfer tokens and to be approved so
2928
they can be spent by another on-chain third party.
30-
Here we provide a complete formalization of ERC20 in
31-
[K](http://kframework.org).
32-
Specifically, we provide a formal executable semantics of ERC20.
33-
Our semantics clarifies what data (accounts, allowances, etc.) are handled by
34-
the various ERC20 functions and the precise meaning of the functions on such
29+
Unfortunately, ERC20 leaves several corner cases unspecified, which makes it
30+
inadequate to use in the formal verification of token implementations.
31+
ERC20-K is a complete formal specification of the ERC20 standard.
32+
Specifically, it is a *formal executable semantics* of a *completion of the
33+
ERC20 standard*, using the [K framework](http://kframework.org).
34+
ERC20-K clarifies what data (accounts, allowances, etc.) are handled by
35+
the various ERC20 functions and the precise meaning of those functions on such
3536
data.
36-
It also clarifies the semantics of *all* the corner cases that the ERC20
37+
ERC20-K also clarifies the meaning of *all* the corner cases that the ERC20
3738
standard omits to discuss, such as transfers from yourself to yourself
38-
or transfers that result in arithmetic overflows,
39-
following the most natural implementations that aim at minimizing gas
40-
consumption.
39+
or transfers that result in arithmetic overflows, following the most natural
40+
implementations that aim at minimizing gas consumption.
41+
Being executable, ERC20-K can also be tested for increased confidence.
42+
Driven by the semantic rules that form ERC20-K, as well as by their side
43+
conditions, we manually but systematically produced a test-suite
44+
(under the `tests` folder) consisting of several dozens of tests which
45+
we believe cover all the corner cases.
46+
We encourage you to analyze these tests and use them to test your
47+
implementations.
48+
Please contribute with more tests if you think that we left any interesting
49+
behaviors uncovered.
50+
4151

4252
## Motivation
4353

44-
Now that the K team has developed
45-
[KEVM](https://github.com/kframework/evm-semantics), a formal semantics of
46-
the Ethereum Virtual Machine, it has become possible to rigorously verify
47-
smart contracts at the EVM level against higher level specifications.
54+
[KEVM](https://github.com/kframework/evm-semantics) makes it possible to
55+
rigorously verify smart contracts at the EVM level against higher level
56+
specifications.
4857
The most requested property to verify so far was *ERC20 compliance* of
49-
smart contracts written in languages like Solidity or Viper.
50-
But what does that really mean?
51-
When formal verification is sought, a property (or specification) to
52-
verify the code against must be explicitly or implicitly provided.
53-
Moreover, such a specification is expected to be non-ambiguous and
54-
capable of answering all the questions regarding corner-case behaviors.
55-
At our knowledge, there was no such formal ERC20 specification available
56-
at the time of this writing.
57-
Our specification below is executable, so it can also be tested for increased
58-
confidence.
59-
We tested it against a test-suite of more than 60 tests
60-
(under the `tests` folder), which we believe cover all the corner cases.
61-
Please contribute with more tests if you think that we left some behaviors
62-
uncovered.
58+
tokens written in languages like Solidity or Viper.
59+
But what does "ERC20 compliance" really mean?
60+
When formal verification is sought, a property (or specification) that the
61+
code must satisfy must be available.
62+
Moreover, such a specification should be non-ambiguous and capable of
63+
answering all the questions regarding corner-case behaviors.
64+
At our knowledge, there was no such formal specification for ERC20, or
65+
ERC20 variants, available at the time of this writing.
6366

6467
## Formal Specification
6568

0 commit comments

Comments
 (0)