@@ -2,24 +2,21 @@ use pinocchio::pubkey::{self, pubkey_eq, PDA_MARKER};
22use pinocchio:: { account_info:: AccountInfo , program_error:: ProgramError } ;
33use pinocchio_log:: log;
44
5+ use crate :: args:: CommitBumps ;
56use crate :: error:: DlpError ;
67use crate :: pod_view:: PodView ;
78use crate :: processor:: fast:: NewState ;
89use crate :: state:: { DelegationMetadata , DelegationMetadataFast , DelegationRecord , ProgramConfig } ;
910use crate :: {
1011 apply_diff_in_place, pda, require_initialized_pda, require_initialized_pda_unsafe,
11- require_owned_by, require_pda, require_program_config, require_program_config_unsafe,
12- require_signer,
12+ require_owned_by, require_program_config, require_program_config_unsafe, require_signer,
1313} ;
1414
1515use super :: to_pinocchio_program_error;
1616
1717/// Arguments for the commit state internal function
1818pub ( crate ) struct CommitFinalizeInternalArgs < ' a > {
19- pub ( crate ) delegation_record_bump : u8 ,
20- pub ( crate ) delegation_metadata_bump : u8 ,
21- pub ( crate ) validator_fees_vault_bump : u8 ,
22- pub ( crate ) program_config_bump : u8 ,
19+ pub ( crate ) bumps : & ' a CommitBumps ,
2320 pub ( crate ) new_state : NewState < ' a > ,
2421 pub ( crate ) commit_id : u64 ,
2522 pub ( crate ) allow_undelegation : bool ,
@@ -48,7 +45,7 @@ pub(crate) fn process_commit_finalize_internal(
4845 & [
4946 pda:: DELEGATION_RECORD_TAG ,
5047 args. delegated_account. key( ) ,
51- & [ args. delegation_record_bump ]
48+ & [ args. bumps . delegation_record ]
5249 ] ,
5350 & crate :: fast:: ID ,
5451 false
@@ -59,7 +56,7 @@ pub(crate) fn process_commit_finalize_internal(
5956 & [
6057 pda:: DELEGATION_METADATA_TAG ,
6158 args. delegated_account. key( ) ,
62- & [ args. delegation_metadata_bump ]
59+ & [ args. bumps . delegation_metadata ]
6360 ] ,
6461 & crate :: fast:: ID ,
6562 true
@@ -70,7 +67,7 @@ pub(crate) fn process_commit_finalize_internal(
7067 & [
7168 pda:: VALIDATOR_FEES_VAULT_TAG ,
7269 args. validator. key( ) ,
73- & [ args. validator_fees_vault_bump ]
70+ & [ args. bumps . validator_fees_vault ]
7471 ] ,
7572 & crate :: fast:: ID ,
7673 false
@@ -81,7 +78,7 @@ pub(crate) fn process_commit_finalize_internal(
8178 & [
8279 pda:: DELEGATION_RECORD_TAG ,
8380 args. delegated_account. key( ) ,
84- & [ args. delegation_record_bump ] ,
81+ & [ args. bumps . delegation_record ] ,
8582 & crate :: fast:: ID ,
8683 PDA_MARKER
8784 ] ,
@@ -94,7 +91,7 @@ pub(crate) fn process_commit_finalize_internal(
9491 & [
9592 pda:: DELEGATION_METADATA_TAG ,
9693 args. delegated_account. key( ) ,
97- & [ args. delegation_metadata_bump ] ,
94+ & [ args. bumps . delegation_metadata ] ,
9895 & crate :: fast:: ID ,
9996 PDA_MARKER
10097 ] ,
@@ -107,7 +104,7 @@ pub(crate) fn process_commit_finalize_internal(
107104 & [
108105 pda:: VALIDATOR_FEES_VAULT_TAG ,
109106 args. validator. key( ) ,
110- & [ args. validator_fees_vault_bump ] ,
107+ & [ args. bumps . validator_fees_vault ] ,
111108 & crate :: fast:: ID ,
112109 PDA_MARKER
113110 ] ,
@@ -210,19 +207,19 @@ pub(crate) fn process_commit_finalize_internal(
210207 // Load the program configuration and validate it, if any
211208
212209 // OPTIMIZE 1
213- if true {
210+ if false {
214211 let has_program_config = if USE_SAFE {
215212 require_program_config ! (
216213 args. program_config_account,
217214 delegation_record. owner. as_array( ) ,
218- args. program_config_bump ,
215+ args. bumps . program_config ,
219216 false
220217 )
221218 } else {
222219 require_program_config_unsafe ! (
223220 args. program_config_account,
224221 delegation_record. owner. as_array( ) ,
225- args. program_config_bump ,
222+ args. bumps . program_config ,
226223 false
227224 )
228225 } ;
0 commit comments