-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]: Adding foundry fuzzer for libraries processing bitmaps #641
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f4c7f25
Merge branch 'feat/cross-borrowing' into feat/foundry-fuzzer
LHerskind ffaada5
feat: Initial addition of foundry fuzzing
LHerskind d6d4ccc
forge install: ds-test
LHerskind 9fbda74
fix: Add fuzzer tet for WadRayMath
LHerskind dea51e5
fix: Add fuzzer test for PercentageMath
LHerskind df32b2c
Merge branch 'master' into feat/foundry-fuzzer
LHerskind b622d46
forge install: ds-test
LHerskind 19a20a8
test: Add fuzz tests for ReserveConfiguration
LHerskind f8f43e7
feat: Add fuzz test for CalldataLogic
LHerskind 24f8d49
fix: Implement test for isolationModeState and SiloedBorrowingState
LHerskind 1b00efb
Merge branch 'master' into feat/foundry-fuzzer
LHerskind f3ce5fa
Create ds-test
LHerskind 2a79cb3
fix: Use `HEVM_ADDRESS` from DSTest.
LHerskind 8a7705c
fix: Add nonEq zero address for assets + reduce fuzz rejects
LHerskind e812718
fix: Replace `assume` with bounds in ReserveConfiguration.
LHerskind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,6 @@ coverage | |
.coverage_cache | ||
.coverage_contracts | ||
coverage.json | ||
deployments/ | ||
deployments/ | ||
|
||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "lib/ds-test"] | ||
path = lib/ds-test | ||
url = https://github.com/dapphub/ds-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[default] | ||
src = 'src' | ||
out = 'out' | ||
libs = ['lib'] | ||
remappings = ['ds-test/=lib/ds-test/src/'] | ||
fuzz_runs = 10000 | ||
optimizer = false | ||
|
||
# See more config options https://github.com/gakonst/foundry/tree/master/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
interface Vm { | ||
// Set block.timestamp | ||
function warp(uint256) external; | ||
|
||
// Set block.number | ||
function roll(uint256) external; | ||
|
||
// Set block.basefee | ||
function fee(uint256) external; | ||
|
||
// Loads a storage slot from an address | ||
function load(address account, bytes32 slot) external returns (bytes32); | ||
|
||
// Stores a value to an address' storage slot | ||
function store( | ||
address account, | ||
bytes32 slot, | ||
bytes32 value | ||
) external; | ||
|
||
// Signs data | ||
function sign(uint256 privateKey, bytes32 digest) | ||
external | ||
returns ( | ||
uint8 v, | ||
bytes32 r, | ||
bytes32 s | ||
); | ||
|
||
// Computes address for a given private key | ||
function addr(uint256 privateKey) external returns (address); | ||
|
||
// Performs a foreign function call via terminal | ||
function ffi(string[] calldata) external returns (bytes memory); | ||
|
||
// Sets the *next* call's msg.sender to be the input address | ||
function prank(address) external; | ||
|
||
// Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called | ||
function startPrank(address) external; | ||
|
||
// Sets the *next* call's msg.sender to be the input address, and the tx.origin to be the second input | ||
function prank(address, address) external; | ||
|
||
// Sets all subsequent calls' msg.sender to be the input address until `stopPrank` is called, and the tx.origin to be the second input | ||
function startPrank(address, address) external; | ||
|
||
// Resets subsequent calls' msg.sender to be `address(this)` | ||
function stopPrank() external; | ||
|
||
// Sets an address' balance | ||
function deal(address who, uint256 newBalance) external; | ||
|
||
// Sets an address' code | ||
function etch(address who, bytes calldata code) external; | ||
|
||
// Expects an error on next call | ||
function expectRevert(bytes calldata) external; | ||
|
||
function expectRevert(bytes4) external; | ||
|
||
// Record all storage reads and writes | ||
function record() external; | ||
|
||
// Gets all accessed reads and write slot from a recording session, for a given address | ||
function accesses(address) external returns (bytes32[] memory reads, bytes32[] memory writes); | ||
|
||
// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData). | ||
// Call this function, then emit an event, then call a function. Internally after the call, we check if | ||
// logs were emitted in the expected order with the expected topics and data (as specified by the booleans) | ||
function expectEmit( | ||
bool, | ||
bool, | ||
bool, | ||
bool | ||
) external; | ||
|
||
// Mocks a call to an address, returning specified data. | ||
// Calldata can either be strict or a partial match, e.g. if you only | ||
// pass a Solidity selector to the expected calldata, then the entire Solidity | ||
// function will be mocked. | ||
function mockCall( | ||
address, | ||
bytes calldata, | ||
bytes calldata | ||
) external; | ||
|
||
// Clears all mocked calls | ||
function clearMockedCalls() external; | ||
|
||
// Expect a call to an address with the specified calldata. | ||
// Calldata can either be strict or a partial match | ||
function expectCall(address, bytes calldata) external; | ||
|
||
function getCode(string calldata) external returns (bytes memory); | ||
|
||
// Label an address in test traces | ||
function label(address addr, string memory label) external; | ||
|
||
// When fuzzing, generate new inputs if conditional not met | ||
function assume(bool) external; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.