All Questions
56 questions
0
votes
1
answer
18
views
the trait bound `I: scale_info::TypeInfo` is not satisfied
I am writing Pallet which has generic parameter T and static parameter I, but as soon as I wish to create storage for Struct with generic parameter T I receive tons of errors. What am I doing wrong?
...
2
votes
2
answers
28
views
As a registrar, how to find unjudged indentities in the indentity pallet?
If I am a registrar, how can I find the judgements that I need/can judge?
As far as I know there is not storage that provides that inforamtion. How the registrar can know what indetity has to be ...
0
votes
0
answers
52
views
How to mutate a Vec<u16> in a struct in a DoubleStorageMap?
How do I mutate a DoubleStorageMap with a Vec<T::AccountId> as a value using a struct?
Data::<T>::mutate(
id.clone(),
user_id.clone(),
|params: &mut DataParams<T::AccountId>...
2
votes
1
answer
63
views
How to update the pallet's storage from the runtime api?
Is it possible to update the storage of pallets through runtime api?
Is yes. Do we have any resources for this same?
3
votes
0
answers
25
views
Difficulty Storing Consensus-Derived Value in Storage: Observing Value in Pallet Log but Not in Storage
I'm trying to store a value obtained from the consensus, specifically sc_consensus_babe::fn import_block. While I can observe the value in the pallet through the log, it doesn't seem to be stored in ...
1
vote
1
answer
28
views
Is it possible to define a storage inside the pallet without config trait?
Actually I want to define a storage without config trait but if I'm doing this then I'm getting lot of error. Is it possible?
/// Author of current block.
#[pallet::storage]
pub type Author<...
1
vote
1
answer
44
views
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::...
1
vote
1
answer
38
views
Mutual value among pallets
How to access value X in pallet A from another pallet?
For example, I saw a few pallets define type Currency = Balance, is it truly the value Balance in pallet_balances?
If not, how to define a ...
1
vote
1
answer
25
views
How to store and query the raw text?
I want to query the task from storage. Here is the Task struct and StorageMap
#[derive(Clone, Encode, Decode, PartialEq, RuntimeDebug, TypeInfo, MaxEncodedLen, Default)]
#[scale_info(...
2
votes
1
answer
30
views
Difference Between Using Preimage Pallet and Hash Storage with T::Hashing in Substrate
I'm working on a project using Substrate and have encountered a technical question regarding data storage. I would like to understand the fundamental difference between using the Preimage pallet and ...
1
vote
1
answer
38
views
How to entirely clear a pallet storage on a living chain?
Would it be possible to clear a pallet storage with a call on a live chain ?
Precisely I would like to remove all contracts and code hash existing on my chain (as sudo).
0
votes
1
answer
23
views
error: Invalid generic declaration, trait is defined with instance but generic use none
I want to make a storage for the pallet but I'm getting this error
/// The target parachains to ping.
#[pallet::storage]
pub type Targets<T:Config> = StorageValue<
_,
BoundedVec&...
3
votes
1
answer
22
views
Query chain for types in a storagemap
I want to get the meta function description of pallets storage maps. Returning an output like this:
{ Twox64Concat, [u8; 16], u32 } = query.storagemap(pallet: "template", storagemap: "...
4
votes
1
answer
216
views
How to convert Account ID into Account Bytes in Hex using polkadot js?
I'm following this article about substrate keys. And I was unable to convert the account ID to account bytes in hex as it guides:
from this:
Account ID
...
4
votes
1
answer
36
views
What is the best practice to change on-chain storage from asynchronous task?
I want to change some of the on_chain data after running some asynchronous task running in task_manager. What is the best way to achieve this?
Thanks
4
votes
1
answer
52
views
Change state from a task
I have a asynchronous task running in service.spawn_essential_task(task).
Which does some stuff and wants to write data in storage. How can i achieve this?
Changing state by making runtime_apis to ...
4
votes
1
answer
75
views
Pallet generate store is deprecated how to avoid this warning and compile the code?
I am getting error in #[pallet::generate_store(pub(super) trait Store)] which is showing deprecated warning due to which I could not compile my custom pallet is there any solution
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
1
answer
92
views
All pallets requires storage deposit to operate extrinsics?
Storage deposit is for economic security as explained here.
All storage usage (not only pallet_balances, frame_system account info, pallet_preimage, pallet_contract's contract storage for e.g.) is ...
4
votes
1
answer
31
views
Why do some storage items use the static type and others not?
In the various frame pallets in substrate there are two ways of declaring storage.
For example some pallet storage is declared with <T: Config> while others are declared <T: Config<I>, ...
0
votes
1
answer
52
views
How to benchmark huge bounded vectors?
I want to have a queue system in a pallet using a storage value and a bounded vector.
/// Data related to tranmission queues.
#[pallet::storage]
#[pallet::getter(fn at_block_queue)]
pub type ...
3
votes
2
answers
217
views
the trait bound `<T as frame_system::Config>::AccountId: pallet::Config` is not satisfied
I'm trying to design a custom pallet with bounded vectors, but I want to leave the user to define the size of the bounds according to their implementation, so I use the next type:
pub trait Config:...
3
votes
3
answers
352
views
Can I store a HashMap in StorageMap?
I need to use HashMap in my struct that I store in StorageMap. As I searched online and other Substrate pallets, I didn't see that being used.
I came across use scale_info::prelude::collections::...
2
votes
1
answer
58
views
Is there any alternative for thread_local! in substrate?
I what to use thread_local! in substrate.
I aware about Storage ;)
I want to store temporary data for unit tests. without thread local it does not work property.
thread_local! {
static COINS: ...
4
votes
2
answers
155
views
How to write pallet rename data migration?
I want to rename one of our collective pallet instances to be visible in the PolkaddotJs App.
I think the best option would be to migrate raw data.
I assume that all pallet data has the same trie path ...
1
vote
1
answer
56
views
how to test for storage leaks in pallets
Storage leaks in runtimes can be very damaging and cleaning up with a runtime update migration is non-trivial. I'd like to ensure the absence of storage leaks already in unit testing.
My strategy ...
0
votes
1
answer
125
views
How to get access to pallet storage from tests
I have approvals map in my pallet
So when i try to get value from my storage, I'm getting this error
So how to properly use pallet storage in tests?
1
vote
1
answer
38
views
Setting a value to an arbitrary key at genesis?
I am wondering if it is possible to set a value to an arbitrary storage key at genesis.
Let's say I want to populate the key 0x3fba98689ebed1138735e0e7a5a790abee99a84ccbfb4b82e714617e5e06f6f7 at ...
0
votes
3
answers
245
views
How to mutate a `StorageDoubleMap` value?
I have StorageDoubleMap for ERC1155 balances u32 -> AccountId -> u32;
How can I mutate this map like balances[1][SomeAccountId] -= 4?
1
vote
1
answer
31
views
Unknown storage interactions during benchmarking custom pallet
I was running benchmarks for my pallet and i had a note about some unknown db interactions besides the ones i expect.
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
I tried ...
0
votes
2
answers
123
views
How to query for All Pallets StorageVersions
Is there an easy way to get a list of all pallets storage versions? An output like this:
[
Palletname, StorageVersion
]
Is it possible to query using curl and the rpc for the storage version of all ...
2
votes
2
answers
46
views
How to migrate storage from a default pallet instance to an actual one
I'm about to introduce several instances of a pallet that was previously used as a default instance. The question is: how do I migrate the storage of pallet_bags_list to pallet_bags_list::<...
2
votes
3
answers
509
views
the trait bound `Kitty<T>: TypeInfo` is not satisfied
I was following the substrate kitties tutorial where i needed to create a storage map where the id is mapped to the kitty struct which is created. But i am getting the following error.
error[E0277]: ...
1
vote
1
answer
94
views
Transactional macro cross pallet transaction
Suppose I have the following cross pallet function call
// Pallet A : method that sets a storage variable
pub fn try_set_value_in_pallet_a(value: u64) -> DispatchResult {
ensure!(!value.is_zero(...
1
vote
1
answer
41
views
How do I call `count()` when testing my pallets `CountedStorageMap`?
I'm using a CountedStorageMap in my custom pallet to store a map of created Things.
#[pallet::storage]
#[pallet::getter(fn things)]
pub type Things<T> = CountedStorageMap<Hasher = ...
4
votes
2
answers
447
views
access storage map from another pallet without trait pallet Config
I have one pallet with a storagemap that I want to use/call with another Pallet.
After doing some research I ran over Centrifuge fudge project(https://github.com/centrifuge/fudge/blob/...
2
votes
1
answer
117
views
Pallet session: QueuedKeys vs NextKeys
I need to interact with pallet_session, in particular to read validator set for the next session. As far as I understand, this data is stored in two places:
QueuedKeys, which is just Vec<(T::...
2
votes
1
answer
212
views
Migrating storage without creating a new storage item
I am using Substrate V3 (using decl_storage) and have an existing storage defined like this:
pub Foo get(fn get_foo) config(): map hasher(blake2_128_concat) u32 => H160;
I would like to change ...
0
votes
1
answer
109
views
Get value *AND KEY* from iter_prefix_values
I have a StorageNMap
#[pallet::storage]
#[pallet::getter(fn resources)]
/// Stores resource info
pub type Resources<T: Config> = StorageNMap<
_,
(
...
1
vote
3
answers
184
views
Inserting into a map of vectors
If I have a storage item defined as:
pub Foo get(fn foo): map hasher(twox_64_concat) u32 => Vec<T::AccountId>;
Do I always need to check if Foo contains the key before deciding to insert or ...
2
votes
1
answer
123
views
After genesis has occurred how do I configure new pallet with pre-filled storage?
This question is somewhat similar to this question about configuring for testing but it is for an already live chain.
In this scenario a new pallet will be added to an existing chain's runtime. The ...
2
votes
1
answer
48
views
How can we use struct instead of tuple in pallet storage?
I am working on a pallet in which there is storage in which I am using a tuple.
Can we use a struct instead of a tuple in the storage of pallet?
if yes is there any reference to how we can use it?
6
votes
1
answer
148
views
How does `#[codec(mel_bound())]` work?
When declaring types, with generic parameters, to be stored in runtime storage, it’s common to see this pattern
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)]
pub struct MyItem<TypeA, TypeB> ...
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 ...
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<_,...
2
votes
1
answer
162
views
How to use `IterableStorageMap`
So currently, I need to iterate over the StorageMap defined like this:
pub(super) type Report<T: Config> = StorageMap<_, Blake2_128Concat, (T::AccountId, HealthRound), Reports<T::AccountId,...
4
votes
1
answer
139
views
BTreeMap storage type
I would like to store a large amount of sorted integers, they should be traversable with efficient get and insert.
If I can iterate over a storage map, could you let me know how?
Or is there a ...
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 ...
6
votes
1
answer
49
views
How i define a 1 to N relation in storage?
i'm trying to define a 1 to N storage relation in my pallet. I have a Resource (owned by an account ) which will be linked to N Use structs ( kind of a set )
- Account #1
--> Resource #A
...