Questions tagged [frame]
Questions about Substrate's framework for developing custom runtime logic.
115
questions
1
vote
0
answers
21
views
Get weights data from a benchmarked pallet
Is there a way to get some informations for an already benchmarked pallet on the weights like the minimum and maximum weights that can be used for a function (worst case/best case) ?
1
vote
1
answer
37
views
Imported pallet and got "use codec::alloc::vec;"
I work on a pallet with interior dispatch mutability where I need to make calls cancel_as_multi and as_multi and after importing contracts pallet, compiler forces me to change contracts pallet. But I ...
1
vote
1
answer
17
views
Ensure that a call is dispatched from a specific pallet
So I want my instance of the pallet membership to be managed only by a specific pallet, and not even the Root origin.
Is there anyway to create an EnsureOrigin object that can verify that a specific ...
1
vote
1
answer
25
views
Dynamic Collectives
In substrate all the existing frames assume a "static" set of Collectives, defined at runtime and with direct management of members using membership frame.
Does anyone have or know of a good ...
2
votes
1
answer
40
views
Storage migrations for frame pallets
I've noticed that some of the frame pallets have migrations and others don't, so I was just wondering if all the required migrations are implemented by the frame pallets, or if it depends on the ...
1
vote
0
answers
17
views
Add a `StorageMap` to a pallet (metadata) from outside the pallet
my problem is the following:
There is a pallet which contains some storage, some extrinsics, and a type in its Config implementing trait CustomPalletHooks to which it delegates some logic.
Assuming ...
0
votes
0
answers
12
views
Standalone Runtime
I want to use Substrate Runtime in my application without consensus layer (outer node). I only want to create extrinsics in memory and pass them to runtime (or FRAME) of my custom pallets to proceed. ...
3
votes
1
answer
74
views
boxed argument of a dispatchable
there are cases when we want to Box an argument of a dispatchable. One such case is when the type is large, for instance, xcm::MultiLocation and we do not want to blow the size of Call type.
these ...
0
votes
1
answer
12
views
Removing an error member with #[pallet::error]
Say i have enum:
#[pallet::error]
pub enum Error<T> {
Error1,
Error2,
Error3,
}
However i realise that Error2 is in fact not in use and i can remove it.
Will i have any consequence ...
1
vote
0
answers
54
views
Batch signed transactions
I need to execute some list of signed extrinsics in order, but because of the randomness that can exist in the transaction pool I have no way to actually ensure that they will execute in the proper ...
3
votes
1
answer
57
views
duplicate lang item in crate `ink_env` - astar-frame/astar
Trying to build Astar shibuya-runtime crate is failing after adding the ink_env dependency an astar-frame chain-extension.
Here are the changes to both Astar and astar-frame.
Run: cargo build --...
5
votes
1
answer
70
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 ...
5
votes
1
answer
94
views
adding an account
I just want to simply add an account in the development config but have no idea how to do it, i tried simply adding the seed in the development_config function but it dosent work, what can i do to add ...
2
votes
1
answer
115
views
Why has the pallet_randomness_collective_flip been removed in polkadot-v0.9.39?
I noticed that the pallet_randomness_collective_flip has been removed in polkadot-v0.9.39, why is this?
What are the alternatives?
Thanks,
1
vote
1
answer
28
views
How does the pay_tips parameter work for NFTs?
Who is it voluntary for? The buyer or the creator of the NFT?
Does the tip get awarded to the creator after every transfer?
Is it voluntary for the buyer each time or is it only voluntary during the ...
2
votes
2
answers
112
views
Transaction Fee Withdrawal
As I've checked the pallet-tx-payment, I've figured it out the fee is withdrawn twice
pub fn validate() {
let (final_fee, _) = self.withdraw_fee(who, call, info, len)?;
...
}
pub fn ...
9
votes
1
answer
117
views
Smart Contract blockspace allocation in Hybrid Chains
In Rob Habermeier's blogpost about Hybrid Chains, he mentions allocating contract execution to a limited fraction of the chain's blockspace.
Is that some functionality that pallet-contracts provides?
...
1
vote
1
answer
65
views
Substrate BoundedVec Error Cannot Borrow as mutable
I have substrate pallet structure as follows
#[derive(
Encode, Decode, CloneNoBound, PartialEqNoBound, Eq, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen,
...
4
votes
2
answers
44
views
DispatchError::Other(_) always being mapped to DispatchError::Other("")
I'm trying to pass some custom error messages to the frame_system::note_applied_extrinsic() but it seems to be ignoring my message and always using an empty string "".
Adding this test to ...
2
votes
1
answer
36
views
Why not implement the sp_std::fmt::Debug for AccountId32 in non-std
https://github.com/paritytech/substrate/blob/d443f148ce0aa6a51798b86c6b3ae54113786f94/primitives/core/src/crypto.rs#L584-L595
Why not implement the sp_std::fmt::Debug for AccountId32 in non-std like ...
2
votes
1
answer
70
views
Different between batch and batchAll functionality in Pallet Utility
Two functions batch and batch_all are slightly similar
batch: https://github.com/paritytech/substrate/blob/master/frame/utility/src/lib.rs#L201
batch_all: https://github.com/paritytech/substrate/...
1
vote
1
answer
60
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:
...
2
votes
1
answer
41
views
When may `apply_extrinsic` panic?
This question is about these lines in FRAME Executive's apply_extrinsic function
pub fn apply_extrinsic(uxt: Block::Extrinsic) -> ApplyExtrinsicResult {
// --snip--
// We don't ...
3
votes
1
answer
97
views
Multisig storage showing calls from another one
I figured there seem to be something wrong with a multisig I have on Rococo.
It's this one: 5FRz8z6U87LBXLUuBRRy4JtVAh2jhkDSbR5ntCGM2Ds631dJ
Checking the storage on it with multisig.multisigs("...
4
votes
1
answer
26
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>, ...
2
votes
2
answers
172
views
Accessibility of functions inside custom pallet
I have two custom pallets pallet1 and pallet2. In pallet1 I have a bunch of calls with assigned weights declared under pallet call macro like this
#[pallet::call]
impl<T: Config> Pallet<T> ...
0
votes
1
answer
25
views
construct_runtime macro panics in a mock environment while it builds in normal runtime [closed]
Trying to create a mock environment for testing a pallet, but getting an error msg failed to resolve: could not find tt_error_token in the crate root whenever trying to add my pallet in the mock ...
7
votes
1
answer
37
views
What is the ValidAtTimestamp error supposed to mean?
In pallet-timestamp, what is InherentError::ValidAtTimestamp supposed to mean exactly?
let minimum = (Self::now() + T::MinimumPeriod::get()).saturated_into::<u64>();
if t > *(data + ...
1
vote
1
answer
35
views
configuring an associated type of a pallet to a pallet
To what will the Currency associated type of pallet-assets be configured if I configure it to pallet-balances like done in statemint?
Will it be set to something within pallet-balances, what exactly?
...
4
votes
1
answer
87
views
Whitelist a call subset of a pallet
Is there a way to whitelist a call subset of a pallet? And hide the rest from the end user.
// something like
Pallet { fn call_a(){} fn call_b(){} }; // Some Pallet
...
construct_runtime!(
pub ...
1
vote
0
answers
19
views
BoundedBTreeMap error with Debug trait
Consider the following snippet
#[weight = 100_000_000] //TODO: update weights
pub fn test(
_origin,
_outputs: frame_support::BoundedBTreeSet<JoyBalanceOf<...
2
votes
1
answer
50
views
Is it possible to call some of the pallet extrinsics from `on_initialize` hook?
Probably a dumb question, but is it possible to do something like this?
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(now: ...
1
vote
1
answer
53
views
How to fix broken trait bounds when instantiating a pallet?
I'm trying to change pallet_assets to pallet_assets::<Instance1> in preparation for more pallet instances. Commit here and compilation error here.
The trouble seems to come from the HandleCredit ...
5
votes
0
answers
48
views
How to use sp_tracing?
When I walk through the sp_tracing documents, it's an overview and does not show us how to use it
I have some questions about sp_tracing:
How to use it? What command that we run it? (Debug Mode?)
...
4
votes
2
answers
82
views
`runtime::Error` type
Is there any way to tell the construct_runtime! macro to build/export a top-level Error enum type in the same way it provides the top-level Call and Event types?
As far as I can tell the only way to ...
5
votes
2
answers
184
views
SignedExtension to mutate Origin
Please see edits 2 and beyond, as they reshape the question a lot.
TLDR: I need a way to mutate an origin for all but some specific calls so that it's dispatched as RawOrigin::Signed to pass ...
3
votes
2
answers
111
views
What does #[pallet::compact] do?
What does #[pallet::compact] do?
1
vote
1
answer
197
views
how to get the current block author?
I am creating a new pallet, i have a simple task, get the current block author, i want to check whether I am the current one that is proposing the block or not by comparing the current block author ...
0
votes
1
answer
136
views
How to create dex pallet? [closed]
I want to create dex pallet(without using pallet-contracts) with functionality like uniswap with pools of liquidity, this dex gonna work with my multi-token-pallet. So now I'm thinking about how to ...
0
votes
1
answer
49
views
How to loose couple trait with config?
I want to loose couple my MultiToken pallet to new Dex pallet, so I created MultiToken trait for interface.
Here I need Config to infer AccountId and OriginFor types
In my Dex pallet I need to add ...
0
votes
1
answer
98
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
34
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 ...
2
votes
1
answer
212
views
Problem with running Benchmarks on substrate pallet: recursion limit reached while expanding `stringify!`
When I add and run a new benchmark via
cargo test --package pallet-<name> --features runtime-benchmarks
I get an error which is unclear and unrelated to the actual benchmark i added:
error: ...
1
vote
1
answer
52
views
How to use as_derivative function found in the Utility pallet?
I found the as_derivative() function call in the FRAME Utility pallet which suggests that I can use it to call a function from address_A on behalf of address_B, provided that address_B was made as a ...
1
vote
1
answer
128
views
How to convert `BlockNumber` to `u64`?
For example, if a have a variable of type <T as frame_system::Config>::BlockNumber how could I convert it into a u64, simply putting u64::from doesn't work.
0
votes
3
answers
187
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?
2
votes
1
answer
35
views
Invalid generic declaration when using FRAME macro pallet::error
I want to add custom error types to a working pallet (permalink duniter-wot/src/lib.rs). In this current state, cargo check pass successfully.
According to Substrate documentation frame-macros/#...
0
votes
1
answer
38
views
Getting error while trying to loosely couple node-template to frame support
I am trying to couple substrate node-template to frame support in order to use trait currency.
Link to github link
Error -
error: failed to run custom build command for `node-template-runtime v4.0.0-...
0
votes
1
answer
44
views
Optimistic block execution and reverting state
I've been playing around with substrate a lot lately and I was wondering how one would go with implementing optimistic block execution.
What I mean by this is that transactions are executed as if they ...
2
votes
1
answer
34
views
Do I need to re-run frame-support weight constants?
I notice that frame-support has some constant weights:
ExtrinsicBaseWeight
RocksDbWeight
BlockExecutionWeight
ParityDbWeight (not using)
Sean recommends that we run weights on all pallets as ...