Questions tagged [map]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer
66 views

How to iterate a large `StorageMap` over multiple extrinsic calls?

Hey valuable Substrate community, I am running into the problem that I need to iterate over an unbounded StorageMap. So I need an IterationLimit and use an extrinsic which gets called multiple times. ...
Chralt's user avatar
  • 503
1 vote
1 answer
53 views

How to store a bounded map inside `StorageValue`?

I need to query a specific account id associated with a Balance in a pool of 10_000 account ids. But I also need to iterate over all account ids in a reasonable amount of computation time. So my ...
Chralt's user avatar
  • 503
2 votes
1 answer
33 views

How to select n random keys from a `StorageMap`?

Assume I have the following storage map: ZAccounts: StorageMap(AccountId -> AccountInfoOf<T>) Is there a simple way to draw n AccountId's randomly. I assume that I already have a secure ...
Chralt's user avatar
  • 503
3 votes
1 answer
53 views

What does `no particular order` mean for storage iterations?

I am always curious what the documentation for the storage means when I see the following. Enumerate all elements in the map in no particular order. https://paritytech.github.io/substrate/master/...
Chralt's user avatar
  • 503
0 votes
1 answer
102 views

When to use StorageDoubleMap `clear_prefix` vs `drain_prefix`?

Hey Substrate community, there are two different methods to remove multiple items for one specific first key from a StorageDoubleMap. There is clear_prefix and drain_prefix. clear_prefix provides ...
Chralt's user avatar
  • 503
0 votes
1 answer
70 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
12 votes
1 answer
72 views

Multiple remove_all calls in same block

I stumbled upon an unexpected behavior when doing storage migration. Problem Description I want to clean-up a large DoubleStorageMap in multiple steps. And that works just fine, however I also want to ...
Dinonard's user avatar
  • 562
0 votes
1 answer
83 views

Definition of storage map for stored items

In the tutorial of learning substrate, a storage map for stored items is defined as follows, in which the symbol => appears, but this specification is not in the standard syntax of rust. How to ...
ben.cn's user avatar
  • 3
9 votes
3 answers
114 views

How to limit the number of values by prefix in StorageDoubleMap?

Say I have a StorageDoubleMap that stores Data structs for each user and ContextId #[pallet::storage] pub type Info<T: Config> = StorageDoubleMap< _, Blake2_128Concat, ...
Angelo's user avatar
  • 501
13 votes
2 answers
310 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