substrate icon indicating copy to clipboard operation
substrate copied to clipboard

[NFTs] Rework permissions model

Open jsidorenko opened this issue 2 years ago • 4 comments

This PR changes the permissions model in the pallet-nfts:

  1. an Admin account will no longer be able to transfer or burn items it doesn't own;
  2. to destroy the collection, there should be 0 items left;
  3. some actions were moved from one role to another to simplify accounts management.

For simple collections, the same account usually has all the roles. But if we take complex collections, then each role here represents a separate service with its own responsibilities (e.g. items issuance), and it should be simple to rotate the keys of those services. At the same time, the main owner's account is usually used just to setup the collection and the private key is kept in cold storage afterwards. Given all that, a bunch of frequently called actions were moved from the Owner role to Admin or Issuer.

So, here is the list of the main actions each role will be able to do:

Owner

  • destroy collection
  • redeposit
  • set_collection_max_supply
  • lock_collection (moved from Freezer) - (make non-transferable, fix max supply, lock collection metadata/attributes) -> one time call

Admin

  • set_attribute/set_metadata (in the CollectionOwner namespace) (moved from Owner)
  • set_attributes_pre_signed (moved from Owner)
  • lock_item_properties (moved from Owner) - (lock item metadata/attributes) -> one time call

Freezer

  • lock_item_transfer
  • unlock_item_transfer

Issuer

  • mint
  • force_mint (with custom item config)
  • mint_pre_signed (moved from Owner)
  • update_mint_settings (moved from Owner)

This PR closes: https://github.com/paritytech/substrate/issues/13171

jsidorenko avatar Feb 27 '23 17:02 jsidorenko

@jsidorenko that looks great! Thanks for adapting so quickly.

One question:

  • Why is this B0-silent although it contains E0-runtime_migration?

mustermeiszer avatar Mar 02 '23 09:03 mustermeiszer

@jsidorenko that looks great! Thanks for adapting so quickly.

One question:

  • Why is this B0-silent although it contains E0-runtime_migration?

It's because I'm still learning the labels science :)

jsidorenko avatar Mar 02 '23 10:03 jsidorenko

bot rebase

jsidorenko avatar Mar 02 '23 10:03 jsidorenko

Rebased

bot rebase

jsidorenko avatar Mar 10 '23 10:03 jsidorenko

Rebased

bot bench $ pallet dev pallet_nfts

jsidorenko avatar Mar 10 '23 12:03 jsidorenko

@jsidorenko https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2507636 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_nfts. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 35-88256996-026f-445e-a2ff-4f87c0c19640 to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] avatar Mar 10 '23 12:03 command-bot[bot]

@jsidorenko Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_nfts has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2507636 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2507636/artifacts/download.

command-bot[bot] avatar Mar 10 '23 13:03 command-bot[bot]

bot bench $ pallet dev pallet_nfts

jsidorenko avatar Mar 10 '23 13:03 jsidorenko

@jsidorenko https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2508377 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_nfts. Check out https://gitlab.parity.io/parity/mirrors/substrate/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 40-24f5b93a-3230-4f20-8b95-50edb54d8710 to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] avatar Mar 10 '23 13:03 command-bot[bot]

@jsidorenko Command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_nfts has finished. Result: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2508377 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2508377/artifacts/download.

command-bot[bot] avatar Mar 10 '23 21:03 command-bot[bot]

bot merge

jsidorenko avatar Mar 13 '23 08:03 jsidorenko

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-40/2468/1

Polkadot-Forum avatar Mar 30 '23 10:03 Polkadot-Forum