I was looking to implement smart-contract into substrate-node-template as I do not want to use substrate-contracts-node. I was trying to follow this guide - https://substrate-developer-hub.github.io/substrate-how-to-guides/docs/pallet-design/add-contracts-pallet/
However, I went into this error the moment I've insert the dependencies and tried cargo build
.
# Contracts specific packages
pallet-contracts = { git = "https://github.com/paritytech/substrate", package = "pallet-contracts", default-features = false, branch = "polkadot-v0.9.42" }
pallet-contracts-primitives = { git = "https://github.com/paritytech/substrate", package = "pallet-contracts-primitives", default-features = false, branch = "polkadot-v0.9.42" }
There are a total of 11 errors and these are two of most common ones.
error: cannot find macro `vec` in this scope
--> /home/<name>/.cargo/git/checkouts/substrate-7e08433d4c370a21/3bb3882/frame/contracts/src/lib.rs:549:6
|
549 | vec![T::Hashing::hash_of(&dest), code_hash, contract.code_hash],
error: cannot find macro `thread_local` in this scope
--> /home/<name>/.cargo/git/checkouts/substrate-7e08433d4c370a21/3bb3882/frame/contracts/src/lib.rs:975:3
|
975 | environmental!(executing_contract: bool);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
My current setup is vanilla, cloned from - https://github.com/substrate-developer-hub/substrate-node-template
This is my current rustc version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.71.0-nightly (74c482104 2023-05-04)`
Things I tried to do:
- Changing the toolchain version to nightly-2023-01-01-x86_64-unknown-linux-gnu
- Tried to follow this: Problem adding a smart contract into a Substrate node
- Clean install
Side note: is there any updated tutorial on implementing smart contract into substrate node template?