Commit Graph

312 Commits

Author SHA1 Message Date
Brooks 570d1a9197
Adds a bench for hash_account() (#47) 2024-03-04 13:59:35 -05:00
Yueh-Hsuan Chiang 608329b974
[TieredStorage] rent_epoch() returns 0 for zero-lamport accounts (#35344)
#### Problem
In TieredAccountMeta, RENT_EXEMPT_RENT_EPOCH will be used when
its optional field rent_epoch is None.  However, for legacy reasons, 0
should be used for zero-lamport accounts.

#### Summary of Changes
Return 0 for TieredAccountMeta::rent_epoch() for zero-lamport accounts.

#### Test Plan
accounts_db::tests::test_clean_zero_lamport_and_dead_slot
2024-03-01 15:18:12 -08:00
Brooks 564a9f78a0
Casts executable bool to integer when computing account hash (#35373) 2024-03-01 14:28:28 -05:00
Brooks 59ed049dc5
Gives back 8 bytes to stack buffer for account data when hashing (#35374) 2024-03-01 14:27:48 -05:00
Brooks 83de6a5930
Moves in_mem_accounts_index.rs into accounts_index directory (#35360) 2024-02-29 06:51:18 -05:00
Brooks 9146236f02
Removes ouroboros dependency (#35355) 2024-02-28 17:58:14 -05:00
Brooks 2e10b3b64f
Removes InMemAccountsIndex::get() (#35354) 2024-02-28 17:57:55 -05:00
Brooks 140c21f8a9
Removes ReadAccountMapEntry (#35351) 2024-02-28 16:08:00 -05:00
Brooks 6aaaf858c9
Adds more info to panic message in AccountsHashVerifier (#35353) 2024-02-28 15:55:05 -05:00
Brooks 7c48cbb7aa
Replaces InMemAccountsIndex::get() with AccountsIndex::get_cloned() (#35352) 2024-02-28 14:45:08 -05:00
Brooks 6402198902
Replaces ReadAccountMapEntry in calculate_accounts_hash_from_index() (#35349) 2024-02-28 14:38:19 -05:00
Brooks f340c1c181
Replaces ReadAccountMapEntry in do_scan_secondary_index() (#35219) 2024-02-28 11:43:33 -05:00
Brooks a4e1a9ac98
Adds AccountsIndex::get_account_info_with_and_then() (#35336) 2024-02-27 20:01:29 -05:00
Brooks da088681ba
Adds safer alternatives to get_internal() (#35325) 2024-02-27 18:08:25 -05:00
Brooks bf2e8ee32f
AccountsIndex::get_cloned() *must* add entry to in-mem cache (#35322) 2024-02-26 18:20:21 -05:00
Brooks 8143fc3f4a
Replaces ReadAccountMapEntry in read_index_for_accessor_or_load_slow() (#35220) 2024-02-26 14:19:18 -05:00
Brooks 8235feefc4
Removes get_for_tests() (#35311) 2024-02-26 14:17:33 -05:00
Brooks 54706a885b
Adds get_with_and_then() to AccountsIndex (#35307) 2024-02-23 18:48:36 -05:00
Brooks 1e47aacd0d
Removes get_account_read_entry() (#35309) 2024-02-23 22:25:30 +00:00
Brooks 58c1b7aefb
Replaces ReadAccountMapEntry in more tests (#35308) 2024-02-23 21:20:42 +00:00
Brooks 923cac8d7f
Replaces ReadAccountMapEntry in exhaustively_verify_refcounts() (#35243) 2024-02-23 11:13:57 -05:00
Brooks b5ffc24a38
Replaces ReadAccountMapEntry in retry_to_get_account_accessor() (#35244) 2024-02-23 11:12:24 -05:00
Brooks db2071a225
Removes get_account_read_entry_with_lock() (#35240) 2024-02-21 11:25:38 -05:00
Dmitri Makarov 0acee67891
SVM: move transaction_results from accounts-db to SVM (#35183)
SVM: Remove accounts-db deps in accounts_loader tests
2024-02-20 12:54:56 -08:00
Brooks 0b5cc03aa3
Replaces ReadAccountMapEntry in ancient append vecs (#35238) 2024-02-20 13:52:11 -05:00
Brooks ce72c22b3a
Replaces ReadAccountMapEntry in accounts index (#35239) 2024-02-20 13:51:54 -05:00
Brooks 2ec136a1ea
Adds get_and_then() & family to AccountsIndex (#35218) 2024-02-19 10:22:00 -05:00
Yueh-Hsuan Chiang 69345899f3
[TieredStorage] Make TieredStorage::write_accounts() thread-safe (#35143)
#### Problem
While accounts-db might not invoke appends_account twice
for the same AccountsFile, TieredStorage::write_accounts()
itself isn't thread-safe, and it depends on the above accounts-db
assumption.

#### Summary of Changes
This PR makes TieredStorage::write_accounts() thread-safe.
So only the first thread that successfully updates the already_written
flag can proceed and write the input accounts.  All subsequent
calls to write_accounts() will be a no-op and return AttemptToUpdateReadOnly
Error.
2024-02-17 16:10:58 -08:00
Yueh-Hsuan Chiang cb61ce435e
[TieredStorage] Put commonly used test functions into test_utils.rs (#35065)
#### Problem
There're some test functions that have been used in different
mod in TieredStorage.  It's better to have one same place for
all tiere-storage related test functions.

#### Summary of Changes
Created test_utils.rs under /tiered_storage and move test-related
functions into it.

#### Test Plan
Existing tests.
2024-02-09 16:35:40 -08:00
Brooks b5e903d1d7
Refactors AccountsIndex::get() (#35163) 2024-02-09 18:26:51 -05:00
Dmitri Makarov 245d1c4087
SVM: Move TransactionCheckResult definition from accounts-db to SVM (#35153) 2024-02-08 21:13:00 -05:00
Dmitri Makarov eeb0cf1ea8
SVM: Move nonce_info from accounts-db to Solana SDK (#35138) 2024-02-08 15:01:15 -05:00
Pankaj Garg 28a320d815
SVM: Move `RentCollector` to sdk (#35122) 2024-02-07 16:38:42 -08:00
Dmitri Makarov b9ee3b475b
SVM: Move RentDebits from accounts-db to Solana SDK (#35135) 2024-02-07 15:10:17 -08:00
Dmitri Makarov 2c0001b530
SVM: Move RewardInfo from accounts-db to Solana SDK (#35120) 2024-02-07 10:55:39 -08:00
Pankaj Garg 56391f655d
Remove unnecessary usage of RentCollector (#35121) 2024-02-07 07:40:17 -08:00
Jeff Washington (jwash) 2aa8b82990
remove activated feature set_exempt_rent_epoch_max (#35082)
* remove activated feature set_exempt_rent_epoch_max

* fix test_rent_eager_collect_rent_in_partition test

* update hash values for test_bank_hash_consistency

* clean up commas
2024-02-07 09:20:31 -06:00
Pankaj Garg 10defb161f
SVM: Move TransactionErrorMetrics to SVM folder (#35112) 2024-02-06 11:15:48 -08:00
Pankaj Garg 99760e519a
SVM: move `inner_instructions_list_from_instruction_trace` to SVM (#35099)
SVM: move inner_instructions_list_from_instruction_trace to SVM
2024-02-06 08:38:24 -08:00
Dmitri Makarov ab30fb5f05
SVM: Move AccountOverrides from accounts-db to SVM (#35091) 2024-02-05 19:16:47 -05:00
Yueh-Hsuan Chiang 785dd2132e
[TieredStorage] Enable hot-storage in TieredStorage::write_accounts() (#35049)
#### Problem
While the implementation of hot-storage reader and writer
are mostly done, it is not yet connected to TieredStorage. 

#### Summary of Changes
This PR enables hot-storage in TieredStorage::write_accounts().

#### Test Plan
Completes the existing tests in TieredStorage to directly
write and read from a TieredStorage with the hot storage format.
2024-02-05 10:23:30 -08:00
HaoranYi 440c3bb156
Avoid account index entry Arc clone in shrinking (#35010)
* avoid account index entry Arc clone in shrink

* use scan to addref

* update code comments for scan fn

* expect

* warn

* update log message

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2024-02-05 16:47:00 +00:00
Brooks a16f982169
Removes redundant check on STORE_META_OVERHEAD (#35069) 2024-02-04 16:56:12 +00:00
Yueh-Hsuan Chiang 9935c2b5e7
[AppendVec] Use proper Vec initial size in append_accounts() (#35047)
#### Problem
append_accounts() only appends (len - skip) accounts.
However, AppendVec::append_accounts() reserves `len`
instead of `(len - skip)` for its vectors.

#### Summary of Changes
Use (len - skip) as the initial size of the Vectors.
2024-02-03 23:02:09 -08:00
Yueh-Hsuan Chiang dd30175e55
[TieredStorage] TieredStorageReader:: and HotStorageReader:: accounts() (#35031)
#### Problem
HotStorageReader and TieredStorageReader haven't implemented
accounts() that is required by AcocuntsFile.

#### Summary of Changes
This PR implements accounts() for both HotStorageReader
and TieredStorageReader

#### Test Plan
Extend the existing test to cover accounts().
2024-02-02 11:18:52 -08:00
Brooks 4b528e890c
Ensures STORE_META_OVERHEAD remains accurate (#35053) 2024-02-02 13:00:54 -05:00
Yueh-Hsuan Chiang 97d994ee6f
[TieredStorage] Use IndexOffset in TieredStorageMeta and get_account() (#35046)
#### Problem
TieredStorageMeta and TieredStorageReader::get_account API uses
u32 to represent IndexOffset.  However, within the TieredStorage scope,
IndexOffset should be used, it is not until working with AccountsFile API
when u32 representation of offset is needed.

#### Summary of Changes
Have TieredStorageMeta and TieredStorageReader to use IndexOffset.

#### Test Plan
Existing unit-tests.
2024-02-02 09:53:13 -08:00
Brooks f62293918d
Moves the async deleter code to accounts-db (#35040) 2024-02-02 09:21:26 -05:00
Yueh-Hsuan Chiang be9f17f053
[TieredStorage] Have HotStorageWriter::write_account() return Vec<StoredAccountInfo> (#34929)
#### Problem
To allow hot-storage to use HotStorageWriter::write_account() to
implement AccountsFile::append_accounts(), it is required to
provide a Vector of StoredAccountInfo to allow AccountsDB to
properly prepare the entry for each account.

#### Summary of Changes
This PR enables HotStorageWriter::write_account() to return
Vec<StoredAccountInfo>.

#### Test Plan
Extend existing tests for HotStorageWriter to verify the correctness
of the returned Vec<StoredAccountInfo>.
2024-02-01 13:33:42 -08:00
Brooks daa2449ad4
Removes RwLock on AccountsDb::shrink_paths (#35027) 2024-02-01 09:35:34 -05:00