Commit Graph

3943 Commits

Author SHA1 Message Date
Brooks 989c80342b
Adds plumbing and tests for verify_snapshot_bank() with Incremental Accounts Hash (#30789) 2023-03-19 21:44:38 -04:00
Brooks d3273ba118
Removes unused `ancestors` param from `get_snapshot_storages` (#30773) 2023-03-18 17:17:41 -04:00
Brooks 8325b0f591
Do not use ancestors in get_snapshot_storages (#30772)
* Do not use ancestors in get_snapshot_storages

* fixup verify_accounts_hash bench
2023-03-17 22:48:47 +00:00
Xiang Zhu 8e3a30c22c
Clean orphaned account snapshot dirs (#30645)
* Clean up orphaned account snapshot hardlink dirs

* fix compilation issues

* debugged, now working.  seeing the orphaned directories deleted

* change back to eprintln + exit for account_path error

* changed eprintln to panic for now

* add test_clean_orphaned_account_snapshot_dirs for codecov check

* address a few comments and nit isseus

* directly unzip, skipped the intermediate array of tuples

* let set_up_account_run_and_snapshot_paths return Result

* 'proper' typo, and comment on return

* use map_err

* use for loop in clean_orphaned_account_snapshot_dirs, removed panic

* add test_set_up_account_run_and_snapshot_paths

* minor, replace .for_each with .all

* rename set_up_account_run_and_snapshot_paths to create_all_accounts_run_and_snapshot_dirs

* remove unnecessary closure return type

* change to for loop

* change match to unwrap_or_else

* remove create_dir_all(&account_path) in create_all

* minor comment cleanup
2023-03-17 15:22:10 -07:00
Brooks d4dd4360e7
Removes `base_slot` param from `calculate_incremental_accounts_hash()` (#30774) 2023-03-17 15:22:22 -04:00
Ryo Onodera 05ee06814e
Fix wrongly swapped parent slot and block height (#30744) 2023-03-17 20:07:52 +09:00
Tao Zhu 17ba051e1f
Revert "add default_cost as mandatory field for Builtin (#30639)" (#30749)
This reverts commit 7b95c8e698.
2023-03-16 11:21:06 -05:00
Brooks 8be99c1c7d
Verifies incremental accounts hash in verify_accounts_hash_and_lamports (#30735) 2023-03-16 09:48:06 -04:00
Yueh-Hsuan Chiang fce949009d
Add new_from_file() API to AccountsFile (#30687)
#### Problem
Accounts db currently use AppendVec::new_from_file() directly
to create a new AcountsFile instance from an existing file.
However, this method should be abstracted out to AccountsFile
so that an existing file can be opened correctly using the right format.

#### Summary of Changes
Add new_from_file() API to AccountsFile which will open an existing
file based on its accounts file format.

Currently, it only supports AppendVec.
2023-03-15 20:38:20 -07:00
Brooks cbc0d01d0d
Refactors verify_accounts_hash_and_lamports() (#30733) 2023-03-15 18:37:27 -04:00
Brooks cefb00e3fb
Includes error in panic in initial accounts hash verification (#30725) 2023-03-15 12:24:55 -04:00
Brooks 65cd55261a
Makes Bank::get_snapshot_hash() aware of incremental accounts hashes (#30719) 2023-03-14 18:03:38 -04:00
Brooks 93c43610ac
AccountsHashVerifier stores IncrementalAccountsHash in AccountsDb (#30696) 2023-03-14 12:41:44 -04:00
Jeff Washington (jwash) 89d5efa0d8
mem idx tracks duplicates better (#30701) 2023-03-14 07:26:39 -07:00
Brooks 560ec08d5e
AccountsHashVerifier writes BankIncrementalSnapshotPersistence (#30587) 2023-03-13 17:44:34 -04:00
Brooks 263342a686
Adds accounts hashes from full & incremental snapshots at startup (#30656) 2023-03-13 14:47:25 -04:00
Brooks 505e3ff5c7
AccountsHashVerifier updates AccountsDb after calculating accounts hash (#30658) 2023-03-13 16:41:24 +00:00
Madhav Goyal 9a8a0223ca
Link needs updating (#30688)
* Link needs updating

Link to monitor the solana cluster doesnt work

* Updated to solana grafna

users could fin the dashboard they are looking for
2023-03-13 17:33:22 +01:00
Brooks a43f803604
AccountsHashVerifier purges old accounts hashes (#30644) 2023-03-13 11:12:11 -04:00
Brooks 5e5b7f00a2
Stores capitalization in account hashes map (#30635) 2023-03-13 10:50:45 -04:00
Brooks 3a97986d7e
Cleans up tests for verify_accounts_hash (#30683) 2023-03-11 01:01:44 -05:00
Brooks 17b48edd7b
Renames types to be consistent with verify_accounts_hash (#30674) 2023-03-10 20:02:14 -05:00
Brooks 63623e4df2
Renames fns to verify_accounts_hash (#30672) 2023-03-10 18:11:47 -05:00
Brooks 64f583b37d
Improves logs in bank verification at startup (#30671)
* Improves logs in bank verification at startup

* pr: should_clean
2023-03-10 21:01:49 +00:00
Tao Zhu 7b95c8e698
add default_cost as mandatory field for Builtin (#30639)
* add default_cost as mandatory field for Builtin

* updated tests

* set zkp program default to VerifyTransfer CUs

---------

Co-authored-by: Jon Cinque <joncinque@pm.me>
2023-03-10 14:02:24 -06:00
Alessandro Decina 13107b4eb6
Enable JIT in Bank::new_with_config_for_tests() (#30661)
The most common validator configuration is JIT on, so test that. On
platforms that don't support JIT we'll still fallback on the
interpreter.
2023-03-10 22:52:33 +11:00
Ryo Onodera 0b9c040fcf
Add .codecov.yml with checks disabled (#30666)
* Add .codecov.yml with checks disabled

* Trigger test-coverage.sh...
2023-03-10 20:11:22 +09: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
Tao Zhu 3b9438fd49
Replace hardcoded loaded accounts size limit with compute budget instruction (#30506)
1. replace hardcoded loaded accounts data size limit with compute budget instruction;
2. new transaction error for invalid account data size limit
3. test requested limit with combination of features and transactions
2023-03-08 19:41:45 -06:00
Brooks 70c6c7e1f7
Uses strong types for snapshot hashes in SnapshotPackagerService (#30603) 2023-03-06 16:50:45 -05:00
Illia Bobyr 82288d4457
accounts_db::get_all_accounts: Select slots with an iterator (#30581)
As `Range` is a special case of an `Iterator`, this is a generalization
that makes `get_all_accounts()` accept other kinds of ranges.  Such as
`RangeInclusive`.
2023-03-06 12:30:50 -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
Alexander Meißner 38e74325e3
Refactor - Remove `process_instruction` parameter `first_instruction_account` (#30579)
* Stops using first_instruction_account parameter in bpf_loader.

* Removes first_instruction_account parameter from process_instruction().
2023-03-06 17:37:37 +01:00
Jeff Washington (jwash) b26d470b02
support loading snapshots with > 1 append vec per slot (#30570)
* support loading snapshots with > 1 append vec per slot

* pr feedback

* drain to into_values

* unwrap() -> expect()

* loop to find non-conflicting file and add test
2023-03-06 06:08:57 -08:00
Illia Bobyr 14c600aa70
StoredAccountMeta: Relax returned refs lifetimes. (#30576)
All the references returned from a `StoredAccountMeta` instance
actually come from the underlying account.  As written, the lifetimes of
the returned references are constrained by the lifetime of the
`StoredAccountMeta` instance.

While technically correct, it is overly strict.  It is totally fine to
use the returned reference as long as the underlying account is alive.
Which could be longer than the lifetime of the `StoredAccountMeta`
wrapper.
2023-03-03 14:51:37 -08:00
Jeff Washington (jwash) b7d05dd755
consolidate held in mem stats (#30574) 2023-03-03 10:05:05 -08:00
Jeff Washington (jwash) fbcb82dcf8
add index_entries_being_shrunk to ShrinkCollect (#30518) 2023-03-01 17:09:42 -08:00
Jeff Washington (jwash) 590ee58667
wip: throttle correctly (#30547)
throttle correctly
2023-03-01 17:08:46 -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
Jeff Washington (jwash) 85eaf1e7ab
improve BankCreationFreezingProgress and add tests (#30513) 2023-02-27 07:54:08 -08:00
Tao Zhu cbcd3ef27e
Not allow transactions request zero CU to update prioritization fee cache (#30507)
* filter out transaction requests zero cu from updating prioritization fee cache

* updated comment
2023-02-24 23:50:02 -06:00
Tao Zhu 9ec5e9b866
refactor to remove additional is_simple_vote check (#30521) 2023-02-24 23:49:04 -06:00
Brooks 64c7b401cd
BankIncrementalSnapshotPersistence uses strong accounts hash types (#30502) 2023-02-24 18:15:23 -05:00
Jeff Washington (jwash) 45a34f637b
move BankCreationFreezingProgress to its own file (#30510) 2023-02-24 14:05:39 -08:00
Brooks ffe2d309b2
Adds serde_snapshot::types module (#30501) 2023-02-24 15:27:12 -05:00
Jeff Washington (jwash) 31573beb2d
use slot instead of store_id in clean (#30472)
* use slot instead of store_id in clean

* update debug
2023-02-24 12:01:16 -08:00
Jeff Washington (jwash) 9080b36192
use local for store_id in write_accounts_to_storage (#30500) 2023-02-24 11:50:57 -08:00
Xiang Zhu 510be7bdb5
Add checks when constructing a BankSnapshotInfo from a directory (#30373)
* Read snapshot directories and find the highest

* format check

* Fix test_get_bank_snapshots

* fix test_bank_fields_from_snapshot

* review changes, is_file etc

* removed incremental snapshot

* SnapshotNewFromDirError

* nit and comments issues

* NewFromDir(#[from] SnapshotNewFromDirError)

* change fill to create

* replace unwrap with map_err and ok_or_else

* Remove BankForks, fix the bank loop
2023-02-24 11:50:29 -08:00
Brooks e0abad43c3
Removes checks for bank_hash_stats in test (#30480) 2023-02-24 14:35:36 -05:00
Jeff Washington (jwash) efc5cc4a48
break apart AccountInfo (#30505) 2023-02-24 11:35:27 -08:00
Jeff Washington (jwash) 7c086ca42d
add DiskIndexValue trait for disk index (#30503) 2023-02-24 11:02:06 -08:00
K-anon 3ed63de656
Revert "Revert "Add test for executor cache runtime feature upgrades.… (#30428) 2023-02-24 10:04:51 -07:00
Tao Zhu 66ea750182
add compute budget instruction to set loaded accounts data size limit (#30377)
* add compute budget instruction to set accounts data size limit

* changes names to explicitly for loaded accounts data size
2023-02-24 09:27:49 -06:00
Jeff Washington (jwash) 0a75be399b
dirty_stores key is slot and not AppendVecId (#30474) 2023-02-24 07:17:09 -08:00
Jeff Washington (jwash) 005dde70e2
minor cleanup (#30477) 2023-02-23 15:10:09 -08:00
Jeff Washington (jwash) 2441a06e78
drop default from PhantomData::default() (#30476) 2023-02-23 14:59:08 -08:00
Brooks b7d31e134c
Refactors Accounts::new_from_parent() (#30475) 2023-02-23 16:50:51 -05:00
Jeff Washington (jwash) 2c7d9f988e
use slot with store id in some clean paths (#30473) 2023-02-23 13:50:25 -08:00
Jeff Washington (jwash) 9ddb89226c
remove_dead_accounts uses slot instead of AppendVecId (#30471) 2023-02-23 13:20:33 -08:00
Jeff Washington (jwash) e39626ab14
add second type to accounts index for disk (#30446) 2023-02-23 13:05:06 -08:00
Jeff Washington (jwash) 6df160bedd
get stored_size from StoredAccountMeta (#30456) 2023-02-23 12:33:35 -08:00
Jeff Washington (jwash) a2b0b8e346
rearrange how shrink_in_progress_map is populated (#30466) 2023-02-23 11:35:38 -08:00
Xiang Zhu d6da019ccf
Clean up old account snapshot directories to avoid the file existing hardlink error (#30426)
* Fix the hardlink failure

* minor comment cleanup

* use ? and slot_str

* &slot_str

* Add InvalidAccountPath
2023-02-23 10:53:12 -08:00
Jeff Washington (jwash) 47d95a431c
remove magic numbers in test (#30465) 2023-02-23 09:23:14 -08:00
Jeff Washington (jwash) c032dc2754
add bank progress stats (#30405)
* add bank progress stats

* handle more bank creation code paths

* use wrapping sub
2023-02-23 06:29:02 -08:00
Jeff Washington (jwash) 9ecc4462f8
cleanup test type (#30453) 2023-02-23 06:26:55 -08:00
Yihau Chen df3ef111f7
chore: workspace inheritance (#29893)
* introduce workspace.package

* introduce workspace.dependencies

* read version from root cargo.toml

* pass check when version = { workspace = true }

* don't bump version when version = { workspace = true }

* including workspace Cargo.toml when bump version

* programs/sbf use workspace inheritance

* fix increasing cargo version ignore program/sbf/Cargo.toml
2023-02-23 22:01:54 +08:00
Pankaj Garg 0e13dcca00
Replenish executor cache eagerly during transaction processing (#30425) 2023-02-23 05:13:39 -08:00
Michael Vines 5136ed3448
Update homepage value for all crates (#30444) 2023-02-23 02:20:18 +00: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
Yueh-Hsuan Chiang 833cb75c20
Fix the dependency of accounts_file.rs (#30423)
Replace the use of append_vec::* in accounts_file.rs
2023-02-22 11:13:58 -08:00
Jeff Washington (jwash) a78f763896
simplify remove_if_slot_list_empty_value (#30436) 2023-02-22 10:46:12 -08:00
Jeff Washington (jwash) 6a66d4631c
remove 'stored_size' from account info (#30407) 2023-02-22 07:04:21 -08:00
Jeff Washington (jwash) db8764f98d
hold items with ref count != 1 in memory (#30414)
* hold items with ref count != 1 in memory

* fix tests
2023-02-22 06:57:59 -08:00
Brooks 1689586213
Uses a channel for AHV -> SPS (#30406) 2023-02-22 03:36:29 +00:00
K-anon 2e4b8ea8bb
Revert "Add test for executor cache runtime feature upgrades. (#30382)" (#30424)
This reverts commit c5a24e11ba.

Co-authored-by: K-anon <IntokuSatori@users.noreply.github.com>
2023-02-21 15:47:39 -07:00
Pankaj Garg b1f5b0d790
Find and load missing programs in LoadedPrograms cache (#30275)
* Find and load missing programs in LoadedPrograms cache

- filter program accounts in a transaction batch
- filter the accounts that are missing in LoadedPrograms cache
- load the programs before processing the transactions
- unit tests

* address review comments

* fix clippy

* address review comments

* fix test

* fix more tests
2023-02-21 12:53:35 -08:00
Brooks 35328ca63d
Makes AccountsHash an enum (#30416) 2023-02-21 15:20:51 -05:00
K-anon c5a24e11ba
Add test for executor cache runtime feature upgrades. (#30382)
Co-authored-by: K-anon <IntokuSatori@users.noreply.github.com>
2023-02-21 12:25:29 -07:00
Jeff Washington (jwash) 568a4b1ca0
move AccountInfo bits from size to offset (#30408)
* move AccountInfo bits from size to offset

* feedback
2023-02-21 10:08:37 -08:00
HaoranYi 22f6dfd98e
typo (#30393) 2023-02-21 09:59:45 -06:00
Brooks bcc4bc80c9
Removes unnecessary derives from Accounts{Delta}Hash (#30392) 2023-02-20 16:00:53 -05:00
Jeff Washington (jwash) 46b42e1888
add hash calc scan_chunks metric (#30333) 2023-02-20 12:55:48 -08:00
Brooks ec288ded9b
Serde snapshot uses own types (#30391) 2023-02-20 12:25:15 -05:00
Brooks a8e07c41fe
Adds `is_incremental_accounts_hash_feature_enabled` to `AccountsPackage` (#30368) 2023-02-20 12:21:38 -05:00
Brooks ad6a3abd8b
Uses set_accounts_{delta,}_hash_for_tests() in serde tests (#30390) 2023-02-17 16:00:25 -05:00
Brooks f91e63dfe9
Upgrades Rust to 1.67.1 (#29947) 2023-02-17 14:08:27 -05:00
Pankaj Garg 3a4ba72daf
Remove executors trait and replace with LoadedProgram (#30348)
* Remove executors trait and replace with LoadedProgram

* fill in deployment slot

* address review comments

* fix clippy warnings

* address review comments

* fix failures caught by sbf tests
2023-02-17 12:47:45 +01:00
Pankaj Garg 6c58033df5
API to enumerate executable program accounts in tx batch (#30371) 2023-02-16 13:29:38 -08:00
Brooks febaf36e6d
Apply clippy fixes for future rust upgrade (#30363) 2023-02-16 16:12:51 +00:00
Xiang Zhu fa22389b22
Add version and state_complete flag into bank snapshot (#30099)
* Add version and state_complate flag into bank snapshot

* Add test_get_highest_full_snapshot_slot_and_path

* fix build checks

* fix slot_deltas panic in test_get_highest_full_snapshot_slot_and_path

* make bank rooted for test_get_highest_full_snapshot_slot_and_path

* fix bank scope problem in test_get_highest_full_snapshot_slot_and_path

* minor cleanup

* misc review issues

* remove unneeded error defs and functions

* Fix state_complete macro naming

* fix snapshot_version
2023-02-15 22:38:40 -08:00
Yueh-Hsuan Chiang ce4251be99
Fix the return type of AccountsFile::account_matches_owners() (#30354)
Update AccountsFile::account_matches_owners() to return the matched index
2023-02-16 03:34:36 +00:00
Yueh-Hsuan Chiang aeb6df3507
Abstract out AppendVec into AccountsFile enum (#29815)
Abstracts out AppendVec into AccountsFile enum.
This will allow different implementations of AccountsFile that support the AccountsDB.
2023-02-15 17:24:04 -08:00
Brooks 5680c76c86
Refactors Accounts::new() fns (#30343) 2023-02-15 18:34:52 -05:00
HaoranYi 615d1a8b69
Extract BankHashLamportsVerifyConfig (#30320)
* refactor BankHashLamportsVerifyConfig

* clippy

* comments

* fix bench
2023-02-15 16:03:50 -06:00
Andrew Fitzgerald b86bfbb5c5
measure_us! use Instant and duration_to_us internally (#30339) 2023-02-15 12:43:47 -08:00
Pankaj Garg 3bea5fc326
Return index of matching owner for a program account (#30337) 2023-02-15 19:41:29 +00:00
Xiang Zhu 4909267c88
Add accounts hard-link files into the bank snapshot directory (#29496)
* Add accounts hard-link files into the bank snapshot directory

* Small adjustments and fixes.

* Address some of the review issues

* Fix compilation issues

* Change the latest slot snapshot storage from VecDeque to Option

* IoWithSourceAndFile and expanded comments on accounts

* last_slot_snapshot_storages in return value

* Update comments following the review input

* rename dir_accounts_hard_links to hard_link_path

* Add dir_full_state flag for add_bank_snapshot

* Let appendvec files hardlinking work with multiple accounts paths across multiple partitions

* Fixes for rebasing

* fix tests which generates account_path without adding run/

* rebasing fixes

* fix account path test failures

* fix test test_concurrent_snapshot_packaging

* review comments.  renamed the path setup function

* Addressed most of the review comments

* update with more review comments

* handle error from create_accounts_run_and_snapshot_dirs

* fix rebasing duplicate

* minor accounts_dir path cleanup

* minor cleanup, remove commented code

* misc review comments

* build error fix

* Fix test_incremental_snapshot_download_with_crossing_full_snapshot_interval_at_startup

* fix build error on MAX_BANK_SNAPSHOTS_TO_RETAIN

* rebase fix, update hardlink filename

* minor comment spelling fix

* rebasing fixes

* fix rebase issues; with_extension

* comments changes for review

* misc minor review issues

* bank.fill_bank_with_ticks_for_tests

* error handling on appendvec path

* fix use_jit

* minor comments refining

* Remove type AccountStorages

* get_account_path_from_appendvec_path return changed to Option

* removed appendvec_path.to_path_buf in create_accounts_run_and_snapshot_dirs

* add test_get_snapshot_accounts_hardlink_dir

* update last_snapshot_storages comment

* update last_snapshot_storages comment

* symlink map_err

* simplify test_get_snapshot_accounts_hardlink_dir with fake paths

* log last_snapshot_storages at the end of the loop
2023-02-15 09:52:07 -08:00
Brooks 2e885cf99a
Removes calls to insert_default_bank_hash_stats() in tests (#30311) 2023-02-14 15:00:38 -05:00
Jeff Washington (jwash) b9b8cd9ccc
misc. cleanup (#30295) 2023-02-14 12:00:13 -08:00