Skip to main content

Questions tagged [storage]

Questions about storing and accessing stored data on a Substrate blockchain.

Filter by
Sorted by
Tagged with
11 votes
2 answers
459 views

How to use bounded vector for storage

I'm trying to use BoundedVec from frame_support for one of my storage items like this, pub(super) type Payloads<T: Config> = StorageMap<_, Blake2_128Concat, T::BlockNumber, Vec<Payload>,...
Faisal Ahmed's user avatar
2 votes
1 answer
124 views

BoundedVec on ink!

BoundedVec is a vector where the length of the queue is always bounded, which is better than Vec for storage because it has a defined a maximum length. I recommend this StackExchange questions to ...
Alex Bean's user avatar
  • 5,767
2 votes
1 answer
114 views

How to selectively populate state from a snapshot of one chain onto another?

Goal To use a full snapshot at some block height of one chain and selectively pull in select parts of this state. Use cases Migrating state from another chain. Example: A snapshot of only assets ...
Nuke's user avatar
  • 1,852
13 votes
2 answers
385 views

Is there a limit to the size of a map in Pallet storage?

If we are using a single or double maps in our pallets to store data on-chain, is there a limit to the number of records or size of one individual map? I understand we should be storing the minimal ...
moolimike's user avatar
  • 345
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?
Oliver Tale-Yazdi's user avatar
8 votes
1 answer
243 views

Generating a Storage Key when making an RPC request

I'm trying to make an RPC call to a Substrate node, but I can't generate a proper Storage Key. The Module and Method parts are fine, the problem is the Twox64Concat part. The sp_core::twox_64 of value ...
Amir Boziev's user avatar
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 ...
HCastano's user avatar
  • 1,091
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 ...
pifragile's user avatar
6 votes
1 answer
122 views

What are good use cases for child tries

After reading the substrate documentation: Child tries are useful when you want your own independent trie with a separate root hash that you can use to verify the specific content in that trie. ...
olanod's user avatar
  • 531
5 votes
1 answer
190 views

Migrate keytype of StorageMap without breakin API

Assume we have a StorageMap MyMap of which we want to extend the type of the decoded keys from KeyTypeOld to an enum including the old type as well as a new one. Before pub type MyMap = StorageMap<...
William Freudenberger's user avatar
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 ...
Chralt's user avatar
  • 543
5 votes
1 answer
139 views

Issue with #[pallet::generate_storage_info]

I was digging into substrate's storage_info macro https://docs.substrate.io/v3/runtime/macros/#palletgenerate_storage_info. To get hands dirty checked code from https://github.com/yourarj/substrate-...
Arjun's user avatar
  • 327
4 votes
2 answers
96 views

Does each block save a copy of a Storage item?

This is what I read from the substrate storage docs: https://docs.substrate.io/v3/runtime/storage/ Runtime storage allows you to store data in your blockchain that is persisted between blocks and can ...
Minh Mốc's user avatar
  • 1,009
4 votes
1 answer
131 views

How do I recover quickly if the number of healthy nodes for my parachain reaches zero?

I'm particularly interested in the role of backups and state stored on disk in the recovery process. In terms of preparations, we are early enough in our project lifecycle to put in place whatever ...
beyond-code's user avatar
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?
Bruno's user avatar
  • 8,455
2 votes
1 answer
71 views

Reclaim used space of a removed StorageItem on a live chain

I am changing the collator_selection pallet by removing the LastAuthoredBlock StorageItem and adding an unrelated one, so although the chain is live, no data migration is needed. What happens with the ...
Garandor's user avatar
  • 121
2 votes
1 answer
128 views

Forked Parity pallet, didn't migrate storage, deployed to chain. How to clear original storage from the live chain?

We started a chain using pallet_collator_selection and later forked it. Both the original and the forked pallet use the LastAuthoredBlock StorageItem. We did not execute a storage migration from the ...
Garandor's user avatar
  • 121
0 votes
1 answer
103 views

Runtime API to collect values in StorageMap

I'm trying to retrieve all values in my StorageMap defined as such in my pallet: #[pallet::storage] #[pallet::getter(fn submitted_tasks)] pub type SubmittedTasks<T: Config> = StorageMap<_,...
Mathis Wellmann's user avatar
0 votes
2 answers
67 views

How to get the validators list?

Is it possible to get the list of validators which validate a particular block? For instance, let's say we have at block 10 and if this block is finalised then I need to find the list of validators ...
Deepak Chaudhary's user avatar