#### Problem
IndexOffset currently uses `usize`, which size is platform dependent.
We want a fixed size type that is consist to what we persist in the tiered-storage file.
#### Summary of Changes
This PR makes IndexOffset use u32.
If the vector holding an account is reallocated during execution of a callee,
we must zero the spare capacity regardless of whether the account size changed,
because the underlying vector might contain uninitialized memory in the spare
capacity.
This helper simply called std::mem::size_of<Self::Index>(). However, all
of the underlying functions that create keys manually copy fields into a
byte array. The fields are copied in end-to-end whereas size_of() might
include alignment bytes.
For example, a (u64, u32) only has 12 bytes of "data", but it would
have size 16 due to the 4 alignment padding bytes that would be
added to get the u32 (size 4) aligned with the u64 (size 8).
#### Problem
In TieredStorage, we want to make AccountOffset and IndexOffset u32 instead
of usize just like OwnerOffset. However, we need to first change what we persist
in the storage. Currently, IndexBlock persists offsets as u64 instead of u32.
#### Summary of Changes
This PR makes IndexBlock persist u32 offsets.
#### Test Plan
Existing test cases.
#### Problem
TieredAccountMeta currently uses `u32` for owner_offset, while
we already have a dedicate type for that --- OwnerOffset.
#### Summary of Changes
This PR makes TieredAccountMeta use OwnerOffset for its
owner_offset field.
#### Test Plan
Existing unit-tests.
The function matches the access type and calls a different RocksDB
function depending on whether we have primary or secondary access. But,
lots of the code is the same for these two paths so de-duplicate the
repeated sections.
* Moves modification of feature accounts from Bank::compute_active_feature_set() into Bank::apply_feature_activations().
* Renames allow_new_activations and newly_activated to include_pending and pending.
* Fix test_compute_active_feature_set.
#### Problem
The current OwnerOffset is defined as usize, which actual size could be u32 or u64.
On the other hand, the OwnerOffset is used to access the ith owner in one
TieredStorageFile. As a result, u32 is more than enough to represent the number of
owners inside one TieredStorageFile while u16 might not be always enough.
#### Summary of Changes
This PR defines OwnerOffset as u32.
#### Test Plan
Existing test cases.
* Add push and get methods for RestartLastVotedForkSlots
* Improve expression format.
* Remove fill() from RestartLastVotedForkSlots and move into constructor.
* Update ABI signature.
* Use flate2 compress directly instead of relying on CompressedSlots.
* Make constructor of RestartLastVotedForkSlots return error if necessary.
* Use minmax and remove unnecessary code.
* Replace flate2 with run-length encoding in RestartLastVotedForkSlots.
* Remove accidentally added file.
* The passed in last_voted_fork don't need to be mutable any more.
* Switch to different type of run-length encoding.
* Fix typo.
* Move constant into RestartLastVotedForkSlots.
* Use BitVec in RawOffsets.
* Remove the unnecessary clone.
* Use iter functions for RLE.
* Use take_while instead of loop.
* Change Run length encoding to iterator implementation.
* Allow one slot in RestartLastVotedForkSlots.
* Various simplifications.
* Fix various errors and use customized error type.
* Various simplifications.
* Return error from push_get_restart_last_voted_fork_slots and
remove unnecessary constraints in to_slots.
* Allow 81k slots on RestartLastVotedForkSlots.
* Limit MAX_SLOTS to 65535 so we can go back to u16.
* Use u16::MAX instead of 65535.