You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello There, I guess I found a bug in the codegen for when the parameters of the StorageEntry is empty.
Error Message
error[E0392]: parameter `'a` is never used
--> src/substrate/protocol_substrate_runtime.rs:29742:39
|
29742 | pub struct LocationAssets<'a>();
| ^^ unused parameter
|
= help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`
Bug Overview
We have a pallet called AssetRegistry that looks like the following (simplified):
// ...snip...#[pallet::config]pubtraitConfig: frame_system::Config{typeEvent:From<Event<Self>> + IsType<<Selfas frame_system::Config>::Event>;/// Asset typetypeAssetId:Parameter
+ Member
+ Default
+ Copy
+ BaseArithmetic
+ MaybeSerializeDeserialize
+ MaxEncodedLen;/// Asset location typetypeAssetNativeLocation:Parameter + Member + Default;/// Native Asset Id#[pallet::constant]typeNativeAssetId:Get<Self::AssetId>;}// ...snip...#[pallet::storage]#[pallet::getter(fn locations)]/// Native location of an asset.pubtypeAssetLocations<T:Config> =
StorageMap<_,Twox64Concat,T::AssetId,T::AssetNativeLocation,OptionQuery>;#[pallet::storage]#[pallet::getter(fn location_assets)]/// Local asset for native location.pubtypeLocationAssets<T:Config> =
StorageMap<_,Blake2_128Concat,T::AssetNativeLocation,T::AssetId,OptionQuery>;// ...snip...
and in our runtime, we are using it like this (simplified):
but it does not take into account if the field_types is empty, we should check for that, and if so we should use core::marker::PhantomData for example.
Thanks for reporting this and for the detailed writeup! Apologies; I've been on holiday and then abroad, but I'll have a look at this when I next get a chance!
Hello There, I guess I found a bug in the
codegen
for when the parameters of theStorageEntry
is empty.Error Message
Bug Overview
We have a pallet called
AssetRegistry
that looks like the following (simplified):and in our runtime, we are using it like this (simplified):
The Bug
When we generate the code, from the metadata we noticed the following code:
AssetLocations
:Which looks correct (semantically and syntactically)
LocationAssets
Which is also looking correct semantically but not syntactically
Ideas
So, this value is considered a tuple, but an empty one and I guess the code hits this path here:
subxt/codegen/src/api/storage.rs
Line 134 in 531e40d
but it does not take into account if the
field_types
is empty, we should check for that, and if so we should usecore::marker::PhantomData
for example.Metadata
rustc version
Substrate Runtime version/branch
subxt version
The text was updated successfully, but these errors were encountered: