rmrk-team / rmrk-substrate

[WIP] RMRK Substrate pallets
https://rmrk.app
Other
74 stars 36 forks source link

Rmrk-Market pallet doesn't compile with `runtime-benchmark` feature #245

Closed Szegoo closed 1 year ago

Szegoo commented 1 year ago

When running:

cargo test -p pallet-rmrk-market --features runtime-benchmarks

The following error is thrown:

error[E0432]: unresolved import `pallet_rmrk_core::RmrkBenchmark`
   --> pallets/rmrk-market/src/mock.rs:108:5
    |
108 | use pallet_rmrk_core::RmrkBenchmark;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `RmrkBenchmark` in the root

error[E0437]: type `Helper` is not a member of trait `pallet_rmrk_core::Config`
   --> pallets/rmrk-market/src/mock.rs:122:2
    |
122 |     type Helper = RmrkBenchmark;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `pallet_rmrk_core::Config`

Edit: this issue also occurs in the rmrk-equip pallet.

Szegoo commented 1 year ago

@ilionic Do you have an idea how this could be fixed? AFAIK when compiling a crate with custom features(in this case runtime-benchamrks feature) the other crates should also have the custom feature on.

ilionic commented 1 year ago

@ilionic Do you have an idea how this could be fixed? AFAIK when compiling a crate with custom features(in this case runtime-benchamrks feature) the other crates should also have the custom feature on.

@Maar-io wdyt?

Maar-io commented 1 year ago

@Szegoo please provide the code/commit for the rmrk-market

Szegoo commented 1 year ago

@Maar-io There is no code to provide, this is an issue regarding the current main branch of this repository. If you run

cargo test -p pallet-rmrk-market --features runtime-benchmarks

Or

cargo test -p pallet-rmrk-equip --features runtime-benchmarks

You will see that the code doesn't compile :/

ilionic commented 1 year ago

@Szegoo can you try copying over the code to relevant pallet instead of importing?

Szegoo commented 1 year ago

@ilionic If I copy the RmrkBenchmark struct into the rmrk-market pallet it successfully compiles.

Edit: so should we then redeclare the RmrkBenchmark struct in every crate where it is being passed for the Helper type?

Maar-io commented 1 year ago

@Szegoo in case there is no code change how do you expect benchmarking for rmrk-market will work? You need to implement benchmarking tests, configure runtime with it and generate weights

Szegoo commented 1 year ago

@Maar-io Yes you are right, I am not sure why I thought the code will compile with the benchmarking feature if I haven't implemented it. Sorry for this.