Commit Graph

132 Commits

Author SHA1 Message Date
Alexander Meißner a310dd776c
Fix - Uses `std::mem::transmute` and `std::ptr::write` in unsafe code in append_vec.rs (#32711)
Uses std::mem::transmute and std::ptr::write in unsafe code in append_vec.rs
2023-08-04 17:18:13 +02:00
Yueh-Hsuan Chiang fbb1dd5fe5
Replace AccountsFile::cloned_account by ReadableAccount::to_account_shared_data() (#32399)
#### Problem
Both AppendVec::cloned_account() and ReadableAccount::to_account_shard_data()
returns an AccountSharedData instance by cloning itself as pointed out under
a comment in PR #32380.

#### Summary of Changes
This PR removes AccountsFile::cloned_account() and replaces its call-sites by
ReadableAccount::to_account_shared_data().
2023-07-07 00:08:50 +08:00
Yueh-Hsuan Chiang 6752019a80
Add enum AppendVecError (#31749)
#### Problem
AppendVec currently uses std::io::ErrorKind::Other for its own errors.

#### Summary of Changes
This PR introduces AppendVecError and has AppendVec use it.
2023-05-24 12:18:17 -07:00
Yueh-Hsuan Chiang c79a6e74e2
Add new error type AccountsFileError (#31631)
#### Problem
AccountsFile- and AppendVec-related code uses io::Error for their main error type.  However, there're many errors under AccountsFile that don't belong to io::Error.

#### Summary of Changes
This PR introduces AccountsFileError and makes minimum changes to keep the PR small.
Subsequent changes related to this will be in separate PRs.
2023-05-22 14:09:09 -07:00
Brooks 53dfb9fa41
Gives lifetimes more descriptive names in append_vec.rs (#31403) 2023-04-28 15:32:29 -04:00
Brooks f86dc35471
Fixes lifetimes on AppendVec::get_type() (#31401) 2023-04-28 15:27:22 -04:00
Jeff Washington (jwash) 812d899c7f
add lifetimes to refs in ReadableAccount (#31258) 2023-04-19 11:35:59 -07:00
Yueh-Hsuan Chiang 72c6099ea0
Move alignment related consts from append_vec.rs to accounts_file.rs (#30782)
#### Problem
As we start supporting new storage formats, alignment-related constants and macros
defined in append_vec.rs aren't only specific to AppendVec.

#### Summary of Changes
Move alignment-related constants/macros from append_vec.rs to accounts_file.rs
2023-03-20 11:34:18 -07:00
Yueh-Hsuan Chiang 71b6370426
Abstract out StoredAccountMeta as an Enum (#30478)
#### Problem
The existing StoredAccountMeta requires the file and in-memory layout of
account metadata to match StoredMeta and AccountMeta.  This limits the
flexibility to implement different accounts storage file formats.

#### Summary of Changes
This PR abstracts out StoredAccountMeta as an Enum.
2023-03-09 15:52:51 -08:00
Yueh-Hsuan Chiang a78ef393bf
Generalize the return value of append_accounts() (#30571)
#### Problem
The existing append_accounts returns a vector of offsets, which accounts-db
later uses it to infer the storage size of each account.  However, such inference
does not apply to the new hot/cold storage format.

#### Summary of Changes
This PR changes the return value of append_accounts() to `Vec<StoredAccountInfo>`,
which includes both offset and storage size information of an account.
2023-03-06 09:52:05 -08:00
Yueh-Hsuan Chiang 33e179905f
getter functions for StoredAccountMeta (#30447)
This PR makes all the StoredAccountMeta fields pub(crate)
and provides getter functions to access its member fields.

This PR is a preparation step for abstracting out StoredAccountMeta.
2023-02-27 10:03:22 -08:00
Yueh-Hsuan Chiang ac7e7aa8f0
Move account-meta structs from append_vec.rs to account_meta.rs (#30443)
#### Problem
As we start supporting new storage formats, those account-meta
structs will be shared by different storage formats and thus need
a new home.

#### Summary of Changes
This PR creates meta.rs under account_storage and moves all the account-meta
structs out from append_vec.rs.
2023-02-22 16:10:34 -08:00
Pankaj Garg 3bea5fc326
Return index of matching owner for a program account (#30337) 2023-02-15 19:41:29 +00:00
Pankaj Garg d0623a38c8
API to match account owner against a set of owners (#30154) 2023-02-07 17:48:10 -08:00
Jeff Washington (jwash) d563d37860
combine lookups in StorableAccountsWithHashesAndWriteVersions (#30061) 2023-02-02 10:46:17 -08:00
Richard Patel 179b406acb
runtime: make {Stored,Account}Meta repr(C) (#30027)
Co-authored-by: Richard Patel <ripatel@jumptrading.com>
2023-01-31 20:13:56 -05:00
Richard Patel 1ca78845bb
runtime: add test_type_layout (#29987)
adds unit test asserting the type layout of structures in append_vec

---------

Co-authored-by: Richard Patel <ripatel@jumptrading.com>
Co-authored-by: brooks <brooks@solana.com>
2023-01-31 11:08:55 -05:00
behzad nouri 272e667cb2
deprecates Pubkey::new in favor of Pubkey::{,try_}from (#29805)
The commit deprecates Pubkey::new which lacks type-safety and instead
implements TryFrom<&[u8]> and TryFrom<Vec<u8>> for Pubkey.
2023-01-21 18:06:27 +00:00
Xiang Zhu a6bf68cec8
Refine appendvec sanitize error message to include path (#29541) 2023-01-05 14:43:10 -08:00
Jeff Washington (jwash) 6edbb61fa0
add test_shrink_ancient_overflow (#29363) 2023-01-02 07:09:53 -08:00
Jeff Washington (jwash) b77bef4ee3
write_version -> write_version_obsolete (#29176) 2022-12-14 07:43:40 -08:00
Jeff Washington (jwash) 06a806bb9d
introduce aligned_stored_size to flush write cache (#29147) 2022-12-08 19:44:23 -08:00
behzad nouri 9524c9dbff patches errors from clippy::uninlined_format_args
https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
2022-12-06 19:32:15 +00:00
behzad nouri 401f66c830 patches errors from clippy::seek_to_start_instead_of_rewind
https://rust-lang.github.io/rust-clippy/master/index.html#seek_to_start_instead_of_rewind
2022-12-06 19:32:15 +00:00
Jeff Washington (jwash) c8cc1270f1
log # append vecs open (#28958) 2022-11-29 16:48:02 -08:00
Jeff Washington (jwash) 5d88a9b32b
improve perf of storing accounts for shrink/ancient (#28880)
* improve perf of storing accounts for shrink/ancient

* rename

* phantom data

* update comment

* make impl Borrow<Hash> consistent

* remove unused static
2022-11-22 15:36:57 -08:00
Jeff Washington (jwash) d449b9ea26
test_new_from_file_crafted_zero_lamport_account uses static append vec file (#28911) 2022-11-21 12:43:03 -08:00
Jeff Washington (jwash) 813f1f993a
remove test only append_account (#28850) 2022-11-17 12:26:51 -08:00
Jeff Washington (jwash) 4837dc071f
cleanup return value from append_accounts (#28836) 2022-11-16 10:59:11 -08:00
Jeff Washington (jwash) cb4c3668c7
.pubkey() instead of meta.pubkey for stored account (#28682) 2022-10-31 13:58:42 -07:00
Jeff Washington (jwash) c47515d055
remove duplicate pubkey when shrinking or combining ancient (#28678) 2022-10-31 12:00:55 -07:00
behzad nouri 9a57c64f21
patches clippy errors from new rust nightly release (#27996) 2022-09-22 22:23:03 +00:00
apfitzge c1f7d1a367
Add AppendVec::new_from_file_unchecked (#26795)
new_from_file_unchecked
2022-07-28 14:57:26 -05:00
HaoranYi 1aa9215411
Refactor: add account_iter api for appendvec (#26591)
* add account iterator for appendvec

* semicolon
2022-07-12 23:56:05 +00:00
Jeff Washington (jwash) 0ab521d5f1
inc counter when append vec drop fails (#26396) 2022-07-05 11:27:01 -05:00
apfitzge 50eb9965ab
fix test_new_from_file_crafted_executable for m1 (#26009)
* fix test_new_from_file_crafted_executable for m1

* re-add old assert/comment, but disable for aarch64
2022-06-27 12:03:52 -05:00
apfitzge e1efc5bebb
append_vec.rs: remove new_empty_map (unused) (#25885) 2022-06-15 08:59:46 -05:00
Michael Vines b05c7d91ed Fix derive_partial_eq_without_eq clippy lint 2022-05-22 22:22:21 -07:00
Brooks Prumo a25212b087
Move append_vec::test_utils into its own file (#25407) 2022-05-20 13:37:45 -05:00
Jeff Washington (jwash) 3fe7655378
use iterator instead of vec to iterate accounts (#25370)
* user iterator instead of vec to iterate accounts

* rename
2022-05-20 08:50:24 -05:00
Jeff Washington (jwash) b1c89cf6d4
append_vec::remaining_bytes (#24531) 2022-04-20 13:44:57 -05:00
HaoranYi 42c094739d
add test cfg attribute (#24154) 2022-04-07 09:05:20 -05:00
HaoranYi 04d23a1597
fix memory ordering in append_vec (#23215) 2022-02-20 20:30:49 -06:00
Jeff Washington (jwash) 46e5350d8c
AcctInfo: store offset in AccountInfo as u32 (#21895) 2021-12-15 15:41:11 -06:00
Jeff Washington (jwash) 825f8bcea4
use AppendVecId instead of usize (#21792) 2021-12-11 21:38:13 -06:00
Michael Vines b8837c04ec Reformat imports to a consistent style for imports
rustfmt.toml configuration:
  imports_granularity = "One"
  group_imports = "One"
2021-12-03 09:19:13 -08:00
Anton Lazarev 6bb884836c address review feedback - use u64 instead of usize 2021-12-02 08:12:30 -08:00
Anton Lazarev adbf31b98c avoid usize overflow for MAXIMUM_APPEND_VEC_FILE_SIZE on 32-bit platforms 2021-12-02 08:12:30 -08:00
Michael Vines e922c2da9d Update to Rust 1.56.1 2021-11-30 23:28:07 -08:00
Michael Vines 3b70cdb8d8 Upgrade to Rust 1.55.0 2021-10-06 17:48:58 -07:00