-
Notifications
You must be signed in to change notification settings - Fork 76
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
stExample
test folder.
https://github.com/ethereum/tests/tree/develop/src/GeneralStateTestsFiller/stExample -
Run
geth
client 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.