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: repair web3.js getBlocks tests #24813

Merged
merged 1 commit into from
Apr 28, 2022
Merged

test: repair web3.js getBlocks tests #24813

merged 1 commit into from
Apr 28, 2022

Conversation

steveluscher
Copy link
Contributor

@steveluscher steveluscher commented Apr 28, 2022

Problem

These tests were never correct, because getBlocks is supposed to return the blocks between startSlot and endSlot inclusive.

I think they were accidentally working before, because of a bug in the validator that has since been fixed in #23853.

Summary of Changes

  • Wait for there to be at least 2 blocks, so that the tests have something to exercise.
  • Fix the mock data to actually return the blocks between startSlot and endSlot inclusive.
  • Make the test resilient to pruning by setting startSlot to whatever firstAvailableBlock returns (this will make the web3.js tests less flaky 🎉)

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #24813 (0e7aac5) into master (8ba003a) will decrease coverage by 11.8%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master   #24813       +/-   ##
===========================================
- Coverage    81.8%    70.0%    -11.9%     
===========================================
  Files         632       38      -594     
  Lines      167499     2303   -165196     
  Branches      322      325        +3     
===========================================
- Hits       137169     1614   -135555     
+ Misses      30217      573    -29644     
- Partials      113      116        +3     

Copy link
Contributor

@CriesofCarrots CriesofCarrots left a comment

Choose a reason for hiding this comment

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

Much better, thank you!

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.

2 participants