#### 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.
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.
* 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
#### 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)
#### 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.
#### 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.
* 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
* 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>