building-secure-contracts icon indicating copy to clipboard operation
building-secure-contracts copied to clipboard

Manticore: show how to use the quick-mode in script

Open montyly opened this issue 5 years ago • 1 comments
trafficstars

This would speed-up many analyses that do not require the detectors/gas consumption.

We could add a section "tips to optimize scripts", or something like that, that will explain how to just disable the gas, etc

montyly avatar Mar 26 '20 10:03 montyly

# Disable gas computation
from manticore.utils import config
consts_evm = config.get_group("evm")
consts_evm.oog = "ignore"
from manticore.ethereum.plugins import SkipRevertBasicBlocks, FilterFunctions
m = Manticore(...)

# Do not explore path that will revert
m.register_plugin(SkipRevertBasicBlocks())

# Do not explore constant/view/pure functions
filter_nohuman_constants = FilterFunctions(regexp=r".*", depth="human", mutability="constant", include=False)
m.register_plugin(filter_nohuman_constants)
m = Manticore(...)
# When calling finalize, only generate testcases that did not revert
m.finalize(only_alive_states=True)

montyly avatar Jan 08 '21 14:01 montyly