github.com/palisadeinc/bor@v0.0.0-20230615125219-ab7196213d15/RETESTBOR.md (about) 1 2 # Retesteth - bor 3 4 These integration tests are included in the bor repo via using the git submodule 5 6 ``` 7 [submodule "tests/testdata"] 8 path = tests/testdata 9 url = https://github.com/ethereum/tests.git 10 ``` 11 12 The version used is the last stable release, tagged as v10.4 from branch develop in ethereum/tests 13 Details on release code can be found here https://github.com/ethereum/tests/commit/a380655e5ffab1a5ea0f4d860224bdb19013f06a 14 15 To run the tests, we hava a `make` command: 16 ``` 17 make test-integration 18 ``` 19 which is also integrated into the CI pipeline on GitHub 20 21 22 ## Retesteth - bor on remote machine 23 24 To explore and test the `retesteth` package, the following steps were executed. 25 This is only for educational purposes. 26 For future usage, there is no need to go through this section, the only thing needed is to have 'green' integration tests. 27 28 - `ssh` into a VM running bor 29 - Change configs by replacing geth with bor inside the docker container 30 ``` 31 mkdir ~/retestethBuild 32 cd ~/retestethBuild 33 wget https://raw.githubusercontent.com/ethereum/retesteth/develop/dretesteth.sh 34 chmod +x dretesteth.sh 35 wget https://raw.githubusercontent.com/ethereum/retesteth/develop/Dockerfile 36 ``` 37 38 Modify the RUN git clone line in the Dockerfile for repo “retesteth” to change branch -b from master to develop. Do not modify repo branches for “winsvega/solidity” [LLLC opcode support] and “go-ethereum”. 39 Modify the Dockerfile so that the eth client points to bor 40 e.g. : `https://github.com/ethereum/retesteth/blob/master/Dockerfile#L41` 41 from `RUN git clone --depth 1 -b master https://github.com/ethereum/go-ethereum.git /geth` 42 to: `RUN git clone --depth 1 -b master https://github.com/maticnetwork/bor.git /geth` 43 44 - build docker image 45 `sudo ./dretesteth.sh build` 46 47 - clone repo 48 ``` 49 git clone --branch develop https://github.com/ethereum/tests.git 50 ``` 51 this step is eventually replaced by adding the git submodule directly into bor repo with 52 ``` 53 git submodule add --depth 1 https://github.com/ethereum/tests.git tests/testdata 54 ``` 55 - Let's move to the restestethBuild folder 56 ``` 57 cd /home/ubuntu/retestethBuild 58 ``` 59 Now we have the tests repo here 60 ``` 61 ls 62 > Dockerfile dretesteth.sh tests 63 ``` 64 - Run test example 65 ``` 66 ./dretesteth.sh -t GeneralStateTests/stExample -- --testpath /home/ubuntu/retestethBuild/tests --datadir /tests/config 67 ``` 68 This will create the config files for the different clients in ~/tests/config 69 Eventually. these config needs to be adapted according to the following doc 70 https://ethereum-tests.readthedocs.io/en/latest/retesteth-tutorial.html 71 Specifically: 72 ``` 73 f you look inside ~/tests/config, you’ll see a directory for each configured client. Typically this directory has these files: 74 75 config, which contains the configuration for the client: 76 The communication protocol to use with the client (typically TCP) 77 The address(es) to use with that protocol 78 The forks the client supports 79 The exceptions the client can throw, and how retesteth should interpret them. This is particularly important when testing the client’s behavior when given invalid blocks. 80 start.sh, which starts the client inside the docker image 81 stop.sh, which stops the client instance(s) 82 genesis, a directory which includes the genesis blocks for various forks the client supports. If this directory does not exist for a client, it uses the genesis blocks for the default client. 83 ``` 84 85 We replaced geth inside docker by using https://ethereum-tests.readthedocs.io/en/latest/retesteth-tutorial.html#replace-geth-inside-the-docker 86 Theoretically, we would not need any additional config change 87 88 - Run test suites 89 ``` 90 ./dretesteth.sh -t <TestSuiteName> -- --testpath /home/ubuntu/retestethBuild/tests --datadir /tests/config 91 ``` 92 Where `TestSuiteName` is one of the maintained test suites, reported here https://github.com/ethereum/tests 93 ``` 94 BasicTests 95 BlockchainTests 96 GeneralStateTests 97 TransactionTests 98 RLPTest 99 src 100 ``` 101 102 If you want to run retestheth against a bor client on localhost:8545 (using 8 threads), instead of isolating it into a docker image, run 103 `sudo ./dretesteth.sh -t GeneralStateTests -- --testpath ~/tests --datadir /tests/config --clients t8ntool --nodes 127.0.0.1:8545 -j 8`