update comments

This commit is contained in:
Kriptikz
2024-07-24 22:38:29 -05:00
parent 49d5e95dbb
commit 97a7d0cb28
2 changed files with 12 additions and 10 deletions

View File

@@ -11,8 +11,8 @@ use solana_program::{
/// DeclareProof is used by other instructions in the same transaction.
/// - Other instructions will use transaction introspection to ensure they
/// only process the declared proof.
/// - Other instructions that need to get the declared proof for validation
/// will only look at the first and second instructions in the transaction
/// - Other instructions will use find_and_parse_declared_proof with the
/// introspection data
///
/// Safety requirements:
/// - No safety requirements are required in this instruction to keep cu's as
@@ -33,6 +33,15 @@ pub fn process_declare_proof<'a, 'info>(
Ok(())
}
/// Require that only the declared proof can be processed in this transaction.
///
/// The intent here is to disincentivize sybil. As long as a user can fit multiple hashes in a single
/// transaction, there is a financial incentive to sybil multiple keypairs and pack as many hashes
/// as possible into each transaction to minimize fee / hash.
///
/// If each transaction is limited to one hash only, then a user will minimize their fee / hash
/// by allocating all their hashpower to finding the single most difficult hash they can.
///
/// Errors if:
/// - Fails to find and parse the declared proof pubkey in the second instruction
/// of the transaction

View File

@@ -38,6 +38,7 @@ use crate::{find_and_parse_declared_proof, utils::AccountDeserialize};
/// - Can only succeed if mining is not paused.
/// - Can only succeed if the last reset was less than 60 seconds ago.
/// - Can only succeed if the provided hash satisfies the minimum difficulty requirement.
/// - Can only succeed if the miners proof pubkey matches the declared proof pubkey.
/// - The provided proof account must be associated with the signer.
/// - The provided bus, config, noise, stake, and slot hash sysvar must be valid.
pub fn process_mine<'a, 'info>(
@@ -61,14 +62,6 @@ pub fn process_mine<'a, 'info>(
load_sysvar(instructions_sysvar, sysvar::instructions::id())?;
load_sysvar(slot_hashes_sysvar, sysvar::slot_hashes::id())?;
/// Require that only the declared proof can be processed in this transaction.
///
/// The intent here is to disincentivize sybil. As long as a user can fit multiple hashes in a single
/// transaction, there is a financial incentive to sybil multiple keypairs and pack as many hashes
/// as possible into each transaction to minimize fee / hash.
///
/// If each transaction is limited to one hash only, then a user will minimize their fee / hash
/// by allocating all their hashpower to finding the single most difficult hash they can.
if let Ok(pubkey) = find_and_parse_declared_proof(&instructions_sysvar.data.borrow()) {
if !pubkey.eq(proof_info.key) {
return Err(OreError::DeclaredProofMissmatch.into());