Skip to main content

Questions tagged [map]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer

query storage to front-end

In the pallet-template, I have this storage: #[pallet::storage] #[pallet::getter(fn getscoreboard)] pub(super) type ScoreBoard<T: Config> = StorageMap <_, Twox64Concat, T::...
4 votes
1 answer

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. ...
1 vote
1 answer

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 ...
2 votes
1 answer

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 ...
3 votes
1 answer

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.
0 votes
1 answer

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 ...
1 vote
1 answer

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 ...
0 votes
1 answer

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<_,...
12 votes
1 answer

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 ...
9 votes
3 answers

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, ...
13 votes
2 answers

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 ...