add pallet_assets error: ^^^ Config not found in 'pallet_assets' - runtime

I get this error when trying to compile and I seem to be unable to solve it...:
In terminal, after running 'cargo check' I get:
Compiling node-template-runtime v2.0.1 (/runtime)
error[E0405]: cannot find trait `Config` in crate `pallet_assets`
--> /runtime/src/lib.rs:360:21
|
360 | impl pallet_assets::Config for Runtime {
| ^^^^^^ not found in `pallet_assets`
error: aborting due to previous error...
I tried with 'Trait' instead of Config, but throws even more errors...?
A hint would be much appreciated. Thanks

The Config trait was introduced in version 3.0.0 of substrate. As you pointed out, it was previously Trait. It is only expected for any substrate project to be compile-able if you use all of the same major version (2.x or 3.x) for building. I highly recommend using v3+ from now on, v2 is not expected to be supported moving forward.

Related

How can I query contract info with the latest polkadot-js and substrate contracts node?

I've been unable to query my existing contract recently due to Unable to create Enum via index 128, in Alive, Tombstone when using api.query.contracts.contractInfoOf. I get this error both on the command line and in the polkadot-js apps explorer.
These are the steps I took:
Deploy a contract with a salt
Retrieve the contract deployedAddress
Use contractInfoOf
const contractInfo = await api.query.contracts.contractInfoOf(deployedAddress);
I've tried downgrading ink! to 3.0-rc5, 3.0-rc4, 3.0-rc3 and then compiling but it doesn't seem to make any difference. Whenever my contract is built it references rc6 at the top:
{"metadataVersion":"0.1.0","source":{"hash":"0x...","language":"ink! 3.0.0-rc6","compiler":"rustc 1.58.0-nightly",
Which suggests its ignoring my .toml and using rc6 to compile the contract.
I changed my cargo-contract version to 0.14 but that causes polkadot-js to fail at reading the contract abi.
I've tried using the substrate-contracts-node using the latest commit from master and also using the v0.1.0 release. Same error in both cases.
> rustup info
stable-x86_64-unknown-linux-gnu (default)
rustc 1.56.1 (59eed8a2a 2021-11-01)
There are more details in an issue on polkadot-js.
Any pointers on how to get a working setup would be very helpful!
The problem here was substrate-contracts-node using an old version of the metadata.
I was able to check out the repo before the metadata merge was reverted and build locally (cargo build).
So checkout 8d91b8e to get the node to work with versions 7.7.1 and 6.6.1 of polkadot-js packages.
> git checkout 8d91b8e578065a7c06433cbd41ac059bf478a0bd
> cargo build
> ./target/debug/substrate-contracts-node --dev --tmp --version
substrate-contracts-node 0.1.0-8d91b8e-x86_64-linux-gnu

Can’t build smart contract - error compiling elrond-wasm with erdpy build contract

When I try to build the ping-pong smart contract from here using:
erdpy build contract
I don't get the following expected output:
INFO:projects.core:WASM file generated: output/ping-pong.wasm
because of the following errors that appear in the sc_results.rs file:
Compiling elrond-codec v0.5.3
Compiling elrond-wasm v0.18.2
error[E0432]: unresolved import `core::ops::FromResidual`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:7:30
...
error[E0437]: type Output is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:62:5
...
error[E0437]: type Residual is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:63:5
...
error[E0407]: method branch is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:65:5
...
error[E0407]: method from_output is not a member of trait `Try`
--> /Users/<username>/elrondsdk/vendor-rust/registry/src/github.com-1ecc6299db9ec823/elrond-wasm-0.18.2/src/types/io/sc_result.rs:71:5
...
error aborting due to 5 previous errors
...
CRITICAL:cli:Build error: error code = 101, see output.
Environment:
elrond-wasm - v0.18.2
erdpy - v1.0.19
How to solve this build issue?
The problem was that Rust had a non-backwards-compatible change earlier this year.
So, there was an incompatibility with old versions, but it worked fine with newer versions.
Updating Rust using:
rustup update
solved the problem.
Now:
rustc --version | grep -o '^[^(]*'
prints
rustc 1.57.0-nightly

errorE0282# type annotations needed & could not compile `sp-arithmetic`

I am following tutorial [Implementing the Contract Trait]. Added code snip to [parameter_types!] and to [imp trait runtime].
When I run [cargo check -p node-template-runtime] receive error:
error[E0282]: type annotations needed
error: could not compile sp-arithmetic
note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
I've had this error previously and it was due to nightly?
I am using windows not mac..
Just to Add to #dundro answer. Go to the link he suggested:
https://github.com/substrate-developer-hub/substrate-node-template/commit/5769470053ba48f364100ff106e32f1beea43127
and download the "rust-toolchain" file. Then place it in the "substrate-node-template" folder. Then try to build again using the command "cargo build --release".
In my case, it solved the E0282 error and gave me a new one E0463. Searching for a fix now
I got the exactly same error, but then I just checked out master ( there is now a toolchain file since https://github.com/substrate-developer-hub/substrate-node-template/commit/5769470053ba48f364100ff106e32f1beea43127)
and with nightly-2020-10-06 the build was successful.
Good luck
Solved: I forgot to add nightly [cargo +nightly-2020-10-06 check -p node-template-runtime]..

Missing refs while upgrading a Nativescript plugin (tns-core-modules → #nativescript/core migration)

I'm updating an existing plugin in order to make it compatible with the upcoming nativescript release.
All references to the tns-core-modules package have been replaced with #nativescript/core.
The released documentation says that the new libraries should be retro-compatible with older versions. Unfortunately in this case something must have changed (related to the view lifecycle), and the plugin is not 100% working.
That's why I attempted a full migration of it's dependencies, but the build process was not possible due to some errors:
node_modules/#nativescript/core/ui/frame/index.d.ts:494:38 - error TS2304: Cannot find name 'ModuleContext'.
494 export function reloadPage(context?: ModuleContext): void;
...
map-view.ios.ts:80:40 - error TS2304: Cannot find name 'WeakRef'.
80 public static initWithOwner(owner: WeakRef<MapView>): MapViewDelegateImpl {
node_modules/#nativescript/core/ui/styling/style/index.d.ts:31:39 - error TS2304: Cannot find name 'WeakRef'.
31 constructor(ownerView: ViewBase | WeakRef<ViewBase>);
I can build the plugin by setting skipLibCheck: true in tsconfig.json. It makes the plugin compile, but the problem comes out later at runtime.
So it must be solved to complete the migration.
Any hints?
Thank you!
Maybe it's not the 100% recommended solution, but in case that the same problem does happen to you, add this line to your tsconfig.json:
"types": [
"#nativescript/core",
],

Weird Haskell 'stack' error: "can't load .so/.DLL" "not a writable segment"

I am trying to install ghc-mod so that I can use ide-haskell in Atom.
The instructions say to use stack build ghc-mod. It seems that GHC 8.2+ is not supported by ghc-mod, so I set my resolver to lts-9.21.
When running stack build ghc-mod, I keep getting this error (emphasis mine; not using code formatting because line wrap helps readability):
aeson > : can't load .so/.DLL for: /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib (dlopen(/Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib, 5): REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment (__LINKEDIT) in /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib)
... (later)
-- While building package aeson-1.1.2.0 using:
/Users/timoffex/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build --ghc-options ""
Process exited with code: ExitFailure 1
Progress 1/4
Here's a snippet from the above that looks weird to me:
REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment
I am running macOS Catalina 10.15.3.
I can't find any mention of this online except for this open GitHub issue: https://github.com/facebook/duckling/issues/446
I also tried lts-7.24. I get the exact same error, except it happens while building profunctors.
What could be the problem? Where can I file a bug?
I had the same error in a project using resolver: lts-9.17.
What fixed it for me is to update stack.yaml and use this line:
resolver: lts-10.9

Resources