Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ETCM-680 retesteth in Nix and on CI #965

Merged
merged 55 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d0efa24
ETCM-680 retesteth in nix WIP
Apr 13, 2021
04e7d57
add lllc, update retesteth sha256
Apr 14, 2021
0cbf125
add retesteth as dependency of mantis to see if hydra will want to bu…
Apr 14, 2021
f7e78d5
WIP
Apr 14, 2021
4ca3869
use retesteth for ets
Apr 14, 2021
4a4af51
ETCM-657 move config files to resources to enable usage during develo…
Mar 23, 2021
e0eb860
fix test API for retesteth WIP
Mar 23, 2021
01b0703
ETCM-697: Added initial import raw block test method
Mar 25, 2021
e597217
ETCM-697: Fixed issue related to genesis data loading
Mar 26, 2021
8f71d32
ETCM-697: Added TestEthBlockServiceWrapper to accommodate response ac…
Mar 26, 2021
4f786e4
ETCM-697: Fixed code hash parsing bug. Added debug account range meth…
Mar 30, 2021
96a350d
add some logging, wait for importBlock before continuing, don't omit …
Mar 29, 2021
a8b92f5
ETCM-697: Added initial account range implementation
Apr 1, 2021
6d5ccbb
ETCM-697: Added separate transaction response class that includes sig…
Apr 5, 2021
e804f13
ETCM-697: Fixed state root calculation when block mining in ets. Adde…
Apr 8, 2021
bd21e7b
ETCM-697: Transaction get log hash implemented
Apr 9, 2021
e0a7206
ETCM-697: Added zero fork blocks to testmode config
Apr 15, 2021
dec1de7
update ETS
Apr 15, 2021
46f53e9
allow ETS to fail, write output to artifacts
Apr 15, 2021
8bdceb6
try retesteth as separate task in hydra
Apr 15, 2021
f1d2fde
wip
Apr 15, 2021
c3ce44b
ETCM-697: Fixed failing tests
Apr 15, 2021
78e2edc
ETCM-697: Fixed scalastyle issues
Apr 15, 2021
1ef233f
lllc in nix shell
Apr 16, 2021
bdad85b
also capture stderr, don't tee it to output of the task (probably not…
Apr 16, 2021
a10f7ea
shebang
Apr 16, 2021
3c158bc
don't retry ETS job
Apr 16, 2021
88b1e79
make ets script a bit chattier
Apr 16, 2021
ea25f01
Merge remote-tracking branch 'origin/develop' into feature/ETCM-680-r…
Apr 16, 2021
9382c72
Merge remote-tracking branch 'origin/develop' into feature/ETCM-697-r…
Apr 16, 2021
1339e12
fix import
Apr 16, 2021
cbfda37
Merge branch 'feature/ETCM-697-retesteth-endpoints' into feature/ETCM…
Apr 16, 2021
8050330
rollback ETS to 8.0.3
Apr 16, 2021
043f63a
almost working, pure retesteth package
nrdxp Apr 16, 2021
25a3de9
Fix cryptopp build
jonringer Apr 16, 2021
c23c5fa
Fix cryptopp build, and update retesteth ref
jonringer Apr 16, 2021
bd1da35
remove superfluous buildInputs for retesteth
nrdxp Apr 16, 2021
1ef8763
update ETS config
Apr 19, 2021
dd645e0
create annotation with retesteth results
Apr 19, 2021
0465ac3
fix retesteth ip
Apr 19, 2021
3ecb6f7
also run retesteth with BlockchainTests suite
Apr 19, 2021
81fecf3
allow docker to connect to host network
Apr 19, 2021
eb29c10
rename docker script to match mantis-ops
Apr 19, 2021
0ac0bcb
update retesteth artifacts list
Apr 19, 2021
917dc31
try without whitespace
Apr 19, 2021
ca28d16
fix artifacts
Apr 19, 2021
d664273
fix annotations
Apr 20, 2021
3cfd982
hydra troubleshooting
Apr 20, 2021
0391f05
Revert "Merge branch 'feature/ETCM-697-retesteth-endpoints' into feat…
Apr 20, 2021
c2a8978
remove custom ETS testing code (now replaced by retesteth)
Apr 20, 2021
5854475
cleanup
Apr 20, 2021
45b984c
cleanup ets subproject, move ETS-related things into top-level folder…
Apr 20, 2021
a852d71
restore submodule
Apr 20, 2021
420cc13
Merge remote-tracking branch 'origin/develop' into feature/ETCM-680-r…
Apr 20, 2021
cabe6c2
Merge branch 'develop' into feature/ETCM-680-retesteth-ci
jvdp Apr 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .buildkite/pipeline.nix
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ in
command = ''
nix-shell --run './test-ets.sh'
'';
softFail = true;
retry.automatic = false;
artifactPaths = [
"mantis-log.txt"
"retesteth-GeneralStateTests-log.txt"
"retesteth-BlockchainTests-log.txt"
];
};

coverageReport = commonAttrs // {
Expand Down
17 changes: 7 additions & 10 deletions .buildkite/shell.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ sources, pkgs }:

{ sources, pkgs }:
let

# TODO, share this code with mantis build in this project
# sbt-protoc puts the scala plugin in /tmp/protobridge<some-random-number>.
# it is in fact a shell script with a standard `#!/usr/bin/env sh` shebang
Expand All @@ -18,11 +16,10 @@ let
exec ${pkgs.protobuf}/bin/protoc "$@"
'';
in
with pkgs;

with pkgs;

mkShell {
nativeBuildInputs = [ sbt solc jdk8 protoc-wrapper ];
# SBT = "sbt -v -mem 2048 -J-Xmx4g -Dsbt.ivy.home=/cache/ivy2 -Dsbt.boot.directory=/cache/sbt -Dmaven.repo.local=/cache/maven -Dnix=true";
SBT = "sbt -v -mem 2048 -J-Xmx4g -Dnix=true";
}
mkShell {
nativeBuildInputs = [ sbt solc lllc jdk8 protoc-wrapper retesteth netcat-gnu ];
# SBT = "sbt -v -mem 2048 -J-Xmx4g -Dsbt.ivy.home=/cache/ivy2 -Dsbt.boot.directory=/cache/sbt -Dmaven.repo.local=/cache/maven -Dnix=true";
SBT = "sbt -v -mem 2048 -J-Xmx4g -Dnix=true";
}
5 changes: 3 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[submodule "src/ets/resources/ets"]
path = src/ets/resources/ets
[submodule "ets/tests"]
path = ets/tests
url = https://github.com/ethereum/tests

