From 70fb0bcfb86eb400abcbd33e5d61b2dc8a17d8c1 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 10 Jul 2024 11:41:47 -0700 Subject: [PATCH] miner as fee payer --- api/src/instruction.rs | 5 ++--- api/src/lib.rs | 2 +- program/src/open.rs | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/api/src/instruction.rs b/api/src/instruction.rs index d402b69..5d4e25b 100644 --- a/api/src/instruction.rs +++ b/api/src/instruction.rs @@ -256,14 +256,13 @@ pub fn mine(signer: Pubkey, bus: Pubkey, solution: Solution) -> Instruction { } /// Builds an open instruction. -pub fn open(signer: Pubkey, miner: Pubkey, payer: Pubkey) -> Instruction { +pub fn open(signer: Pubkey, miner: Pubkey) -> Instruction { let proof_pda = Pubkey::find_program_address(&[PROOF, signer.as_ref()], &crate::id()); Instruction { program_id: crate::id(), accounts: vec![ AccountMeta::new(signer, true), - AccountMeta::new(payer, true), - AccountMeta::new_readonly(miner, false), + AccountMeta::new(miner, true), AccountMeta::new(proof_pda.0, false), AccountMeta::new_readonly(solana_program::system_program::id(), false), AccountMeta::new_readonly(sysvar::slot_hashes::id(), false), diff --git a/api/src/lib.rs b/api/src/lib.rs index b4c2f23..84c6b71 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -10,4 +10,4 @@ pub(crate) use ore_utils as utils; use solana_program::declare_id; // declare_id!("mineRHF5r6S7HyD9SppBfVMXMavDkJsxwGesEvxZr2A"); -declare_id!("EarRpm6FCvs7biAjL1F6yTugqUvLoXtYUvPKb2tHNh8w"); +declare_id!("6NSA5s2mk5fJctfoKxWoewFpT4uwtZpBAVd6DHyMk8Zi"); diff --git a/program/src/open.rs b/program/src/open.rs index 4535e8c..89728ca 100644 --- a/program/src/open.rs +++ b/program/src/open.rs @@ -33,13 +33,11 @@ pub fn process_open<'a, 'info>( let args = OpenArgs::try_from_bytes(data)?; // Load accounts - let [signer, payer_info, miner_info, proof_info, system_program, slot_hashes_info] = accounts - else { + let [signer, miner_info, proof_info, system_program, slot_hashes_info] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); }; load_signer(signer)?; - load_signer(payer_info)?; - load_system_account(miner_info, false)?; + load_signer(miner_info)?; load_uninitialized_pda( proof_info, &[PROOF, signer.key.as_ref()], @@ -56,7 +54,7 @@ pub fn process_open<'a, 'info>( 8 + size_of::(), &[PROOF, signer.key.as_ref(), &[args.bump]], system_program, - payer_info, + miner_info, )?; let clock = Clock::get().or(Err(ProgramError::InvalidAccountData))?; let mut proof_data = proof_info.data.borrow_mut();