polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

Pallet assets: new status LiveAndNoPrivilege and new call revoke_all_privilege

Open gui1117 opened this issue 1 year ago • 9 comments

Some coins don't want to have any privilege role once the distribution is done. We have seen that with $PINK coins which transfered its ownership to a killed proxy account, ensuring nobody can have this privilege. The issue is that this is not easily discoverable. For instance light client can't get this proof easily.

So this PR introduces:

  • new asset status: live and no privilege. Under this status all Owner, Issuer, Freezer, Admin privilege are null.

  • new call: revoke_all_privilege. Can be called by owner or ForceOrigin, asset must be live. It set the status LiveAndNoPrivilege, and it also freezes the metadata.

  • new config associated type: DepositDestinationOnRevocation. When owner revoke its privilege, the deposit goes to this handler. Note that if ForceOrigin calls revoke_all_privilege then owner get its deposit back.

gui1117 avatar Apr 16 '24 08:04 gui1117

bot bench cumulus-assets --pallet=pallet_assets

joepetrowski avatar Apr 23 '24 11:04 joepetrowski

bot bench cumulus-assets --runtime=asset-hub-rococo --pallet=pallet_assets bot bench cumulus-assets --runtime=asset-hub-westend --pallet=pallet_assets

bkontur avatar Apr 23 '24 11:04 bkontur

bot cancel 2-944d4427-747d-465a-bf68-fb13f218c003 bot cancel 3-4e934382-1e4c-4950-bd24-2e115f67cf3d bot bench cumulus-assets --runtime=asset-hub-rococo --pallet=pallet_assets bot bench cumulus-assets --runtime=asset-hub-westend --pallet=pallet_assets

bkontur avatar Apr 23 '24 11:04 bkontur

Hopefully the last commit fix the CI for benchmarks

I don't know yet what is failing in CI migration tests. But I don't have time today, I will look into it tomorrow.

If it doesn't get into the tomorrow release it is ok to me.

gui1117 avatar Apr 23 '24 12:04 gui1117

bot fmt

joepetrowski avatar Apr 23 '24 15:04 joepetrowski

bot bench cumulus-assets --runtime=asset-hub-rococo --pallet=pallet_assets bot bench cumulus-assets --runtime=asset-hub-westend --pallet=pallet_assets

joepetrowski avatar Apr 23 '24 15:04 joepetrowski

bot clean

joepetrowski avatar Apr 24 '24 05:04 joepetrowski

@thiolliere what is the status here?

bkchr avatar May 14 '24 20:05 bkchr

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

https://forum.polkadot.network/t/revoke-root-priviledges/8132/4

Polkadot-Forum avatar May 19 '24 18:05 Polkadot-Forum

CI should be fixed with https://github.com/paritytech/polkadot-sdk/pull/4904

gui1117 avatar Jun 28 '24 02:06 gui1117

Looks good except for this one question and we need an XCM program to properly burn things on Asset Hub (see https://github.com/paritytech/polkadot-sdk/pull/3940/files#diff-37cc15e938c38da98634db29e597af5b5233e3eda662e79491ded2f58c943b52R50-R81)

I added burn at relay, but I didn't test it: https://github.com/paritytech/polkadot-sdk/pull/4150/commits/3794a11d2c3b4ef959bf0fea15b57b89a9930b36

Note that I can refactor it inside assets common if needed. I followed the design of coretime PR so I duplicated it in both westend and rococo.

gui1117 avatar Jul 01 '24 11:07 gui1117

Note that I can refactor it inside assets common if needed. I followed the design of coretime PR so I duplicated it in both westend and rococo.

Yeah, looks good now. We do need a test, but @seadanda was going to work on a test for the Coretime one. I agree this should be refactored and be available somewhere that any system para can use the type.

joepetrowski avatar Jul 01 '24 12:07 joepetrowski

We do need a test

where are end-to-end test for westend and rococo?

gui1117 avatar Jul 02 '24 04:07 gui1117

https://github.com/paritytech/polkadot-sdk/tree/master/cumulus/parachains/integration-tests/emulated

joepetrowski avatar Jul 02 '24 04:07 joepetrowski

I added a integration test for Assets: https://github.com/paritytech/polkadot-sdk/pull/4150/commits/6976d91c21314c85d1b6fd099e71196bf50a04df

Maybe a similar test should be written for PoolAssets And ForeignAssets. But at least the code is covered for BurnAtRelay

gui1117 avatar Jul 03 '24 08:07 gui1117

Testing the coretime XCMs end to end was non-trivial as they are sent by the runtime at various points. We need to trigger a session change on the relay for it to fire the XCM for notify core count, but emulated tests previously had a fairly limited idea of time passing. I've added to the emulator test environment to support running hooks and the other tests are working, but the session still doesn't change so I'm just investigating that.

Testing this XCM should be relatively straightforward if we just send it manually in an AH - relay test

seadanda avatar Jul 03 '24 09:07 seadanda

I agree this should be refactored and be available somewhere that any system para can use the type.

I was thinking only refactoring for westend and rococo, not for other usecase. The code is small, an abstraction can only fit for parachains using DOT as currency and who wants to give away the money from deposit when it is burned.

Actually any non-system parachain should rather keep the deposit for themselves as it is them who hold the storage data.

gui1117 avatar Jul 03 '24 09:07 gui1117

The CI pipeline was cancelled due to failure one of the required jobs. Job name: test-linux-stable-int Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/7138716

paritytech-cicd-pr avatar Aug 27 '24 04:08 paritytech-cicd-pr