Commit Graph

4374 Commits

Author SHA1 Message Date
Pankaj Garg aba637d5d9
Split snapshot_utils.rs into snapshot_bank_utils.rs (#32612) 2023-07-24 16:31:03 -07:00
Brooks de4ff348b4
Removes manual call to `.0.display()` with thiserror (#32605) 2023-07-24 12:02:55 -04:00
HaoranYi 17af3ab10a
Add stake_flags to stake state (#32524)
add stake_flags to stake state

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-24 09:09:40 -05:00
Tao Zhu 62b9fcfa76
cleanup feature: Use default units per instruction in fee calculation (#32570)
* cleanup feature: Use default units per instruction in fee calculation
2023-07-21 18:37:58 -05:00
Pankaj Garg fc35b13365
Cleanup load_program() in bank.rs (#32146) 2023-07-21 13:43:46 -07:00
behzad nouri 952d8861c6
removes feature-gate code for updating rewards from cached accounts (#32514) 2023-07-21 19:52:44 +00:00
HaoranYi 9e8639f7ae
Add distributed rewards for the block in partitioned reward metrics (#32580)
report distributed rewards for the block in metrics

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-21 14:42:52 -05:00
Pankaj Garg faff34403c
Move bank dependent tests out of serde_snapshot/tests.rs (#32571) 2023-07-21 12:08:32 -07:00
Tao Zhu 19f5b49abb
Priority queue supports deprecated compute budget ix (#32567)
Supports deprecated compute budget instruction when getting transaction's priority details
2023-07-20 19:17:56 -05:00
Brooks faa002c2b6
Adds error types for all of `add_bank_snapshot()` (#32564) 2023-07-20 18:30:19 -04:00
Brooks 979913e1d5
Returns Self instead of Result<Self> for AccountsPackage::new_for_snapshot() (#32545) 2023-07-20 12:52:31 -04:00
Brooks 3fbfac41da
AccountsBackgroundService gracefully exits when snapshot request handling errors (#32543) 2023-07-20 11:53:06 -04:00
Jeff Washington (jwash) 0f70098410
allow shrinking to be in progress during `scan_account_storage` (#32553) 2023-07-20 08:01:10 -07:00
Brooks 6d30429dd1
Replaces `unwrap` with `?` when writing snapshot version file (#32542) 2023-07-19 16:42:46 -04:00
behzad nouri a8b0c92873
simplifies update_stakes_cache implementation (#32534) 2023-07-19 18:13:30 +00:00
HaoranYi 5408872476
test force reward interval end fn (#32513)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-17 15:37:10 -05:00
Yueh-Hsuan Chiang a2d9870678
[TieredStorage] Implementation of AccountIndexFormat for hot accounts (#32497)
#### Summary of Changes
This PR implements AccountIndexFormat::AddressAndOffset, the index format
that will be used by the hot account storage.

#### Test Plan
Unit tests are included in this PR.
Tested via the prototype implementation of tiered-storage.
2023-07-16 07:23:08 +08:00
Pankaj Garg 2a86420777
Move calculate_fee() out of bank.rs (#32409)
* Move calculate_fee() to fee.rs

* fixup code for compilation
2023-07-14 20:17:38 -07:00
behzad nouri cfb028819a
deprecates Signature::new in favor of Signature::{try_,}from (#32481) 2023-07-14 22:51:12 +00:00
Brooks 78230050fb
Fixes measure in log when calculating accounts hash (#32502) 2023-07-14 17:02:14 -04:00
Pankaj Garg 7177dd9809
Remove calculate_fee()'s dependency on ComputeBudget (#32487) 2023-07-14 12:25:04 -07:00
Pankaj Garg eb74562124
Move methods to get num signatures and locks to SanitizedMessage (#32489) 2023-07-14 10:59:55 -07:00
Yueh-Hsuan Chiang e6d1217dc3
[TieredStorage] Replace 'a by 'accounts_file in TieredReadableAccount (#32470)
#### Summary of Changes
This PR replaces the struct life-time parameter `'a` to `'accounts_file` in
TieredReadableAccount to improve readability.
2023-07-14 14:35:05 +08:00
Brooks 3b0e4c8452
Removes unnecessary default() (#32477) 2023-07-13 13:59:57 -04:00
Brooks 3c825f28a5
Uses next_back() (#32478) 2023-07-13 13:38:18 -04:00
Jeff Washington (jwash) 09ddbd731c
correctly log stats at remove_unrooted_slots (#32467) 2023-07-13 06:55:35 -07:00
Ryo Onodera d80745cfaf
dcou: BorrowedAccount::set_data() (#32424)
* dcou: BorrowedAccount::set_data()

* Properly depend on dev-context-only-utils
2023-07-13 22:44:08 +09:00
Brooks b99ff04b7b
Removes default impls on TieredAccountMeta (#32464)
#### Problem

`TieredAccountMeta` has default impls on many of its methods. But I don't think it should, because these defaults are not actually useful defaults (i.e. they are `unimplemented!()`).

We're only going to have a small number of structs that'll implement this trait, and each struct should be responsible for picking the correct impl for each method. 

Currently, `HotAccountMeta` is the only one, and it implements every method.

#### Summary of Changes

Remove default impls on TieredAccountMeta
2023-07-13 13:45:19 +08:00
HaoranYi ae6abda786
Remove unnecessary dead_code attributes (#32416)
* remove unnecessary dead_code attr

* move test fn to test files

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-12 18:41:17 -05:00
Justin Starry d344ae5297
feature flag cleanup: fix_recent_blockhashes (#32443)
* feature flag cleanup: fix_recent_blockhashes

* flip test logic
2023-07-11 20:43:50 -05:00
Jeff Washington (jwash) 245cd9631a
hook up ancient.slots_considered metric (#32458) 2023-07-11 11:51:16 -07:00
HaoranYi 466564686b
update epoch rewards sysvar (#32415)
* update epoch rewards sysvar

* add back the one reward distribution reward test

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-11 11:24:20 -05:00
HaoranYi 943fba5afd
update max reward block factor (#32445)
* update max reward block factor

* review comments

* more tests

* reduce the number of stakes per block to speed up tests

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-11 09:36:11 -05:00
HaoranYi 2ed30793cc
add PartitionedEpochRewardsConfigRewardBlock (#32444)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-10 17:04:40 -05:00
Yueh-Hsuan Chiang a58b84ce95
[TieredStorage] TieredReadableAccount::data() (#32433)
#### Problem
While TieredReadableAccount implements ReadableAccount that
already includes `fn data(&self) -> &'a [u8]`, a `data()` function that
directly under TieredReadableAccount is still needed in order to
correctly link the lifetime of the returned value and its member
account_block.  Otherwise, cargo will complain lifetime may not
live long enough.

#### Summary of Changes
This PR adds TieredReadableAccount::data() that directly links the lifetime
of its account_block to the returned value.
2023-07-11 00:33:36 +08:00
Brooks 65e90ab0bc
Uses `'storage` for lifetime in StoredAccountMeta (#32440) 2023-07-10 10:57:20 -04:00
behzad nouri d54b6204be
removes instances of clippy::manual_let_else (#32417) 2023-07-09 21:41:36 +00:00
HaoranYi a3171d3de2
Fix typos (#32420)
* typo

* more typos

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-07 21:05:32 +00:00
HaoranYi 37a36384f3
Test stake program execution restricted in reward period (#32404)
test stake program execution restricted in reward period

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-07 10:24:49 -05:00
Illia Bobyr 282e043177
`cargo fmt` using 1.6.0-nightly (#32390)
Seems like rustfmt 1.6.0 can now format `let/else` statements.
1.5.2 we use in our `solana-nightly` does not mind the reformatting.

```
$ cargo +nightly fmt --version
rustfmt 1.6.0-nightly (f20afcc 2023-07-04)

$ cargo +nightly fmt
$ git add -u
$ git commit

$ ./cargo nightly fmt --version
+ exec cargo +nightly-2023-04-19 fmt --version
rustfmt 1.5.2-nightly (c609da5 2023-04-18)

$ ./cargo nightly fmt
$ git diff
[empty output]
```
2023-07-06 20:45:29 -07:00
HaoranYi 8273b103d2
Test rewards compuation and partitioned rewards distribution at the epoch boundary (#32349)
* Test rewards compuation and partitioned rewards distribution at the epoch boundary

* reviews

* match to if

* clippy

* peeling of bank1 from the loop

* collapse if_same

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-07-06 14:49:09 -05:00
Pankaj Garg 4674b0099f
Move CostModel and CostTracker to its own crate (#32354)
* Move CostModel and CostTracker to its own crate

* compile new crate and update imports

* update sbf Cargo.lock

* fix AbiExample

* fix cargo sort

* Fix AbiExample
2023-07-06 10:08:18 -07:00
Pankaj Garg b060f62004
Move transaction results data structures out of bank.rs (#32386)
* Move transaction results data structures out of bank.rs

* Fix CI check failures
2023-07-06 09:45:01 -07: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 f1836bb10f
[TieredAccountStorage] TieredReadableAccount (#32380)
#### Summary of Changes
This PR introduces TieredReadableAccount, a struct that takes a generic
TieredAccountMeta that implements ReadableAccount and support
StoredAccountMeta.

#### Test Plan
More tests will be added once more reader and writer functions for hot
accounts have been added.
2023-07-07 00:08:09 +08:00
Brooks d08ce116b3
Measures accounts hash calculation time (#32385) 2023-07-05 15:53:36 -04:00
Brooks f1f0f451b7
Adds cache_hash_data_us to HashStats (#32371) 2023-07-05 13:57:07 -04:00
Pankaj Garg 356a827087
Move NonceInfo, NonceFull and NoncePartial out of bank.rs (#32375)
* Move NonceInfo, NonceFull and NoncePartial out of bank.rs

* fix imports

* move test_nonce_info to nonce_info.rs
2023-07-05 10:44:54 -07:00
Brooks c80981070c
Adds mark_time and sort_time to HashStats total_time (#32370) 2023-07-05 12:26:31 -04:00
Brooks 52fe7eb1cf
Renames HashStats "sort" to "sort_us" (#32369) 2023-07-05 09:35:44 -04:00
Yueh-Hsuan Chiang 806d79a643
[TieredStorage] Improve TieredAccountMeta API's readability (#32338)
#### Problem
In TieredAccountMeta, it uses `data` and `account_data` to refer to
the data associated with the account, and this could be confusing.

#### Summary of Changes
This PR makes TieredAccountMeta only use `account_data` to refer
to the data associated with the account.
2023-07-01 01:55:13 +08:00
HaoranYi 9b405b21ff
Test `EpochRewards` sysvar creation, distribution, and burning. (#32339)
* Test `EpochRewards` sysvar creation, distribution, and burning.

* Update runtime/src/bank/tests.rs

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

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
Co-authored-by: Brooks <brooks@prumo.org>
2023-06-30 10:46:31 -05:00
HaoranYi fccc1c75f3
test partitioned reward history update from rewards slice (#32334)
Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-30 09:44:20 -05:00
Yueh-Hsuan Chiang 2850432b57
[TieredStorage] Make data_size related APIs cleaner (#32317)
#### Problem
Function data_size_for_shared_block() is designed to provide
the data_size when its account shares its account block with
other accounts.  However, TieredAccountMeta already has another
function for returning data size.

#### Summary of Changes
This PR removes data_size_for_shared_block() from TieredAccountMeta.
Will follow-up with another PR that includes a better API.
2023-06-30 02:44:57 +08:00
Brooks d62f5ba37b
Removes unnecessary casts calling datapoint! (#32333) 2023-06-29 14:43:07 +00:00
HaoranYi 801bc2c814
Add test for partitioned epoch rewards store (#32319)
add tests for partitioned epoch rewards store

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-29 08:57:03 -05:00
Ryo Onodera 5b6c3ba81b
Make prepare_simulation_batch() more usable (#32304)
* Make prepare_simulation_batch() more usable

* Rename

* Use `use`
2023-06-29 11:20:42 +09:00
Yueh-Hsuan Chiang 9c9db4a461
[TieredAccountStorage] getter functions for HotAccountMeta (#32296)
#### Summary of Changes
This PR implements HotAccountMeta's getter functions for accessing
optional fields (e.g. rent_epoch, account_hash, etc) and account data.

#### Test Plan
A new unit test is included in this PR.
2023-06-29 04:17:57 +08:00
HaoranYi 05ba9d58fb
Add test for partition out of range (#32312)
add test for partition out of range

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-28 14:58:37 -05:00
Yueh-Hsuan Chiang 5e830d2692
[TieredAccountStorage] functions for obtaining optional fields offsets (#32311)
#### Summary of Changes
This PR adds several functions to AccountMetaOptionalFields
for obtaining the offset of each optional field.

#### Test Plan
New unit test cases are included in this PR.
2023-06-29 01:30:37 +08:00
Brooks 794f3849a4
Standardizes datapoints in AccountsBackgroundService's StatsManager (#32310) 2023-06-28 13:00:46 -04:00
Yueh-Hsuan Chiang 4cfdb374ae
[TieredStorage] byte_block::read_type (#32295)
#### Summary of Changes
This PR adds byte_block::read_type(), an util function that
reads the raw part of the input byte block at the specified offset
as type T.  This function will be later used by the hot storage.

#### Test Plan
Modified existing unit tests to use byte_block::read_type()
when the input byte block is properly aligned.
2023-06-28 12:33:29 +08:00
Brooks 9fb105c801
Cleanup impl for remove_tmp_snapshot_archives() (#32297) 2023-06-27 15:51:28 -04:00
Brooks 13aff74f82
Cleanup filesystem error handling in snapshot_utils (#32286) 2023-06-27 13:08:47 -04:00
Wen 6f72258e3e
Vote refresh fix when outside slothash (#29948)
* When there are too many pubkeys in one slot, kick the one with lowest
stake out.

* Cache last_root to reduce read locks we need.

* Use slots_in_epoch to limit number of slots in the map.

* Fix lint errors.

* Only cache stake and slots per epoch once per epoch.

* Revert "Only cache stake and slots per epoch once per epoch."

This reverts commit 8658aad0083456794b4c4403adaf9c74d1a71d09.

* Vote at the tip of current fork if last vote is outside SlotHash
of the tip and last vote expired.

* Add unittest when last vote is outside slothash, we should vote at the tip
of the current fork.

* Revert "Use slots_in_epoch to limit number of slots in the map."

This reverts commit 93574f57a48d2a70fbbc0f62fa8810d3b6bee0af.

* Revert "Cache last_root to reduce read locks we need."

This reverts commit bb114ec2b62cb9c0207328b19c415f6116be0f1c.

* Revert "When there are too many pubkeys in one slot, kick the one with lowest"

This reverts commit 711e29a6a025fd4f11fbc97dcbbe90e4832be04c.

* Move new vote generation when last vote is outside slothash into the
main path, this actually makes more sense since we don't select where
to vote in two different places, and all the vote generation logic
is seamlessly inherited.

* - Move vote refresh to be behind select vote and do not refresh vote if a new
  vote is selected.
- Check whether last vote is inside slothash inside select_vote_and_reset_forks
- rename slot_within_slothash to is_in_slothashes_history
- remove one unittest for now, more tests will be added in a separate CL

* Remove new test, it will be in another file.

* Add is_in_slot_hashes_history test in the new file.

* Add unittest for the case when last vote is outside slot hashes.

* Small improvements and more unittests.

* Fix bad merge.

* Update docs/src/terminology.md

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

* Put SwitchForkDecision::FailedSwitchThreshold logic into separate function.

* Make linter happy.

---------

Co-authored-by: mvines <mvines@gmail.com>
2023-06-26 18:21:24 -07:00
Brooks 4547549a73
Uses fs_err instead of SnapshotError::IoWithSourceAndFile (#32267) 2023-06-26 17:10:21 -04:00
Yueh-Hsuan Chiang 1b2b825c1f
[TieredStorage] getter functions for TieredAccountMeta trait (#32276)
#### Summary of Changes
This PR adds getter functions to the TieredAccountMeta for accessing
optional fields and account data.

#### Test Plan
This PR only adds methods to a trait.  More tests will be included in the
follow-up PRs.
2023-06-27 03:01:06 +08:00
steviez 77b587aa4d
Add constant for disabled snapshot interval (#32236)
Slot::MAX was used to specify that a type of snapshots should not be
created; define a constant to be that value and reference the constant
to have a single point of edit.
2023-06-26 12:26:56 -05:00
Brooks 95fae285a4
Introduces fs_err to snapshot_utils (#32266) 2023-06-26 13:14:27 -04:00
Brooks 394fc9b8fc
Adds "archive" to log when loading snapshot archives (#32278) 2023-06-26 12:32:28 -04:00
Brooks 814ea7ae9f
Removes file permission twiddling in snapshot test (#32277) 2023-06-26 12:17:14 -04:00
Brooks 644cdaaa48
Adds comments in BankSnapshotInfo::new_from_dir() when selecting Pre or Post (#32261) 2023-06-26 11:53:25 -04:00
Brooks 4fb6bbf92e
Refactors datapoints and logs in bank_from_xxx fns (#32255) 2023-06-26 11:33:58 -04:00
Pankaj Garg 089fb464a9
Move message_processor to program-runtime (#32268) 2023-06-24 15:55:39 -07:00
Tyera 02eaaae513
Clean up credits_auto_rewind feature (#32211)
* Remove credits_auto_rewind feature logic from stake program

* Obey clean-up orders

* Clippy prefers this match

* Remove credits_auto_rewind feature helpers from Bank

* Comment nit for language, and shrink to fit on one line
2023-06-24 10:26:27 -06:00
Pankaj Garg 0b8af56924
Remove message_processor dependency on solana_runtime (#32256) 2023-06-24 07:55:32 -07:00
Yueh-Hsuan Chiang 9a620b4862
[TieredStorage] HotAccountMeta (2/N) (#32227)
#### Summary of Changes
This PR introduces HotAccountMeta, the storage and in-memory struct of
the metadata struct for a hot account.

#### Test Plan
Unit tests are included in this PR.
Tested in mnb w/ the prototype implementation of the tiered account storage (#30626)
2023-06-24 01:25:54 +08:00
Yueh-Hsuan Chiang d95e976a71
[TieredStorage] AccountMetaOptionalFields::size_from_flags() (#32242)
#### Summary of Changes
This PR adds AccountMetaOptionalFields::size_from_flags that takes
`&AccountMegaFlags` and returns the size of the AccountMetaOptionalFields
based on the input AccountMegaFlags.

This function is needed because the reader of the TieredAccountMeta
directly extract all the Some fields of AccountMetaOptionalFields
from its account block without constructing the AccountMetaOptionalFields
instance.

#### Test plan
Improve existing unit tests that further verify the correctness of the function.
2023-06-23 01:42:02 +08:00
Yueh-Hsuan Chiang 1c618f2479
[TieredStorage] TieredAccountMeta (1/N) (#32220)
#### Summary of Changes
This PR introduces TieredAccountMeta, a trait that allows different implementations
of the account meta for different tiers of the accounts storage.

This PR includes the mutator and getter methods for the common TieredAccountMeta
fields.  Functions that also work with the account data block will be in separate PRs.
2023-06-23 01:40:43 +08:00
Ryo Onodera f62d231886
Make `ci/_` to print to stderr instead of stdout (#32238)
* make _ print to stderr instead...

* Trigger normal build procedure
2023-06-22 15:46:22 +09:00
Brooks ba05cbf4cc
Sets default snapshot archive format to zstd (#32205) 2023-06-21 15:15:53 -04:00
steviez 20a7cdd43d
Restrict access to Bank's HardForks (#32180)
* Restrict access to Bank's HardForks

Callers could previously obtain a a lock to read/write HardForks from
any Bank. This would allow any caller to modify, and creates the
opportunity for inconsistent handling of what is considered a valid hard
fork (ie too old).

This PR adds a function to Bank so consistent sanity checks can be
applied; the caller will already have a Bank as that is where they would
have obtained the HardForks from in the first place. Additionally,
change the getter to return a copy of HardForks (simple Vec).

* Allow hard fork at bank slot if bank is not yet frozen
2023-06-20 23:44:43 -05:00
HaoranYi 203544293b
Add epoch_rewards to sysvar cache (#32155)
add epoch_rewards to sysvar cache

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-20 15:01:34 -05:00
HaoranYi 2e9aeff8dd
Enable partitioned epoch reward by feature id (#32174)
enable partitioned epoch reward feature by feature id
update stake rewards tests with partitioned epoch rewards feature enable

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-20 12:12:50 -05:00
Yueh-Hsuan Chiang c56d0bc6a6
[TieredStorage] Make AccountMetaFlags::new_from pub (#32194)
#### Summary of Changes
The newly introduced AccountMetaFlags::new_from must be pub
in order to make the tiered storage writer able to use it.
2023-06-21 00:00:59 +08:00
galactus 2ceabd9368
Simd 47 syscall sysvar last restart slot (#31957)
* add sysvar and logic for last restart slot

* cleanup

* add test for getting last restart slot from account

* format code

* add some basic rustdoc

* copy+paste error

* feature flag for last_restart_slot

* add to sysvars.md

* updated wording in sysvars.md

* rename sol_get_last_restart_slot_sysvar > sol_get_last_restart_slot

* create sbf C header for sol_get_last_restart_slot

* cleanup imports

* reverted hardened_unpack workaround

* cleanup imports

* cleanup logs + blank lines

* Implementing ui changes for last restart slot, nit

* Some more nit change and implementing the UI for sysvar

* fixing the CI

* Minor clippy fix

* format changes

* changes suggested by mvines and lichtso

* increase timeout in local_cluster test

* fix code format

* use keypair for feature flag from mvines

* delete test.json file

* Revert "increase timeout in local_cluster test"

This reverts commit a67465ae22.

* last restart slot should be always less than or equal to current slot

* fixing bug

* changes after  steviez comments

* format issue fixed

* fixing the comment on premature application of future hardfork

* nit change in test

Co-authored-by: steviez <steven@solana.com>

* reverting sysvar_cache.rs because change was not necessary

---------

Co-authored-by: steve-gg <grooviegermanikus@gmail.com>
Co-authored-by: steviez <steven@solana.com>
2023-06-16 20:14:02 +00:00
Jeff Washington (jwash) 174ceba82b
rename to stake_rewards_by_partition for clarity (#32165) 2023-06-16 19:28:53 +00:00
HaoranYi 39d9f8974d
Revert "add test for is_partitioned_rewards_feature_enabled (#32158)" (#32176)
This reverts commit d06b099ecb.

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-16 11:56:05 -05:00
HaoranYi d06b099ecb
add test for is_partitioned_rewards_feature_enabled (#32158)
* add set_partitioned_rewards_enabled_for_test fn

* reveiws

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-16 11:07:07 -05:00
HaoranYi af7b7f1436
Refactor reward block calculation fn (#32167)
refactor reward block calculation fn

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-16 08:40:23 -05:00
Brooks 47ff3cecc9
Enables creating snapshots after booting from local state (#32137) 2023-06-15 22:54:32 -04:00
Jeff Washington (jwash) b1b7ae5e09
cleanup math in distribute_partitioned_epoch_rewards (#32164) 2023-06-15 16:17:38 -07:00
Jeff Washington (jwash) b4265217e6
update begin_partitioned_rewards to include sysvar (#32151)
* update begin_partitioned_rewards to include sysvar

* cleanup
2023-06-15 14:00:24 -07:00
Jeff Washington (jwash) d79b565c72
connect `begin_partitioned_rewards` to bank (#32152) 2023-06-15 11:51:10 -07:00
Jeff Washington (jwash) e7a676dc01
add distribute_partitioned_epoch_rewards (#32124)
* add distribute_partitioned_epoch_rewards

* reviews

* reanme

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-15 11:32:44 -05:00
Jeff Washington (jwash) 988bff93c8
deactivate_epoch_rewards_status burns sysvar (#32143)
* deactivate_epoch_reward_status burns sysvar

* warn to info

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-15 10:36:50 -05:00
Jeff Washington (jwash) 00b5c40122
add partitioned rewards sysvar fns (#32128) 2023-06-14 16:08:15 -07:00
Jeff Washington (jwash) 60e36afd42
add begin_partitioned_rewards (#32116)
* add begin_partitioned_rewards

* pr feedback

* Apply suggestions from code review

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

---------

Co-authored-by: HaoranYi <haoran.yi@gmail.com>
Co-authored-by: Brooks <brooks@prumo.org>
2023-06-14 14:24:49 -07:00
Jeff Washington (jwash) 088ac5ec01
add is_partitioned_rewards_code_enabled (#32123)
* add partitioned_rewards_code_enabled

* renames
2023-06-14 14:36:53 -05:00
Jeff Washington (jwash) f487dfbc77
add distribute_epoch_rewards_in_partition (#32125) 2023-06-14 11:03:17 -07:00
Jeff Washington (jwash) a1ce3cbaa3
partitioned rewards fn for tests: force_reward_interval_end_for_tests (#32127)
partitioned rewards fn for tests
2023-06-14 10:59:48 -07:00
Jeff Washington (jwash) 4eb7db8737
in testing, hash_internal_state ignores epoch_rewards_sysvar (#32122) 2023-06-14 10:57:29 -07:00
Jeff Washington (jwash) 9cf10b7aae
optionally compare with partitioned rewards (#32126) 2023-06-14 10:55:09 -07:00
Jeff Washington (jwash) c01250fc58
add calculate_rewards_and_distribute_vote_rewards (#32109)
* add calculate_rewards_and_distribute_vote_rewards

* warn -> info
2023-06-14 08:38:25 -07:00
Jeff Washington (jwash) a44b080b7f
add partitioned_rewards_feature_enabled (#32115) 2023-06-14 07:47:12 -07:00
Jeff Washington (jwash) 1fa73e778f
add deactivate_epoch_reward_status (#32114) 2023-06-14 07:46:34 -07:00
Jeff Washington (jwash) 2968587d42
add compare_with_partitioned_rewards (#32108) 2023-06-14 07:43:09 -07:00
Jeff Washington (jwash) 67a434fc5b
add calculate_rewards_for_partitioning (#32110) 2023-06-13 15:45:59 -07:00
Jeff Washington (jwash) 65268af497
pass get_reward_interval to load_accounts (#32084) 2023-06-13 14:49:07 -07:00
Jeff Washington (jwash) 9774826b08
add calculate_validator_rewards (#32107) 2023-06-13 14:45:19 -07:00
Jeff Washington (jwash) dcd66534dd
add partitioned rewards helpers (#32085)
* add partitioned rewards helpers

* remove pub(crate)

* credit -> distribution
2023-06-13 13:57:52 -07:00
Jeff Washington (jwash) 0762e69863
remove build error from merge (#32104) 2023-06-13 12:33:40 -07:00
Jeff Washington (jwash) 3fc183ca74
add calculate_stake_vote_rewards for partitioned rewards (#32066)
* add calculate_stake_vote_rewards for partitioned rewards

* check stake reward in test

* pr feedback

* add comment

---------

Co-authored-by: HaoranYi <haoran.yi@solana.com>
2023-06-13 11:53:30 -07:00
Jeff Washington (jwash) 446b82afba
update comment (#32099) 2023-06-13 10:54:38 -07:00
Jeff Washington (jwash) 7c5c70a522
add compare_with_partitioned_rewards_results for testing partitioned rewards (#32086) 2023-06-13 07:39:46 -07:00
Jeff Washington (jwash) b89ce94d33
add store_vote_accounts_partitioned (#32061)
* add store_vote_accounts_partitioned

* pr feedback
2023-06-12 14:38:30 -07:00
Tao Zhu 9b2c9b8f5a
correct feature gate use_default_units_in_fee_calculation usage (#32077) 2023-06-12 16:29:21 -05:00
Alexander Meißner d0ae8c38bd
Fix - `enable_alt_bn128_syscall` (#32083)
* Fixes test_runtime_feature_enable_with_program_cache.

* Adds enable_alt_bn128_syscall to FEATURES_AFFECTING_RBPF.
2023-06-12 22:37:02 +02:00
Jeff Washington (jwash) 6280c63e1a
epoch rewards are stored partitioned as Vec<Vec< (#32076)
* epoch rewards are stored partitioned as Vec<Vec<

* update comment
2023-06-12 13:06:22 -07:00
Jeff Washington (jwash) 7e7c286d50
factor out get_epoch_reward_calculate_param_info to share results (#32065)
* factor out get_epoch_reward_calculate_param_info to share results

* remove extra comment
2023-06-12 09:56:08 -07:00
steviez 2e5b062809
Display path in error message when file create/write fails (#32036)
Using .unwrap() will panic and display the error; however, the path
isn't displayed which makes debugging harder.
2023-06-12 11:45:26 -05:00
Jeff Washington (jwash) 0645e96bc6
add calc_vote_accounts_to_store (#32063)
* add calc_vote_accounts_to_store

* update comment
2023-06-12 08:38:18 -07:00
Jeff Washington (jwash) 26f4c405b2
add update_reward_history_in_partition (#32062)
* add update_reward_history_in_partition

* remove explicit type

* remove spurrious comment
2023-06-12 08:37:46 -07:00
Jeff Washington (jwash) b81a060898
add store_stake_accounts_in_partition (#32060)
* add store_stake_accounts_in_partition

* pr feedback on assert
2023-06-12 08:37:22 -07:00
Jeff Washington (jwash) a001c5eb49
add calculate_reward_points_partitioned (#32050)
* add calculate_reward_points_partitioned

* remove unnecessary clone

* add comment

* clean up test from pr feedback
2023-06-12 08:36:42 -07:00
Jeff Washington (jwash) 37efc82a76
snapshot epoch reward fields tests (#32064) 2023-06-12 07:39:59 -07:00
Jeff Washington (jwash) 2572df7452
stake tests modification: next_epoch_and_n_slots (#32052)
stake tests modification: next_epoch_and_n_slots
2023-06-11 12:26:16 -07:00
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