substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Name Service Pallet as Collectives Service

Open rossbulat opened this issue 2 years ago • 31 comments

This PR expands on what was worked on in https://github.com/paritytech/substrate/pull/11052, getting the name service pallet to a production ready state.

The addition of a register_para and deregister_para will be added, ideally only callable via XCM over OpenGov proposals, as a mechanism for paras to be registered on the service. This will prevent arbitrary / non-existent Para IDs from being stored on the service. The set_address call within the name service resolver can then take a para_id in addition to the address itself, so the service knows which para to route addresses to.

  • [x] Fix up code from #11052 to work with master and get tests working.
  • [x] Review of pallet and write-up high level lib doc.
    • [x] Check deposit mechanism and whether deposits should be added to subdomains too (they are).
    • [x] Update header comments to match master.
    • [x] Registrations storage item to have counter.
  • [x] Add register_para and deregister_para calls to store Para IDs that wish to be a part of the name service.
    • [x] Use RegistrationManager and ensure origin is RuntimeOrigin for these calls.
    • [x] Provide a suffix that acts as the source of truth for the para.
  • [x] set_address to also require para_id arg, ensure para id is registered.
  • [x] Revise configs and move to storage where applicable (deposits, tiers) via a set_configs call (similar to Nomination Pools set_configs) for root origin to manage.
  • [x] Make suffixes unique, reverse lookup & set address to take suffix instead of para ID.
    • [x] hash -> address, suffix -> para.
  • [x] Remove controller related code in preparation for a NameService Collectives proxy type.
  • [x] Expand call comments.
  • [x] Don't unreserve deposit on reveal. Instead, assign to owner (if depositor different) to back up registration and incentivise deregistering.
  • [x] Write up benchmarks and plug in call weights.
  • [x] Expand pallet docs with calls.
  • [x] Fix tests to account for domains & configs.
  • [x] Use domain terminology for para registrations, and name terminology for nodes.
  • [x] Revisit tests and determine what needs to be added.
  • [x] Add test proving that a tree of a registered TLD and subnodes can all be deregistered and removed from storage.
  • [x] Bound renew max length & update benchmark.
  • [ ] Cumulus Companion (Westend Collectives only): Add pallet to runtime and add a NameService proxy to have access to resolver management and registration of new subdomains.

Other tasks post initial release

  • Explore whether a force_deregister_para is possible, to asynchronously query Relay Chain and remove para from name service if the para is no longer registered.
  • Decentralised / trustless transfer of ownership on-chain process.

rossbulat avatar Jul 02 '23 14:07 rossbulat

bot clean

rossbulat avatar Jul 04 '23 11:07 rossbulat

bot rebase

rossbulat avatar Jul 06 '23 10:07 rossbulat

Rebased

bot rebase

rossbulat avatar Jul 07 '23 16:07 rossbulat

Rebased

bot rebase

rossbulat avatar Jul 08 '23 12:07 rossbulat

Branch is already up-to-date

bot rebase

rossbulat avatar Jul 10 '23 17:07 rossbulat

Rebased

bot rebase

rossbulat avatar Jul 14 '23 07:07 rossbulat

Branch is already up-to-date

bot bench $ pallet dev pallet_name_service

rossbulat avatar Jul 14 '23 12:07 rossbulat

@rossbulat "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_name_service (https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3188692) was cancelled in https://github.com/paritytech/substrate/pull/14491#issuecomment-1635801559

command-bot[bot] avatar Jul 14 '23 12:07 command-bot[bot]

bot bench $ pallet dev pallet_name_service

rossbulat avatar Jul 14 '23 12:07 rossbulat

@rossbulat https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3188827 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_name_service. 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 27-4fe4c106-3c09-4b9d-9381-d67502cc1ec3 to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] avatar Jul 14 '23 12:07 command-bot[bot]

bot cancel 26-9d7e5b22-92a0-4571-81b6-5877849b9bdf

rossbulat avatar Jul 14 '23 12:07 rossbulat

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

command-bot[bot] avatar Jul 14 '23 12:07 command-bot[bot]

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

command-bot[bot] avatar Jul 14 '23 12:07 command-bot[bot]

bot bench $ pallet dev pallet_name_service

rossbulat avatar Jul 14 '23 12:07 rossbulat

@rossbulat https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3189239 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/bench/bench.sh" pallet dev pallet_name_service. 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 28-a92b1d43-821d-4760-bca0-15dadecbfdbf to cancel this command or bot cancel to cancel all commands in this pull request.

command-bot[bot] avatar Jul 14 '23 12:07 command-bot[bot]

bot rebase

rossbulat avatar Jul 14 '23 13:07 rossbulat

Rebased

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

command-bot[bot] avatar Jul 14 '23 13:07 command-bot[bot]

bot rebase

rossbulat avatar Jul 17 '23 05:07 rossbulat

Rebased

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

https://forum.polkadot.network/t/name-service-pallet-introduction-and-call-for-frame-devs-to-review/3480/1

Polkadot-Forum avatar Jul 21 '23 06:07 Polkadot-Forum

bot rebase

rossbulat avatar Jul 21 '23 16:07 rossbulat

Rebased

Love this! 🚀 Left mostly comments about documentation.

Super appreciated @franciscoaguirre , this is exactly the FRAME expertise the pallet needs. 💪

rossbulat avatar Jul 22 '23 02:07 rossbulat

The CI pipeline was cancelled due to failure one of the required jobs. Job name: cargo-check-benches Logs: https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3322490

paritytech-cicd-pr avatar Aug 03 '23 05:08 paritytech-cicd-pr