runtimeverification / runtimeverification/kontrol
Implement `symbolicCallData()` and `assumeBytesLength(bytes,uint256)` cheatcodes
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Python
- Stars
- 122
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Implement the following cheatcodes that have been factored out from https://github.com/runtimeverification/kontrol/pull/223:
// Make calldata symbolic
function symbolicCalldata() external;
// Add assumptions about the length of symbolic calldata
function assumeBytesLength(bytes calldata,uint256) external;
rule ( selector ( "symbolicCallData()" ) => 2368578420 )
rule ( selector ( "assumeBytesLength(bytes,uint256)" ) => 1696199529 )
symbolicCallData — Changes the current calldata after a function selector to a symbolic variable.
function symbolicCallData() external;
rule [foundry.call.symbolicCallData]:
<k> #call_foundry SELECTOR _ARGS => . ... </k>
<callData> CD:Bytes => #range( CD, 0, 4) +Bytes ?CALLDATA </callData>
requires SELECTOR ==Int selector ( "symbolicCallData()" )
assumeBytesLength — Adds assumptions about the length of a symbolic bytes array.
function assumeBytesLength(bytes, uint256) external;
rule [foundry.call.assumeBytesArray]:
<k> #call_foundry SELECTOR ARGS => #assume (lengthBytes(#range(ARGS, 0, 32)) ==Int #asWord(#range(ARGS, 32, 32))) ... </k>
requires SELECTOR ==Int selector ( "assumeBytesLength(bytes,uint256)" )
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 by reading the changes factored out from kontrol pull request 223 and locate the existing Foundry cheatcode handling for the named selectors. Check the provided symbolicCalldata and assumeBytesLength rules and verify that both selectors apply the stated calldata transformation or length assumption; done means both cheatcodes are implemented with the specified behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- blockchain
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100