Skip to content
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

[Draft] Add stateful properties #821

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
86 changes: 12 additions & 74 deletions echidna.config.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,12 @@
#format can be "text" or "json" for different output (human or machine readable)
format: "text"
#checkAsserts checks assertions
checkAsserts: true
#coverage controls coverage guided testing
coverage: false
# #psender is the sender for property transactions; by default intentionally
# #the same as contract deployer
# psender: "0x00a329c0648769a73afac7f9381e08fb43dbea70"
# #prefix is the prefix for Boolean functions that are properties to be checked
# prefix: "echidna_"
# #propMaxGas defines gas cost at which a property fails
# propMaxGas: 8000030
# #testMaxGas is a gas limit; does not cause failure, but terminates sequence
# testMaxGas: 8000030
# #maxGasprice is the maximum gas price
# maxGasprice: 100000000000
# #testLimit is the number of test sequences to run
# testLimit: 50000
# #stopOnFail makes echidna terminate as soon as any property fails and has been shrunk
# stopOnFail: false
# #estimateGas makes echidna perform analysis of maximum gas costs for functions (experimental)
# estimateGas: false
# #seqLen defines how many transactions are in a test sequence
# seqLen: 100
# #shrinkLimit determines how much effort is spent shrinking failing sequences
# shrinkLimit: 5000
# #contractAddr is the address of the contract itself
# contractAddr: "0x00a329c0648769a73afac7f9381e08fb43dbea72"
# #deployer is address of the contract deployer (who often is privileged owner, etc.)
# deployer: "0x00a329c0648769a73afac7f9381e08fb43dbea70"
# #sender is set of addresses transactions may originate from
# sender: ["0x10000", "0x20000", "0x00a329c0648769a73afac7f9381e08fb43dbea70"]
# #balanceAddr is default balance for addresses
# balanceAddr: 0xffffffff
# #balanceContract overrides balanceAddr for the contract address
# balanceContract: 0
# #solcArgs allows special args to solc
# solcArgs: ""
# #solcLibs is solc libraries
# solcLibs: []
# #cryticArgs allows special args to crytic
# cryticArgs: []
# #quiet produces (much) less verbose output
# quiet: false
# #initialize the blockchain with some data
# initialize: null
# #whether ot not to use the multi-abi mode of testing
# multi-abi: false
# #benchmarkMode enables benchmark mode
# benchmarkMode: false
# #timeout controls test timeout settings
# timeout: null
# #seed not defined by default, is the random seed
# #seed: 0
# #dictFreq controls how often to use echidna's internal dictionary vs random
# #values
# dictFreq: 0.40
# maxTimeDelay: 604800
# #maximum time between generated txs; default is one week
# maxBlockDelay: 60480
# #maximum number of blocks elapsed between generated txs; default is expected increment in one week
# # timeout:
# #campaign timeout (in seconds)
# # list of methods to filter
# filterFunctions: []
# # by default, blacklist methods in filterFunctions
# filterBlacklist: true
# #directory to save the corpus; by default is disabled
# corpusDir: null
# # constants for corpus mutations (for experimentation only)
# mutConsts: [100, 1, 1]
# # maximum value to send to payable functions
# maxValue: 100000000000000000000 # 100 eth
testMode: "assertion"
prefix: "crytic_"
coverage: true
corpusDir: "echidna"
balanceAddr: 0x1043561a8829300000
balanceContract: 0x1043561a8829300000
cryticArgs: ["--ignore-compile"]
testLimit: 5000000000
allContracts: false
workers: 14
seqLen: 10
allowFFI: true
7 changes: 7 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ via_ir = false
optimizer_runs = 200
fuzz.runs = 100

[profile.statefulfuzz]
solc = "0.8.24"
via_ir = false
ffi = true
optimizer_runs = 0
fuzz.runs = 0

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
73 changes: 73 additions & 0 deletions medusa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"fuzzing": {
"workers": 16,
"workerResetLimit": 50,
"timeout": 0,
"testLimit": 200000000,
"callSequenceLength": 150,
"corpusDirectory": "medusa",
"coverageEnabled": true,
"shrinkLimit": 10000,
"deploymentOrder": ["ActionFuzzEntrypoint"],
"targetContracts": ["ActionFuzzEntrypoint"],
"targetContractsBalances": ["0x27b46536c66c8e3000000"],
"constructorArgs": {},
"deployerAddress": "0x30000",
"senderAddresses": ["0x10000"],
"blockNumberDelayMax": 60480,
"blockTimestampDelayMax": 604800,
"blockGasLimit": 125000000,
"transactionGasLimit": 12500000,
"testing": {
"stopOnFailedTest": true,
"stopOnFailedContractMatching": false,
"stopOnNoTests": true,
"testAllContracts": false,
"traceAll": false,
"assertionTesting": {
"enabled": true,
"testViewMethods": false,
"panicCodeConfig": {
"failOnCompilerInsertedPanic": true,
"failOnAssertion": true,
"failOnArithmeticUnderflow": false,
"failOnDivideByZero": false,
"failOnEnumTypeConversionOutOfBounds": true,
"failOnIncorrectStorageAccess": true,
"failOnPopEmptyArray": true,
"failOnOutOfBoundsArrayAccess": true,
"failOnAllocateTooMuchMemory": true,
"failOnCallUninitializedVariable": true
}
},
"propertyTesting": {
"enabled": true,
"testPrefixes": ["crytic_"]
},
"optimizationTesting": {
"enabled": false,
"testPrefixes": ["optimize_"]
}
},
"chainConfig": {
"codeSizeCheckDisabled": true,
"cheatCodes": {
"cheatCodesEnabled": true,
"enableFFI": true
}
}
},
"compilation": {
"platform": "crytic-compile",
"platformConfig": {
"target": ".",
"solcVersion": "",
"exportDirectory": "",
"args": ["--foundry-ignore-compile"]
}
},
"logging": {
"level": "info",
"logDirectory": ""
}
}
2 changes: 1 addition & 1 deletion src/PoolManager.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.26;
pragma solidity ^0.8.24;

import {Hooks} from "./libraries/Hooks.sol";
import {Pool} from "./libraries/Pool.sol";
Expand Down
Loading