All Questions
12 questions
3
votes
0
answers
74
views
Dispatch of extrinsic that has prevalidate function which emits events and modifies storage
TLDR: How to implement a substrate unsigned call, which performs storage modifications and emits events during it's validation? If transaction fails, it seems like it leaves garbage in runtime, due ...
2
votes
0
answers
34
views
Are onchain storage reads cheaper from offchain worker versus from extrinsic?
Are reads from offchain workers less expensive than reads from extrinsics? I am determining how to do some large, asynchronous processing of data and determining whether the reads in this process see ...
3
votes
1
answer
50
views
Reading from storage in weight annotation
We have an extrinsic where the complexity is dictated by the number of items held in storage. Is it appropriate to read from storage in the weight annotation? See for example:
pub trait Tree<...
3
votes
1
answer
132
views
What is Dev Mode? And how can I use it?
I heard there is something called Dev Mode in Substrate for pallet development.
What is Dev Mode? And how can I use it?
7
votes
1
answer
270
views
Prepare pallets for Weights v2
I am trying to prepare the pallets for Weights v2 at Encointer and a couple of questions arose.
Where can I find documentation on what exactly has to be done in terms of bounded types?
What is the ...
3
votes
2
answers
70
views
Number of and writes of StorageMap drain
I was wondering about the number of reads and writes when draining a StorageMap which consists of n items. Is the answer (n, 1) or (n, n)?
5
votes
1
answer
283
views
How to weight `on_initialize`?
Is there any best practice how to count the weights in on_initialize correctly?
I read through the Polkadot and Substrate on_initialize weight calculations and couldn't always figure out: When to ...
3
votes
2
answers
64
views
benchmarks: Significant different between 99th and worst case
I'm running benchmark-cli storage tool to calculate average weights for DB read and writes and one thing that I've noticed is that there are significant difference between even 99th percentile and ...
2
votes
1
answer
104
views
Are read/write weight propotional to the size of the data manipulated?
I used to think that each read/write access to storage account for the same weight. But does it ? Or is there a linear relation between the (encoded) size of the data accessed and the price to pay ?
...
2
votes
1
answer
50
views
Do repeated reads of the same storage value add to the total weight?
I have an extrinsic with multiple calls to other pallet functions. As it calls other internal functions, more than one of them access the same storage value (either an actual StorageValue or the same ...
8
votes
2
answers
258
views
What's the overhead associated with the `#[transactional]` macro?
Substrate has a macro, #[transactional], to ensure that any modifications to storage are not persisted in case of an error during execution.
I imagine there's some sort of caching done before ...
11
votes
1
answer
323
views
How expensive is it to access storage items?
How expensive are storage reads and writes?
Does the cost depend on the size of the item?