Commit Graph

312 Commits

Author SHA1 Message Date
Brooks 0569304835
Replaces bare Arc::default() in CacheHashData::new() (#35017) 2024-01-31 10:52:59 -05:00
Yueh-Hsuan Chiang 16a2f1bd3d
[TS] Add get_account() and account_matches_owner() to TieredStorageReader (#34968)
#### Problem
TieredStorageReader is a wrapper enum that works for
both Hot and Cold storage readers, but its get_account()
and account_matches_owner() API are missing.

#### Summary of Changes
Add get_account() and account_matches_owner() to
TieredStorageReader.

#### Test Plan
hot.rs offers similar coverage for HotStorageReader.
2024-01-29 11:05:47 -08:00
Brooks b9815da6cc
Fixes typo (#34990) 2024-01-28 17:32:09 -05:00
Pankaj Garg 0d117d420c
Remove BlockhashQueue dependency from SVM related code (#34974) 2024-01-26 13:46:44 -08:00
HaoranYi e38848e519
Remove unused get_append_vec_id function (#34949)
remove unused get_append_vec_id fn

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-01-26 21:41:09 +00:00
Yueh-Hsuan Chiang 3380c14044
[TieredStorage] Correct the HotStorage API for account_matches_owners (#34967)
#### Problem
In HotStorageReader, the account_matches_owners takes
&[&Pubkey] as the address candidates.  However, it should
be &[Pubkey] as defined in the accounts_file API.

#### Summary of Changes
Correct HotStorageReader::account_matches_owners() to
take &[Pubkey] instead.

#### Test Plan
Existing unit-tests
2024-01-26 09:40:05 -08:00
Yueh-Hsuan Chiang 7138f8767e
[TieredStorage] Avoid AccountHash copy in AccountMetaOptionalFields (#34969)
#### Problem
Using non-reference type of AccountHash in 
AccountMetaOptionalFields causes an unnecessary copy
as mentioned in #34948.

#### Summary of Changes
Uses &AccountHash in AccountMetaOptionalFields to
avoid copying.

#### Test Plan
Existing unit tests.

Fixes #34948
2024-01-26 09:13:09 -08:00
Yueh-Hsuan Chiang 663a1bb8f4
[TieredStorage] Write owners block for HotAccountStorage (#34927)
#### Problem
So far the current HotStorageWriter::write_accounts() only writes
accounts blocks and index block.

#### Summary of Changes
The PR further writes owners block in HotStorageWriter::write_accounts().

#### Test Plan
Extended existing test for HotStorageWriter to cover the owners block.
2024-01-26 06:48:28 -08:00
Yueh-Hsuan Chiang 51c0649af8
[TieredStorage] Use RENT_EXEMPT_RENT_EPOCH in HotStorageWriter (#34950)
#### Problem
In HotStorageWriter::write_accounts, it skips storing rent-epoch when
the rent-epoch equals Epoch::MAX.  While the value is correct, it is
more suitable to use RENT_EXEMPT_RENT_EPOCH instead as the
goal here is to save bytes for rent-exempt accounts.

#### Summary of Changes
Replace Epoch::MAX by RENT_EXEMPT_RENT_EPOCH when checking
whether to skip storing rent-epoch in HotStorageWriter.
2024-01-25 17:17:24 -08:00
Brooks f0d67d7f28
Adds hit/miss stats for cache hash data (#34954) 2024-01-25 17:27:45 -05:00
Brooks e155d9c445
Adds cache hash data deletion policy enum (#34956) 2024-01-25 16:58:56 -05:00
Yueh-Hsuan Chiang 26d62b9516
[TieredStorage] writing hot account blocks and index blocks (#34828)
#### Problem
The implementation of write_accounts() for HotAccountStorage is missing.
It consists of the writing of account blocks, index block, and owners block.

#### Summary of Changes
This PR completes part of the HotStorageWriter::write_accounts().
Specifically, it finishes the writing of account blocks and index block.

#### Test Plan
A new unit-test is added to verify the correctness of the work-in-progress
HotStorageWriter::write_accounts().
2024-01-25 09:38:06 -08:00
Brooks 5898b9a2f7
Cleans up stale accounts hash cache files (#34933) 2024-01-24 15:31:50 -05:00
Dmitri Makarov ef233eaaa7
Refactor load_accounts to take a reference to a slice instead of vec (#34919)
This is in preparation for further refactoring of
Bank::load_and_execute_transactions in a separate commit.
2024-01-24 09:43:18 -05:00
Yueh-Hsuan Chiang 1810feadc2
[TieredStorage] In-memory struct for writing OwnersBlock (#34853)
#### Problem
To write the owners-block, it requires an in-memory struct that maintains
a set of unique owner addresses while providing a look-up function to
obtain the OwnerOffset with the specified owner address. 

#### Summary of Changes
This PR adds OwnersTable, the in-memory struct that maintains
a set of unique owner addresses while providing a look-up function to
obtain the OwnerOffset with the specified owner address.

#### Test Plan
A new unit-test is added.
2024-01-23 14:57:53 -08:00
Brooks 8ff511e8fa
Moves create_and_canonicalize_directories() into accounts-db utils (#34882) 2024-01-23 06:46:27 -05:00
Brooks 2f744f1639
Moves create_all_accounts_run_and_snapshot_dirs() into accounts-db utils (#34877) 2024-01-22 18:18:43 -05:00
Brooks d005b3a5b8
Removes fs-err dependency from accounts-db crate (#34869) 2024-01-22 06:55:13 -05:00
Brooks 3916c31cb4
Replaces fs-err in tiered storage (#34859) 2024-01-19 17:16:56 -05:00
Brooks 3eb06b4b37
Replaces fs-err in accounts-db (#34860) 2024-01-19 16:35:02 -05:00
Yueh-Hsuan Chiang 81b3210eec
[TieredStorage] Code refactoring for OwnersBlock (#34854)
#### Problem
The OwnersBlockFormat is currently defined inside footer.rs
instead of inside owners.rs.  In addition, the implementation of
OwnersBlock doesn't honor OwnersBlockFormat.

#### Summary of Changes
This PR moves OwnersBlockFormat from footer.rs to owners.rs
and repurpose OwnersBlock as OwnersBlockFormat (just like
the IndexBlockFormat inside index.rs)

#### Test Plan
Existing unit-tests.
2024-01-19 08:15:25 -08:00
steviez 3dd348802f
Bubble up genesis load errors instead of exiting (#34851)
The function open_genesis_config() performs several operations that
could fail. If any of these fail, the process exits immediately.

Instead of exiting immediately, bubble up the error and let the caller
decide the appropriate action. solana-validator and solana-ledger-tool
will functionally be unchanged, but this consolidates startup failures
for both of these processes.
2024-01-19 10:25:46 -05:00
Yueh-Hsuan Chiang 3fa44e6fbe
[TieredStorage] Include executable field into AccountMetaFlags (#34724)
#### Problem
Before we have fully switched to the new way to determine whether
an account is executable, we still need a bit for th executable flag at
this moment in the TieredStorage as well as for backward compatibility
in case we want to revert it back.

#### Summary of Changes
This PR adds the executable flag into AccountMetaFlags.

#### Test Plan
Updated existing tests for AccountMetaFlags to cover executable flag.
2024-01-16 11:25:57 -08:00
Andrew Fitzgerald 95f888ab54
Unlock only if lock_result was Ok (#34652) 2024-01-09 08:19:25 -08:00
Yueh-Hsuan Chiang 2082f8b3ca
[TieredStorage] HotStorageWriter::new() (#34659)
#### Problem
The implementation of HotAccountWriter is missing.

#### Summary of Changes
This PR kicks off the implementation of HotStorageWriter by
adding HotStorageWriter::new().

#### Test Plan
Add a new unit-test that verifies the correctness of HotStorageWriter
writing zero accounts using HotStorageReader.
2024-01-08 14:14:30 -08:00
Yueh-Hsuan Chiang 3a2f1320c5
[TieredStorage] Rename AddressAndBlockOffsetOnly to AddressesThenOffsets (#34658)
#### Problem
In the previous refactoring, IndexBlockFormat::AddressAndBlockOffsetOnly
can now work independently with the AccountMetaFormat.  As a result,
the naming of this format should be updated to reflect this.

#### Summary of Changes
As the format first persists the list of addresses followed by the list of offsets,
this PR renames AddressAndBlockOffsetOnly to AddressesThenOffsets.
2024-01-08 13:10:37 -08:00
Brooks e4ec68d704
clippy: accounts-db lints (#34628)
```
warning: this `let...else` may be rewritten with the `?` operator
  --> accounts-db/src/rolling_bit_field/iterators.rs:36:13
   |
36 | /             let Some(bit) = self.bit_range.next() else {
37 | |                 return None;
38 | |             };
   | |______________^ help: replace it with: `let bit = self.bit_range.next()?;`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
   = note: `#[warn(clippy::question_mark)]` on by default

    Checking solana-rpc-client-api v1.18.0 (/Users/brooks/src/solana/rpc-client-api)
warning: `solana-accounts-db` (lib) generated 1 warning
```
2024-01-03 14:17:12 +00:00
Nick Frostbutter fc2a8794be
[docs] updated readme and fix links (#34565)
* feat: updated readme

* fix: updated links

* fix: proposal links

* fix: more links

* fix: json-rpc links

* fix: more links

* fix: zk links

* fix: managing forks

* fix: links for deprecated methods
2024-01-03 09:06:06 -05:00
Yueh-Hsuan Chiang d500eb6510
[TieredStorage] HotAccountsReader::get_account (#34499)
#### Problem
All structs that implement AccountsFile are required to support get_account,
but the implementation for HotAccounts is currently missing.

#### Summary of Changes
This PR implements HotAccountsReader::get_account_from_index_offset.
This will allow it to support AccountsFile::get_account API.

#### Test Plan
Add new unit-test.
2023-12-25 06:44:00 -08:00
Yueh-Hsuan Chiang 5b26d2737b
[TieredStorage] Fix typos in index.rs (#34546)
#### Problem
There're some typos in the comments and assert messages index.rs mentioned in #34529

#### Summary of Changes
Fix the typos (only in assert message and comments).
2023-12-21 22:36:38 -08:00
Yueh-Hsuan Chiang f73fd9dd3c
[TieredStorage] HotStorageReader::account_matches_owners (#34350)
#### Problem
Each AccountsFile is required to implement account_matches_owners(),
a public API that checks whether the account located at the specified
offset matches any input owners.  However, the implementation of
account_matches_owners() for HotAccountsStorage is missing.

#### Summary of Changes
This PR implements HotStorageReader::account_matches_owners().

#### Test Plan
A new unit-test is added to this PR.
2023-12-21 19:20:03 -08:00
Yueh-Hsuan Chiang a583035812
[TieredStorage] Boundary check for get_account_offset() (#34531)
#### Problem
TieredStorage doesn't perform boundary check in get_account_offset
when the input IndexOffset isn't valid.

#### Summary of Changes
This PR adds two checks.  First, it checks whether the IndexOffset exceeds
the boundary of the index block.  Second, when an index format that has the
same index entries as account entries is used, it also checks whether IndexOffset
is smaller than account_entry_count.

#### Test Plan
Two new tests are added to this PR.
2023-12-21 12:52:15 -08:00
GoodDaisy 03386cc7b9
Fix typos (#34459)
* Fix typos

* Fix typos

* fix typo
2023-12-21 13:06:00 -07:00
Yueh-Hsuan Chiang 09efd704eb
[TieredStorage] boundary check for get_account_address() (#34529)
#### Problem
get_account_address() does not check whether IndexOffset is valid.

#### Summary of Changes
This PR adds two checks.  First, it checks whether the IndexOffset exceeds
the boundary of the index block.  Second, when an index format that has the
same index entries as account entries is used, it also checks whether IndexOffset
is smaller than account_entry_count.

#### Test Plan
New unit-test is added.
2023-12-20 10:44:34 -08:00
Yueh-Hsuan Chiang eb948b1ddc
[TieredStorage] Boundary check for accessing hot account meta (#34349)
#### Problem
Hot accounts are stored in accounts blocks, whose offset is smaller than
the index block offset.  However, the current code doesn't perform
any boundary checks when accessing hot account meta.

#### Summary of Changes
Adds boundary check when accessing hot account meta.
2023-12-18 14:32:41 -08:00
Brooks e858a5a7c0
Removes unnecessary new_sized() AccountsDb ctor (#34504) 2023-12-18 16:39:57 -05:00
Brooks 4181ea4677
Removes unnecessary AccountsDb::new_with_config_for_benches() (#34484) 2023-12-18 06:52:41 -05:00
Brooks cbe8a02029
Removes unnecessary AccountsDb::new_with_config_for_tests() (#34485) 2023-12-18 00:46:46 -05:00
Joe C 171c58c5c0
RPC: Add inner instructions to simulate transaction response (#34313)
* rpc: add optional `innerInstructions: bool` arg to `simulateTransaction`

* bank: enable cpi recording in simulate

* sdk: move `InnerInstructions` into SDK from accounts DB

* bank: return inner instructions from simulate tx

* rpc: return inner instructions from simulate tx

* rpc: simulate tx: add `jsonParsed` support for inner instructions

* accounts db: add deprecated attribute to re-exported inner instructions

* rpc: de-dupe inner instruction mapping

* update deprecated comment

Co-authored-by: Tyera <teulberg@gmail.com>

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2023-12-16 12:49:22 +00:00
Brooks 45eaa4c1a6
Removes unnecessary Accounts constructors (#34471) 2023-12-14 22:50:15 -05:00
Brooks e79c09bdc4
Refactors Accounts constructors (#34466) 2023-12-14 16:36:47 -05:00
Brooks c7a57672d7
Adds read/write/get_pod() fns to tiered storage (#34415) 2023-12-14 13:25:25 -05:00
Brooks d1cfd26abb
Refactors AccountsDb constructors (#34456) 2023-12-14 12:34:15 -05:00
Ashwin Sekar 337c233b5f
fix rename of HOT_ACCOUNT_ALIGNMENT (#34422) 2023-12-12 16:18:10 -05:00
Yueh-Hsuan Chiang 383aa0451e
[TieredStorage] Unit-tests for checking invalid HotAccountOffset (#34376)
#### Problem
HotAccountOffset::new() might return Err for invalid offset, and this
part needs some test coverage.

#### Summary of Changes
Add unit-tests for checking invalid HotAccountOffset.
2023-12-12 12:31:16 -08:00
Brooks a2d7be0d07
Derives Pod for tiered storage types (#34414) 2023-12-12 14:59:51 -05:00
Yueh-Hsuan Chiang 376b1430e7
[TieredStorage] Improve comments for HOT_ACCOUNT_ALIGNMENT (#34404)
#### Problem
The current naming and the code comments for HOT_ACCOUNT_OFFSET_ALIGNMENT
aren't really reflecting its role as pointed out in #34335.

#### Summary of Changes
This PR renames HOT_ACCOUNT_OFFSET_ALIGNMENT to HOT_ACCOUNT_ALIGNMENT
as it's the hot account instead of hot account offset needs to be aligned.

In addition, improve the comment block for HOT_ACCOUNT_ALIGNMENT.
2023-12-12 11:48:29 -08:00
Yueh-Hsuan Chiang 39a3566438
[TieredStorage] Make AccountOffset a trait, introduce HotAccountOffset (#34335)
#### Problem
Hot and cold accounts storage have different implementations of
their offsets.  As a result, a single struct AccountOffset isn't suitable
to describe the offsets used by hot and cold accounts storage.

#### Summary of Changes
This PR makes AccountOffset a trait.  On top of that, introduces
HotAccountOffset that implements AccountOffset.

#### Test Plan
Updated existing unit-tests.
2023-12-11 15:38:38 -08:00
HaoranYi aab12c31c7
tune ancient append vec size to 128M (#34067)
* tune ancient append vec size to 130M

* fix a test and get rid of the assert since it is covered in the test

* use 128M

* assert max append vec size for ancient append vec

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-12-11 15:45:35 -06:00
HaoranYi c43edd2fef
use seqlock for AccountStorage count and status tracking (#34356)
use seqlock for appendvec count and status tracking

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-12-08 08:49:54 -06:00
Brooks b32903a534
Removes glob import of AccountsHashVerificationError (#34332) 2023-12-06 13:46:00 -05:00
Brooks 5c00a33252
Removes unnecessary #[allow(dead_code)] in tiered storage (#34320) 2023-12-06 00:23:01 +00:00
Brooks c971ad2944
Removes unnecessary #[allow(dead_code)] in partitioned rewards (#34321) 2023-12-05 15:58:11 +00:00
Jeff Washington (jwash) 091fc820ba
ancient append vec append creates big enough ancient append vecs (#34154)
* ancient append vec append creates big enough ancient append vecs

* assert we write the correct # of bytes

* fix tests

* u64 align accounts bytes written

* fix build

* add tests

* we don't need to align the store to u64.

When we call `remaining_bytes` to calculate, for the last element, u64_align!(len) could be greater than capacity.  However, because saturate_sub is used, we still get the correct answer of 0. Therefore, no need to align the storage to u64.

* add comments

* add shink test for min_size

* remove dead code

* fix build

* reviews

* add test for squash ancient vec overflow too much to fit into ideal av

* add test for get_bytes on AccountToStore

* clippy

* modify test to assert 0 size of opposite

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-12-05 09:25:11 -06:00
Brooks 2c033e05e5
Switches order of tiered storage footer size and version (#34310) 2023-12-04 14:23:56 -05:00
Brooks 4f65f7dc8d
Sanitizes tiered storage footer after reading from disk (#34200) 2023-12-01 13:58:10 -05:00
Yueh-Hsuan Chiang fa0930f254
[TieredStorage] Allow HotStorage to handle more account data (#34155)
#### Problem
After we have defined AccountOffset to be u32, it means the address space within
one HotAccountsFile is up to 4GB.  However, since the Accounts Blocks in a
HotAccountsFile is 8-byte aligned, it has the opportunity to store more data by
internally multiplying the AccountOffset by 8.

#### Summary of Changes
This PR allows a HotAccountsFile to store up to 32GB accounts data by using
8 x AccountOffset as its actual offset.

#### Test Plan
Updated existing unit-tests.
2023-12-01 10:39:15 -08:00
Andrew Fitzgerald 2294801954
Do not derive Copy for EpochSchedule and Rent (#32767) 2023-12-01 07:57:25 -08:00
Jeff Washington (jwash) 32c7acbf74
add slot to assert message (#34225) 2023-11-28 10:29:39 -06:00
Brooks deee5f833c
Uses Display for error in VerifyAccountsHashInBackground's panic message (#34219) 2023-11-27 09:51:39 -05:00
Yueh-Hsuan Chiang ecc067f7ad
[TieredStorage] Make AccountOffset use u32 (#34151)
#### Problem
AccountOffset currently uses `usize`, which size is platform dependent.
We want a fixed size type that is consist to what we persist in the tiered-storage file.

#### Summary of Changes
This PR makes AccountOffset use u32.
2023-11-21 10:40:10 -08:00
Yueh-Hsuan Chiang db2444bd11
Move MatchAccountOwnerError from append_vec to accounts_file (#34187)
#### Problem
MatchAccountOwnerError currently belongs to append_vec.

However, it is a public error type that is also required by other AccountsFile
implementations such as TieredStorageFile.

#### Summary of Changes
Move MatchAccountOwnerError from append_vec to accounts_file.
2023-11-21 10:39:56 -08:00
Jeff Washington (jwash) 481c357543
remaining_bytes aligns len since all writes will align first (#34171)
* remaining_bytes aligns len since all writes will align first

* use remaining_bytes() to check for whether the new account can fit into the av storage

* Add test coverage for av remaining bytes alignment

* use great equal to check space available

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-11-21 09:34:52 -06:00
HaoranYi 90b11a608b
refactor AccountsToStore (#34185)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-11-21 09:27:31 -06:00
Yueh-Hsuan Chiang c73f226958
[TieredStorage] Make IndexOffset use u32 (#34152)
#### Problem
IndexOffset currently uses `usize`, which size is platform dependent.
We want a fixed size type that is consist to what we persist in the tiered-storage file.

#### Summary of Changes
This PR makes IndexOffset use u32.
2023-11-20 14:57:15 -08:00
Lucas Steuernagel a3670054be
Move `RewardInterval` to runtime (#34146)
Move RewardInterval to runtime
2023-11-20 10:17:21 -03:00
Brooks e02f25d5a2
Removes filler accounts (#34115) 2023-11-19 20:36:57 -05:00
Jeff Washington (jwash) 202463849a
log when appending exceeds available space (#34170) 2023-11-19 18:50:37 -06:00
Brooks 574b8b5bfc
Refactor assert in scan_snapshot_stores() (#34162) 2023-11-18 12:05:39 -05:00
Brooks 8c8cd66095
Uses Display in TieredStorageFile::new_readonly() panic message (#34148) 2023-11-17 15:24:05 -05:00
Yueh-Hsuan Chiang 625e898c63
[TieredStorage] Make IndexBlock persist u32 offsets (#34133)
#### Problem
In TieredStorage, we want to make AccountOffset and IndexOffset u32 instead
of usize just like OwnerOffset.  However, we need to first change what we persist
in the storage.  Currently, IndexBlock persists offsets as u64 instead of u32. 

#### Summary of Changes
This PR makes IndexBlock persist u32 offsets.

#### Test Plan
Existing test cases.
2023-11-17 11:35:32 -08:00
Brooks e23bfb5167
Refactors TieredStorageFile read/write methods (#34147) 2023-11-17 14:17:49 -05:00
Yueh-Hsuan Chiang 1e9f6d9d83
[TieredStorage] Use OwnerOffset type in TieredAccountMeta (#34106)
#### Problem
TieredAccountMeta currently uses `u32` for owner_offset, while
we already have a dedicate type for that --- OwnerOffset.

#### Summary of Changes
This PR makes TieredAccountMeta use OwnerOffset for its
owner_offset field.

#### Test Plan
Existing unit-tests.
2023-11-17 09:26:52 -08:00
Brooks 07b0b9f9e9
Uses `mmap` for names in tiered storage (#34127) 2023-11-16 23:59:08 +00:00
Lucas Steuernagel 2c71d21fad
Move load_accounts to runtime (#34017)
* Move load_accounts to runtime

---------

Signed-off-by: Lucas Steuernagel <lucas.tnagel@gmail.com>
2023-11-16 18:45:58 -03:00
Brooks 7e3b09defe
Uses consistent error types in tiered storage (#34110) 2023-11-16 15:51:57 -05:00
Yueh-Hsuan Chiang f59887077a
[TieredStorage] Define OwnerOffset as u32 (#34105)
#### Problem
The current OwnerOffset is defined as usize, which actual size could be u32 or u64.
On the other hand, the OwnerOffset is used to access the ith owner in one
TieredStorageFile.  As a result, u32 is more than enough to represent the number of
owners inside one TieredStorageFile while u16 might not be always enough.

#### Summary of Changes
This PR defines OwnerOffset as u32.

#### Test Plan
Existing test cases.
2023-11-16 12:48:33 -08:00
HaoranYi 60fdd85aed
Add a feature to disable rent collection (#33945)
* add a feature to disable rent collection

* fix a test

* fix a test

* rekey

* should collect rent

* Update runtime/src/bank/fee_distribution.rs

Co-authored-by: Brooks <brooks@prumo.org>

* expand tests to cover both rent collection disabled and enabled

* feedbacks

* reviews - move should collect rent check out of rent collector into bank

* enforce rent_epoch to u64:max when rent collection is disabled

* review feedbacks and fix a test
When rent fee collection is disabled, we won't collect rent for any account. If there are any rent paying accounts, their `rent_epoch` won't change too.

* revise comments

* update rent_epoch for rent exempted account

* rebase

* set rent_epoch in rent collection for rent exempted account

* revert test change

* don't assert

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: Brooks <brooks@prumo.org>
2023-11-16 08:57:49 -06:00
Yueh-Hsuan Chiang b7f839ea18
[TieredStorage] HotStorageReader::get_owner_address (#34053)
#### Problem
The HotStorageReader does not have an API to obtain owners_address.

#### Summary of Changes
This PR adds HotStorageReader::get_owner_address().

#### Test Plan
A new unit-test is added to this PR.
2023-11-15 15:54:53 -08:00
Yueh-Hsuan Chiang d58db6e255
Improve formatting in test_hot_storage_get_account_offset_and_address() (#34071)
#### Problem
#34032 mentioned nice-to-have a formatting improvement that
can improve the readability. 

#### Summary of Changes
Improve the code formatting in test_hot_storage_get_account_offset_and_address().
2023-11-15 11:25:18 -08:00
Brooks 67dab71e82
Uses `RENT_EXEMPT_RENT_EPOCH` to mark account as rent exempt (#34090) 2023-11-15 18:13:18 +00:00
Alexander Meißner ffa462dd3a
Cleanup - Feature gate of `delay_visibility_of_program_deployment` (#34087)
* Cleans up feature gate of delay_visibility_of_program_deployment.

* Removes programs_updated_only_for_global_cache.
2023-11-15 18:29:31 +01:00
Alexander Meißner 48ed70a8d8
Cleanup - Feature gate of `disable_builtin_loader_ownership_chains` (#34083)
* Cleans up feature gate of disable_builtin_loader_ownership_chains.
2023-11-15 17:17:31 +01:00
Yueh-Hsuan Chiang 7fd13c0cd2
[TieredStorage] OwnersBlock (#34052)
#### Problem
A TieredStorage file has three types of block:  accounts block, index block,
and owner block, but implementation of the TieredStorage OwnersBlock
is missing in the current master.

#### Summary of Changes
This PR implements OwnersBlock which stores a set of owners' addresses
in a compact but efficient way.

#### Test Plan
A new unit-test is included in this PR.
2023-11-15 01:51:13 -08:00
Yueh-Hsuan Chiang eb7e68f029
[TieredStorage] HotStorageReader::get_account_address (#34032)
#### Problem
HotStorageReader currently not yet has an API to obtain account_address

#### Summary of Changes
This PR adds HotStorageReader::get_account_address() which returns
the Pubkey of the account associated with the specified IndexOffset.

#### Test Plan
Augmented an existing unit-test to cover get_account_address() case.
2023-11-14 20:44:03 -08:00
Yueh-Hsuan Chiang 2877b8182c
[TieredStorage] Rename owners_offset to owners_block_offset (#34047)
#### Problem
TieredStorageFooter::owners_offset refers to the offset to the
owners block, which looks very similar to OwnerOffset that
has a completely different concept -- the offset to access the
address of an owner in the owners-block.

#### Summary of Changes
Similar to the previous renaming index_offset to index_block_offset,
this PR renames owners_offset to owners_block_offset to
avoid confusion.
2023-11-13 18:42:51 -08:00
Brooks 725ab37bf4
clippy: Replaces .get(0) with .first() (#34048) 2023-11-13 17:22:17 -05:00
Jeff Washington (jwash) a25eae41fc
stop page aligning shrunk append vecs (#34016)
* stop page aligning shrunk append vecs

* fix build

* fix test by removing aligned alive page bytes asserts

* rm dup assert

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-11-13 14:22:26 -06:00
Yueh-Hsuan Chiang 2b9054a60e
[TieredStorage] HotStorageReader::get_account_offset (#34031)
#### Problem
HotStorageReader currently not yet has an API to obtain account_offset

#### Summary of Changes
This PR adds HotStorageReader::get_account_offset() which takes
IndexOffset and returns AccountOffset.

#### Test Plan
A new unit-test is included in this PR.
2023-11-13 12:07:09 -08:00
Yueh-Hsuan Chiang 3db7eaf1fc
[TieredStorage] Improve param naming of IndexBlockFormat (#34033)
#### Problem
In IndexBlockFormat, both `IndexOffset` and `AccountOffset` parameters
are named `offset` in some functions which could be confusing.

#### Summary of Changes
Renamed `offset` to `index_offset` and `account_offset` to improve
readability.
2023-11-13 12:05:25 -08:00
Brooks 3c71f859e1
Uses fold+reduce for handling duplicate pubkeys during index generation (#34011) 2023-11-10 14:32:24 -05:00
Brooks 69ab8a8234
Uses IntSet for uncleaned slots from visit_duplicate_pubkeys_during_startup() (#34009) 2023-11-10 11:29:13 -05:00
Pankaj Garg 59eb55990c
Move filter_executable_program_accounts to bank.rs (#34004) 2023-11-09 14:40:04 -08:00
Brooks 9f25f67e60
Simplifies adding uncleaned pubkeys during index generation (#34007) 2023-11-09 16:06:15 -05:00
Brooks a96be5d2f0
Uses IntSet for uncleaned roots during index generation (#34008) 2023-11-09 15:04:19 -05:00
Yueh-Hsuan Chiang 874fae507f
[TieredStorage] Make HotStorageReader use AccountOffset type (#33964)
#### Problem
#33927 introduced a new type AccountOffset, but HotStorageReader
still uses `usize` to access accounts.

#### Summary of Changes
This PR makes HotStorageReader use the new AccountOffset type.
2023-11-08 21:58:44 -08:00
Brooks bba6ea2d69
Returns IntMap from select_candidates_by_total_usage() (#33976) 2023-11-08 16:15:51 -05:00
Brooks 7cb83bc491
Adds `S` to HashMap/HashSet impls of Contains (#33973) 2023-11-08 15:08:33 -05:00
Brooks 6f213c38aa
Removes Default from RollingBitField (#33969) 2023-11-07 15:58:52 -05:00
Yueh-Hsuan Chiang b013c03afa
[TieredStorage] Add IndexOffset type (#33929)
#### Problem
TieredStorage conceptually has different offsets. However, the current code directly
uses the same primitive type for accessing offsets, which is error-prone as one could
easily use one offset to access data that should be accessed with a different offset
type.

#### Summary of Changes
This PR adds IndexOffset type -- a struct for obtaining the ith entry inside the
index-block to obtain account's offset and address.
2023-11-07 10:26:21 -08:00