File tree 3 files changed +5
-34
lines changed
3 files changed +5
-34
lines changed Original file line number Diff line number Diff line change 13
13
instruction:: UpdPriceArgs ,
14
14
utils:: {
15
15
check_valid_funding_account,
16
- check_valid_writable_account_without_rent_check ,
16
+ check_valid_writable_account ,
17
17
get_status_for_conf_price_ratio,
18
18
is_component_update,
19
19
pyth_assert,
@@ -123,7 +123,7 @@ pub fn upd_price(
123
123
} ?;
124
124
125
125
check_valid_funding_account ( funding_account) ?;
126
- check_valid_writable_account_without_rent_check ( program_id, price_account) ?;
126
+ check_valid_writable_account ( program_id, price_account) ?;
127
127
// Check clock
128
128
let clock = Clock :: from_account_info ( clock_account) ?;
129
129
Original file line number Diff line number Diff line change @@ -58,21 +58,7 @@ fn test_add_publisher() {
58
58
permissions_account_data. security_authority = * funding_account. key ;
59
59
}
60
60
61
- // Expect the instruction to fail, because the price account isn't rent exempt
62
- assert_eq ! (
63
- process_instruction(
64
- & program_id,
65
- & [
66
- funding_account. clone( ) ,
67
- price_account. clone( ) ,
68
- permissions_account. clone( ) ,
69
- ] ,
70
- instruction_data
71
- ) ,
72
- Err ( OracleError :: InvalidWritableAccount . into( ) )
73
- ) ;
74
-
75
- // Now give the price account enough lamports to be rent exempt
61
+ // Give the price account enough lamports to be rent exempt
76
62
* * price_account. try_borrow_mut_lamports ( ) . unwrap ( ) =
77
63
Rent :: minimum_balance ( & Rent :: default ( ) , PriceAccount :: MINIMUM_SIZE ) ;
78
64
Original file line number Diff line number Diff line change @@ -115,9 +115,7 @@ fn valid_writable_account(
115
115
program_id : & Pubkey ,
116
116
account : & AccountInfo ,
117
117
) -> Result < bool , ProgramError > {
118
- Ok ( account. is_writable
119
- && account. owner == program_id
120
- && get_rent ( ) ?. is_exempt ( account. lamports ( ) , account. data_len ( ) ) )
118
+ Ok ( account. is_writable && account. owner == program_id)
121
119
}
122
120
123
121
pub fn check_valid_writable_account (
@@ -130,24 +128,11 @@ pub fn check_valid_writable_account(
130
128
)
131
129
}
132
130
133
- pub fn check_valid_writable_account_without_rent_check (
134
- program_id : & Pubkey ,
135
- account : & AccountInfo ,
136
- ) -> Result < ( ) , ProgramError > {
137
- pyth_assert (
138
- account. is_writable && account. owner == program_id,
139
- OracleError :: InvalidWritableAccount . into ( ) ,
140
- )
141
- }
142
-
143
131
fn valid_readable_account (
144
132
program_id : & Pubkey ,
145
133
account : & AccountInfo ,
146
134
) -> Result < bool , ProgramError > {
147
- Ok (
148
- account. owner == program_id
149
- && get_rent ( ) ?. is_exempt ( account. lamports ( ) , account. data_len ( ) ) ,
150
- )
135
+ Ok ( account. owner == program_id)
151
136
}
152
137
153
138
pub fn check_valid_readable_account (
You can’t perform that action at this time.
0 commit comments