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

test: Declarative state transition test suite #589

Merged
merged 4 commits into from
Apr 13, 2023
Merged

Conversation

chfast
Copy link
Member

@chfast chfast commented Mar 21, 2023

Add unit test fixture based on state transition. The fixture is designed in a way the test cases have structure similar to JSON state tests. This should make it easier to export the test cases to JSON format in the future.

@chfast chfast force-pushed the test_state_transition branch from 062693a to 383074a Compare March 23, 2023 13:12
@chfast chfast force-pushed the test_state_transition branch from 383074a to 1087c53 Compare March 23, 2023 16:01
@chfast chfast marked this pull request as ready for review March 23, 2023 16:02
test/unittests/state_transition.cpp Outdated Show resolved Hide resolved
{
static constexpr auto create_address = 0x864bbda5c698ac34b47a9ea3bd4228802cc5ce3b_address;

pre.get(*tx.to).code = eof1_bytecode(create() + push(1) + OP_SSTORE + OP_STOP, 3);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ongoing discussion is wether to have an individual tool that will verify validity of EOF
cause strictly there are EOF codes that are valid, but represent an invalid evm code sequence. so it can't be tested through state transition

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are you talking about, what's invalid evm code sequence?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In eth rnd execution layer testing channel.

@chfast chfast force-pushed the test_state_transition branch from 1087c53 to 2297703 Compare April 3, 2023 11:04
@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #589 (9926f46) into master (7028b6b) will increase coverage by 0.07%.
The diff coverage is 94.80%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #589      +/-   ##
==========================================
+ Coverage   97.21%   97.29%   +0.07%     
==========================================
  Files          74       78       +4     
  Lines        7571     7640      +69     
==========================================
+ Hits         7360     7433      +73     
+ Misses        211      207       -4     
Flag Coverage Δ
blockchaintests 65.16% <ø> (ø)
statetests 63.10% <0.00%> (-0.12%) ⬇️
unittests 94.80% <94.80%> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
test/state/hash_utils.cpp 0.00% <0.00%> (ø)
test/state/hash_utils.hpp 100.00% <ø> (ø)
test/unittests/evm_control_flow_test.cpp 100.00% <100.00%> (ø)
test/unittests/evm_memory_test.cpp 99.04% <100.00%> (-0.02%) ⬇️
test/unittests/evm_state_test.cpp 100.00% <100.00%> (ø)
test/unittests/state_transition.cpp 100.00% <100.00%> (ø)
test/unittests/state_transition_create_test.cpp 100.00% <100.00%> (ø)
test/unittests/state_transition_eof_test.cpp 100.00% <100.00%> (ø)
test/utils/bytecode.hpp 96.17% <100.00%> (+0.07%) ⬆️

... and 3 files with indirect coverage changes

@chfast chfast force-pushed the test_state_transition branch 3 times, most recently from f0caaa8 to 4322ecb Compare April 5, 2023 10:49
@chfast chfast force-pushed the test_state_transition branch 2 times, most recently from dae0072 to 7d61b6d Compare April 12, 2023 10:51
test/utils/bytecode.hpp Outdated Show resolved Hide resolved
@chfast chfast force-pushed the test_state_transition branch from 7d61b6d to 04fd5d8 Compare April 13, 2023 10:59
Copy link
Member

@gumb0 gumb0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@chfast chfast force-pushed the test_state_transition branch from d133961 to 9926f46 Compare April 13, 2023 12:54
@chfast chfast merged commit 1fb6fa6 into master Apr 13, 2023
@chfast chfast deleted the test_state_transition branch April 13, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants