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

refactoring: Speed up flipped block test #12840

Merged
merged 2 commits into from
Jan 31, 2025
Merged

Conversation

Trisfald
Copy link
Contributor

@Trisfald Trisfald commented Jan 30, 2025

This PR makes the test ultra_slow_test_check_process_flipped_block_fails more efficient by re-using the same test loop environment, instead of initializing a new TestEnv at every iteration.

Locally the test runs 40% faster.

@Trisfald Trisfald marked this pull request as ready for review January 30, 2025 10:26
@Trisfald Trisfald requested a review from a team as a code owner January 30, 2025 10:26
Copy link
Contributor

@shreyan-gupta shreyan-gupta left a comment

Choose a reason for hiding this comment

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

I don't see a problem with the setup change although I wouldn't claim I'm 100% certain. However, I think we can merge.


let mid_height = 3;
for h in 1..=mid_height {
let mid_height = last_block_height + 3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get last_block_height from last_block.height()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is possible indeed

I had to fix check_corrupt_block() to do properly process the correct block, though

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a biggie, only if it is convenient and straightforward

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.39%. Comparing base (57b9b81) to head (dd7c5cc).
Report is 24 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12840      +/-   ##
==========================================
- Coverage   70.41%   70.39%   -0.02%     
==========================================
  Files         848      851       +3     
  Lines      174849   174187     -662     
  Branches   174849   174187     -662     
==========================================
- Hits       123117   122623     -494     
+ Misses      46485    46320     -165     
+ Partials     5247     5244       -3     
Flag Coverage Δ
backward-compatibility 0.16% <ø> (+<0.01%) ⬆️
db-migration 0.16% <ø> (?)
genesis-check 1.41% <ø> (-0.01%) ⬇️
linux 70.07% <ø> (-0.02%) ⬇️
linux-nightly 70.02% <ø> (-0.06%) ⬇️
pytests 1.71% <ø> (+0.29%) ⬆️
sanity-checks 1.52% <ø> (?)
unittests 70.22% <ø> (-0.07%) ⬇️
upgradability 0.20% <ø> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Trisfald Trisfald added this pull request to the merge queue Jan 31, 2025
Merged via the queue into near:master with commit abb3842 Jan 31, 2025
28 of 29 checks passed
@Trisfald Trisfald deleted the speed-up-test branch January 31, 2025 18:17
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