Skip to main content

Questions tagged [hook]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer

Validation of Transactions Executed in on_finalised Function within the Hook

Will transactions executed within the on_finalised function inside the hook undergo validation by the validators?
Deepak Chaudhary's user avatar
0 votes
1 answer

Weight consumed inside the on_idle hook?

The documentation of the on_idle hook states that "Any implementation should always respect _remaining_weight and never consume (and therefore return) more than this amount." In the ...
Benjamin Gallois's user avatar
3 votes
0 answers

How to add custom process without exceeding the block time?

The question can seem weird but here is the geist of it : In a custom chain with 20 sec block time, we have a different format of header that includes more information. At the end of the block, we ...
Leouarz's user avatar
  • 353
0 votes
1 answer

Verifying storage changes made during block hooks

I am having trouble understanding the verification process for storage changes that are applied during the on_initialize hooks of a pallet. From what I understand, imported blocks do not re-run any ...
blakeb's user avatar
  • 35
9 votes
2 answers

Chain stalls because of inherent transaction

I have a question about on_finalize hook and inherent transactions. I have added an inherent transaction to starknet pallet in the Madara repo, that fetches the sequencer address from the local ...
LANA_IS_BACK's user avatar
4 votes
1 answer

Are on_idle hooks transactional?

Trying to call a function marked as #[require_transactional] from on_idle() hook triggers the error Err : Transactional(NoLayer). I realise the transactional macro is optional for extrinsics and the ...
nexot14640's user avatar
2 votes
1 answer

Calculating weight for CPU intensive hooks

This wouldn't be a problem if the CPU-intensive code would be placed inside an extrinsic since we could benchmark it and get the accurate weight for the code. But the problem is that we cannot ...
Szegoo's user avatar
  • 657
2 votes
1 answer

Is it possible to call some of the pallet extrinsics from `on_initialize` hook?

Probably a dumb question, but is it possible to do something like this? #[pallet::hooks] impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> { fn on_initialize(now: ...
Szegoo's user avatar
  • 657
2 votes
1 answer

Benchmarking pallet code which is not an extrinsic

I am currently writing code for the hooks on_initialize and on_idle. They share functionality in the form of 2 methods, each using these methods multiple times. I would like to accurately benchmark ...
gatsey's user avatar
  • 183
1 vote
1 answer

Genesis build order

From what I see in the code, the Executive pallet controls the hook order via one of the passed parameters AllPallets, AllPalletsReversed, etc. that depend upon the declaration order in ...
nbaztec's user avatar
  • 197
2 votes
1 answer

frame_support::traits::OnInitialize vs frame_support::traits::Hooks

Both of these have on_initialize calls. What's the difference? When is one run vs the other? Why are these separate concepts?
Kyle's user avatar
  • 311
0 votes
1 answer

panic_with_hook in session change

We are dealing with a runtime panic. We are looking for advice on how to best debug and are looking for help to get past it. At the change of an epoch we want a function to scan for a specific asset ...
Ilhan's user avatar
  • 53
2 votes
1 answer

How can I access another pallet extrinsic WeightInfo

In my pallet I use the pallet_balances, through loose coupling via trait Currency. I use T::Currency::transfer in my on_initialize hook. In this hook I'm supposed to keep track of the weight I'm ...
Timothée Delabrouille's user avatar