Skip to content

Commit

Permalink
refactor(pallet): remove loaded pages from pallet manager (#3981)
Browse files Browse the repository at this point in the history
  • Loading branch information
grishasobol authored May 23, 2024
1 parent bddd84f commit 67c0395
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 22 deletions.
15 changes: 0 additions & 15 deletions pallets/gear/src/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ pub struct ExtManager<T: Config> {
users: BTreeSet<ProgramId>,
/// Ids checked that they are programs.
programs: BTreeSet<ProgramId>,
/// Ids of programs which memory pages have been loaded earlier during processing a block.
program_loaded_pages: BTreeSet<ProgramId>,
/// Messages dispatches.
dispatch_statuses: BTreeMap<MessageId, DispatchStatus>,
/// Programs, which state changed.
Expand Down Expand Up @@ -178,7 +176,6 @@ where
_phantom: PhantomData,
users: Default::default(),
programs: Default::default(),
program_loaded_pages: Default::default(),
dispatch_statuses: Default::default(),
state_changes: Default::default(),
builtins,
Expand Down Expand Up @@ -210,18 +207,6 @@ where
!self.check_program_id(id)
}

/// Checks if memory pages of a program were loaded.
pub fn program_pages_loaded(&self, id: &ProgramId) -> bool {
self.program_loaded_pages.contains(id)
}

/// Adds program's id to the collection of programs with
/// loaded memory pages.
pub fn insert_program_id_loaded_pages(&mut self, id: ProgramId) {
debug_assert!(self.check_program_id(&id));

self.program_loaded_pages.insert(id);
}
/// NOTE: By calling this function we can't differ whether `None` returned, because
/// program with `id` doesn't exist or it's terminated
pub fn get_actor(&self, id: ProgramId) -> Option<Actor> {
Expand Down
6 changes: 0 additions & 6 deletions pallets/gear/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use core_processor::ContextChargedForInstrumentation;

pub(crate) struct QueueStep<'a, T: Config> {
pub block_config: &'a BlockConfig,
pub ext_manager: &'a mut ExtManager<T>,
pub gas_limit: GasBalanceOf<T>,
pub dispatch: StoredDispatch,
pub balance: u128,
Expand All @@ -34,7 +33,6 @@ where
pub(crate) fn run_queue_step(queue_step: QueueStep<'_, T>) -> Vec<JournalNote> {
let QueueStep {
block_config,
ext_manager,
gas_limit,
dispatch,
balance,
Expand Down Expand Up @@ -161,9 +159,6 @@ where
Err(journal) => return journal,
};

// Load program memory pages.
ext_manager.insert_program_id_loaded_pages(destination_id);

let (random, bn) = T::Randomness::random(dispatch_id.as_ref());

core_processor::process::<Ext>(
Expand Down Expand Up @@ -233,7 +228,6 @@ where

let journal = Self::run_queue_step(QueueStep {
block_config: &block_config,
ext_manager: &mut ext_manager,
gas_limit,
dispatch,
balance: balance.unique_saturated_into(),
Expand Down
1 change: 0 additions & 1 deletion pallets/gear/src/runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,6 @@ where
// Processing of the message, if destination is common program.
let journal = Self::run_queue_step(QueueStep {
block_config: &block_config,
ext_manager,
gas_limit,
dispatch,
balance: CurrencyOf::<T>::free_balance(&destination.cast()).unique_saturated_into(),
Expand Down

0 comments on commit 67c0395

Please sign in to comment.