From 127eba9bc667c4241d4ea4786d6ae810f46549f9 Mon Sep 17 00:00:00 2001 From: Sean Darcy Date: Mon, 18 Dec 2023 08:11:29 +1100 Subject: [PATCH] upgrade echidna --- .github/workflows/fuzz-testing.yml | 9 +- echidna.config.yml | 162 ++++++++++++++++------------- 2 files changed, 95 insertions(+), 76 deletions(-) diff --git a/.github/workflows/fuzz-testing.yml b/.github/workflows/fuzz-testing.yml index e305c87..5b4838c 100644 --- a/.github/workflows/fuzz-testing.yml +++ b/.github/workflows/fuzz-testing.yml @@ -45,9 +45,10 @@ jobs: - name: Install echidna run: | - sudo wget -O /tmp/echidna-test.tar.gz https://github.com/crytic/echidna/releases/download/v1.6.0/echidna-test-v1.6.0-Ubuntu-18.04.tar.gz - sudo tar -xf /tmp/echidna-test.tar.gz -C /usr/bin - sudo chmod +x /usr/bin/echidna-test + sudo wget -O /tmp/echidna.zip https://github.com/crytic/echidna/releases/download/v2.2.1/echidna-2.2.1-Linux.zip + sudo unzip /tmp/echidna.zip -d /tmp + sudo tar -xf /tmp/echidna.tar.gz -C /usr/bin + sudo chmod +x /usr/bin/echidna - name: Run ${{ matrix.testName }} - run: echidna-test . --contract ${{ matrix.testName }} --config echidna.config.yml + run: echidna . --contract ${{ matrix.testName }} --config echidna.config.yml --test-mode assertion diff --git a/echidna.config.yml b/echidna.config.yml index 64a761d..20ebac9 100644 --- a/echidna.config.yml +++ b/echidna.config.yml @@ -1,74 +1,92 @@ -#format can be "text" or "json" for different output (human or machine readable) -format: 'text' -#checkAsserts checks assertions -checkAsserts: true +#select the mode to test, which can be property, assertion, overflow, exploration, optimization +testMode: "assertion" +#check if some contract was destructed or not +testDestruction: false +#psender is the sender for property transactions; by default intentionally +#the same as contract deployer +psender: "0x10000" +#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: 0 +#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 #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 +#format can be "text" or "json" for different output (human or machine readable) +format: "text" +#contractAddr is the address of the contract itself +contractAddr: "0x00a329c0648769a73afac7f9381e08fb43dbea72" +#deployer is address of the contract deployer (who often is privileged owner, etc.) +deployer: "0x30000" +#sender is set of addresses transactions may originate from +sender: ["0x10000", "0x20000", "0x30000"] +#balanceAddr is default balance for addresses +balanceAddr: 0xffffffff +#balanceContract overrides balanceAddr for the contract address +balanceContract: 0 +#codeSize max code size for deployed contratcs (default 24576, per EIP-170) +codeSize: 0x6000 +#solcArgs allows special args to solc +solcArgs: "" +#solcLibs is solc libraries +solcLibs: ["BN256G2.sol"] +#cryticArgs allows special args to crytic +cryticArgs: [] +#cryticArgs: ["--compile-libraries=(BN256G2,0x1f)"] +#quiet produces (much) less verbose output +quiet: false +#initialize the blockchain with some data +initialize: null +#initialize the blockchain with some predeployed contracts in some addresses +#deployContracts: [["0x1f", "BN256G2"]] +deployContracts: [] +#initialize the blockchain with some bytecode in some addresses +deployBytecodes: [] +#whether ot not to fuzz all contracts +allContracts: 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 +# enable or disable ffi HEVM cheatcode +allowFFI: false +#directory to save the corpus; by default is disabled +corpusDir: null +# list of file formats to save coverage reports in; default is all possible formats +coverageFormats: ["txt","html","lcov"] +# constants for corpus mutations (for experimentation only) +mutConsts: [1, 1, 1, 1] +# maximum value to send to payable functions +maxValue: 100000000000000000000 # 100 eth +# URL to fetch contracts over RPC +rpcUrl: null +# block number to use when fetching over RPC +rpcBlock: null +# number of workers +workers: 1