runtimeverification / runtimeverification/kontrol
Errors due to placeholders for unlinked libraries in bytecode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 122
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
When a Solidity library has functions declared external or public (rather than only internal functions), it must be linked by providing the compiler with the address where the library is deployed (see Library Linking in the Solidity documentation). Until it is linked, the bytecode of a contract using the library will contain placeholders of the form __$53aea86b7d70b31448b230b20ae141a537$__ instead of the library address. Trying to execute this bytecode using KEVM leads to two issues:
- The definedness constraint added by
foundry-prove(here) evaluates to#Bottom, causing the entire initial configuration to simplify to#Bottom. I believe this happens because#parseByteStackis not defined when the string includes non-numerical characters. foundry-showcan fail because it tries to read a numerical byte and gets something that contains a special character instead, like__or$5(see runtimeverification/evm-semantics#1895).
To avoid these issues, which are non-trivial for a user to debug, it would be better if we could detect when the bytecode contains placeholders for unlinked libraries and give the user an informative error message.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the definedness constraint in kevm-pyk/src/kevm_pyk/foundry.py around line 863 and inspect how foundry-prove processes bytecode containing Solidity library placeholders. Also trace the foundry-show failure described in runtimeverification/evm-semantics#1895. Done means unlinked-library placeholders are detected and users receive an informative error instead of the current failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, solidity
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100