mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-17 23:16:48 +00:00
block based sha256 mining
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
use steel::*;
|
||||
|
||||
use super::OreAccount;
|
||||
|
||||
/// Bus accounts are responsible for distributing mining rewards. There are 8 busses total
|
||||
/// to minimize write-lock contention and allow Solana to process mine instructions in parallel.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct Bus {
|
||||
/// The ID of the bus account.
|
||||
pub id: u64,
|
||||
|
||||
/// The remaining rewards this bus has left to payout in the current epoch.
|
||||
pub rewards: u64,
|
||||
|
||||
/// The rewards this bus would have paid out in the current epoch if there no limit.
|
||||
/// This is used to calculate the updated reward rate.
|
||||
pub theoretical_rewards: u64,
|
||||
|
||||
/// The largest known stake balance seen by the bus this epoch.
|
||||
#[deprecated(since = "2.8.0", note = "Top balance is no longer tracked or used")]
|
||||
pub top_balance: u64,
|
||||
}
|
||||
|
||||
account!(OreAccount, Bus);
|
||||
@@ -6,17 +6,20 @@ use super::OreAccount;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct Config {
|
||||
/// The base reward rate paid out for a hash of minimum difficulty.
|
||||
pub base_reward_rate: u64,
|
||||
|
||||
/// The timestamp of the last reset.
|
||||
pub last_reset_at: i64,
|
||||
|
||||
/// The minimum accepted difficulty.
|
||||
pub min_difficulty: u64,
|
||||
/// The best difficulty score of this epoch.
|
||||
pub best_difficulty: u64,
|
||||
|
||||
/// The proof of the best submitted hash of this epoch.
|
||||
pub best_proof: Pubkey,
|
||||
|
||||
/// The challenge of this epoch.
|
||||
pub challenge: [u8; 32],
|
||||
|
||||
/// The target emissions rate in ORE/min.
|
||||
pub target_emmissions_rate: u64,
|
||||
pub block_reward: u64,
|
||||
}
|
||||
|
||||
account!(OreAccount, Config);
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
mod bus;
|
||||
mod config;
|
||||
mod proof;
|
||||
mod treasury;
|
||||
|
||||
pub use bus::*;
|
||||
pub use config::*;
|
||||
pub use proof::*;
|
||||
pub use treasury::*;
|
||||
@@ -15,17 +13,11 @@ use crate::consts::*;
|
||||
#[repr(u8)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
|
||||
pub enum OreAccount {
|
||||
Bus = 100,
|
||||
Config = 101,
|
||||
Proof = 102,
|
||||
Treasury = 103,
|
||||
}
|
||||
|
||||
/// Fetch the PDA of a bus account.
|
||||
pub fn bus_pda(id: u8) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[BUS, &[id]], &crate::id())
|
||||
}
|
||||
|
||||
/// Derive the PDA of the config account.
|
||||
pub fn config_pda() -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[CONFIG], &crate::id())
|
||||
|
||||
Reference in New Issue
Block a user