Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Moves some accounts-db test-only code into a dev-context-only-utils feature #32748

Merged

Conversation

brooksprumo
Copy link
Contributor

@brooksprumo brooksprumo commented Aug 7, 2023

Problem

To prepare for splitting the runtime crate, we'll need access to some private/test-only functions from accounts-db. To simplify that move, we can consolidate the test-only code within accounts-db into dev-context-only-utils feature blocks.

The AccountsDb accounts_hashes and accounts_delta_hashes fields were made public recently (#32671) to keep tests working. This PR only adds/moves code to return those two fields back to private. Future PRs can/will more move test-only accounts-db code into dcou blocks.

Summary of Changes

Add a dcou block for getting/setting the AccountsDb accounts hashes and accounts delta hashes, and update the callers.

Refer to #32169 for more information about dev-context-only-utils.

@brooksprumo brooksprumo self-assigned this Aug 7, 2023
Comment on lines +9513 to +9519
pub fn set_accounts_delta_hash_for_tests(
&self,
slot: Slot,
accounts_delta_hash: AccountsDeltaHash,
) {
self.set_accounts_delta_hash(slot, accounts_delta_hash);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ryoqun Do you have any suggestions/thoughts on how to name dcou functions that exist to re-export private functions for tests?

Rust won't let me call the dcou-version set_accounts_delta_hash(), since there's already one. And the _for_tests() is not needed anymore, since it's now within a dcou block. But I can't think of a better name... Have you already pondered on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have you already pondered on this?

yep. seems this is common use case for dcou, i encountered this problem already...

not the rename, but i hope you like the taste of #32822

@brooksprumo brooksprumo marked this pull request as ready for review August 7, 2023 20:30
@brooksprumo brooksprumo requested review from ryoqun and pgarg66 August 7, 2023 20:30
@codecov
Copy link

codecov bot commented Aug 7, 2023

Codecov Report

Merging #32748 (ab17ed5) into master (6eea38d) will decrease coverage by 0.1%.
Report is 6 commits behind head on master.
The diff coverage is 99.4%.

@@            Coverage Diff            @@
##           master   #32748     +/-   ##
=========================================
- Coverage    82.0%    82.0%   -0.1%     
=========================================
  Files         785      785             
  Lines      211192   211198      +6     
=========================================
- Hits       173200   173197      -3     
- Misses      37992    38001      +9     

@brooksprumo brooksprumo merged commit 4894eb0 into solana-labs:master Aug 7, 2023
@brooksprumo brooksprumo deleted the dcou/accounts-db/accounts-hash branch August 7, 2023 21:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants