forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 1k
Removes is_accounts_lt_hash_enabled() #7008
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
Merged
brooksprumo
merged 1 commit into
anza-xyz:master
from
brooksprumo:lthash/215/is_enabled
Jul 17, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,22 +17,15 @@ use { | |
| }; | ||
|
|
||
| impl Bank { | ||
| /// Returns if the accounts lt hash is enabled | ||
| pub fn is_accounts_lt_hash_enabled(&self) -> bool { | ||
| true | ||
| } | ||
|
Comment on lines
-20
to
-23
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Main change. |
||
|
|
||
| /// Returns if snapshots use the accounts lt hash | ||
| pub fn is_snapshots_lt_hash_enabled(&self) -> bool { | ||
| self.is_accounts_lt_hash_enabled() | ||
| && (self | ||
| .rc | ||
| .accounts | ||
| .accounts_db | ||
| .snapshots_use_experimental_accumulator_hash() | ||
| || self | ||
| .feature_set | ||
| .is_active(&feature_set::snapshots_lt_hash::id())) | ||
| self.rc | ||
| .accounts | ||
| .accounts_db | ||
| .snapshots_use_experimental_accumulator_hash() | ||
| || self | ||
| .feature_set | ||
| .is_active(&feature_set::snapshots_lt_hash::id()) | ||
| } | ||
|
|
||
| /// Updates the accounts lt hash | ||
|
|
@@ -44,7 +37,6 @@ impl Bank { | |
| /// | ||
| /// Since this function is non-idempotent, it should only be called once per bank. | ||
| pub fn update_accounts_lt_hash(&self) { | ||
| debug_assert!(self.is_accounts_lt_hash_enabled()); | ||
| let delta_lt_hash = self.calculate_delta_lt_hash(); | ||
| let mut accounts_lt_hash = self.accounts_lt_hash.lock().unwrap(); | ||
| accounts_lt_hash.0.mix_in(&delta_lt_hash); | ||
|
|
@@ -60,7 +52,6 @@ impl Bank { | |
| /// | ||
| /// This function is idempotent, and may be called more than once. | ||
| fn calculate_delta_lt_hash(&self) -> LtHash { | ||
| debug_assert!(self.is_accounts_lt_hash_enabled()); | ||
| let measure_total = Measure::start(""); | ||
| let slot = self.slot(); | ||
|
|
||
|
|
@@ -308,7 +299,6 @@ impl Bank { | |
| account_state: &AccountState, | ||
| is_writable: bool, | ||
| ) { | ||
| debug_assert!(self.is_accounts_lt_hash_enabled()); | ||
| if !is_writable { | ||
| // if the account is not writable, then it cannot be modified; nothing to do here | ||
| return; | ||
|
|
@@ -486,9 +476,6 @@ mod tests { | |
| genesis_config.fee_rate_governor = FeeRateGovernor::new(0, 0); | ||
| let (bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| let amount = cmp::max( | ||
| bank.get_minimum_balance_for_rent_exemption(0), | ||
| LAMPORTS_PER_SOL, | ||
|
|
@@ -648,9 +635,6 @@ mod tests { | |
| let (genesis_config, mint_keypair) = genesis_config_with(features); | ||
| let (bank, _bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| // ensure this bank is for slot 0, otherwise this test doesn't actually do anything... | ||
| assert_eq!(bank.slot(), 0); | ||
|
|
||
|
|
@@ -677,9 +661,6 @@ mod tests { | |
| let (genesis_config, _mint_keypair) = genesis_config_with(features); | ||
| let (bank, _bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| // the cache should start off empty | ||
| assert_eq!(bank.cache_for_accounts_lt_hash.len(), 0); | ||
|
|
||
|
|
@@ -788,9 +769,6 @@ mod tests { | |
| let (genesis_config, mint_keypair) = genesis_config_with(features); | ||
| let (mut bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| let amount = cmp::max( | ||
| bank.get_minimum_balance_for_rent_exemption(0), | ||
| LAMPORTS_PER_SOL, | ||
|
|
@@ -833,9 +811,6 @@ mod tests { | |
| let (genesis_config, mint_keypair) = genesis_config_with(features); | ||
| let (mut bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| let amount = cmp::max( | ||
| bank.get_minimum_balance_for_rent_exemption(0), | ||
| LAMPORTS_PER_SOL, | ||
|
|
@@ -933,9 +908,6 @@ mod tests { | |
| genesis_config.fee_rate_governor = FeeRateGovernor::new(0, 0); | ||
| let (mut bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| let amount = cmp::max( | ||
| bank.get_minimum_balance_for_rent_exemption(0), | ||
| LAMPORTS_PER_SOL, | ||
|
|
@@ -1058,9 +1030,6 @@ mod tests { | |
| let (genesis_config, _mint_keypair) = genesis_config_with(features); | ||
| let (mut bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise this test doesn't actually do anything... | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| let slot = bank.slot() + 1; | ||
| bank = new_bank_from_parent_with_bank_forks(&bank_forks, bank, &Pubkey::default(), slot); | ||
|
|
||
|
|
@@ -1096,9 +1065,6 @@ mod tests { | |
| let (genesis_config, mint_keypair) = genesis_config_with(features); | ||
| let (mut bank, bank_forks) = Bank::new_with_bank_forks_for_tests(&genesis_config); | ||
|
|
||
| // ensure the accounts lt hash is enabled, otherwise the snapshot lt hash is disabled | ||
| assert!(bank.is_accounts_lt_hash_enabled()); | ||
|
|
||
| bank.rc | ||
| .accounts | ||
| .accounts_db | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the other main fallout. We always have an AccountsLtHash now.