Questions tagged [hook]
The hook tag has no usage guidance.
12
questions
0
votes
1
answer
25
views
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 ...
3
votes
0
answers
36
views
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 ...
0
votes
1
answer
41
views
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 ...
9
votes
2
answers
91
views
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 ...
4
votes
1
answer
55
views
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 ...
2
votes
1
answer
48
views
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 ...
2
votes
1
answer
50
views
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: ...
2
votes
1
answer
41
views
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 ...
1
vote
1
answer
55
views
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 ...
2
votes
1
answer
42
views
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?
0
votes
1
answer
51
views
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 ...
2
votes
1
answer
38
views
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 ...