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: add support for seeded rng #3270

Merged
merged 9 commits into from
Jun 21, 2023
Merged

test: add support for seeded rng #3270

merged 9 commits into from
Jun 21, 2023

Conversation

onbjerg
Copy link
Member

@onbjerg onbjerg commented Jun 20, 2023

Adds the ability to set the seed used to generate random test data using an environment variable SEED.

This should make coverage more deterministic, although our proptests still end up making the results fluctuate a bit even if nothing in the code was changed.

Ref #1344

@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #3270 (76f0a78) into main (938b979) will decrease coverage by 0.01%.
The diff coverage is 98.72%.

@@            Coverage Diff             @@
##             main    #3270      +/-   ##
==========================================
- Coverage   69.74%   69.74%   -0.01%     
==========================================
  Files         531      531              
  Lines       71581    71670      +89     
==========================================
+ Hits        49927    49985      +58     
- Misses      21654    21685      +31     
Flag Coverage Δ
integration-tests 16.37% <0.00%> (-0.04%) ⬇️
unit-tests 64.78% <98.72%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
crates/stages/src/stages/bodies.rs 90.54% <66.66%> (-2.93%) ⬇️
crates/stages/src/stages/headers.rs 91.74% <88.88%> (+0.05%) ⬆️
crates/interfaces/src/test_utils/generators.rs 98.01% <98.24%> (-0.25%) ⬇️
crates/blockchain-tree/src/block_buffer.rs 98.63% <100.00%> (+0.06%) ⬆️
crates/consensus/beacon/src/engine/mod.rs 78.90% <100.00%> (+0.17%) ⬆️
crates/net/downloaders/src/bodies/bodies.rs 90.02% <100.00%> (+0.02%) ⬆️
crates/net/downloaders/src/bodies/request.rs 83.53% <100.00%> (+0.10%) ⬆️
crates/net/downloaders/src/test_utils/mod.rs 100.00% <100.00%> (ø)
crates/rpc/rpc-engine-api/src/engine_api.rs 89.97% <100.00%> (+0.22%) ⬆️
crates/rpc/rpc-types/src/eth/engine/payload.rs 87.38% <100.00%> (+0.07%) ⬆️
... and 8 more

... and 7 files with indirect coverage changes

@onbjerg onbjerg marked this pull request as ready for review June 20, 2023 15:52
@onbjerg onbjerg added C-enhancement New feature or request C-test A change that impacts how or what we test labels Jun 20, 2023
@gakonst
Copy link
Member

gakonst commented Jun 21, 2023

I think we can add a proptest specific env var for setting a seed?

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

makes sense

lgtm, pending smol conflict

@onbjerg onbjerg enabled auto-merge June 21, 2023 19:41
@onbjerg onbjerg added this pull request to the merge queue Jun 21, 2023
Merged via the queue into main with commit dc74fad Jun 21, 2023
@onbjerg onbjerg deleted the onbjerg/deterministic-rng branch June 21, 2023 22:13
yuichiroaoki pushed a commit to yuichiroaoki/reth that referenced this pull request Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request C-test A change that impacts how or what we test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants