Skip to main content

MinerInstruction

Enum MinerInstruction 

Source
#[repr(u8)]
pub enum MinerInstruction { Initialize = 0, Register = 1, AuthorizeSession = 2, Mine = 3, Claim = 4, Crank = 5, CloseRound = 6, UpdateConfig = 7, SetAdmin = 8, }
Expand description

Instruction tags (first byte of instruction data).

Variants§

§

Initialize = 0

Program initialization. Accounts: [admin (signer, payer), config (PDA), mint, round0 (PDA), system_program] Mint requirements (created outside the program before initialize): decimals = 9, mint_authority = “treasury” PDA, freeze_authority = None.

§

Register = 1

Miner registration. Accounts: [authority (signer, payer), miner (PDA), slot_hashes, system_program]

§

AuthorizeSession = 2

Set a session key (signs background submits). Accounts: [authority (signer), miner] Data: session_key [u8;32] (zeros = revoke)

§

Mine = 3

Hash submission (once per round): PoW verification, weight accrual, lazy settlement of the previous round. Accounts: [signer (authority or session), miner, config, current_round, prev_round, token_account (authority ATA), slot_hashes] Data: nonce u64 LE

§

Claim = 4

Claim accrued rewards (mint to the authority’s ATA). Accounts: [authority (signer), miner, config, prev_round, mint, treasury (PDA), token_account (authority ATA), token_program]

§

Crank = 5

Close the current round and open the next (permissionless crank). Accounts: [payer (signer), config, new_round (PDA), system_program]

§

CloseRound = 6

Close an expired Round account after retention (rent to the caller). Accounts: [recipient (signer), config, round]

§

UpdateConfig = 7

Admin parameter change. Accounts: [admin (signer), config] Data: min_difficulty u64 LE, base_weight u64 LE, round_seconds u64 LE

§

SetAdmin = 8

Admin role handover (ultimately: a multisig with a timelock). Accounts: [admin (signer), config] Data: new_admin [u8;32]

Implementations§

Trait Implementations§

Source§

impl Clone for MinerInstruction

Source§

fn clone(&self) -> MinerInstruction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MinerInstruction

Source§

impl Debug for MinerInstruction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for MinerInstruction

Source§

impl PartialEq for MinerInstruction

Source§

fn eq(&self, other: &MinerInstruction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MinerInstruction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.