Questions tagged [traits]
The traits tag has no usage guidance.
15
questions
1
vote
1
answer
38
views
Conflicting `Encode` and `Decode` Trait Implementations for Type Aliases in a custom pallet
I'm working on a custom pallet related to the zero-knowledge proof system and I've run into an issue regarding the trait implementations. I have defined a fixed-size hash type H256 using a custom ...
1
vote
1
answer
26
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<...
0
votes
1
answer
33
views
facing unconstrained type parameter issue
I'm using fresh node template and trying to implement below code:
#[pallet::storage]
pub type Author<T: Config> = StorageValue<_, sr25519::Public, OptionQuery>;
pub struct ...
1
vote
1
answer
129
views
Customizing AccountId
In my runtime I'm using pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;. Within my pallet I also need this type to implement From<SomeType>. I ...
5
votes
1
answer
73
views
Trait item implementation is missing: `reserve_withdraw_assets`
I am running the Astar node locally and pointing to the astar-frame repository which is cloned on my local machine. In the Astar node repository, I added the paths-override method to the point all ...
2
votes
1
answer
79
views
How can I convert an account of type sp_runtime::traits::IdentifyAccount::AccountId to sp_runtime::AccountId32?
I get the following error when trying to convert my frame_system::Config::AccountId to a MultiAddress.
expected enum `MultiAddress<sp_runtime::AccountId32, ()>`
found enum `MultiAddress<&...
0
votes
1
answer
71
views
frontier template upgrade to polkadotv0.9.38 but using Babe instead of Aura
I've upgraded the frontier-node-template to substrate polkadot-v0.9.38, I've fixed all issues in runtime, migrated my code as well.
But since last few days, I'm stuck in converting service.rs file in ...
1
vote
1
answer
62
views
How to implement the `Get` trait for a `Pallet<T>`?
I'm writing a pallet that implements evm::executor::stack::PrecompileSet.
The goal is to use this pallet in conjunction with Frontier's pallet-evm, which has the following types in its Config trait:
...
0
votes
1
answer
33
views
Multiple test mock runtimes with slightly different configs based off common base?
We have some custom pallet unit tests that use multiple mock runtimes that are configured slightly differently. The problem is that when we have to make changes to the runtime, we have to apply those ...
2
votes
1
answer
47
views
frame_support::traits::OnInitialize vs frame_support::traits::Hooks
Both of these have on_initialize calls. What's the difference? When is one run vs the other? Why are these separate concepts?
3
votes
2
answers
78
views
What is the difference between `Lookup` and `StaticLookup`?
The docs say that StaticLookup does not require "context" whereas Lookup does. What does this mean? Is there an example or a pallet where we can look at both Lookup and StaticLookup ...
2
votes
1
answer
162
views
trait bound MaxEncodedLen is not satisfied/not implemented for `RewardInfo<T>` or `<T as pallet::Config>::RelayChainAccountId`
My code for this crowdloan rewards pallet
#[pallet::config]
pub trait Config: frame_system::Config {
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::...
3
votes
1
answer
55
views
Basics > Runtime > Core primitives > frame_system / node_primitives vs core primitives / Docu of a Pallet configuration trait [closed]
My questions relate to Core Primitives for setting up a node with FRAME.
Do I include the Core Primitives by using the Crate frame_system or Crate node_primitives?
The core primitives mentioned here:...
5
votes
3
answers
289
views
Missing trait problem
Hello the following code snippet is giving me headaches:
mod items;
pub use super::*;
pub use crate::roles::items::*;
pub type BalanceOf<T> = <<T as pallet::Config>::Currency as ...
5
votes
1
answer
772
views
Cannot infer type for type parameter 'T'
I have a function using the following 2 types:
pub type BalanceOf<T> = <<T as pallet::Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
pub ...