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

add AccountsHashConfig to manage parameters #23850

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

jeffwashington
Copy link
Contributor

@jeffwashington jeffwashington commented Mar 22, 2022

Problem

parameters and clarity to calculate accounts are already unmanageably large.

Summary of Changes

Add a config struct to make things more clear and reduce complexity of signatures.

Fixes #

@@ -18,6 +22,28 @@ pub struct PreviousPass {
pub lamports: u64,
}

/// parameters to calculate accounts 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.

the main change

@jeffwashington jeffwashington marked this pull request as ready for review March 22, 2022 22:28
@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #23850 (22278c0) into master (2da4e3e) will decrease coverage by 0.1%.
The diff coverage is 75.3%.

❗ Current head 22278c0 differs from pull request most recent head 4be211d. Consider uploading reports for the commit 4be211d to get more accurate results

@@            Coverage Diff            @@
##           master   #23850     +/-   ##
=========================================
- Coverage    81.8%    81.7%   -0.2%     
=========================================
  Files         581      583      +2     
  Lines      158312   159164    +852     
=========================================
+ Hits       129518   130041    +523     
- Misses      28794    29123    +329     

runtime/src/accounts_db.rs Show resolved Hide resolved
)>,
filler_account_suffix: Option<&Pubkey>,
num_hash_scan_passes: Option<usize>,
config: &mut AccountsHashConfig<'_>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the HashStats parameter be removed from the config struct so that this parameter no longer needs to be mut? I didn't see anything else that needed to be mutable, and the stats don't seem to be related to configuration IMO. And then the HashStats would stay as its own parameter to this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can consider this in a future pr.

@@ -18,6 +22,28 @@ pub struct PreviousPass {
pub lamports: u64,
}

/// parameters to calculate accounts hash
pub struct AccountsHashConfig<'a> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you anticipate this struct being used in more places? If no, then maybe (1) it would be better to have in accounts_db.rs, and (2) nit: maybe rename to CalculateAccountsHashConfig? Wdyt?

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, I imagine it will be passed through a few functions. Just trying to keep the name shorter. Maybe CalcAccountsHashConfig satisfies it all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#1 - I'm trying to move things out of accounts_db.rs over time since it is so large. This config is related to accounts hashing, so I was thinking I'd put it here.

Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

I think looks good. Can you re-request after the conflicts are resolved?

brooksprumo
brooksprumo previously approved these changes Mar 23, 2022
@jeffwashington jeffwashington added the CI Pull Request is ready to enter CI label Mar 23, 2022
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Mar 23, 2022
@mergify mergify bot dismissed brooksprumo’s stale review March 23, 2022 17:24

Pull request has been modified.

@jeffwashington jeffwashington merged commit 9e61fe7 into solana-labs:master Mar 23, 2022
giogam pushed a commit to giogam/solana that referenced this pull request Mar 30, 2022
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.

3 participants