Skip to content

Commit 2515456

Browse files
authored
Merge pull request #541 from ethereum/state-tests
Upgrade state tests
2 parents 1f92037 + 7106f4f commit 2515456

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

circle.yml

+13-7
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,23 @@ commands:
138138
paths:
139139
- ~/silkworm/consensus
140140

141-
download_consensus_tests:
141+
download_execution_tests:
142142
parameters:
143143
rev:
144144
type: string
145+
default: develop
146+
commit:
147+
type: string
148+
default: ""
145149
steps:
146150
- run:
147-
name: "Download consensus tests: <<parameters.rev>>"
151+
name: "Download execution tests: <<parameters.rev>> <<parameters.commit>>"
148152
working_directory: ~/tests
149153
command: |
150-
git clone --depth=1 --recurse-submodules --shallow-submodules --single-branch https://github.com/ethereum/tests . --branch <<parameters.rev>>
154+
git clone --no-checkout --depth=250 --single-branch https://github.com/ethereum/tests . --branch <<parameters.rev>>
155+
<<#parameters.rev>>git checkout <<parameters.rev>><</parameters.rev>>
156+
<<#parameters.commit>>git checkout <<parameters.commit>><</parameters.commit>>
157+
git submodule update --init --recursive --depth=1 --progress
151158
152159
build:
153160
description: "Build"
@@ -366,7 +373,7 @@ jobs:
366373
- build
367374
- build_silkworm:
368375
commit: 98e4908f57643def0069ac9ae85a26eba715d8a7
369-
- download_consensus_tests:
376+
- download_execution_tests:
370377
rev: v11.1
371378
- run:
372379
name: "Silkworm-driven blockchain tests (Advanced)"
@@ -389,12 +396,11 @@ jobs:
389396
CMAKE_OPTIONS: -DCMAKE_CXX_FLAGS=-Og
390397
steps:
391398
- build
392-
- download_consensus_tests:
393-
rev: v11.1
399+
- download_execution_tests:
400+
commit: e279c3d0a53e2f3055c7d7f72f993b62dde18e36
394401
- run:
395402
name: "State tests"
396403
working_directory: ~/build
397-
# TODO: Some state tests are expected to fail because precompiles are not implemented.
398404
command: EVMONE_PRECOMPILES_STUB=~/project/test/state/precompiles_stub.json bin/evmone-statetest ~/tests/GeneralStateTests ~/tests/LegacyTests/Constantinople/GeneralStateTests
399405
- collect_coverage_gcc
400406
- upload_coverage:

test/state/state.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ std::optional<std::vector<Log>> transition(
116116
auto& sender_acc = state.get(tx.sender);
117117
const auto execution_gas_limit = validate_transaction(sender_acc, block, tx, rev);
118118
if (execution_gas_limit < 0)
119+
{
120+
// Pre EIP-158 coinbase has to be touched also for invalid tx.
121+
if (rev <= EVMC_TANGERINE_WHISTLE)
122+
state.touch(block.coinbase);
119123
return {};
124+
}
120125

121126
const auto base_fee = (rev >= EVMC_LONDON) ? block.base_fee : 0;
122127
assert(tx.max_gas_price >= base_fee); // Checked at the front.

test/statetest/statetest.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ int main(int argc, char* argv[])
6161
// The default test filter. To enable all tests use `--gtest_filter=*`.
6262
testing::FLAGS_gtest_filter =
6363
"-"
64+
// Unsupported or broken EIP implementations:
65+
"EIPTests/stEOF/*.*:" // EOF implementation is broken
6466
// Slow tests:
6567
"stCreateTest.CreateOOGafterMaxCodesize:" // pass
6668
"stQuadraticComplexityTest.Call50000_sha256:" // pass

test/statetest/statetest_loader.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ evmc_revision to_rev(std::string_view s)
108108
return EVMC_LONDON;
109109
if (s == "Merge")
110110
return EVMC_PARIS;
111+
if (s == "Merge+3855") // PUSH0
112+
return EVMC_SHANGHAI;
113+
if (s == "Shanghai")
114+
return EVMC_SHANGHAI;
111115
throw std::invalid_argument{"unknown revision: " + std::string{s}};
112116
}
113117
} // namespace

0 commit comments

Comments
 (0)