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

Cleanup - mock_process_instruction() #31088

Merged

Conversation

Lichtso
Copy link
Contributor

@Lichtso Lichtso commented Apr 6, 2023

Problem

We need the tests to be consistent about how they use mock_process_instruction() if we want to unify the built-in and syscall interfaces.

Summary of Changes

  • Uses declare_process_instruction!() in all tests.
  • Adds post_adjustments to mock_process_instruction().

@Lichtso Lichtso requested a review from pgarg66 April 6, 2023 19:45
@Lichtso Lichtso force-pushed the cleanup/mock_process_instruction branch 3 times, most recently from a4dc596 to fa1c290 Compare April 6, 2023 21:13
@@ -1407,7 +1405,7 @@ fn assert_instruction_count() {
(program_key, AccountSharedData::new(0, 0, &loader_id)),
(
Pubkey::new_unique(),
AccountSharedData::new(0, 8, &program_key),
AccountSharedData::new(0, 0, &program_key),
Copy link
Contributor

Choose a reason for hiding this comment

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

Was 8 an incorrect value, or is it a cleanup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A post_adjustments closure was added to mock_process_instruction().
Thus, the value of the expected CU consumption can now be transported by the scope,
and does not need an instruction account anymore.

pgarg66
pgarg66 previously approved these changes Apr 6, 2023
@Lichtso Lichtso force-pushed the cleanup/mock_process_instruction branch from fa1c290 to c080c9c Compare April 7, 2023 07:17
pgarg66
pgarg66 previously approved these changes Apr 7, 2023
Lichtso added 2 commits April 7, 2023 11:02
Removes "solana_sbf_rust_external_spend" from assert_instruction_count() as it panics.
@Lichtso Lichtso force-pushed the cleanup/mock_process_instruction branch from c080c9c to 4048f59 Compare April 7, 2023 09:03
@codecov
Copy link

codecov bot commented Apr 7, 2023

Codecov Report

Merging #31088 (4048f59) into master (bcd43d7) will increase coverage by 0.0%.
The diff coverage is 93.6%.

@@           Coverage Diff            @@
##           master   #31088    +/-   ##
========================================
  Coverage    81.5%    81.5%            
========================================
  Files         728      728            
  Lines      206251   205752   -499     
========================================
- Hits       168112   167800   -312     
+ Misses      38139    37952   -187     

@Lichtso Lichtso merged commit 0cd57ad into solana-labs:master Apr 7, 2023
@Lichtso Lichtso deleted the cleanup/mock_process_instruction branch April 7, 2023 10:53
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