Skip to content

Commit

Permalink
Merge pull request #99 from crytic/dev-remove-echidna
Browse files Browse the repository at this point in the history
Remove echidna integration
  • Loading branch information
anishnaik committed Jun 28, 2022
2 parents 3ec0d2f + f9f3714 commit 3a7e121
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.pyc
build
dist
venv/
*egg*
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - && sudo apt-

RUN npm install --production -g ganache-cli truffle && npm --force cache clean

# BEGIN Install Echidna

COPY --from=trailofbits/echidna:latest /root/.local/bin/echidna-test /usr/local/bin/echidna-test

RUN update-locale LANG=en_US.UTF-8 && locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8

# END Install Echidna

RUN useradd -m etheno
RUN usermod -aG sudo etheno
USER etheno
Expand Down
15 changes: 11 additions & 4 deletions etheno/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from . import parity
from . import truffle


def main(argv = None):
parser = argparse.ArgumentParser(description='An Ethereum JSON RPC multiplexer, differential fuzzer, and test framework integration tool.')
parser.add_argument('--debug', action='store_true', default=False, help='Enable debugging from within the web server')
Expand All @@ -28,9 +29,12 @@ def main(argv = None):
parser.add_argument('-b', '--balance', type=float, default=100.0, help='Default balance (in Ether) to seed to each account (default=100.0)')
parser.add_argument('-c', '--gas-price', type=int, default=None, help='Default gas price (default=20000000000)')
parser.add_argument('-i', '--network-id', type=int, default=None, help='Specify a network ID (default is the network ID of the master client)')
'''
We might need the Echidna feature later for differential fuzz testing but for reducing confusion we will remove the command-line arguments
parser.add_argument('-e', '--echidna', action='store_true', default=False, help='Fuzz the clients using transactions generated by Echidna')
parser.add_argument('--fuzz-limit', type=int, default=None, help='The maximum number of transactions for Echidna to generate (default=unlimited)')
parser.add_argument('--fuzz-contract', type=str, default=None, help='Path to a Solidity contract to have Echidna use for fuzzing (default is to use a builtin generic Echidna fuzzing contract)')
'''
parser.add_argument('-t', '--truffle', action='store_true', default=False, help='Run the truffle migrations in the current directory and exit')
parser.add_argument('--truffle-cmd', type=str, default='truffle', help='Command to run truffle (default=truffle)')
parser.add_argument('--truffle-args', type=str, default='migrate',
Expand Down Expand Up @@ -137,8 +141,9 @@ def main(argv = None):
if args.export_summary is not None:
ETHENO.add_plugin(EventSummaryExportPlugin(args.export_summary))


# First, see if we need to install Echidna:
'''
Commenting this out and can re-use if needed
if args.echidna:
if not echidna_exists():
if not ynprompt('Echidna does not appear to be installed.\nWould you like to have Etheno attempt to '
Expand All @@ -149,7 +154,7 @@ def main(argv = None):
ETHENO.logger.error('Etheno failed to install Echidna. Please install it manually '
'https://github.com/trailofbits/echidna')
sys.exit(1)
'''
if args.genesis is None:
# Set defaults since no genesis was supplied
if args.accounts is None:
Expand Down Expand Up @@ -323,14 +328,16 @@ def truffle_thread():
map(str, [ETHENO.master_client] + ETHENO.clients)
))
ETHENO.add_plugin(DifferentialTester())


'''
Keeping in case we want it later
if args.echidna:
contract_source = None
if args.fuzz_contract is not None:
with open(args.fuzz_contract, 'rb') as c:
contract_source = c.read()
ETHENO.add_plugin(EchidnaPlugin(transaction_limit=args.fuzz_limit, contract_source=contract_source))

'''
had_plugins = len(ETHENO.plugins) > 0

if ETHENO.master_client is None and not ETHENO.clients and not ETHENO.plugins:
Expand Down
3 changes: 2 additions & 1 deletion etheno/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from .etheno import EthenoPlugin
from .utils import format_hex_address

# TODO: what is this file for?
class ContractSynchronizer(EthenoPlugin):
def __init__(self, source_client, contract_address):
if isintsance(source_client, str):
if isinstance(source_client, str):
source_client = RpcProxyClient(source_client)
self.source = source_client
self.contract = format_hex_address(contract_address, True)
Expand Down
2 changes: 1 addition & 1 deletion etheno/echidna.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ def emit_transaction(self, txn):


if __name__ == '__main__':
install_echidna(allow_reinstall=True)
install_echidna(allow_reinstall=True)
23 changes: 0 additions & 23 deletions examples/ConstantinopleGasUsage/README.md

This file was deleted.

15 changes: 0 additions & 15 deletions examples/ConstantinopleGasUsage/constantinople.sol

This file was deleted.

1 change: 0 additions & 1 deletion examples/ConstantinopleGasUsage/run_etheno.sh

This file was deleted.

0 comments on commit 3a7e121

Please sign in to comment.