"unlocked_scaled_factor" was a confusing name because the value is
also used when computing vote weight for locked deposits. Rename to
"baseline_vote_weight_scaled_factor" and generally change "unlocked"
to "baseline" in several places.
Also rename "lockup_scaled_factor" to
"max_extra_lockup_vote_weight_scaled_factor" to highlight that it's just
the maximum contribution and that it's "extra" - on top of baseline.
- withdrawable -> unlocked
"withdrawable" was a bad name, since these funds - while unlocked -
are not necessarily withdrawable if the voter is currently engaged in
a vote.
- only_deposit -> only_unlocked
Locked funds are technically also deposited. Make it clearer that this
is talking about the unlocked parts of the funds on the account.
The vote power computation was broken for lockups that start very far
in the future.
- Fix the underflow itself
- Disallow lockups that start more than 100 years in the future
- Error if the lockup-scaled voting power is bigger than the maximum
lockup voting power
Adds LockupKind::Constant, extends the reset_lockup instruction and
adds the internal_transfer instruction to allow working with constant
maturity lockups.
- Make Registrar zero-copy. While it was using borsh for serialization,
the array of voting mint configs couldn't be serialized without
unaligned references.
- Reorganize all zero_copy fields such that switching to repr(C) would
not make a difference. (just for safety in case that happens)
- Add static asserts on the sizes of all account structs, so any changes
are visible very early.
- Add padding to structs that didn't have it yet.
- The vote power decay now has second resolution.
- Monthly and daily vesting behave exactly like multiple cliff locked
deposits.
- In particular, monthly vesting deposits lock-up power decays during
the month, making it smooth over time.
- Gain vote power even if start_ts is in the future (shouldn't happen)
This avoids a security issue where three separate transactions in the
same slot may update the voter weight record, withdraw funds and then
vote with the stale voter weight record.