0

Here's a snip from my file showing the relevant stuff:

#[pallet::config]
pub trait Config: frame_system::Config {
    /// The ID type for freezes.
    type FreezeIdentifier: Parameter + Member + MaxEncodedLen + Copy;
    /// The maximum number of individual freeze locks that can exist on an account at any 
    time.
    #[pallet::constant]
    type MaxFreezes: Get<u32>;
}
#[pallet::storage]
pub type Freezes<T: Config> = StorageMap<
    _,
    Blake2_128Concat,
    T::AccountId,
    BoundedVec<IdAmount<T::FreezeIdentifier, T::NativeBalance>, T::MaxFreezes>,
    ValueQuery,
>;

It's giving me a ton of errors all with the same format, just for different traits such as Encode and Decode:

error[E0277]: the trait bound `BoundedVec<IdAmount<<T as pallet::Config>::FreezeIdentifier, <T as pallet::Config>::NativeBalance>, <T as pallet::Config>::MaxFreezes>: parity_scale_codec::Decode` is not satisfied
   --> pallets/bullposting/src/lib.rs:48:15
    |
48  |       #[pallet::pallet]
    |  _______________^
49  | |     pub struct Pallet<T>(_);
50  | |
51  | |     /// The pallet's configuration trait.
...   |
133 | |     #[pallet::storage]
134 | |     pub type Freezes<T: Config> = StorageMap<
    | |____________________^ the trait `parity_scale_codec::Decode` is not implemented for `BoundedVec<IdAmount<<T as pallet::Config>::FreezeIdentifier, <T as pallet::Config>::NativeBalance>, <T as pallet::Config>::MaxFreezes>`, which is required by `frame_support::pallet_prelude::StorageMap<_GeneratedPrefixForStorageFreezes<T>, frame_support::Blake2_128Concat, <T as frame_system::Config>::AccountId, BoundedVec<IdAmount<<T as pallet::Config>::FreezeIdentifier, <T as pallet::Config>::NativeBalance>, <T as pallet::Config>::MaxFreezes>, frame_support::pallet_prelude::ValueQuery>: StorageInfoTrait`
    |
    = note: required for `BoundedVec<IdAmount<<T as pallet::Config>::FreezeIdentifier, <T as pallet::Config>::NativeBalance>, <T as pallet::Config>::MaxFreezes>` to implement `FullCodec`
    = note: required for `StorageMap<_GeneratedPrefixForStorageFreezes<T>, Blake2_128Concat, <T as Config>::AccountId, BoundedVec<..., ...>, ...>` to implement `StorageInfoTrait`
    = note: the full name for the type has been written to '/home/tgang/rust/BullChain/target/debug/deps/pallet_bullposting-a4d011cb0bb97c3a.long-type-9057226278347970660.txt'
    = note: consider using `--verbose` to print the full type name to the console
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
    |
48  |     #[pallet::pallet where BoundedVec<IdAmount<<T as pallet::Config>::FreezeIdentifier, <T as pallet::Config>::NativeBalance>, <T as pallet::Config>::MaxFreezes>: parity_scale_codec::Decode]
    |                      ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I've found a few other questions along these lines but the fix for both was using Get<u32> instead of Get<u16>, but I'm already using Get<u32>. I copied my code from the Balances pallet.

4
  • > but the fix for both was using Get<u32> instead of Get<u16>, but I'm already using Get<u32>. I didn't get your mean.
    – aurexav
    Commented Nov 16 at 2:57
  • type MaxFreezes: Get<u32>; Both of the related Q&As I found had Get<u16> and the solution to their problems was to change it to Get<u32> but I already have that, so neither of those helped me. @AurevoirXavier
    – Yung Beef
    Commented Nov 17 at 17:13
  • Can you share your pallet code? Then I can try to compile it. Since I checked the code that you provided, it's exactly the same as what pallet-balances did.
    – aurexav
    Commented Nov 18 at 2:08
  • @AurevoirXavier github.com/Yung-Beef/BullChain/tree/master/pallets/bullposting
    – Yung Beef
    Commented Nov 18 at 15:07

1 Answer 1

0

These default-features should be false.

https://github.com/Yung-Beef/BullChain/blob/8f3ad89d3daa6901c380a96af284bd4dea67e083/pallets/bullposting/Cargo.toml#L25-L26

Those features should only be enabled in std.

Add sp-io/std, pallet-balances/std to the std feature scope.


I just noticed that you are using different versions of dependencies.

You should ensure all dependencies are on the same version.

For example, pallet-balances depends on [email protected], while frame-support depends on [email protected]. The macro from frame-support will assume that you haven't implemented those traits.

You can also check https://github.com/paritytech/psvm.

6
  • I did and I still get the errors. github.com/Yung-Beef/BullChain/commit/… Thanks for the help @AurevoirXavier
    – Yung Beef
    Commented Nov 18 at 20:05
  • Updated my answer.
    – aurexav
    Commented Nov 19 at 1:57
  • I ran that with -v polkadot-stable2409-2 (the latest) and it only updated sc-network from 0.45.0 to 0.45.1, with the errors still happening. Does [email protected] refer to SCALE? Does pallet-balances need to get updated?
    – Yung Beef
    Commented Nov 20 at 2:18
  • codec is merely an example. I apologize, but I lack the time to verify all your dependencies. However, I’m certain that this issue arises from the inconsistent version of your dependencies. In my opinion, managing git dependencies is easier compared to crates. Personally, I won't use crates dependencies.
    – aurexav
    Commented Nov 22 at 15:07
  • github.com/polkadot-evm/frontier/blob/…, this is the recommended way to manage dependencies. You can simply keep all dependencies at same the commit.
    – aurexav
    Commented Nov 22 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.