@@ -9,6 +9,7 @@ use crate::pda::{
99 fees_vault_pda, undelegate_buffer_pda_from_delegated_account,
1010 validator_fees_vault_pda_from_validator,
1111} ;
12+ use crate :: { total_size_budget, AccountSizeClass } ;
1213
1314/// Builds an undelegate instruction.
1415/// See [crate::processor::process_undelegate] for docs.
@@ -46,3 +47,20 @@ pub fn undelegate(
4647 data : DlpDiscriminator :: Undelegate . to_vec ( ) ,
4748 }
4849}
50+
51+ pub fn undelegate_size_budget ( delegated_account : AccountSizeClass ) -> u32 {
52+ total_size_budget ( & [
53+ AccountSizeClass :: Tiny , // validator
54+ delegated_account, // delegated_account
55+ AccountSizeClass :: Tiny , // owner_program
56+ delegated_account, // undelegate_buffer_pda
57+ delegated_account, // commit_state_pda
58+ AccountSizeClass :: Tiny , // commit_record_pda
59+ AccountSizeClass :: Tiny , // delegation_record_pda
60+ AccountSizeClass :: Tiny , // delegation_metadata_pda
61+ AccountSizeClass :: Tiny , // rent_reimbursement
62+ AccountSizeClass :: Tiny , // fees_vault_pda
63+ AccountSizeClass :: Tiny , // validator_fees_vault_pda
64+ AccountSizeClass :: Tiny , // system_program
65+ ] )
66+ }
0 commit comments