0

need help with benchmarking: the command cargo build --release --features runtime-benchmarks completes without any problem, but then I try ./target/release/fs-node benchmark pallet --chain dev --execution wasm --wasm-execution compiled --pallet pallet_nft --extrinsic "*" --steps 100 --repeat 40 --output ./pallets/nft/src/weights.rs --template ./pallets/roles/src/frame-weight-template.hbs and I get this : Error: Input("NotPermitted") any idea about the source of this error? Thanks in advance.

2

1 Answer 1

2

In your case the error originates from your pallet logic itself.
The NotPermitted error is defined here.
In your benchmark you call the mint extrinsic with this account: create_account::<T>("caller", 0) which is not permitted to mint, therefore the error.
The can_mint function in the Permissions trait guards that, you can either mock it by whitelisting that account or use an account that is permissioned.

With mocked Permissions it looks like this for the mint extrinsic but the others need fixing as well.

Pallet: "pallet_nft", Extrinsic: "mint", Lowest values: [], Highest values: [], Steps: 100, Repeat: 40
Raw Storage Info
========
Storage: NftModule Collections (r:1 w:0)
Storage: Uniques Asset (r:1 w:1)
Storage: Uniques Class (r:1 w:1)
Storage: Uniques CollectionMaxSupply (r:1 w:0)
Storage: Uniques Account (r:0 w:1)
Storage: NftModule Items (r:0 w:1)

Median Slopes Analysis
========
-- Extrinsic Time --

Model:
Time ~=    48.62
              µs

Reads = 4
Writes = 4

Min Squares Analysis
========
-- Extrinsic Time --

Model:
Time ~=    48.62
              µs

Reads = 4
Writes = 4

Two more things just for your convenience:

  1. You can run the benchmarks in a test mode where just one iteration is executed. This compiles much faster than the normal benchmarking. The test mode uses the mocked runtime and the real benchmarks use the node runtime.
cargo t --features=runtime-benchmarks -p pallet-nft
  1. In the long run you should try to get rid of the without_storage_info annotation. Just delete them and fix the compile errors. In the future these annotations need to be removed to enable PoV benchmarking.
1
  • 1
    Thank you!! It totally makes sense!! and thank you for the additional advices!!! Jul 23, 2022 at 11:52

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.