Skip to content

Commit

Permalink
Rename multi-abi to allContracts (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcz authored Feb 22, 2023
1 parent 78c4d69 commit ff312a6
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 32 deletions.
38 changes: 20 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## TODO
## 2.1.0 (Unreleased)

* Rename multi-abi mode to allContracts

## 2.0.5

Expand All @@ -7,26 +9,26 @@
* Update hevm to 0.50 (#884, #894, #896, #897, #901)
* Added saving and loading of reproducers for every test (#858)
* Added events and revert reasons for any failure in the constructor (#871)
* Fixed uninitialized sender addresses from etheno transactions (#823)
* Fixed crash when minimizing inputs during optimization tests (#837)
* Fixed uninitialized sender addresses from etheno transactions (#823)
* Fixed crash when minimizing inputs during optimization tests (#837)
* Refactored code and removed useless dependencies (#856, #857, #874, #878, #895, #903)

## 2.0.4

* Added colored html for coverage output code (#816)
* Fixed crash when parsing solc versions (#835)
* Fixed crash when parsing solc versions (#835)
* Fixed long transactions and event lines in UI (#832)
* Added Homebrew installation instructions (#848)
* Added Homebrew installation instructions (#848)
* Moved all nix stuff to flake and use nix-bundle-exe for macOS release (#851)
* Updated codebase to GHC 9.0.2 (#846)
* Updated codebase to GHC 9.0.2 (#846)
* Refactored code and removed useless dependencies (#854, #853, #829, #827, #828)

## 2.0.3

* Clean up Docker containers (#706)
* Avoid resetting accounts if there is a deployed contract (#795)
* Fixed decoding non-utf8 strings from slither printer (#799)
* Fixed generation and mutation of extreme signed integers (#791)
* Fixed decoding non-utf8 strings from slither printer (#799)
* Fixed generation and mutation of extreme signed integers (#791)
* Removed fallback from signature map when it is not defined (#772)

## 2.0.2
Expand All @@ -37,13 +39,13 @@
* Fixed crash when the EVM execution triggers more than one query (#760)
* Added support for detection and handling of ancient solc versions (#675)
* Added explicit static flag and removed pthread one from ghc options (#768)

## 2.0.1

* Optimized stateless mutators (#747)
* Expanded and improved command-line help (#741)
* Added dapptest support: compatibility mode to run foundry and dapptool fuzz tests (#733, #745)
* Generate more values closer to the maximum (#736)
* Generate more values closer to the maximum (#736)
* Fix TERMINFO path for Nix release builds (#731)
* Mitigate large memory consumption when replaying corpus (#725)
* Fix --shrink-limit to change shrink limit instead of test limit (#728)
Expand All @@ -54,14 +56,14 @@

* Refactored test internal data structures and code
* Refactored unit test code and moved the related files to the `tests` directory
* Added support to show events and custom errors when a property/assertion fails
* Added support to show events and custom errors when a property/assertion fails
* Added support for catching assertion failure in Solidity 0.8.x
* Added two new testing mode: optimization and overflow (only in Solidity 0.8.x)
* Added optional checks for contract destruction
* Added `testMode` option and removed related flags
* Simplified contract deployer and property sender addresses to be easier to read
* Updated hevm to 0.49.0

## 1.7.3

* Removed old compilation artifacts before starting a new fuzzing campaign (#697)
Expand Down Expand Up @@ -92,17 +94,17 @@
* Refactor coverage types and added corpus size in UI (#627)
* Fixed link to macOS binary in binaries.soliditylang.org (#629)
* Fixed default.nix to use 1.7.0 as version (#623)
* Refactored Test type (#622)
* Refactored Test type (#622)

## 1.7.0

* Refactored and improved etheno support to be more useful (#615)
* Refactored and improved etheno support to be more useful (#615)
* Coverage filenames are not overwritten (#620)
* Refactored the mutator code (#618)
* More corpus and array mutations implemented (#372)
* Source coverage is printed after fuzzing campaign (#516)
* Nix improvements and fixes (#603, #604, #608, #612)
* Simplified slither information parsing (#543)
* Simplified slither information parsing (#543)
* Enabled use of coverage by default (#605)
* Run echidna tests in parallel (#571)

Expand All @@ -112,10 +114,10 @@
* Use metadata to detect deployed contracts (#593)
* Semver integration for improving testing with different solc versions (#594)
* Added some performance improvement in property execution (#576)
* Fixed wait bug when shrinking (#584)
* Fixed wait bug when shrinking (#584)
* Added funwithnumber example from Sabre (#565)
* Improved function filtering to be more precise (#570)
* Small fixes in the macOS CI (#597), the README (#590) and Nix (#581)
* Small fixes in the macOS CI (#597), the README (#590) and Nix (#581)

## 1.6.0
* Slither is now a required dependency.
Expand All @@ -134,7 +136,7 @@
* Fix negative address bug (#552)
* Various Github Actions improvements (#527, #554)
* Allow to bypass EIP-170 and set up a custom max code size (#544)

## 1.5.1

* Fix timestamp and block delays having the initial timestamp/block added to them (#460, #469)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Our tool signals each execution trace in the corpus with the following "line mar

Echidna can test contracts compiled with different smart contract build systems, including [Truffle](https://truffleframework.com/) or [hardhat](https://hardhat.org/) using [crytic-compile](https://github.com/crytic/crytic-compile). To invoke echidna with the current compilation framework, use `echidna .`.

On top of that, Echidna supports two modes of testing complex contracts. Firstly, one can [describe an initialization procedure with Truffle and Etheno](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/end-to-end-testing.md) and use that as the base state for Echidna. Secondly, echidna can call into any contract with a known ABI by passing in the corresponding solidity source in the CLI. Use `multi-abi: true` in your config to turn this on.
On top of that, Echidna supports two modes of testing complex contracts. Firstly, one can [describe an initialization procedure with Truffle and Etheno](https://github.com/crytic/building-secure-contracts/blob/master/program-analysis/echidna/end-to-end-testing.md) and use that as the base state for Echidna. Secondly, Echidna can call into any contract with a known ABI by passing in the corresponding Solidity source in the CLI. Use `allContracts: true` in your config to turn this on.

### Crash course on Echidna

Expand Down
2 changes: 1 addition & 1 deletion lib/Echidna/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ instance FromJSON EConfigWithUsage where
<*> v ..:? "initialize" ..!= Nothing
<*> v ..:? "deployContracts" ..!= []
<*> v ..:? "deployBytecodes" ..!= []
<*> v ..:? "multi-abi" ..!= False
<*> v ..:? "allContracts" ..!= False
<*> mode
<*> v ..:? "testDestruction" ..!= False
<*> v ..:? "allowFFI" ..!= False
Expand Down
2 changes: 1 addition & 1 deletion lib/Echidna/Types/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ data SolConf = SolConf
, initialize :: Maybe FilePath -- ^ Initialize world with Etheno txns
, deployContracts :: [(Addr, String)] -- ^ List of contracts to deploy in specific addresses
, deployBytecodes :: [(Addr, Text)] -- ^ List of contracts to deploy in specific addresses
, multiAbi :: Bool -- ^ Whether or not to use the multi-abi mode
, allContracts :: Bool -- ^ Whether or not to fuzz all contracts
, testMode :: String -- ^ Testing mode
, testDestruction :: Bool -- ^ Whether or not to add a property to detect contract destruction
, allowFFI :: Bool -- ^ Whether or not to allow FFI hevm cheatcode
Expand Down
8 changes: 4 additions & 4 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ data Options = Options
, cliOutputFormat :: Maybe OutputFormat
, cliCorpusDir :: Maybe FilePath
, cliTestMode :: Maybe TestMode
, cliMultiAbi :: Bool
, cliAllContracts :: Bool
, cliTestLimit :: Maybe Int
, cliShrinkLimit :: Maybe Int
, cliSeqLen :: Maybe Int
Expand Down Expand Up @@ -113,8 +113,8 @@ options = Options
<> help "Directory to save and load corpus and coverage data.")
<*> optional (option str $ long "test-mode"
<> help "Test mode to use. Either 'property', 'assertion', 'dapptest', 'optimization', 'overflow' or 'exploration'" )
<*> switch (long "multi-abi"
<> help "Use multi-abi mode of testing.")
<*> switch (long "all-contracts"
<> help "Generate calls to all deployed contracts.")
<*> optional (option auto $ long "test-limit"
<> metavar "INTEGER"
<> help ("Number of sequences of transactions to generate during testing. Default is " ++ show defaultTestLimit))
Expand Down Expand Up @@ -178,5 +178,5 @@ overrideConfig config Options{..} =
, deployer = fromMaybe solConf.deployer cliDeployer
, contractAddr = fromMaybe solConf.contractAddr cliContractAddr
, testMode = maybe solConf.testMode validateTestMode cliTestMode
, multiAbi = cliMultiAbi || solConf.multiAbi
, allContracts = cliAllContracts || solConf.allContracts
}
6 changes: 3 additions & 3 deletions src/test/Tests/Integration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ integrationTests = testGroup "Solidity Integration Testing"
]
, testContract "basic/library.sol" (Just "basic/library.yaml")
[ ("echidna_library_call failed", solved "echidna_library_call")
, ("echidna_valid_timestamp failed", passed "echidna_valid_timestamp")
, ("echidna_valid_timestamp failed", passed "echidna_valid_timestamp")
]
, testContractV "basic/fallback.sol" (Just (< solcV (0,6,0))) Nothing
[ ("echidna_fallback failed", solved "echidna_fallback") ]
Expand All @@ -74,7 +74,7 @@ integrationTests = testGroup "Solidity Integration Testing"
[ ("echidna_construct passed", solved "echidna_construct") ]
, testContract "basic/gasprice.sol" (Just "basic/gasprice.yaml")
[ ("echidna_state passed", solved "echidna_state") ]
, testContract' "basic/multi-abi.sol" (Just "B") Nothing (Just "basic/multi-abi.yaml") True
, testContract' "basic/allContracts.sol" (Just "B") Nothing (Just "basic/allContracts.yaml") True
[ ("echidna_test passed", solved "echidna_test") ]
, testContract "basic/array-mutation.sol" Nothing
[ ("echidna_mutated passed", solved "echidna_mutated") ]
Expand All @@ -94,7 +94,7 @@ integrationTests = testGroup "Solidity Integration Testing"
, checkConstructorConditions "basic/codesize.sol"
"invalid codesize"
, testContractV "basic/eip-170.sol" (Just (>= solcV (0,5,0))) (Just "basic/eip-170.yaml")
[ ("echidna_test passed", passed "echidna_test") ]
[ ("echidna_test passed", passed "echidna_test") ]
, testContract' "basic/deploy.sol" (Just "Test") Nothing (Just "basic/deployContract.yaml") True
[ ("test passed", solved "test") ]
, testContract' "basic/deploy.sol" (Just "Test") Nothing (Just "basic/deployBytecode.yaml") True
Expand Down
2 changes: 1 addition & 1 deletion tests/solidity/assert/multi.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
testMode: assertion
multi-abi: true
allContracts: true
File renamed without changes.
1 change: 1 addition & 0 deletions tests/solidity/basic/allContracts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
allContracts: true
4 changes: 2 additions & 2 deletions tests/solidity/basic/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ initialize: null
deployContracts: []
#initialize the blockchain with some bytecode in some addresses
deployBytecodes: []
#whether ot not to use the multi-abi mode of testing
multi-abi: false
#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
Expand Down
1 change: 0 additions & 1 deletion tests/solidity/basic/multi-abi.yaml

This file was deleted.

0 comments on commit ff312a6

Please sign in to comment.