Commit Graph

4147 Commits

Author SHA1 Message Date
Jeff Washington (jwash) 4ebec905c5
add hash_rewards_into_partitions (#31795)
* add sort_and_shuffle_partitioned_rewards

* break stake accounts into partitions by hashing

* fmt

* Update runtime/src/epoch_rewards_hasher.rs

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

* Update runtime/src/bank/tests.rs

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

* Update runtime/src/bank/tests.rs

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

* Update runtime/src/bank.rs

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

* fix build

* more build fixes

* use spihasher13 for reward partition

* update comments

* revert calc reward struct change to avoid abi changes for now

* cippy

* sort deps

* saturating math

* use copy traits on hasher
use parent block hash to seed rewards partition

* fmt

* use concurrent map to speed up reward partition

* clippy

* Update runtime/src/epoch_rewards_hasher.rs

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

* Update runtime/Cargo.toml

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

* Update runtime/src/bank.rs

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

* rename

* address review comments

* cargo.lock

* Update runtime/src/bank.rs

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

* update test

* clippy

* comments

* move hash_address_to_partition to epoch_rewards_hasher.rs

* tests to nail down width of partitions

* rename parameter to match with comments

* hash_address takes &self

* clippy

* EpochRewardHasher -> EpochRewardsHasher

* revert "hash_address takes &self" and refactor

* stake_rewards takes by value

---------

Co-authored-by: HaoranYi <haoran.yi@gmail.com>
Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-09 11:55:01 -07:00
Jeff Washington (jwash) 14e90cb27d
test ancient packing with recycling (#32021)
* test ancient packing with recycling

* fix holdover from debugging and update comment
2023-06-09 10:38:34 -07:00
Andrew Fitzgerald 4a566ec938
create and canonicalize account_paths (#32037)
Co-authored-by: Brooks <brooks@prumo.org>
2023-06-09 10:04:25 -07:00
Brooks 948b66ee95
Removes #[allow(dead_code)] from ancient_append_vecs.rs (#32047) 2023-06-09 16:47:24 +00:00
Jeff Washington (jwash) 4fde0b0d4a
remove packed ancient append vec from shrink candidate list (#32022) 2023-06-09 09:28:49 -07:00
Jeff Washington (jwash) 31f2f569a6
simplify clean_dead_slot, factor out root stats (#32035) 2023-06-09 07:35:38 -07:00
Brooks afbb0fa92f
Removes init-time cleanup in add_bank_snapshot() (#31997) 2023-06-09 08:30:35 -04:00
Andrew Fitzgerald bfe171017c
move cost model tests (#32034) 2023-06-08 15:02:28 -07:00
Yueh-Hsuan Chiang 7cea6dd57c
[TieredStorage] ByteBlockWriter::write_optional_fields (#32025)
#### Summary of Changes
This PR implements the writer function for AccountMetaOptionalFields
in ByteBlockWriter::write_optional_fields().

#### Test Plan
Unit tests are included in this PR.
Tested in mnb w/ the prototype implementation of the tiered storage (#30626)
2023-06-08 14:09:01 -07:00
Yueh-Hsuan Chiang 634f925d75
[TieredStorage] AccountMetaOptionalFields (#32005)
#### Summary of Changes
This PR introduces AccountMetaOptionalFields, the in-memory struct for
handling optional fields.

#### Test Plan
Unit tests are included in this PR.
Tested in mnb w/ the prototype implementation of the tiered storage (#30626).
2023-06-08 12:31:27 -07:00
Andrew Fitzgerald 3ba05d9c3d
Fix move_and_async_delete_path (#32020) 2023-06-08 10:55:52 -07:00
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