You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support gatekeeping web3names and account linkings (#813)
Fixeshttps://github.com/KILTprotocol/ticket/issues/3691.
This PR allows to dynamically (i.e., via the sudo origin) elect an
account as the only authorised to submit `claim` extrinsic for any
web3name pallet deployment, and `associate_account` and
`associate_sender` extrinsics for any did-lookup deployment.
I also updated our dotnames and unique linking deployments for both our
runtimes to use this new feature, althought I had to rely on a trick
with `storage_alias`es to avoid introducing a new pallet just for this.
Unfortunately, the
[pallet-parameters](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/parameters)
was only introduced in 1.8.0, so we might want to migrate to using that
once we update our codebase to 1.8.0. For now, I could not think of any
other way to implement this feature without touching the pallets storage
entries, which I did not want to.
For both our runtimes, these are the two new storage keys introduced:
* `0x8ea135058ec16554c8e3d230d658fbffd30ff375811804de60521a1654f58ebb`
for the dotnames deployment authorization
* `0x41a63f711fa40ef5e1dc8f0ac115a906d4378bcb7f1d95ba1124c2140bfccdba`
for the unique linking deployment authorization
These values can be updated with a `system.setStorage(key, value)` call,
which must specify an account ID as the sole submitter of the extrinsics
specified above. A `system.killStorage(keys)` call will set the relative
entry to `None`, which means no gating is enforced and anyone can
create. This is the default for our web3name and did linking
deployments.
**Important: when deploying the new runtime, we will also need to set
the storage value for these entries, and we don't need to wait for the
new runtime to be live as writing it earlier has no effect on the rest
of the runtime**.
## How to test
1. Spin up a chopsticks Peregrine setup
2. Set a desired account as the sole allowed submitter for dotnames
* E.g., This call sets it to the sudo
`0x000404808ea135058ec16554c8e3d230d658fbffd30ff375811804de60521a1654f58ebb80921cbc0ffe09a865dbf4ae1d0410aa17c656881fe86666da0f97939e3701b674`
4. Try to claim a dotname with any DID while submitting the tx with an
account different than the sudo account: this will not work
5. Try again with the sudo account and it will work.
6. Remove the authorised account with `killStorage`
* This call removes it:
`0x000504808ea135058ec16554c8e3d230d658fbffd30ff375811804de60521a1654f58ebb`
8. Try again with the first account: it will now work.
let owner:Web3NameOwnerOf<T,I> = account("owner",0,OWNER_SEED);
83
84
let web3_name_input:BoundedVec<u8, <TasConfig<I>>::MaxNameLength> = BoundedVec::try_from(<TasConfig<I>>::BenchmarkHelper::generate_name_input_with_length(n.saturated_into())).expect("BoundedVec creation should not fail.");
84
85
let web3_name_input_clone = web3_name_input.clone();
85
-
let origin = <TasConfig<I>>::OwnerOrigin::generate_origin(caller.clone(), owner.clone());
86
+
let origin = <TasConfig<I>>::ClaimOrigin::generate_origin(caller.clone(), owner.clone());
0 commit comments