Skip to content

Commit

Permalink
fix: move CurrentLogs are empty assert to evm pallet
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigoriy Simonov committed Apr 19, 2023
1 parent 2a94e33 commit 6e3e102
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ pub mod pallet {
));
}
Pending::<T>::kill();
assert_eq!(<CurrentLogs<T>>::get().len(), 0, "fake transaction finalizer is not initialized, as some logs was left after block is finished");
}

fn on_initialize(_: T::BlockNumber) -> Weight {
Expand Down
15 changes: 15 additions & 0 deletions frame/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ pub mod pallet {
}
}

#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_finalize(_: T::BlockNumber) {
assert_eq!(<CurrentLogs<T>>::get().len(), 0, "fake transaction finalizer is not initialized, as some logs was left after block is finished");
}

fn on_initialize(_: T::BlockNumber) -> Weight {
Weight::zero()
}

fn on_runtime_upgrade() -> Weight {
Weight::zero()
}
}

#[pallet::call]
impl<T: Config> Pallet<T> {
/// Withdraw balance from EVM into currency/balances pallet.
Expand Down

0 comments on commit 6e3e102

Please sign in to comment.