Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyera Eulberg committed Feb 26, 2022
1 parent 1f7e608 commit 039e3a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
36 changes: 2 additions & 34 deletions runtime/src/account_rent_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,47 +51,15 @@ pub(crate) fn submit_rent_state_metrics(pre_rent_state: &RentState, post_rent_st
pub(crate) fn check_rent_state(
pre_rent_state: Option<&RentState>,
post_rent_state: Option<&RentState>,
pubkey: &Pubkey,
address: &Pubkey,
account: &AccountSharedData,
) -> Result<()> {
if let Some((pre_rent_state, post_rent_state)) = pre_rent_state.zip(post_rent_state) {
<<<<<<< HEAD
submit_rent_state_metrics(pre_rent_state, post_rent_state);
if !post_rent_state.transition_allowed_from(pre_rent_state) {
debug!("Account {:?} not rent exempt, state {:?}", pubkey, account,);
debug!("Account {:?} not rent exempt, state {:?}", address, account);
return Err(TransactionError::InvalidRentPayingAccount);
}
=======
let expect_msg = "account must exist at TransactionContext index if rent-states are Some";
check_rent_state_with_account(
pre_rent_state,
post_rent_state,
transaction_context
.get_key_of_account_at_index(index)
.expect(expect_msg),
&transaction_context
.get_account_at_index(index)
.expect(expect_msg)
.borrow(),
)?;
}
Ok(())
}

pub(crate) fn check_rent_state_with_account(
pre_rent_state: &RentState,
post_rent_state: &RentState,
address: &Pubkey,
account_state: &AccountSharedData,
) -> Result<()> {
submit_rent_state_metrics(pre_rent_state, post_rent_state);
if !post_rent_state.transition_allowed_from(pre_rent_state) {
debug!(
"Account {} not rent exempt, state {:?}",
address, account_state,
);
return Err(TransactionError::InvalidRentPayingAccount);
>>>>>>> 36484f4f0 (Prevent new RentPaying state created by paying fees (#23358))
}
Ok(())
}
Expand Down
10 changes: 5 additions & 5 deletions runtime/src/accounts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::{
account_rent_state::{check_rent_state_with_account, RentState},
account_rent_state::{check_rent_state, RentState},
accounts_db::{
AccountShrinkThreshold, AccountsAddRootTiming, AccountsDb, AccountsDbConfig,
BankHashInfo, ErrorCounters, LoadHint, LoadedAccount, ScanStorageResult,
Expand Down Expand Up @@ -406,14 +406,14 @@ impl Accounts {

let payer_post_rent_state =
RentState::from_account(payer_account, &rent_collector.rent);
let rent_state_result = check_rent_state_with_account(
&payer_pre_rent_state,
&payer_post_rent_state,
let rent_state_result = check_rent_state(
Some(&payer_pre_rent_state),
Some(&payer_post_rent_state),
payer_address,
payer_account,
);
// Feature gate only wraps the actual error return so that the metrics and debug
// logging generated by `check_rent_state_with_account()` can be examined before
// logging generated by `check_rent_state()` can be examined before
// feature activation
if feature_set.is_active(&feature_set::require_rent_exempt_accounts::id()) {
rent_state_result?;
Expand Down

0 comments on commit 039e3a2

Please sign in to comment.