rmrk-substrate icon indicating copy to clipboard operation
rmrk-substrate copied to clipboard

Question: Adding rmrk-core as an external dependency

Open amatsonkali opened this issue 3 years ago • 5 comments

I'm starting on rust & susbtrate development and I'm interested in adding the rmrk-core pallet as an external dependency to a fresh susbtrate-node-template project, but I'm getting a bunch of errors. This is what I've tried:

  • Adding the pallet on runtime/Cargo.toml:


[dependencies.pallet-rmrk-core]
default_features = false
git = 'https://github.com/rmrk-team/rmrk-substrate.git'
branch = 'main'
version = "0.0.1"

...

[features]
default = ["std"]
std = [
	#... Template dependencies
	"pallet-rmrk-core/std",
	
]
  • Configure the pallets on runtime/src/lib.rs

parameter_types! {
	pub const MaxRecursions: u32 = 10;
}

impl pallet_rmrk_core::Config for Runtime {
	type Event = Event;
	type ProtocolOrigin = EnsureRoot<AccountId>;
	type MaxRecursions = MaxRecursions;
}

And adding them on the construct_runtime! macro:

construct_runtime!(
	pub enum Runtime where
		Block = Block,
		NodeBlock = opaque::Block,
		UncheckedExtrinsic = UncheckedExtrinsic
	{
		/*--- snip ---*/
		RmrkCore: pallet_rmrk_core::{Pallet, Call, Event<T>, Storage},
	}
);

Executing cargo check on the terminal generates several (164 at the time) errors, but here's some that seem interesting:

error: duplicate lang item in crate `sp_io` (which `frame_support` depends on): `panic_impl`.
    |
    = note: the lang item is first defined in crate `sp_io` (which `frame_support` depends on)
    = note: first definition in `sp_io` loaded from ./substrate-node-template/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-d578f12f545fdf6e.rmeta
    = note: second definition in `sp_io` loaded from ./substrate-node-template/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-2c478c57ead6a958.rmeta

error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
     --> ./substrate-node-template/runtime/src/lib.rs:287:6
      |
  287 | impl pallet_uniques::Config for Runtime {
      |      ^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
      |
  note: required by a bound in `pallet_uniques::Config`
     --> ./.cargo/git/checkouts/substrate-7e08433d4c370a21/1ca6b68/frame/uniques/src/lib.rs:69:37
      |
  69  |     pub trait Config<I: 'static = ()>: frame_system::Config {
      |                                        ^^^^^^^^^^^^^^^^^^^^ required by this bound in `pallet_uniques::Config`

  error[E0277]: the trait bound `Runtime: frame_system::pallet::Config` is not satisfied
     --> ./substrate-node-template/runtime/src/lib.rs:307:6
      |
  307 | impl pallet_rmrk_core::Config for Runtime {
      |      ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `frame_system::pallet::Config` is not implemented for `Runtime`
      |
  note: required by a bound in `pallet_rmrk_core::Config`
     --> ./.cargo/git/checkouts/rmrk-substrate-4fe3068c99fc9e3a/b47d311/pallets/rmrk-core/src/lib.rs:53:20
      |
  53  |     pub trait Config: frame_system::Config + pallet_uniques::Config {
      |                       ^^^^^^^^^^^^^^^^^^^^ required by this bound in `pallet_rmrk_core::Config`

Am I doing something wrong when importing the pallet? I'll be happy to provide more information if required. Thanks in advance.

amatsonkali avatar Feb 28 '22 18:02 amatsonkali

@amatsonkali Since it's currently in early stage of development we haven't tested rmrk pallets yet as external dependency. Need to adjust some configs. Are you able to run in its current form as the standalone test chain?

ilionic avatar Feb 28 '22 21:02 ilionic

The standalone project is working flawlessly excluding a few minor bugs. I'll keep an eye out for this project Thanks for the response!

amatsonkali avatar Feb 28 '22 23:02 amatsonkali

Please do report any bugs you find, big or small. Or questions too. If you have questions, others will too. Will get to external dependencies before too long.

bmacer avatar Mar 02 '22 01:03 bmacer

FYI: publish: false was removed. Versioning defaulted to 0.0.1. You can try again.

ilionic avatar Mar 04 '22 15:03 ilionic

Unfortunately not yet, I removed pallet-uniques and pallet-utility from the runtime, but the errors shown are the same (issue was edited according to the mentioned pallet removal).

amatsonkali avatar Mar 10 '22 00:03 amatsonkali

Closing this as number of teams integrating pallets using approach similar to polkadot/substrate ( either targeting specific branch or version ) ie

pallet-rmrk-core = { version = "0.1.1", default-features = false, git = "https://github.com/rmrk-team/rmrk-substrate.git", tag="0.1.0" }

ilionic avatar Oct 19 '22 17:10 ilionic