Skip to content

Commit d8be0a7

Browse files
committed
fix: remove rent check everywhere
1 parent 3295f19 commit d8be0a7

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

program/rust/src/processor/upd_price.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use {
1313
instruction::UpdPriceArgs,
1414
utils::{
1515
check_valid_funding_account,
16-
check_valid_writable_account_without_rent_check,
16+
check_valid_writable_account,
1717
get_status_for_conf_price_ratio,
1818
is_component_update,
1919
pyth_assert,
@@ -123,7 +123,7 @@ pub fn upd_price(
123123
}?;
124124

125125
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)?;
127127
// Check clock
128128
let clock = Clock::from_account_info(clock_account)?;
129129

program/rust/src/utils.rs

+2-17
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ fn valid_writable_account(
115115
program_id: &Pubkey,
116116
account: &AccountInfo,
117117
) -> 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)
121119
}
122120

123121
pub fn check_valid_writable_account(
@@ -130,24 +128,11 @@ pub fn check_valid_writable_account(
130128
)
131129
}
132130

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-
143131
fn valid_readable_account(
144132
program_id: &Pubkey,
145133
account: &AccountInfo,
146134
) -> 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)
151136
}
152137

153138
pub fn check_valid_readable_account(

0 commit comments

Comments
 (0)