Deprecate legacy staking (#99)

* add post balance to MineEvent log

* log input hash

* deprecate legacy staking

* update error message

* remove stake from readme

* err msg

* err msg

* update logs and comments

* consolidate logs

* last hash at

* bump version

* deprecate legacy staking

* update error message

* remove stake from readme

* err msg

* err msg

* bump version

---------

Co-authored-by: tonton-sol <19677766+tonton-sol@users.noreply.github.com>
Co-authored-by: alex <aabinaei@gmail.com>
This commit is contained in:
Hardhat Chad
2024-10-24 13:41:03 -05:00
committed by GitHub
parent 22b974bf7b
commit d59b3a2f4d
10 changed files with 12 additions and 67 deletions

View File

@@ -94,28 +94,6 @@ pub fn process_mine(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult {
.checked_mul(2u64.checked_pow(normalized_difficulty).unwrap())
.unwrap();
// Apply staking multiplier.
//
// If user has greater than or equal to the max stake on the network, they receive 2x multiplier.
// Any stake less than this will receives between 1x and 2x multipler. The multipler is only active
// if the miner's last stake deposit was more than one minute ago to protect against flash loan attacks.
if proof.balance.gt(&0) && proof.last_stake_at.saturating_add(ONE_MINUTE).lt(&t) {
// Calculate staking reward.
if config.top_balance.gt(&0) {
let staking_reward = (reward as u128)
.checked_mul(proof.balance.min(config.top_balance) as u128)
.unwrap()
.checked_div(config.top_balance as u128)
.unwrap() as u64;
reward = reward.checked_add(staking_reward).unwrap();
}
// Update bus stake tracker.
if proof.balance.gt(&bus.top_balance) {
bus.top_balance = proof.balance;
}
}
// Apply boosts.
//
// Boosts are staking incentives that can multiply a miner's rewards. Up to 3 boosts can be applied