-
Notifications
You must be signed in to change notification settings - Fork 79
Creating a State Test with retesteth
Requirements:
-
latest geth client fork with retesteth support https://github.com/ethereum/go-ethereum/
-
retesteth docker or compiled version
https://github.com/ethereum/retesteth/wiki/Docker-instructions
https://github.com/ethereum/retesteth -
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:
-
Put your tests to
stExampletest folder.
https://github.com/ethereum/tests/tree/develop/src/GeneralStateTestsFiller/stExample -
Run
gethclient with (Make sure the port is set in your [client config] (https://github.com/ethereum/retesteth/wiki/Add-client-configuration-to-Retesteth) for retesteth)
geth retesteth --rpcport 8545 -
Generate your test with
retesteth:
./retesteth -t GeneralStateTests/stExample -- --clients "<yourClientConfigName>" --singletest <yourTestName> --singlenet <forkName> -d <trDataIndex> -g <trGasIndex> -v <trValueIndex> --filltests --testpath <pathToTheTestRepo>
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.