Questions tagged [frame]
Questions about Substrate's framework for developing custom runtime logic.
115
questions
1
vote
0
answers
15
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 ...
3
votes
0
answers
101
views
Cannot create a runtime on benchmark run
Using polkadot-v0.9.19 branch I've created benchmarks for a pallet, added it into runtime, compiled.
On run of any of created benchmarks getting this error:
Error:
Service(Client(RuntimeApiError(...
1
vote
1
answer
16
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 ...
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 --...
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 ...
1
vote
1
answer
34
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 ...
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
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. ...
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 ...
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
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 ...
6
votes
1
answer
48
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
...
3
votes
1
answer
132
views
Problem running assert_last_event in tests.rs
As the title suggests, I've been trying to call assert_last_event on the tests.rs class without success. The problem first happened when developing the kitties tutorial and after several toolchain ...
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 ...
22
votes
3
answers
699
views
When should I build a Substrate FRAME Pallet versus a Smart Contract?
What are the differences between developing a Substrate FRAME Pallet and a Substrate Smart Contract (for example with the ink! language)?
What are some examples of applications which are best written ...
5
votes
1
answer
93
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 ...
10
votes
2
answers
104
views
How does the AccountData type work in FRAME runtimes?
The FRAME system for runtime development defines an AccountData type, which is coupled with data from the Balances Pallet in the Polkadot runtime.
What other types of data could be tracked using this ...
1
vote
1
answer
60
views
Recommended layout for testing integration of pallets
I've been working on a pallet in isolation for a few months. I did testing by mocking a runtime and mocking the related pallets that are expected by it. Basically, so far I have created fake pallets ...
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> ...
10
votes
1
answer
177
views
Are Offences ever pruned?
In our runtime we have a custom implementation of offence reporting. I want to write an adapter for grandpa equivocation offences (implementing the ReportOffence trait), and have been using the ...
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 ...
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/...
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("...
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 ...
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>, ...
12
votes
2
answers
575
views
How to fix `parity_scale_codec::MaxEncodedLen` is not implemented for `T`?
When building my pallet, I run into the error:
error[E0277]: the trait bound `T: parity_scale_codec::MaxEncodedLen` is not satisfied
--> pallets/template/src/lib.rs:42:15
|
42 | #[pallet::...
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
3
answers
124
views
Basics > Runtime > FRAME > Modules (Runtime, System) / Difference?
I am a curious learner and on my way of understanding the core principles of the Substrate universe + going through the tutorials on substrate.io.
As far as I understood is: there exists a Core ...
2
votes
1
answer
114
views
testing pallet with ensure_root
I have written tests.rs and mock.rs
everything is working except a function which has checks for root
pub fn create_something(
origin: OriginFor<T>,
org: T::Hash
) -> ...
2
votes
1
answer
120
views
When to use `compact` on extrinsic arguments?
I keep seeing #[pallet::compact] on some extrinsic arguments like here on the pallet-assets/mint definition:
pub fn mint(
origin: OriginFor<T>,
#[pallet::compact] id: T::...
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 ...
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 ...
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: ...
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?
3
votes
2
answers
111
views
What does #[pallet::compact] do?
What does #[pallet::compact] do?
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
1
answer
134
views
How can I configure genesis state for my pallet's tests without hardcoding it?
I've been writing tests for pallet-kitties and have configured the genesis state inside my mock runtime by setting the storage items for two kitties (one Male and one Female) and their owners (with ...
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 ...