Skip to content

Commit 563469a

Browse files
author
Leo Alt
committed
Docs
1 parent 61160aa commit 563469a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/smtchecker.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,25 @@ are located in storage, even though they also have type ``uint[]``. However,
830830
if ``d`` was assigned, we would need to clear knowledge about ``array`` and
831831
vice-versa.
832832

833+
Contract Balance
834+
================
835+
836+
A contract may be deployed with funds sent to it, if ``msg.value`` > 0 in the
837+
deployment transaction.
838+
However, the contract's address may already have funds before deployment,
839+
which are kept by the contract.
840+
Therefore, the SMTChecker assumes that ``address(this).balance >= msg.value``
841+
in the constructor in order to be consistent with the EVM rules.
842+
The contract's balance may also increase without triggering any calls to the
843+
contract, if
844+
845+
- ``selfdestruct`` is executed by another contract with the analyzed contract
846+
as the target of the remaining funds,
847+
- the contract is the coinbase (i.e., ``block.coinbase``) of some block.
848+
849+
To model this properly, the SMTChecker assumes that at every new transaction
850+
the contract's balance may grow by at least ``msg.value``.
851+
833852
**********************
834853
Real World Assumptions
835854
**********************
@@ -841,3 +860,7 @@ push: If the ``push`` operation is applied to an array of length 2^256 - 1, its
841860
length silently overflows.
842861
However, this is unlikely to happen in practice, since the operations required
843862
to grow the array to that point would take billions of years to execute.
863+
Another similar assumption taken by the SMTChecker is that an address' balance
864+
can never overflow.
865+
866+
A similar idea was presented in `EIP-1985 <https://eips.ethereum.org/EIPS/eip-1985>`_.

0 commit comments

Comments
 (0)