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.

Clone this wiki locally