Skip to content

Creating a State Test with retesteth

winsvega edited this page Jun 29, 2020 · 12 revisions

Requirements:

  1. latest geth client fork with retesteth support https://github.com/ethereum/go-ethereum/

  2. retesteth docker or compiled version
    https://github.com/ethereum/retesteth/wiki/Docker-instructions
    https://github.com/ethereum/retesteth

  3. test repo
    https://github.com/ethereum/tests

  4. solidity lllc translator
    https://github.com/winsvega/solidity

Steps:

  • Implement your EIP on fork of the ethereum geth client or on your own client with retesteth support
  • Follow the requirements steps
  • Write tests for you EIP in StateTest format (1 transaction)
  • Figure out the post condition (expect section) for you test/transaction
  • Generate test using your client and retesteth
  • Correct post condition errors if any
  • Write more tests
  • Make a PR to the test repo with your tests
  • Add link to the test to your EIP

Write a StateTest:
Study the https://github.com/ethereum/tests/blob/develop/src/GeneralStateTestsFiller/stExample/add11Filler.json
Create your test by repeating the pattern.
Study more complex test which has LLL: https://github.com/ethereum/tests/blob/develop/src/GeneralStateTestsFiller/stShift/shiftCombinationsFiller.yml

Commands:

Example run on default (geth) client:
./retesteth -t GeneralStateTests/stExample -- --clients "default" --testpath <pathToTheTestRepo>

** You could remove unused selectors (-d, -g, -v, --singlenet, --singletest)

** <yourClientConfigName> corresponds to this config names: ~/.retesteth/*
More about client configs: https://github.com/ethereum/retesteth/wiki/Add-client-configuration-to-Retesteth

** By default testpath is read from ETHEREUM_TEST_PATH env variable. --testpath "" option overrides this.