diff --git a/evm_loader/program/src/account/state.rs b/evm_loader/program/src/account/state.rs index 02ef6d6b2..d45931493 100644 --- a/evm_loader/program/src/account/state.rs +++ b/evm_loader/program/src/account/state.rs @@ -229,17 +229,10 @@ impl<'a> StateAccount<'a> { program_id: &Pubkey, info: &AccountInfo<'a>, accounts: &AccountsDB, - update_last_usage: bool, ) -> Result<(Self, AccountsStatus)> { let mut status = AccountsStatus::Ok; let mut state = Self::from_account(program_id, info)?; - if update_last_usage { - let current_slot = - solana_program::clock::Clock::get().map(|clock| clock.slot.as_u256().as_u64())?; - state.data.last_used_slot = current_slot; - } - let is_touched_account = |key: &Pubkey| -> bool { state .data @@ -272,6 +265,14 @@ impl<'a> StateAccount<'a> { Ok((state, status)) } + pub fn update_last_usage_slot(program_id: &Pubkey, info: &AccountInfo<'a>) -> Result<()> { + let mut state = Self::from_account(program_id, info)?; + state.data.last_used_slot = + solana_program::clock::Clock::get().map(|clock| clock.slot.as_u256().as_u64())?; + + Ok(()) + } + pub fn finalize(self, program_id: &Pubkey) -> Result<()> { debug_print!("Finalize Storage {}", self.account.key); diff --git a/evm_loader/program/src/instruction/transaction_cancel.rs b/evm_loader/program/src/instruction/transaction_cancel.rs index c0cb8b542..e6e78cea0 100644 --- a/evm_loader/program/src/instruction/transaction_cancel.rs +++ b/evm_loader/program/src/instruction/transaction_cancel.rs @@ -29,7 +29,7 @@ pub fn process<'a>( log_data(&[b"MINER", operator_balance.address().as_bytes()]); let accounts_db = AccountsDB::new(&accounts[3..], operator, Some(operator_balance), None, None); - let (storage, _) = StateAccount::restore(program_id, &storage_info, &accounts_db, false)?; + let (storage, _) = StateAccount::restore(program_id, &storage_info, &accounts_db)?; let current_timestamp = solana_program::clock::Clock::get().map(|clock| clock.slot.as_u256().as_u64())?; diff --git a/evm_loader/program/src/instruction/transaction_step_from_account.rs b/evm_loader/program/src/instruction/transaction_step_from_account.rs index 84ae0a658..499a7eede 100644 --- a/evm_loader/program/src/instruction/transaction_step_from_account.rs +++ b/evm_loader/program/src/instruction/transaction_step_from_account.rs @@ -106,7 +106,8 @@ pub fn process_inner<'a>( } TAG_STATE => { let (storage, accounts_status) = - StateAccount::restore(program_id, &holder_or_storage, &accounts_db, true)?; + StateAccount::restore(program_id, &holder_or_storage, &accounts_db)?; + StateAccount::update_last_usage_slot(program_id, &holder_or_storage)?; operator_balance.validate_transaction(storage.trx())?; let miner_address = operator_balance.miner(storage.trx_origin()); diff --git a/evm_loader/program/src/instruction/transaction_step_from_instruction.rs b/evm_loader/program/src/instruction/transaction_step_from_instruction.rs index af061a75f..96c25cd57 100644 --- a/evm_loader/program/src/instruction/transaction_step_from_instruction.rs +++ b/evm_loader/program/src/instruction/transaction_step_from_instruction.rs @@ -77,7 +77,8 @@ pub fn process<'a>( } TAG_STATE => { let (storage, accounts_status) = - StateAccount::restore(program_id, &storage_info, &accounts_db, true)?; + StateAccount::restore(program_id, &storage_info, &accounts_db)?; + StateAccount::update_last_usage_slot(program_id, &storage_info)?; operator_balance.validate_transaction(storage.trx())?; let miner_address = operator_balance.miner(storage.trx_origin());