[submodule "src/main/protobuf/extvm"]
path = src/main/protobuf/extvm
url = https://github.com/input-output-hk/mantis-extvm-pb
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ In the root of the project:
nix-build
```

##### On a Mac

This project uses Nix for CI, deployment and, optionally, local development.
Some of the dependencies are not available for Darwin (macOS) however. To work
with Nix on a Mac you can instead use Docker via the `nix-in-docker/run` script,
which will start a `nix-shell` with the same environment as CI.

##### Update sbt+nix dependencies

When updating project dependencies, the nix fixed-output-derivation
Expand Down
6 changes: 1 addition & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ lazy val node = {

val Evm = config("evm") extend Test

val Ets = config("ets") extend Test

val Rpc = config("rpcTest") extend Test

val malletDeps = Seq(
Expand Down Expand Up @@ -182,7 +180,7 @@ lazy val node = {

val node = project
.in(file("."))
.configs(Integration, Benchmark, Evm, Ets, Rpc)
.configs(Integration, Benchmark, Evm, Rpc)
.enablePlugins(BuildInfoPlugin)
.dependsOn(bytes, crypto, rlp)
.settings(
Expand Down Expand Up @@ -217,7 +215,6 @@ lazy val node = {
)
.settings(inConfig(Benchmark)(Defaults.testSettings :+ (Test / parallelExecution := false)): _*)
.settings(inConfig(Evm)(Defaults.testSettings :+ (Test / parallelExecution := false)): _*)
.settings(inConfig(Ets)(Defaults.testSettings :+ (Test / parallelExecution := false)): _*)
.settings(inConfig(Rpc)(Defaults.testSettings :+ (Test / parallelExecution := false)): _*)
.settings(
// protobuf compilation
Expand Down Expand Up @@ -266,7 +263,6 @@ addCommandAlias(
|;test:compile
|;evm:compile
|;it:compile
|;ets:compile
|;rpcTest:compile
|;benchmark:compile
|""".stripMargin
Expand Down
11 changes: 0 additions & 11 deletions ci-like/Dockerfile

This file was deleted.

51 changes: 51 additions & 0 deletions ets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Ethereum Test Suite

This folder contains a git submodule pointing at the Ethereum Consensus Tests,
also known as the Ethereum Test Suite (ETS), config files for retesteth (the
tool for running these tests) and a wrapper script to set the its command line
options. Oh, and this readme file is in there too, of course.

* ETS: https://github.com/ethereum/tests
* retesteth: https://github.com/ethereum/retesteth

## Continous integration

The tests are run on CI. For more details look at `.buildkite/pipeline.nix` and
`test-ets.sh`. Output is stored as artifacts and a summary is added as
annotation.

Two test suites are run; GeneralStateTests and BlockchainTests. These seem to
be the only ones maintained and recommended at the moment.

## Running ETS in a Nix environment

Start Mantis in test mode:

sbt -Dconfig.file=./src/main/resources/conf/testmode.conf -Dlogging.logs-level=WARN run

NB. raising the log level is a good idea as there will be a lot of output,
depending on how many tests you run.

Once the RPC API is up, run retesteth:

ets/retesteth -t GeneralStateTests

You can also run parts of the suite; refer to `ets/retesteth --help` for details.

## Running retesteth in Docker (eg. macOS)

You should run Mantis outside Nix as that is probably more convenient for your
tooling (eg. attaching a debugger.)

sbt -Dconfig.file=./src/main/resources/conf/testmode.conf -Dlogging.logs-level=WARN run

Retesteth will need to be able to connect to Mantis, running on the host
system. First, find the IP it should use:

nix-in-docker/run --command "getent hosts host.docker.internal"

Edit `ets/config/mantis` and replace `0.0.0.0` with this IP.

Finally, run retesteth in Nix in Docker:

nix-in-docker/run --command "ets/retesteth -t GeneralStateTests"
26 changes: 26 additions & 0 deletions ets/config/mantis/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name" : "IOHK Mantis on TCP",
"socketType" : "tcp",
"socketAddress" : [
"0.0.0.0:8546"
],
"initializeTime" : "5",
"forks" : [
"Frontier",
"Homestead",
"EIP150",
"EIP158",
"Byzantium",
"Constantinople",
"ConstantinopleFix",
"Istanbul"
],
"additionalForks" : [
"FrontierToHomesteadAt5",
"HomesteadToEIP150At5",
"EIP158ToByzantiumAt5",
"HomesteadToDaoAt5",
"ByzantiumToConstantinopleFixAt5"
],
"exceptions" : {}
}
15 changes: 15 additions & 0 deletions ets/config/mantis/genesis/Berlin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x00",
"constantinopleForkBlock" : "0x00",
"constantinopleFixForkBlock" : "0x00",
"istanbulForkBlock" : "0x00",
"berlinForkBlock" : "0x00",
"chainID" : "0x01"
},
"accounts" : {
}
}
10 changes: 10 additions & 0 deletions ets/config/mantis/genesis/Byzantium.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x00"
},
"accounts" : {
}
}
12 changes: 12 additions & 0 deletions ets/config/mantis/genesis/ByzantiumToConstantinopleFixAt5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x00",
"constantinopleForkBlock" : "0x05",
"constantinopleFixForkBlock" : "0x05"
},
"accounts" : {
}
}
11 changes: 11 additions & 0 deletions ets/config/mantis/genesis/Constantinople.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x00",
"constantinopleForkBlock" : "0x00"
},
"accounts" : {
}
}
12 changes: 12 additions & 0 deletions ets/config/mantis/genesis/ConstantinopleFix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x00",
"constantinopleForkBlock" : "0x00",
"constantinopleFixForkBlock" : "0x00"
},
"accounts" : {
}
}
8 changes: 8 additions & 0 deletions ets/config/mantis/genesis/EIP150.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00"
},
"accounts" : {
}
}
9 changes: 9 additions & 0 deletions ets/config/mantis/genesis/EIP158.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00"
},
"accounts" : {
}
}
10 changes: 10 additions & 0 deletions ets/config/mantis/genesis/EIP158ToByzantiumAt5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x05"
},
"accounts" : {
}
}
6 changes: 6 additions & 0 deletions ets/config/mantis/genesis/Frontier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"params" : {
},
"accounts" : {
}
}
7 changes: 7 additions & 0 deletions ets/config/mantis/genesis/FrontierToHomesteadAt5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"params" : {
"homesteadForkBlock" : "0x05"
},
"accounts" : {
}
}
7 changes: 7 additions & 0 deletions ets/config/mantis/genesis/Homestead.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"params" : {
"homesteadForkBlock" : "0x00"
},
"accounts" : {
}
}
8 changes: 8 additions & 0 deletions ets/config/mantis/genesis/HomesteadToDaoAt5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"daoHardforkBlock" : "0x05"
},
"accounts" : {
}
}
8 changes: 8 additions & 0 deletions ets/config/mantis/genesis/HomesteadToEIP150At5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x05"
},
"accounts" : {
}
}
14 changes: 14 additions & 0 deletions ets/config/mantis/genesis/Istanbul.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"params" : {
"homesteadForkBlock" : "0x00",
"EIP150ForkBlock" : "0x00",
"EIP158ForkBlock" : "0x00",
"byzantiumForkBlock" : "0x00",
"constantinopleForkBlock" : "0x00",
"constantinopleFixForkBlock" : "0x00",
"istanbulForkBlock" : "0x00",
"chainID" : "0x01"
},
"accounts" : {
}
}
12 changes: 12 additions & 0 deletions ets/config/mantis/genesis/correctMiningReward.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"//comment" : "State Tests does not calculate mining reward in post conditions, so when filling a blockchain test out of it, the mining reward must be set",
"Frontier": "5000000000000000000",
"Homestead": "5000000000000000000",
"EIP150": "5000000000000000000",
"EIP158": "5000000000000000000",
"Byzantium": "3000000000000000000",
"Constantinople": "2000000000000000000",
"ConstantinopleFix": "2000000000000000000",
"Istanbul": "2000000000000000000",
"Berlin" : "2000000000000000000"
}
1 change: 1 addition & 0 deletions ets/config/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-
5 changes: 5 additions & 0 deletions ets/retesteth
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh

dir="$(cd "$(dirname "$0")" && pwd)"

retesteth $@ -- --testpath $dir/tests --datadir $dir/config --clients mantis
1 change: 1 addition & 0 deletions ets/tests
Submodule tests added at 644967
2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@
}) // (collectHydraSets [
(mkHydraSet [ "mantis" ] [ "x86_64-linux" ])
(mkHydraSet [ "mantis-entrypoint" ] [ "x86_64-linux" ])
(mkHydraSet [ "retesteth" ] [ "x86_64-linux" ])
(mkHydraSet [ "lllc" ] [ "x86_64-linux" ])
]);
}
6 changes: 3 additions & 3 deletions ci-like/nix.conf → nix-in-docker/nix.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sandbox = false
sandbox = relaxed
experimental-features = nix-command flakes ca-references
substituters = https://hydra.iohk.io https://cache.nixos.org https://mantis-ops.cachix.org
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= mantis-ops.cachix.org-1:SornDcX8/9rFrpTjU+mAAb26sF8mUpnxgXNjmKGcglQ=
substituters = https://hydra.iohk.io https://cache.nixos.org https://mantis-ops.cachix.org https://hydra.mantis.ist
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= mantis-ops.cachix.org-1:SornDcX8/9rFrpTjU+mAAb26sF8mUpnxgXNjmKGcglQ= hydra.mantis.ist-1:4LTe7Q+5pm8+HawKxvmn2Hx0E3NbkYjtf1oWv+eAmTo=
Loading