crytic / crytic/medusa

Optimization tests should support inputs and uint return value

Open
#486 0 comments 0 reactions 0 assignees View on GitHub
feature-request low-priority
Dominant language
Go
Stars
486
Forks
92
Avg merge
4d 6h
Merged PRs (30d)
5

Description

Currently optimization tests only support `optimize_*` functions with no inputs and a `int` output, as visible [here](https://github.com/crytic/medusa/blob/9a2d0d9f895c74b168047b37f825e7d2b4079d41/fuzzing/utils/fuzz_method_utils.go#L10-L23). It would be useful to have optimization tests that support inputs and `uint` outputs as well.

Example of optimization test that currently won't be run:
```solidity
function optimize_rateDifference() public returns (uint256) {
if (newRate < startingRate) {
return startingRate - newRate;
}
return 0;
}
```

Contributor guide

Open the contributing guide

Research direction

Start in fuzzing/utils/fuzz_method_utils.go at the optimization-function handling referenced by the issue. Trace how function inputs and return types are currently recognized, using the Solidity optimize_rateDifference example as the target case. Done means optimization tests with inputs and uint or uint256 return values are discovered and run.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, solidity
Domain
blockchain, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.