1

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 do not want to change contracts pallet, and I completely do not understand why compiler forces me to implement those changes. Here is what I got from a compiler:

   Compiling pallet-contracts v4.0.0-dev (/home/tomek/workspaces/polkadot-sdk/substrate/frame/contracts) error: cannot find macro `vec` in this scope    --> substrate/frame/contracts/src/wasm/mod.rs:272:7
    | 272 |                         vec![code_hash],
    |                         ^^^
    | help: consider importing one of these items
    | 30  + use codec::alloc::vec;
    | 30  + use crate::vec;
    | 30  + use scale_info::prelude::vec;
    | 30  + use sp_api::vec;
    |
      and 1 other candidate

This kind of errors I got many, many more but all connected to use codec::alloc::vec;. I have no idea why, can anyone explain the way? I do not understand the mechanism that works behind. I ask the question because I was assuming, that just the fact of importing a pallet should not induce any changes in the imported pallet.

1 Answer 1

3

Sometimes, if you forget to include xxx/std in the features, you will encounter this error.

1
  • Right, forgot to import xxx/std ;/ Thanks!! Commented Nov 30, 2023 at 8:37

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.