Commit Graph

4336 Commits

Author SHA1 Message Date
steviez 4b2db0d546
Add explaining comment for Err case in get_bank_snapshots() (#31998) 2023-06-08 12:54:24 -05:00
Tao Zhu 37a759045a
include cost of transaction's requested loaded accounts size in cost model (#31905)
* include transaction requested loaded accounts size cost in cost model

* move function to avoid circular dependency
2023-06-08 12:49:42 -05:00
Jeff Washington (jwash) 8937fd9bd6
improve packed ancient test by sweeping (#32002) 2023-06-08 07:50:18 -07:00
Alexander Meißner 3f13cd353e
Fix - LoadedProgramType::Closed (#31922)
* Makes Bank::load_program() return correct tombstones.

* Removes early TX failure caused by closed and invalid programs.

* Adjusts the feature gate of simplify_writable_program_account_check.
2023-06-08 15:40:18 +02:00
Brooks ddbc35fcc3
Add logging to move_and_async_delete_path (#32017) 2023-06-07 16:31:16 -04:00
Jeff Washington (jwash) 36ccc71220
move StakeReward to stake_rewards.rs (#32014) 2023-06-07 12:35:28 -07:00
Alexander Meißner c87ff8780a
Cleanup - `Bank::reconfigure_token2_native_mint()` (#31817)
Removes Bank::reconfigure_token2_native_mint().
2023-06-07 21:14:43 +02:00
Yueh-Hsuan Chiang b1db4ccc9a
[TieredStorage] Make AccountMetaFlags and its fields public (#32004)
#### Problem
AccountMetaFlags and its fields are required to be public as the visibility of their get
functions generated by `bit_fields` are tied to the visibility of their fields, and the
get functions will later be used to support the TieredAccountMeta for AccountMeta.

#### Summary of Changes
Make AccountMetaFlags and its fields public
2023-06-07 11:37:56 -07:00
Jeff Washington (jwash) 0f215575ca
add RewardInterval::InsideInterval (#31799)
* add RewardInterval::InsideInterval

* update abi hash

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-07 09:56:36 -07:00
Alexander Meißner ee2c2ef6c7
Cleanup - require_static_program_ids_in_transaction (#31767)
require_static_program_ids_in_transaction
2023-06-07 17:12:41 +02:00
Pankaj Garg c86e160438
Add runtime environment to FailedVerification tombstones (#31991)
* Add runtime environment to FailedVerification tombstones

* modify default variant

* prune update

* add DelayVisibility in prune_feature_set_transition
2023-06-06 22:24:39 +00:00
Jeff Washington (jwash) 85a0e31c60
add ProgramExecutionTemporarilyRestricted error (#31796)
* add StakeProgramUnavailable error

* rename to ProgramExecutionTemporarilyRestricted

* Update sdk/src/transaction/error.rs

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>

* fmt

* update frozen abi hash

* add account_index to ProgramExecutionTemporarilyRestricted error

* Update sdk/src/transaction/error.rs

Co-authored-by: mvines <mvines@gmail.com>

* populate transaction_details from transaction_error for ProgramExecutionTemporarilyRestricted error

* fix a test

* update abi digest

* Update sdk/src/transaction/error.rs

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

---------

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: HaoranYi <haoran.yi@gmail.com>
Co-authored-by: mvines <mvines@gmail.com>
Co-authored-by: Brooks <brooks@prumo.org>
2023-06-06 14:13:41 -07:00
Tao Zhu 71c78f7a21
Will failed transaction should be considered has zero execution cost by cost model (#31976) 2023-06-06 15:45:45 -05:00
Brooks f08fb3e158
Downgrades log to debug if reading bank snapshot from dir fails (#31990) 2023-06-06 15:07:45 -04:00
Tao Zhu 83ac66caa1
split TransactionCost to its own module (#31977)
* split TransactionCost to its own module

* remove unused function
2023-06-06 11:15:38 -05:00
Alexander Meißner 89207a3fe5
Feature - Prune on feature set transition (#31945)
* Call create_program_runtime_environment() in Bank::apply_builtin_program_feature_transitions().

* Adds LoadedPrograms::prune_feature_set_transition().
2023-06-06 17:49:02 +02:00
Yueh-Hsuan Chiang 40d3e8e8fa
[TieredStorage] Enable ByteBlockWriter to report the length of raw data (#31900)
#### Summary of Changes
This PR adds raw_len() to ByteBlockWriter which returns
the length of the data after decoding.  This information is needed
for the cold storage to keep track of the current size of the account
block after decompression.

#### Test Plan
Improved existing tests to verify the returned raw_len().
Tested in mnb w/ the prototype implementation of the tiered storage (https://github.com/solana-labs/solana/pull/30626)
2023-06-02 14:01:38 -07:00
Pankaj Garg 37ebb709e6
Evict program cache using transaction usage counter (#31927)
* Evict program cache using tx usage counter

* address review feedback

* address review feedback
2023-06-02 11:26:56 -07:00
Tao Zhu 10995f66c0
use one definition of builtin program cost in runtime and banking stage (#31930)
* use one definition of builtin program cost in runtime and banking stage
* add loader_v4
2023-06-02 10:22:22 -05:00
steviez 858ea5a143
chore: Add name string for bank_serialize measure! (#31926)
The measurement is later logged, so include a name to more clearly
identify what the measurement was.
2023-06-02 06:54:04 -05:00
Pankaj Garg 29d7a57cce
Reset program cache stats after submit (#31929) 2023-06-02 01:16:49 -07:00
Illia Bobyr 4353ac6797
Pass Arc<AtomicBool> by value, not by reference. (#31916)
`Arc` is already a reference internally, so it does not seem to be
beneficial to pass a reference to it.  Just adds an extra layer of
indirection.

Functions that need to be able to increment `Arc` reference count need
to take `Arc<AtomicBool>`, but those that just want to read the
`AtomicBool` value can accept `&AtomicBool`, making them a bit more
generic.

This change focuses specifically on `Arc<AtomicBool>`.  There are other
uses of `&Arc<T>` in the code base that could be converted in a similar
manner.  But it would make the change even larger.
2023-06-01 17:25:48 -07:00
Yueh-Hsuan Chiang 2b04f28c7b
[TieredStorage] AccountMetaFlags (#31913)
#### Summary of Changes
This PR implements AccountMetaFlags, which will later be used in
the tiered accounts storage to support optional fields.

#### Test Plan
Unit tests are included in this PR.
2023-06-01 14:48:27 -07:00
Yueh-Hsuan Chiang 1302962521
[TieredStorage] Support Lz4 in ByteBlockWriter (2/N) (#31862)
#### Summary of Changes
Support Lz4 in ByteBlockWriter.

#### Test Plan
Added test cases for Lz4.
Tested in mnb w/ the prototype implementation of the tiered storage (#30626)
2023-06-01 10:29:08 -07:00
steviez debe794987
Replace improper &Arc<...> with Arc<...> in Bank and Accounts (#31892)
The callstack updated in this PR passed an &Arc<...> down only to have
the bottom level clone the reference. Thus, we are giving shared
ownership so the reference is a bit redundant and arguably obscures the
intention to clone further down the callstack.
2023-05-31 12:36:44 -05:00
Brooks 8e191bbc56
Downgrades log to warn if reading bank snapshot from dir fails (#31885) 2023-05-30 19:35:06 -04:00
Yueh-Hsuan Chiang 33d64c6b2f
[TieredStorage] Add doc comments for byte_block.rs (#31863)
#### Summary of Changes
Add doc comments for byte_block.rs

#### Test Plan
This is a comment-only PR.  No code change.
2023-05-30 16:25:25 -07:00
Brooks c569a37713
Handle errors when sending an accounts package during shutdown (#31874) 2023-05-30 17:42:33 -04:00
Yueh-Hsuan Chiang 5334efd63c
Byte-blocks utils for TieredStorage (1/N) (#31815)
#### Summary of Changes
This PR includes the util structs for writing byte blocks, which will be used
by the TieredStorage writer (currently used in the prototype #30626).

The PR only includes the Raw encoding format.  Will add more in subsequent PRs.

#### Test Plan
Tested in mnb with the prototype implementation of the tiered-storage (#30626)
Unit tests are also included in this PR.
2023-05-30 14:14:29 -07:00
Jeff Washington (jwash) 6c520396cd
bank process_new_epoch takes parent_height (#31820) 2023-05-30 08:58:40 -05:00
Jeff Washington (jwash) 588a7a4e53
add RewardsStoreMetrics for partitioned rewards (#31819) 2023-05-30 08:58:00 -05:00
Jeff Washington (jwash) 0c64e26d53
partitioned rewards helper functions (#31818) 2023-05-30 08:57:31 -05:00
Brooks 8a3f446db0
Removes MAX_BANK_SNAPSHOTS_TO_RETAIN constant (#31827) 2023-05-25 17:13:28 -04:00
Andrew Fitzgerald 75954dc061
Banking worker (#30970) 2023-05-25 10:16:04 -07:00
Brooks 0e93090520
Updates priority for which snapshot request to handle next (#31798) 2023-05-24 16:21:06 -04: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
Jeff Washington (jwash) 461342cdd4
add cli args and use of partitioned rewards config (#31800)
* add cli args and use of partitioned rewards config

* update comments
2023-05-24 10:54:09 -07:00
Jeff Washington (jwash) 49259dcad8
add optional ignore to `calculate_accounts_delta_hash` (#31801) 2023-05-24 10:51:03 -07:00
Jeff Washington (jwash) d6a54e0f4d
add partitioned_rewards.rs (#31794) 2023-05-24 09:59:38 -07:00
Alexander Meißner a85548cf34
Cleanup - spl_token_v3_4_0 and spl_associated_token_account_v1_1_0 (#31764)
* spl_token_v3_4_0

* spl_associated_token_account_v1_1_0

* Marks replace_program_account() as dead code.
2023-05-24 18:45:37 +02:00
Jeff Washington (jwash) e396a10312
change StartBlockHeightAndRewards from parent to current (#31781) 2023-05-23 20:10:51 -07:00
Jeff Washington (jwash) ae12079139
add debug to VoteReward (#31782) 2023-05-23 20:10:20 -07:00
Jeff Washington (jwash) 8e8b2f1671
reformat comments (#31780) 2023-05-23 17:04:47 -07:00
Andrew Fitzgerald f52ded35f4
async delete contents but leave directory (#31737)
* async delete contents but leave directory

* Clarified comment
2023-05-23 15:33:09 -07:00
Brooks 05c932f92d
Moves transient accounts hash cache files into their own dir (#31778) 2023-05-23 22:14:30 +00:00
Yueh-Hsuan Chiang 174951478f
Add new error type -- TieredStorageError (#31633)
#### Summary of Changes
This PR adds a new error type for the tiered storage.
2023-05-23 15:06:55 -07:00
Brooks a474cb24b9
Creates temporary accounts hash cache files inside accounts hash cache dir (#31776) 2023-05-23 17:09:16 -04:00
Brooks 61afb07dbd
Purges old bank snapshots at startup (#31656)
Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
2023-05-23 13:18:05 -04:00
Andrew Fitzgerald 5448d0b1e8
Remove redundant clones (#31685)
* broadcast_stage remove redundant clone

* broadcast_fake_shreds_run remove redundant clone

* wallet remove redundant clone

* cluster_query remove redundant clone

* accounts remove redundant clones
2023-05-23 09:42:05 -07:00
Alexander Meißner 1e8e024ec5
Cleanup - disable_fee_calculator (#31766)
disable_fee_calculator
2023-05-23 18:20:38 +02:00
Alexander Meißner e9d99973ca
Cleanup - bank_transaction_count_fix (#31768)
bank_transaction_count_fix
2023-05-23 18:18:15 +02:00
Alexander Meißner d866fce3d8
Cleanup - include_account_index_in_rent_error (#31770)
include_account_index_in_rent_error
2023-05-23 15:02:55 +02:00
Alexander Meißner 183e7fd60f
Cleanup - instructions_sysvar_owned_by_sysvar (#31769)
instructions_sysvar_owned_by_sysvar
2023-05-23 15:02:35 +02:00
Yueh-Hsuan Chiang d9d2120d32
Make reconstruct_single_storage() returns SnapshotError (#31748)
#### Problem
The return error type -- io::Error used in reconstruct_single_storage()
isn't suitable to describe all possible errors inside the function such as
AccountsFileError.

#### Summary of Changes
This PR makes it return SnapshotError which can better handle
both AccountsFileError and io::Error.
2023-05-23 02:18:23 -07:00
Yueh-Hsuan Chiang 586fd407bf
Refactor SnapshotError related code (#31632)
#### Problem
Part of the snapshot-related code uses io::Error while other parts use SnapshotError.

#### Summary of Changes
As SnapshotError can be created from io::Error, this PR makes snapshot-related
code to use SnapshotError instead.
2023-05-22 15:33:11 -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
Alexander Meißner 83f692ce67
Refactor - Share RBPF config and syscall registry globally (#31727)
* Adds LoadedPrograms::program_runtime_environment_v1.

* No need to explicitly remove precompiles from program_accounts_map.
2023-05-20 20:28:00 +02:00
Pankaj Garg e6d490708a
Do not overwrite builtin program in the same slot (#31718) 2023-05-19 05:26:31 -07:00
Andrew Fitzgerald d391e75a60
Performance: Allowed forced inline update_index (no thread pool) (#31455) 2023-05-18 13:32:41 -07:00
Alexander Meißner 520c647918
Refactor - Merges `BuiltinPrograms` into `LoadedPrograms` (#31654)
* Merges BuiltinPrograms into LoadedPrograms.

* Prevents built-ins from being pruned.
2023-05-18 22:18:28 +02:00
Jeff Washington (jwash) 9fd6f09984
remove redundant `mut`s (#31696) 2023-05-18 11:08:13 -07:00
Jeff Washington (jwash) 3ac5bb2a60
deserialize epoch_reward_status into BankFieldsToDeserialize (#31698) 2023-05-18 07:14:59 -07:00
Jeff Washington (jwash) 0291454876
persist EpochRewardStatus::Active (#31697)
persist `EpochRewardStatus::Active`
2023-05-18 07:14:41 -07:00
Jeff Washington (jwash) 3f625e47df
working towards persistence for EpochRewardStatus (#31678) 2023-05-17 13:23:20 -07:00
Jeff Washington (jwash) 8ed4962229
refactor serialization tuple into an enum (#31679) 2023-05-17 10:53:28 -07:00
Jeff Washington (jwash) ce32cb43db
add bank.epoch_reward_status (#31680) 2023-05-17 10:01:14 -07:00
Pankaj Garg b03422968b
Remove Rc and RefCell to carry program cache in invoke_context (#31684) 2023-05-17 06:10:50 -07:00
Jeff Washington (jwash) 7c6478da8f
remove unnecessary pub (#31676) 2023-05-16 13:53:57 -07:00
Jeff Washington (jwash) 5bc41a0eb8
prepare load_transaction_accounts to recognize reward interval (#31673) 2023-05-16 12:55:35 -07:00
Jeff Washington (jwash) cdb430d287
add StorableAccount impl for account value (#31675) 2023-05-16 12:54:48 -07:00
Jeff Washington (jwash) d841ff7fe1
support snapshot deserialization with EpochRewardStatus (#31672)
* support snapshot deserialization with EpochRewardStatus

* pub(crate)
2023-05-16 12:53:52 -07:00
Jeff Washington (jwash) db4b76d9e2
default to using packed ancient append vec (#31657) 2023-05-16 07:11:24 -07:00
Jeff Washington (jwash) eaaed0a726
clean up is_ancient in is_candidate_for_shrink (#31616)
clean up `is_ancient` in `is_candidate_for_shrink`
2023-05-15 14:05:41 -07:00
Jeff Washington (jwash) 6172b0d50c
cleanup a stat call to `is_ancient` (#31621)
cleanup some calls to `is_ancient`
2023-05-15 13:22:15 -07:00
Jeff Washington (jwash) 656d93d805
remove unused `accounts_hash_complete_oldest_non_ancient_slot` (#31652) 2023-05-15 12:44:37 -07:00
Andrew Fitzgerald e5effa38b1
derive TransactionCost::{PartialEq, Eq} (#31626) 2023-05-15 12:27:17 -07:00
Maximilian Schneider 31aafc8ae6
race condition when running solana-program-test (#31637)
* hold bank freeze lock in banks-server to prevent RC on slot change

* clean up comments and loop

---------

Co-authored-by: Maximilian Schneider <max@mango.markets>
2023-05-15 12:25:06 -07:00
Jeff Washington (jwash) 596a76ffb3
`get_ancient_slots` returns slots based on slot as opposed to contents (#31620) 2023-05-15 11:21:33 -07:00
Brooks dd4cfe9924
Do not purge bank snapshots in AccountsBackgroundService (#31647) 2023-05-15 13:53:48 -04:00
Brooks bac4d50761
Uses `_` instead of `-` for datapoint field names (#31648) 2023-05-15 12:02:43 -04:00
Jeff Washington (jwash) 376f562d8f
mark_old_slots_as_dirty is a no-op when ancient append vecs are enabled (#31624) 2023-05-15 06:28:06 -07:00
Jeff Washington (jwash) 5cdb5daaad
clean stat updated based on slot instead of contents (#31623) 2023-05-15 06:26:40 -07:00
Jeff Washington (jwash) 13077e0b71
remove an irrelevant ancient stat (#31622) 2023-05-15 06:25:54 -07:00
Ashwin Sekar 3e8f5bad81
refactor: highest_cluster_confirmed_root -> highest_super_majority_root (#31619) 2023-05-14 00:42:03 -07:00
Ashwin Sekar ef75f1cb4e
Add ancestor hashes to state machine (#31627)
* Notify replay of pruned duplicate confirmed slots

* Ingest replay signal and run ancestor hashes for pruned

* Forward PDC to ancestor hashes and ingest pruned dumps from ancestor hashes service

* Add local-cluster test
2023-05-13 02:05:44 -07:00
Brooks 8e5e66fdb4
Revert "Revert "SnapshotPackagerService purges old bank snapshots (#31511)" (#31524)" (#31558)
This reverts commit 775639c058.
2023-05-12 15:39:14 -04:00
Brooks 7dbcf5a0fd
Do not remove bank snapshots in new_from_dir() (#31556) 2023-05-12 13:19:07 -04:00
Andrew Fitzgerald 2c869ef778
QoS refactor: Allow pre-filtering (#31542) 2023-05-12 08:53:22 -07:00
Jeff Washington (jwash) 3e543665c7
remove unused functions connecting hash calc and ancient append vec boundary (#31575)
remove coupling between hash calc and ancient append vec boundary
2023-05-11 13:30:44 -07:00
Jeff Washington (jwash) 122b05b9f5
pass include_slot_in_hash through hash calcs to allow rehashing if hash is not stored (#31579)
* pass include_slot_in_hash through hash calcs to allow rehashing

* tests use each include_slot_in_hash value

* move include_slot_in_hash

* typo

* reorder struct init

* spelling is hard
2023-05-11 13:23:29 -07:00
Jeff Washington (jwash) d9cfb31bba
remove unnecessary struct IndexAccountMapEntry (#31605) 2023-05-11 13:22:03 -07:00
Jeff Washington (jwash) e0b914e775
use highest alive root to determine ancient for packing (#31573) 2023-05-11 12:13:15 -07:00
Jeff Washington (jwash) ea95173b27
remove IndexAccountMapEntry.store_id (#31600)
* remove IndexAccountMapEntry.store_id

* fix empty case that test hit

* store_id checks

* cleanup generate index when slot contains no storage

* remove unwrap
2023-05-11 12:12:41 -07:00
Jeff Washington (jwash) 722921380b
remove unused IndexAccountMapEntry.write_version (#31599) 2023-05-11 09:16:27 -07:00
Tao Zhu 49f44f5ded
Refactor pass feature status to deserialized packet via packet meta (#31549)
Add a flag to packet, set its value by packet_deserializer when received by banking_stage with working_bank
2023-05-11 09:31:05 -05:00
Alexander Meißner bbd8be6cbe
Refactor - Renames loader-v3 to loader-v4. (#31570)
Renames loader-v3 to loader-v4.
2023-05-11 08:29:06 +02:00
Pankaj Garg 04425b81ce
Add stats for LoadedPrograms (#31577) 2023-05-10 12:08:55 -07:00
Jeff Washington (jwash) fed1bb7d54
use max alive root to determine ancient cutoff for clean stats (#31545)
* use max alive root to determine ancient cutoff for clean stats

* fix math and add tests
2023-05-10 08:05:31 -07:00
Alexander Meißner 9e72668a77
Refactor - Simplify built-in program feature transition (#31565)
* Removes builtins::get_builtins(), instead derive them from Bank::builtin_programs.

* Removes BuiltinAction.
Turns BuiltinFeatureTransition from an enum into a struct.

* Makes Bank::remove_builtin() place tombstones.
2023-05-10 16:53:36 +02:00
Pankaj Garg ab89e2cb15
Remove executor cache from the codebase (#31566) 2023-05-10 07:11:04 -07:00
Alexander Meißner 8e9b064ab3
Cleanup - `add_compute_budget_program` and `versioned_tx_message_enabled` (#31560)
* Moves compute_budget_program and address_lookup_table_program into genesis_builtins().

* Removes feature gate of versioned_tx_message_enabled.
2023-05-10 01:14:08 +02:00
Pankaj Garg 2210af60ee
Replace executor cache usage with LoadedPrograms cache (#31462)
* Replace executor cache usage with LoadedPrograms cache

* clippy fixes

* update cache with updated programs

* fixes

* more cleanup

* update tx batch cache with the tx results

* address review comments

* handle program closing backward compatibility

* handle unloaded programs during extraction
2023-05-09 15:44:38 -07:00
Brooks 3bb2e3b546
Purges incomplete snapshot dirs at startup (#31555) 2023-05-09 14:08:12 -04:00
Jeff Washington (jwash) c7867cfa5f
clean stats for ancient aren't based off last hash calc slot (#31546) 2023-05-09 10:08:08 -07:00
Pankaj Garg 3845423e17
Generalize matching criteria for tombstone at boot up (#31547)
Generalize matching criteria for tombstone at bootup
2023-05-09 08:26:42 -07:00
behzad nouri 8e638b785a
removes feature gate code sending votes to tpu-vote-port (#31529) 2023-05-08 18:12:35 +00:00
Jeff Washington (jwash) 8d98589c85
remove unused historical_roots (#31539) 2023-05-08 10:50:27 -07:00
Yueh-Hsuan Chiang 8120d31396
Implementation of the footer for tiered account storage (#31161)
#### Summary of Changes
This PR includes the implementation of the footer for the tiered account storage.

Tiered account storage proposal: #30551
The prototype implementation of the tiered account storage: #30626.
2023-05-07 13:18:10 -07:00
Brooks 775639c058
Revert "SnapshotPackagerService purges old bank snapshots (#31511)" (#31524)
This reverts commit a6c39ded8e.
2023-05-06 09:18:03 -04:00
steviez e62e4fbabd
Replace inc_new_counter_* with datapoint_* in Bank (#31495)
Counters can only report a single field; this adds an extra step to
debugging efforts to figure out the context for where/why the counted
event occurred. Use datapoints instead to subtmit some extra context.
2023-05-05 16:33:35 -05:00
Brooks a6c39ded8e
SnapshotPackagerService purges old bank snapshots (#31511) 2023-05-05 17:22:48 -04:00
Brooks 39a092c3dc
Adds snapshot_utils::purge_bank_snapshot() (#31500)
Co-authored-by: Andrew Fitzgerald <apfitzge@gmail.com>
2023-05-05 14:01:08 -04:00
Brooks c7d922f229
Uses SNAPSHOT_VERSION_FILENAME constant (#31508) 2023-05-05 14:00:08 -04:00
Jeff Washington (jwash) d8664397b6
clarify AccountsIndexScanResult::OnlyKeepInMemoryIfDirty (#31513) 2023-05-05 10:39:32 -07:00
Brooks 1d861ad558
Removes solana_logger from snapshot_utils unit tests (#31510) 2023-05-05 12:52:36 -04:00
Brooks 10b8b32a31
Uses SNAPSHOT_ARCHIVE_DOWNLOAD_DIR constant (#31507) 2023-05-05 12:36:32 -04:00
Brooks ab6094a94f
Uses SNAPSHOT_ACCOUNTS_HARDLINKS constant (#31499) 2023-05-05 12:36:21 -04:00
Brooks 4196dbcbf4
Replaces snapshot_utils::remove_bank_snapshot() (#31498) 2023-05-05 07:43:28 -04:00
Brooks 0e0c91faac
Adds snapshot_utils::purge_bank_snapshot() (#31497) 2023-05-04 19:19:26 -04:00
HaoranYi 0f4293914c
remove unnecessary-struct-initialization (#31486)
* remove unnecessary-struct-initialization

* more  remove unnecessary-struct-initialization

---------

Co-authored-by: haoran <haoran.yi@solana.com>
2023-05-04 17:48:33 -05:00
Pankaj Garg 555520b640
Update SBF programs tests to use bank from the correct slot (#31491) 2023-05-04 13:25:02 -07:00
Alexander Meißner 67939c061e
Feature Gate Update - Requires the owner accounts of programs to be built-ins. (#31488)
Requires the owner accounts of programs to be built-ins.
(owned by the native_loader and have the executable flag set)
2023-05-04 21:03:09 +02:00
Andrew Fitzgerald 18cd4311af
remove counters in hotpath (#31398) 2023-05-04 09:36:28 -07:00
Pankaj Garg 96e170bd37
Do not evict unloaded programs (#31465)
* Do not evict unloaded programs

* cleanup
2023-05-04 07:49:54 -07:00
Brooks 22d4c6abf2
Adds test for SortedStorages::new_with_slots() (#31471) 2023-05-04 06:13:08 -04:00
Jeff Washington (jwash) ddd1f2fce0
remove unnecessary casts (#31461) 2023-05-03 08:54:25 -07:00
Brooks a9515e9269
Inlines AccountsDb::remove_bank_hash_infos() (#31454) 2023-05-03 10:42:16 -04:00
Pankaj Garg ba6f7e80e8
Remove obsolete code for lazily loading programs (#31395) 2023-05-02 14:39:27 -07:00
Alexander Meißner ae75c7cb3f
Refactoring - Remove redundant definition of `BuiltinProgram` (#31429)
* Replaces BuiltinProgram in the program-runtime with the one from solana_rbpf.

* Adjusts the runtimes built-ins to use Arc<LoadedProgram>.

* Adjusts the tests and benchmarks.
2023-05-02 23:01:28 +02:00
Brooks fdf7bdae1a
Fixes name of snapshot_utils::get_bank_snapshot_dir() (#31432) 2023-05-01 19:28:35 +00:00
Xiang Zhu 0a2e897f16
Clean up the outdated SnapshotPackage snapshot_links field (#31360)
* Remove snapshot_links

* Change the function name from snapshot_dir to bank_snapshot_dir

* Format fix

* Fix test_concurrent_snapshot_packaging

* Fix clippy error

* Fix nits

* Fix nits 2nd try

* Use get_bank_snapshots_dir

* Use slot_dir

* Revert "Use get_bank_snapshots_dir" because get_bank_snapshots_dir is private to crate

This reverts commit 1ed9b3b2c8e84689a918beee7159f63c56500a96.
2023-05-01 11:24:59 -07:00
Jeff Washington (jwash) 58ce19446f
replace tuple with `VoteReward` struct (#31408) 2023-05-01 10:42:05 -07:00
Pankaj Garg 8eebf64464
Add a second level cache to contain tx batch specific programs (#31413)
* Add a second level cache to contain tx batch specific programs

* fix clippy

* address review comments
2023-05-01 09:09:43 -07:00
steviez 1a995ade3f
Combine multiple snapshot_utils metrics (#31406)
Within the contents of snapshot_utils::add_bank_snapshot(), metrics were
being reported in several datapoints and counters. This adds extra
overhead, and makes it harder to correlate fields that correspond to the
same snapshot.

So, combine the counters and multiple datapoints into a single
datapoint.
2023-04-30 16:36:08 -04:00
Dmitri Makarov 74bd5f87af
Add minor extensions to Bank API (#31396)
* Make load_program method of Bank public for use in ledger-tool

* Add an accessor method to get a reference to builtin_programs of Bank

* Add a parameter to Bank::load_program to control debugging_features
2023-04-28 19:02:49 -04:00
Xiang Zhu bb95d44328
Check incomplete file flag first (#31409)
* Check incomplete file flag first

* Use the simple is_file call, no need for metadata
2023-04-28 15:44:59 -07:00
Alessandro Decina 117a194b73
Account data direct mapping (#28053)
* AccountSharedData: make data_mut() private

This ensures that the inner Vec is never handed out. This is in
preparation of enforcing that the capacity of the inner vec never
shrinks, which is required for direct mapping.

* Adds the feature bpf_account_data_direct_mapping.

* Remaps EbpfError::AccessViolation into InstructionError::ReadonlyDataModified.

* WIP: Memory regions for each instruction account in create_vm().

* Fix serialization benches, run both copy and !copy variants

* rbpf-cli: fix build

* BorrowedAccount: ensure that account capacity is never reduced

Accounts can be directly mapped in address space. Their capacity can't
be reduced mid transaction as that would create holes in vm address
space that point to invalid host memory.

* bpf_load: run serialization tests for both copy and !copy account data

* bpf_loader: add Serializer::write_account

* fix lints

* BorrowedAccount: make_data_mut is host only

* Fix unused import warning

* Fix lints

* cpi: add explicit direct_mapping arg to update_(callee|caller)_account

* cpi: rename account_data_or_only_realloc_padding to serialized_data

* cpi: add CallerAccount::original_data_len comment

* cpi: add update_callee_account direct_mapping test

* cpi: add test_update_caller_account_data_direct_mapping and fix bug

We used to have a bug in zeroing data when shrinking account, where we zeroed
the spare account capacity but not the realloc padding.

* cpi: add tests for mutated readonly accounts

* cpi: update_caller_account doesn't need to change .serialized_data when direct_mapping is on

* cpi: update_caller_account: ensure that account capacity is always enough

Introduce a better way to ensure that account capacity never goes below what
might be mapped in memory regions.

* cpi: zero account capacity using the newly introduced BorrowedAccount::spare_data_capacity_mut()

Before we were using BorrowedAccount::get_data_mut() to get the base pointer to
the account data, then we were slicing the spare capacity from it. Calling
get_data_mut() doesn't work if an account has been closed tho, since the
current program doesn't own the account anymore and therefore get_data_mut()
errors out.

* bpf_loader: fix same lint for the umpteenth time

* bpf_loader: map AccessViolation to ReadonlyDataModified only for account region violations

* programs/sbf: realloc: add test for large write after realloc

Add a test that after a realloc does a large write that spans the
original account length and the realloc area. This ensures that memory
mapping works correctly across the boundary.

* programs/sbf: run test_program_sbf_realloc with both direct_mapping on and off

By default test banks test with all features on. This ensures we keep
testing the existing code until the new feature is enabled.

* bpf_loader: tweak memcmp syscall

Split the actual memcmp code in a separate function. Remove check
indexing the slices since the slices are guaranteed to have the correct
length by construction.

* bpf_loader: tweak the memset syscall

Use slice::fill, which is effectively memset.

* bpf_loader: syscalls: update mem syscalls to work with non contiguous memory

With direct mapping enabled, accounts can now span multiple memory
regions.

* fix lint, rebase mem_ops

* Implement CoW for writable accounts

* Fix CI

* Move CoW to the MemoryMapping level

* Update after rbpf API change

* Fix merge screwup

* Add create_vm macro. Fix benches.

* cpi: simplify update_caller_account

Simplify the logic to update a caller's memory region when a callee
causes an account data pointer to change (eg during CoW)

* benches/bpf_loader: move serialization out of  create_vm bench

* benches/bpf_loader: don't copy accounts when direct mapping is on

* Fix review nits

* bpf_loader: mem_ops: handle u64 overflow in MemoryChunkIterator::new

When starting at u64::MAX, the chunk iterator would always return the
empty sequence (None on the first next()) call, instead of returning a
memory access violation.

Use checked instead of saturating arithmetic to detect the condition and
error out.

This commit also adds more tests around boundary conditions.

* Fix loader-v3 tests: data_mut => data_as_mut_slice

* Fix CI

* bpf_loader: fix tuner bench: account must be writable

With direct mapping on, invalid writes are caught early meaning the
tuner would fail on the first store and not consume the whole budget
like the benchmark expects.

---------

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
2023-04-29 06:54:39 +10: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
Brooks d621b48026
Cleanup usage of AsRef<Path> in snapshot_utils (#31393) 2023-04-28 14:46:57 +00:00
Pankaj Garg 94dc8fed55
Check program modification slots during cold start (#31331) 2023-04-28 06:22:14 -07:00
Brooks 6393c7d98d
Removes erroneous Copy on AsRef<Path> params in snapshot_utils (#31382) 2023-04-27 22:45:59 -04:00
Xiang Zhu a52f44c342
Use async delete to save time and gracefully handle missing dir (#31380) 2023-04-27 18:13:34 -07:00
Jeff Washington (jwash) 45558f6efe
remove unused metrics (#31377) 2023-04-27 13:26:46 -07:00
Tyera 9af7009bb4
Add new CreateVoteAccount instruction-set builders (#31330)
* Add failing test

* Add config struct for vote-account creation

* Add create-vote-account ix builders that use CreateVoteAccountConfig

* Test now passes; add case to demonstrate failure after activation

* Deprecate existing ix builders

* Use new builders in solana-cli

* Query feature status to use correct VoteState size in solana-cli

* Fix tests and clippy warnings

* Improve ugly conditional block
2023-04-27 11:14:39 -06:00
Alexander Meißner 54f1595dfa
Fix - Filter condition in `filter_executable_program_accounts()` (#31371)
* Removes `!tx.message().is_writable(i)` from the filter condition in `filter_executable_program_accounts()`.

* cargo fmt
2023-04-27 18:38:00 +02:00
Ryo Onodera a30830d7a9
ci: treewide: deny used_underscore_binding (#31319)
* Enforce used_underscore_binding

* Fix all

* Work around for cfg()-ed code...

* ci....

* Make clipply fixes more pleasant

* Clone exit signal while intentionally shadowing

* Use more verbose code to avoid any #[allow(...)]s
2023-04-27 10:10:16 +09:00
Brennan 685ebcb3b0
Rework bank to allow RentCollectionCycleParams private (#31361) 2023-04-26 14:48:51 -07:00
Brennan a540690778
Move partition logic out of bank (#31343)
* Move partition logic out of bank
2023-04-26 12:37:02 -07:00
Xiang Zhu f3e94ca73c
AHV processes the snapshot dirs in place (#30978)
* AHV processes the snapshot dirs in place

Let account pacakge use the snapshot dir, so AHV computes the accounts hash and turns the pre snapshot dir into a post snapshot dir

* fix status cache path to maintain the archive layout for the in-place snapshot dir archiving

* fix test_package_snapshots

* Fix test_concurrent_snapshot_packaging

* Remove debug change.

* Fix snapshot_links path

* change to borrow for bank_snapshots_dir

* Reverted changes in create_and_verify_snapshot

* Fix param errors

* Fix rebase errors

* Remove NOTE 1

* Remove unwrap

* Remove the variables to make it apparent taht snapshot_links is the bank_snapshots_dir

* Use soft link instead of hard link for snapshot and status cache

* After switching to soft symlinking, the src path should be absolute
2023-04-26 11:48:48 -07:00
Jeff Washington (jwash) 6f7429556b
avoid incorrect internal assert in purge_slot_cache_pubkeys (#31344) 2023-04-26 09:09:38 -07:00
Brooks 18aa54a4b6
Removes bank_snapshots_dir param from bank_fields_from_snapshot_archives() (#31349) 2023-04-26 11:45:00 -04:00
Alexander Meißner c05d1d5c51
Refactor - Moves bpf_loader registration into the runtime (#31345)
* Moves the registration of bpf_loader built-ins from the ledger into the runtime.

* Removes bpf_loader built-ins registration in tests and benchmarks.

* Removes declare_builtin!() of bpf_loader built-ins.

* Removes built-ins from the SDK.

* Adjusts tests.
2023-04-26 14:44:19 +02:00
Alexander Meißner 7002c568fb
Cleanup - Removes the CLI option "no-bpf-jit" (#31329)
* Enables JIT everywhere by default.

* Removes the CLI argument "no-bpf-jit" and its plumbering through out the validator code base.

* Removes with_jit bpf_loader variants.

* Removes the to_builtin!() macro.
2023-04-25 19:04:11 +02:00
Xiang Zhu 16f3dcd5d2
Update fn create_and_verify_snapshot (#31245)
* only 1 snapshot per archive in create_and_verify_snapshot

* Update create_and_verify_snapshot with the newer funtion calls

* Fix test_package_snapshots

* Remove account path access change

* Rename slot to num_snapshots

* Remove unncessary purge_old_bank_snapshots in test

* Update non-deterministic format comment

* Cleanup unnecessary hash calls

* Use get_accounts_hash

* Remove extra declaration

* Remove rehash

* Remove clean_accounts

* Revert "Cleanup unnecessary hash calls"

This reverts commit 06b1457462cf6d7acf62e0e5531633caf5d9fc58.

Removing unncessary hash calls should be done for create_and_verify_snapshot,
not bank_to_full_snapshot_archive

* Fix typo appenedvecs

* Remove bank_snapshots_dir after rebasing
2023-04-24 18:52:50 -07:00
Alexander Meißner 4b0e16d06f
Refactor - `BuiltinPrograms` (#31324)
* Moves BuiltinProgram of the program runtime into its own file.

* Unifies the runtimes Builtin and program runtimes BuiltinProgram definitions.

* Moves BuiltinPrograms from bank.rs into the program runtime.
2023-04-24 19:01:40 +02:00
Jeff Washington (jwash) 05391b5244
packed ancient: report random stat (#31274) 2023-04-24 07:40:45 -07:00
Jeff Washington (jwash) 8b30aa187b
ancient packing: leave same append vecs alone (#31295) 2023-04-24 07:40:05 -07:00
Alexander Meißner e5490b8d09
Refactor - Use builtin function interface from rbpf (#31221)
* Removes test_program_entry_debug().

* Uses declare_process_instruction!() in all tests and benchmarks.

* Replaces with ProcessInstructionWithContext with solana_rbpf::BuiltInFunction.
2023-04-21 18:08:32 +02:00
Tao Zhu b4331ae955
use checked arithmetic (#31259)
* use checked arithmetic
* add feature gate; updated tests
* allow collapsible-else-if

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
Co-authored-by: mvines <mvines@gmail.com>
2023-04-20 22:56:08 -05:00
Jeff Washington (jwash) 318f981274
add `is_recyclable` to `AccountsFile` (#31257) 2023-04-19 11:36:44 -07:00
Jeff Washington (jwash) 9124d1f35d
rework assert_no_shrink_in_progress to get assert stack easily (#31251) 2023-04-19 11:36:24 -07:00
Jeff Washington (jwash) 812d899c7f
add lifetimes to refs in ReadableAccount (#31258) 2023-04-19 11:35:59 -07:00
Xiang Zhu a5275f8839
Remove bank_snapshots_dir param (#31249)
* Remove bank_snapshots_dir param

* Remove outdated comment

* Revert "Remove outdated comment"

This reverts commit e4441432bec57edb0dc22c4bacf4d48ce26ed818.

* Handle parent() error

* Fix format error
2023-04-19 09:37:46 -07:00
Brooks ca1bde3591
Use Arc instead of &Arc in AccountsBackgroundService::new (#31268) 2023-04-19 11:10:41 -04:00
Alexander Meißner 8162358b8b
Refactor - Moves the system program into its own crate (#31244)
* Moves the system program into its own crate in "programs/system".

* Moves bank tests back into the runtime to resolve cyclic dependency.
2023-04-19 12:58:08 +02:00
bji a45710838d
Add new vote state version that replaces Lockout with LandedVote to a… (#30831)
Add new vote state version that replaces Lockout with LandedVote to allow vote latency to be tracked in a future change.

Includes a feature to be enabled which will when enabled cause the vote state to be written in the new form.
2023-04-18 20:27:38 -07:00
Trent Nelson f34a6bcfce
runtime: transpose `VoteAccount::vote_state()` return to improve ergonomics (#31256) 2023-04-18 14:48:52 -06:00
Jeff Washington (jwash) ad30a60059
update stats for packed ancient (#31255) 2023-04-18 13:33:02 -07:00
Jeff Washington (jwash) fb4b5c4fb8
add comment (#31252) 2023-04-18 13:13:57 -07:00
Jeff Washington (jwash) 30b62c0e1e
remove unused metrics (#31250)
pack ancient: add test for addref_accounts_failed_to_shrink_ancient
2023-04-18 12:29:37 -07:00
Brennan 2164a50d00
Move BankIncrementalSnapshotPersistence (#31236)
* Move BankIncrementalSnapshotPersistence

* Update bank serialize ABI digest
2023-04-18 11:18:17 -07:00
Brennan f5fe2607b6
Make VerifyAccountsHashConfig private (#31235) 2023-04-18 07:31:23 -07:00
Jeff Washington (jwash) 3cf4ffc88d
pack ancient: add test for addref_accounts_failed_to_shrink_ancient (#31228) 2023-04-17 20:05:59 -07:00
Xiang Zhu e74bc4e2e7
Add a filter_by_type param for purge_old_bank_snapshots (#31191)
* Add a type_select param for purge_old_bank_snapshots

* Use flags to make the function calls more readable

* Remove the extra purge calls

* replace select_type with filter_by_type

* Add test

* Use matches

* Fix CI test on reference

* use match and call do_purge once

* Let bank_snapshots_dir be TempDir

* remove account_paths in the test

* replace bank with _bank

* Remove create_snapshot_dirs_for_tests, will take the lastest from master

* Fix merge errors
2023-04-17 16:16:41 -07:00
Xiang Zhu 667fad6da7
Refactor the common test snapshot dirs creation code (#31223)
* Create fn create_snapshot_dirs_for_tests to refactor the common test snapshot dirs creation code

* Fix trailing space

* Fix missed set_accounts_delta_hash
2023-04-17 14:14:01 -07:00
Jeff Washington (jwash) 3d6d34ebd0
packed ancient: add revisit_accounts_with_many_refs (#31209) 2023-04-17 13:52:26 -07:00
Xiang Zhu f066ea9f71
Define bank_snapshots_dir as tmpdir (#31216)
* Let bank_snapshots_dir be TempDir

* Same change in test_bank_from_latest_snapshot_dir

* Use borrow to avoid releasing the tmp dir

* One more to change to reference
2023-04-17 08:07:24 -07:00
Jeff Washington (jwash) 8fccbadbc3
ancient append vecs: better application of offset (#31208)
* ancient append vecs: better application of offset

* fix subtle bug in get_oldest_slot_within_one_epoch_prior

* add tests
2023-04-17 06:50:32 -07:00
Jeff Washington (jwash) a8134b8e73
packed ancient: addref when pack operation fails (#31211) 2023-04-16 12:24:25 -07:00
Jeff Washington (jwash) 09bcf59003
packed ancient: shrink_collect accounts in parallel (#31212) 2023-04-16 12:23:11 -07:00
Xiang Zhu 5747290d51
Move reference-holding last_snapshot_storages from ABS to AHV (#31175)
* Let AHV hold and update last_snapshot_storages

* Clean up comment

* Move cloning after enqueued_time

* Minor positon change

* Remove  type last_snapshot_storages annotation
2023-04-14 14:38:44 -07:00
Jeff Washington (jwash) c008a557c5
packed ancient: parallel write to append vecs (#31144) 2023-04-14 13:57:46 -07:00
Brennan 93d0d25d77
Move rent debit out of bank (#31204)
* Move rent debit out of bank

* Clean up imports and visibility

* Fix imports

* rename public mod rent_debits
2023-04-14 19:41:10 +00:00
Andrew Fitzgerald 8fe28c3798
RootBankCache: only cache weak reference to avoid keeping a bank alive (#31189) 2023-04-14 11:33:18 -07:00
Alexander Meißner 8eb31f6cfd
Refactor - Syscalls in RBPF CLI (#31109)
* Makes members of SyscallContext public.
Removes check_aligned and check_size from SyscallContext.

* Replaces InvokeContext::set_syscall_context() in tests with mock_create_vm!().

* Passes SyscallContext directly to InvokeContext::set_syscall_context().

* Merges TraceLogStackFrame into SyscallContext.

* Removes the create_vm!() macro.

* Moves BpfAllocator from bpf_loader into program_runtime.

* Frees BpfAllocator from Rc<RefCell<>>.

* Removes unused code from BpfAllocator.

* Consume CUs for heap before doing the allocation.

* Exposes syscalls in rbpf-cli.

* Adds debugging_features parameter to load_program_from_bytes() and load_program_from_account().

* Removes test_bpf_loader_non_terminating_program() as that is already tested in RBPF.

* Moves stack and heap allocation back onto the program runtime stack.
2023-04-14 15:20:08 +02:00
Brooks d43e19bb03
Refactors the Full/Incremental SnapshotHash types (#31186) 2023-04-13 18:01:27 -04:00
Xiang Zhu 9f53c42339
bank_from_latest_snapshot_dir (#31115)
* bank_from_latest_snapshot_dir

* Clear the account paths before constructing a bank from a snapshot dir

* Clear the account paths before constructing a bank from a snapshot dir (#31170)

* use the highest POST snapshot dir to construct a bank

* Use POST to fix test_bank_from_latest_snapshot_dir

* Revert "Clear the account paths before constructing a bank from a snapshot dir"

This reverts commit 272bb9fee14a09d7fde3cddb3d439f2cdadb5493.

* Remove the set_accounts_hash_for_tests call

* Revert "Revert "Clear the account paths before constructing a bank from a snapshot dir""

This reverts commit 2e345d8b98b8fb3b07f00ce050132c678acf88d4.
2023-04-13 12:44:56 -07:00
Brooks 1f67591e21
Removes `base` from `IncrementalSnapshotHash` (#31185) 2023-04-13 17:35:35 +00:00
Xiang Zhu 78d061a3d3
Clear the account paths before constructing a bank from a snapshot dir (#31170) 2023-04-12 16:03:19 -07:00
HaoranYi 1db0683a50
Refactor reward payout code - part 4 (#31159)
extract redeem_reward fn
2023-04-12 10:20:21 -05:00
HaoranYi f2e3a0d821
Refactor reward payout code - part 3 (#31157)
extract calculate points fn
2023-04-12 09:36:23 -05:00
HaoranYi 9e14cdc19f
Refactor reward payout code - part 2 (#31156)
* extract load_vote_stake_accounts fn

* rename
2023-04-12 08:40:08 -05:00
Xiang Zhu 31784b2ecc
Add remove_incomplete_bank_snapshot_dir (#31131)
* Add remove_incomplete_bank_snapshot_dir

* Remove incomplete snapshot dir if incomplete

* Revert "Add remove_incomplete_bank_snapshot_dir"

This reverts commit aaafef74803ca4e2050b8cd83ef352c5a59509b4.

* Replace metadata's is_file with simple PathBuf's is_file

* In test verify the deletion of the incomplete snapshot dir

* Add comments to explain the snapshot dir cleanup
2023-04-11 17:56:26 -07:00
HaoranYi 20d1615ccd
Refactor reward payout code - part 1 (#31155)
type alias
2023-04-11 16:23:52 -05:00
Tao Zhu 5816d33b57
Add test for transaction has too high prioritization fee (#31097)
* Add test for transaction has too high prioritization fee than payer account balance
2023-04-11 16:22:19 -05:00
Pankaj Garg 12e3e8b467
Add provisions to unload a program from the cache (#31036) 2023-04-10 16:42:05 -07:00
HaoranYi e12c250cf5
Extract new_epoch processing out of new_bank (#31127)
* extract new epoch processing out of new_bank

* review feedbacks

* remove epoch_schedule param

* use RewardCalcTracer
2023-04-10 16:10:45 -05:00
Jeff Washington (jwash) d63359a3ff
disk index: batch insert (#31094) 2023-04-10 11:08:54 -07:00
Andrew Fitzgerald 15011eaa5a
separate check_transaction_age from check_age (#30994) 2023-04-07 09:04:03 -07:00
Alexander Meißner 0cd57addcf
Cleanup - mock_process_instruction() (#31088)
* Uses declare_process_instruction!() in all tests.

* Adds post_adjustments to mock_process_instruction().
Removes "solana_sbf_rust_external_spend" from assert_instruction_count() as it panics.
2023-04-07 12:53:19 +02:00
Jeff Washington (jwash) 6dc18fe241
fix cli arg for ancient append vecs (#31066) 2023-04-06 12:03:31 -07:00
HaoranYi 684901879d
Refactor squash timing report (#31041)
* typo

* refactor squash timing report

* address review comments
2023-04-05 08:53:49 -05:00
Alexander Meißner 24a87f33a8
Refactor - Cleanup error handling in program runtime (#30693)
* Moves stable_log::program_invoke(), stable_log::program_success() and stable_log::program_failure() calls from bpf_loader into InvokeContext::process_executable_chain().

* Turns result of ProcessInstructionWithContext from InstructionError into Box<dyn std::error::Error>.

* Bump to solana_rbpf v0.3.0

* Removes Result from return type of EbpfVm::new().

* Turns EbpfError into Box<dyn std::error::Error>.

* Removes BpfError.

* Removes SyscallError::InstructionError.

* Adds a type alias for Box<dyn std::error::Error> in syscalls.
2023-04-05 15:50:34 +02:00
Xiang Zhu fac76715e9
bank_from_snapshot_dir returns BankFromDirTimings (#31051) 2023-04-04 17:10:56 -07:00
Jeff Washington (jwash) aa3e0b9c20
disk index: add stat: disk_index_failed_resizes (#31039) 2023-04-04 09:39:06 -07:00
Jeff Washington (jwash) bc343a431c
disk index: set_anticipated_count to optimally grow disk buckets at startup (#31033)
* disk index: set_anticipated_count to optimally grow disk buckets at startup

* remove atomic
2023-04-03 20:28:50 -07:00
Alexander Meißner a0c7fde90e
Cleanup - mock InvokeContext (#31007)
* Turns with_mock_invoke_context() into a macro.

* Removes prepare_mock_invoke_context().

* Replaces InvokeContext::new_mock() with with_mock_invoke_context().

* Removes InvokeContext::new_mock().

* Removes Cow from InvokeContext::sysvar_cache.

* Removes override parameters from mock_process_instruction().

* cargo fmt
2023-04-03 17:23:24 +02:00
Jeff Washington (jwash) 07f4789257
fix assert (#31012) 2023-04-03 06:40:54 -07:00
Jeff Washington (jwash) 9600643860
reduce contention on startup index generation (#31006) 2023-03-31 12:46:42 -07:00
Pankaj Garg bc44ac73db
Return error early if program is a tombstone (#30940) 2023-03-30 11:16:01 -07:00
steviez cc8e531a5d
Enforce a minimum of 1 on full and incremental snapshot retention (#30968) 2023-03-30 10:16:36 -05:00
blackghost1987 9f9d6f8a89
Relax `Sized` bound for `Signers` in `Transaction` and `Client` (#30568)
* relax Sized bound for Signers in Transaction and Client

* also relax Sized bounds in client, runtime, thin-client and tpu-client

* add tests for using non-sized transaction signers

* fix macro for thin_client vs ?Sized

* move tests to transactions, add Sized relaxation to mut macro

* fix clippy warning

* get rid of unnecessary imports
2023-03-30 13:12:48 +00:00
Jeff Washington (jwash) d542496d10
fix typo in info log (#30964)
fix typo
2023-03-29 13:23:06 -07:00
Alexander Meißner a6ad37f3ad
Cleanup - `load_and_get_programs_from_cache()` (#30959)
* Replaces assign_program() by replenish() in load_and_get_programs_from_cache().

* Replaces LoadedProgramEntry by a boolean.

* Only lock the global cache once all missing programs have been loaded

* Factors out call of self.rc.accounts.filter_executable_program_accounts().
2023-03-29 16:11:14 +02:00
steviez 4bd7de4887
Update comments around snapshot retention policy unit tests (#30955) 2023-03-29 08:55:05 -05:00
Jeff Washington (jwash) 823d55ea9f
disk index find_entry -> find_index_entry (#30941) 2023-03-29 06:54:03 -07:00
Brooks 1f420f2b03
Moves shrink after flush and clean (#30918) 2023-03-28 16:11:56 -04:00
Pankaj Garg 035c974a8c
Remove redundant check during loading upgradeable program for writing (#30561)
* Remove redundant check during loading upgradeable program

* Apply clippy suggestion
2023-03-28 11:50:49 -07:00
Pankaj Garg aebc191c38
Stop loading program accounts if program exists in cache (#30703)
* Stop loading program accounts if program exists in cache

* load accounts for upgradeable programs

* revert loader change to conditionally use program data account

* load instruction accounts

* generate TransactionExecutorCache from loaded programs

* cleanup account_found_and_dep_index variable

* address review comments

* handle tombstones in loader

* unify tombstone constructor

* handle multiple tombstones
2023-03-28 11:49:56 -07:00
Brooks e7887cfb06
RootBankCache must use Acquire-Release semantics when accessing BankForks::root (#30936) 2023-03-28 14:35:02 -04:00
Jeff Washington (jwash) aaac046b6b
flush individual buckets every n ages (#30855)
disk index flush individual buckets every n ages
2023-03-28 09:26:34 -07:00
Brooks d7ae05c3fd
Unifies logging of start/stop for background services (#30916) 2023-03-28 08:32:18 -04:00
Xiang Zhu bf986d64f8
Add more explict error messages for hardlink operations (#30913) 2023-03-27 19:55:10 -07:00
Pankaj Garg 0df28f6d51
Increment usage count for loaded programs and call eviction (#30900) 2023-03-27 06:48:05 -07:00
Andrew Fitzgerald 2a05b25732
Standardize Thread Naming - Prioritization Fee Cache (#30890)
Thread naming in accordance with #27237
2023-03-24 13:48:55 -07:00
Andrew Fitzgerald f226a34f48
Only need bank reference for update (#30879) 2023-03-24 09:48:04 -07:00
Tao Zhu 3e500d9e92
Feature gate builtin consumes static units during processing instruction (#30702)
* add feature gate
* builtins consume statically defined units at beginning of process_instruction()
* Add new instructionError; return error if builtin did not consume units to enforce builtin to consume units;
* updated related tests
* updated ProgramTest with deactivated native_programs_consume_cu feature to continue support existing mock/test programs that do not consume units
2023-03-24 11:31:01 -05:00
Jeff Washington (jwash) 3ebfda5aef
add stat for disk buckets flushed (#30850) 2023-03-22 15:04:17 -07:00
Xiang Zhu d69f60229d
Construct bank from snapshot dir (#30171)
* Construct a bank from a snapshot directory

* Clean up.  Remove archiving releated data structures

* Fix auto checks

* remove ArchiveFormat::None

* fix merge error

* remove incremental snapshot dir

* Minor cleanup, remove unused functiond defs

* remove pub fn bank_from_latest_snapshot_dir

* rename bank_from_snapshot_dir to bank_from_snapshot

* Clean up invalid comments

* A few minor review changes

* Removed insert_slot_storage_file

* Add comment explain hardlink symlink

* Skip the whole verify_snapshot_bank call for the from_dir case

* Add bank.set_initial_accounts_hash_verification_completed()

* address review issues: appendvec to append_vec, replace unwrap with expect, etc

* AtomicAppendVecId, remove arc on bank etc

* slice, CI error on &snapshot_version_path

* measure_build_storage

* move snapshot_from

* remove measure_name from build_storage_from_snapshot_dir

* remove from_dir specific next_append_vec_id logic

* revert insert_slot_storage_file change

* init next_append_vec_id to fix the substraction underflow

* remove measure from build_storage_from_snapshot_dir

* make measure name more specific

* refactor status_cache deserialization into a function

* remove reference to pass the ci check

* track next appendvec id

* verify that the next_append_vec_id tracking is correct

* clean up usize

* in build_storage_from_snapshot_dir remove expect

* test max appendvecc id tracking with multiple banks in the test

* cleared expect and unwrap in streaming_snapshot_dir_files

* rebase cleanup

* change to measure!

* dereference arc in the right way
2023-03-22 13:49:23 -07:00
Jeff Washington (jwash) 9a1d5ea95d
at startup, keep duplicates in in-memory index since they will be cleaned shortly (#30736)
at startup, keep duplicates in in-memory index since they will be cleaned soon
2023-03-22 08:33:39 -07:00
Brooks 35437b8dad
Makes AccountsHashVerifier aware of Incremental Accounts Hash (#30820) 2023-03-22 10:20:16 -04:00
Tao Zhu 21c287a64f
include loaded accounts data size limit in transaction fee calculation (#30659)
* include loaded accounts data size limit in transaction base fee calculation
* citing compute_budget for heap cost;
* update sbf tests

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
2023-03-21 18:41:41 -05:00
HaoranYi d646820a6e
Do not log detailed epoch stakes (#30825)
* do not log detailed epoch stakes

* allow dead code

* log stake details at trace level

* no need dead_code

* Update runtime/src/bank.rs

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

---------

Co-authored-by: Brooks <brooks@prumo.org>
2023-03-21 14:43:06 -05:00
Jeff Washington (jwash) 2216647f7e
better duplicate key stats during index generation (#30829) 2023-03-21 12:02:23 -07:00
Brooks b64d0de771
Makes snapshot_utils aware of Incremental Accounts Hash (#30804) 2023-03-21 16:34:30 +00:00
HaoranYi 6a6d5ee498
typo (#30824) 2023-03-21 11:19:16 -05:00
Brooks 836494fc5f
Cleans *up to* the last full snapshot slot in verify_snapshot_bank() (#30818)
Cleans up to the last full snapshot slot in verify_snapshot_bank()
2023-03-21 15:49:49 +00:00
Brooks e5edcb9c48
Sets IncrementalAccountsHash in serde_snapshot when reconstructing AccountsDb (#30801) 2023-03-21 10:51:04 -04:00
Jeff Washington (jwash) ce0e23fbab
accounts index does not randomly flush dirty entries (#30783) 2023-03-20 12:23:30 -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
HaoranYi f42f61804f
typos (#30797) 2023-03-20 10:47:15 -05:00
Jeff Washington (jwash) df2c95119c
add buckets stats for # files and total file size (#30780)
* add buckets stats for # files and total file size

* change metrics to bytes

* get index file size correct
2023-03-20 08:22:31 -07:00
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