mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-17 07:26:52 +00:00
Global Boost (#112)
* update accounting logic for global boosts * rename vars * update event * const * deprecate top balance * handle div by zero * cast to u128 * debug logs * fix proof parser * debug logs * update boost sdk * remove debug logs * import * cleanup sdk * silent error * debug logs * more logs * boost math * debug log * log timing * debug logs * alt model * alt model * refine sdk * fix optional account parser * debug logs * boost keys * update sdk * remove debug logs * mainnet program id * cleanup * update metadata * update deps
This commit is contained in:
@@ -7,10 +7,10 @@ pub struct MineEvent {
|
||||
pub difficulty: u64,
|
||||
pub last_hash_at: i64,
|
||||
pub timing: i64,
|
||||
pub reward: u64,
|
||||
pub boost_1: u64,
|
||||
pub boost_2: u64,
|
||||
pub boost_3: u64,
|
||||
pub net_reward: u64,
|
||||
pub net_base_reward: u64,
|
||||
pub net_miner_boost_reward: u64,
|
||||
pub net_staker_boost_reward: u64,
|
||||
}
|
||||
|
||||
event!(MineEvent);
|
||||
|
||||
@@ -56,10 +56,10 @@ pub fn mine(
|
||||
authority: Pubkey,
|
||||
bus: Pubkey,
|
||||
solution: Solution,
|
||||
boost_accounts: Vec<Pubkey>,
|
||||
boost_keys: Option<(Pubkey, Pubkey)>,
|
||||
) -> Instruction {
|
||||
let proof = proof_pda(authority).0;
|
||||
let required_accounts = vec![
|
||||
let mut accounts = vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(bus, false),
|
||||
AccountMeta::new_readonly(CONFIG_ADDRESS, false),
|
||||
@@ -67,13 +67,14 @@ pub fn mine(
|
||||
AccountMeta::new_readonly(sysvar::instructions::ID, false),
|
||||
AccountMeta::new_readonly(sysvar::slot_hashes::ID, false),
|
||||
];
|
||||
let optional_accounts = boost_accounts
|
||||
.into_iter()
|
||||
.map(|pk| AccountMeta::new_readonly(pk, false))
|
||||
.collect();
|
||||
if let Some((boost_address, reservation_address)) = boost_keys {
|
||||
accounts.push(AccountMeta::new_readonly(boost_address, false));
|
||||
accounts.push(AccountMeta::new(proof_pda(boost_address).0, false));
|
||||
accounts.push(AccountMeta::new_readonly(reservation_address, false));
|
||||
}
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: [required_accounts, optional_accounts].concat(),
|
||||
accounts,
|
||||
data: Mine {
|
||||
digest: solution.d,
|
||||
nonce: solution.n,
|
||||
|
||||
@@ -16,6 +16,7 @@ pub struct Config {
|
||||
pub min_difficulty: u64,
|
||||
|
||||
/// The largest known stake balance on the network from the last epoch.
|
||||
#[deprecated(since = "2.4.0", note = "Please stake with the boost program")]
|
||||
pub top_balance: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ pub struct Proof {
|
||||
pub last_hash_at: i64,
|
||||
|
||||
/// The last time stake was deposited into this account.
|
||||
#[deprecated(since = "2.4.0", note = "Please stake with the boost program")]
|
||||
pub last_stake_at: i64,
|
||||
|
||||
/// The keypair which has permission to submit hashes for mining.
|
||||
|
||||
Reference in New Issue
Block a user