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

[program-test] adding method warp_to_epoch #34620

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

ochaloup
Copy link
Contributor

@ochaloup ochaloup commented Jan 2, 2024

Problem

The program test contains only method to warping to a particular slot. It would be nice to have a way to easily warp per epoch. The method https://github.com/solana-labs/solana/blob/v1.17.7/ledger-tool/src/main.rs#L3447 provides the calculation of the number of slots per epoch.

It could be then mapped to e.g., bankrun to profit from kevinheavey/solana-bankrun#13

Summary of Changes

New method warp_to_epoch for the tests.

@mergify mergify bot added community Community contribution need:merge-assist labels Jan 2, 2024
@mergify mergify bot requested a review from a team January 2, 2024 11:51
@CriesofCarrots CriesofCarrots added the CI Pull Request is ready to enter CI label Jan 2, 2024
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Jan 2, 2024
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.

Thanks, this looks useful. One formatting nit.
@joncinque , can you take a look and see if you have any concerns?

@@ -65,6 +65,7 @@ use {
tokio::task::JoinHandle,
};
// Export types so test clients can limit their solana crate dependencies
use solana_sdk::clock::Epoch;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add this to the common use statement above (L33)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Hopefully in the way you suggested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Hopefully in the way you suggested.

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great to me! Thanks for the contribution, R+ with the nit addressed

Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (c1c857c) 81.8% compared to head (02790f5) 81.8%.
Report is 10 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #34620   +/-   ##
=======================================
  Coverage    81.8%    81.8%           
=======================================
  Files         824      824           
  Lines      222260   222264    +4     
=======================================
+ Hits       181885   181951   +66     
+ Misses      40375    40313   -62     

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.

Looks great, thanks!

@CriesofCarrots CriesofCarrots merged commit 8330dee into solana-labs:master Jan 3, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution need:merge-assist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants