Add storage point tracking and tie in storage rewards to economics (#4824)
* Add storage point tracking and tie in storage rewards to epochs and economics * Prevent validators from updating their validations for a segment * Fix test * Retain syscall scoping for readability * Update Credits to own epoch tracking
This commit is contained in:
@@ -5,7 +5,7 @@ use solana_sdk::hash::Hash;
|
||||
use solana_sdk::instruction::{AccountMeta, Instruction};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::Signature;
|
||||
use solana_sdk::syscall::current;
|
||||
use solana_sdk::syscall::{current, rewards};
|
||||
use solana_sdk::system_instruction;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@@ -35,8 +35,10 @@ pub enum StorageInstruction {
|
||||
///
|
||||
/// Expects 1 Account:
|
||||
/// 0 - Storage account with credits to redeem
|
||||
/// 1 - MiningPool account to redeem credits from
|
||||
/// 1 - Current Syscall to figure out the current epoch
|
||||
/// 2 - Replicator account to credit - this account *must* be the owner
|
||||
/// 3 - MiningPool account to redeem credits from
|
||||
/// 4 - Rewards Syscall to figure out point values
|
||||
ClaimStorageReward,
|
||||
ProofValidation {
|
||||
/// The segment during which this proof was generated
|
||||
@@ -168,7 +170,10 @@ pub fn proof_validation(
|
||||
segment: u64,
|
||||
checked_proofs: Vec<(Pubkey, Vec<ProofStatus>)>,
|
||||
) -> Instruction {
|
||||
let mut account_metas = vec![AccountMeta::new(*storage_pubkey, true)];
|
||||
let mut account_metas = vec![
|
||||
AccountMeta::new(*storage_pubkey, true),
|
||||
AccountMeta::new(current::id(), false),
|
||||
];
|
||||
let mut proofs = vec![];
|
||||
checked_proofs.into_iter().for_each(|(id, p)| {
|
||||
proofs.push(p);
|
||||
@@ -182,6 +187,8 @@ pub fn claim_reward(owner_pubkey: &Pubkey, storage_pubkey: &Pubkey) -> Instructi
|
||||
let storage_instruction = StorageInstruction::ClaimStorageReward;
|
||||
let account_metas = vec![
|
||||
AccountMeta::new(*storage_pubkey, false),
|
||||
AccountMeta::new(current::id(), false),
|
||||
AccountMeta::new(rewards::id(), false),
|
||||
AccountMeta::new(rewards_pools::random_id(), false),
|
||||
AccountMeta::new(*owner_pubkey, false),
|
||||
];
|
||||
|
Reference in New Issue
Block a user