-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Pallet assets: new status LiveAndNoPrivilege and new call revoke_all_privilege #4150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gui1117
wants to merge
66
commits into
paritytech:master
Choose a base branch
from
gui1117:gui-assets-revoke-through-status
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 47 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
89ccc72
WIP
gui1117 e286945
rename
gui1117 a716e0f
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 9430c24
version and prdoc
gui1117 f185216
doc
gui1117 ef36ecf
formatting refactoring
gui1117 4f61356
prdoc
gui1117 31ebf61
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 1c8185d
address comments improves prdoc
gui1117 fb0a90c
safer internal API
gui1117 602eeab
doc
gui1117 18358ad
reorg and fix destroying assert
gui1117 f7021bb
fmt and typo
gui1117 a2a3a26
make runtimes burn when privilege is revoked
gui1117 e2315c6
fmt
gui1117 27cf5a8
weights
gui1117 b5884a2
fake weight before benchmarking with bot
gui1117 a9f51b5
fix
gui1117 250b321
prdoc
gui1117 4dc68c4
weights
gui1117 0dd982a
spelling and fix compilation
gui1117 51ae60c
log
gui1117 e2a3782
fix migration for pallet with instance
gui1117 d3c2801
fix benchmarking by using force_create
gui1117 bc31d85
Merge branch 'master' into gui-assets-revoke-through-status
joepetrowski 9176cd9
".git/.scripts/commands/fmt/fmt.sh"
1aec7d5
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
0ac4845
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
bb1a490
Fix migration idempotency
gui1117 43b61d8
prdoc suggestions
gui1117 c4f98f6
Fix spelling and use saturating_add
gui1117 3cda448
Use versioned migration
gui1117 615f5ae
Fix compilation
gui1117 c1d67aa
Fix migration
gui1117 266cbb8
fix compilation
gui1117 f146170
fix unused
gui1117 a76350b
Merge branch 'master' into gui-assets-revoke-through-status
gui1117 e1853a6
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 7dd5394
fix mock
gui1117 f76b23f
Apply suggestions from code review
gui1117 3036e0c
doc
gui1117 3794a11
Burn at relay
gui1117 d6d83e2
Merge branch 'master' into gui-assets-revoke-through-status
gui1117 6976d91
add integration test for assets and burn at relay
gui1117 247c84a
hello clippy
gui1117 a0c0f1f
Merge branch 'master' into gui-assets-revoke-through-status
gui1117 85e4fcc
minor improvement
gui1117 47d4bfd
Apply suggestions from code review
joepetrowski 69ee8b4
Merge branch 'master' into gui-assets-revoke-through-status
gui1117 5962bb5
add migration for penpal and rococo and do prdoc
gui1117 36a3d7d
fmt
gui1117 a49b673
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 905f658
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 35fb7e2
Merge branch 'master' into gui-assets-revoke-through-status
gui1117 c0929cb
fix nostd
gui1117 5be3576
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 ec8f2d0
fix tests
gui1117 50634c9
prdoc
gui1117 6594d94
address review: refactor + error returned on internal error, instead …
gui1117 04bd5ae
Merge remote-tracking branch 'origin/master' into gui-assets-revoke-t…
gui1117 24ab012
fixup
gui1117 d0a8ab2
better doc about reset team
gui1117 d029b29
fix test
gui1117 0fbdeb3
slightly better wording
gui1117 5d30a4e
use some random account for team with no privileges
gui1117 6b99f08
prdoc
gui1117 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
...hains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/burn_at_relay.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (C) Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| use crate::imports::*; | ||
| use emulated_integration_tests_common::accounts; | ||
|
|
||
| /// Create asset and then remove privileges, this result in the burning of the deposit which must | ||
| /// burn at the relay chain. | ||
| #[test] | ||
| fn create_asset_remove_privileges_burn_deposit_at_relay() { | ||
| let owner = AssetHubRococo::account_id_of(accounts::CHARLIE); | ||
| let asset_id = 3939; | ||
|
|
||
| // We need first to teleport some balance so that it can be withdrawn later on the relay | ||
| // chain. Otherwise the asset is not withdrawable due to how genesis is setup. | ||
joepetrowski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Rococo::execute_with(|| { | ||
| type XcmPallet = <Rococo as RococoPallet>::XcmPallet; | ||
|
|
||
| assert_ok!(XcmPallet::limited_teleport_assets( | ||
| <Rococo as Chain>::RuntimeOrigin::signed(Rococo::account_id_of(accounts::CHARLIE)), | ||
| bx!(Parachain(AssetHubRococo::para_id().into()).into()), | ||
| bx!((*AsRef::<[u8; 32]>::as_ref(&owner)).into()), | ||
| bx!(Assets::from((Here, 1_000_000_000_000u128)).into()), | ||
| 0, | ||
| WeightLimit::Unlimited, | ||
| )); | ||
| }); | ||
|
|
||
| let original_total_issuance = | ||
| Rococo::execute_with(|| <Rococo as RococoPallet>::Balances::total_issuance()); | ||
|
|
||
| let deposit = AssetHubRococo::execute_with(|| { | ||
| type Assets = <AssetHubRococo as AssetHubRococoPallet>::Assets; | ||
| type Balances = <AssetHubRococo as AssetHubRococoPallet>::Balances; | ||
|
|
||
| let original_reserved_balance = Balances::reserved_balance(owner.clone()); | ||
|
|
||
| assert_ok!(Assets::create( | ||
| <AssetHubRococo as Chain>::RuntimeOrigin::signed(owner.clone()), | ||
| asset_id.into(), | ||
| owner.clone().into(), | ||
| 1, | ||
| )); | ||
| assert_ok!(Assets::set_metadata( | ||
| <AssetHubRococo as Chain>::RuntimeOrigin::signed(owner.clone()), | ||
| asset_id.into(), | ||
| vec![], | ||
| vec![], | ||
| 0, | ||
| )); | ||
|
|
||
| let new_reserved_balance = Balances::reserved_balance(owner.clone()); | ||
| let original_total_issuance = Balances::total_issuance(); | ||
|
|
||
| let deposit = new_reserved_balance - original_reserved_balance; | ||
| assert!(deposit != 0); // This ensures we are testing something. | ||
|
|
||
| assert_ok!(Assets::revoke_all_privileges( | ||
| <AssetHubRococo as Chain>::RuntimeOrigin::signed(owner.clone()), | ||
| asset_id.into(), | ||
| )); | ||
|
|
||
| assert_eq!(deposit, original_total_issuance - Balances::total_issuance()); | ||
|
|
||
| deposit | ||
| }); | ||
|
|
||
| let new_total_issuance = | ||
| Rococo::execute_with(|| <Rococo as RococoPallet>::Balances::total_issuance()); | ||
|
|
||
| assert_eq!(deposit, original_total_issuance - new_total_issuance); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
...ains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/burn_at_relay.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (C) Parity Technologies (UK) Ltd. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| use crate::imports::*; | ||
| use emulated_integration_tests_common::accounts; | ||
|
|
||
| /// Create asset and then remove privileges, this result in the burning of the deposit which must | ||
| /// burn at the relay chain. | ||
joepetrowski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #[test] | ||
| fn create_asset_remove_privileges_burn_deposit_at_relay() { | ||
| let owner = AssetHubWestend::account_id_of(accounts::CHARLIE); | ||
| let asset_id = 3939; | ||
|
|
||
| // We need first to teleport some balance so that it can be withdrawn later on the relay | ||
| // chain. Otherwise the asset is not withdrawable due to how genesis is setup. | ||
joepetrowski marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Westend::execute_with(|| { | ||
| type XcmPallet = <Westend as WestendPallet>::XcmPallet; | ||
|
|
||
| assert_ok!(XcmPallet::limited_teleport_assets( | ||
| <Westend as Chain>::RuntimeOrigin::signed(Westend::account_id_of(accounts::CHARLIE)), | ||
| bx!(Parachain(AssetHubWestend::para_id().into()).into()), | ||
| bx!((*AsRef::<[u8; 32]>::as_ref(&owner)).into()), | ||
| bx!(Assets::from((Here, 1_000_000_000_000u128)).into()), | ||
| 0, | ||
| WeightLimit::Unlimited, | ||
| )); | ||
| }); | ||
|
|
||
| let original_total_issuance = | ||
| Westend::execute_with(|| <Westend as WestendPallet>::Balances::total_issuance()); | ||
|
|
||
| let deposit = AssetHubWestend::execute_with(|| { | ||
| type Assets = <AssetHubWestend as AssetHubWestendPallet>::Assets; | ||
| type Balances = <AssetHubWestend as AssetHubWestendPallet>::Balances; | ||
|
|
||
| let original_reserved_balance = Balances::reserved_balance(owner.clone()); | ||
|
|
||
| assert_ok!(Assets::create( | ||
| <AssetHubWestend as Chain>::RuntimeOrigin::signed(owner.clone()), | ||
| asset_id.into(), | ||
| owner.clone().into(), | ||
| 1, | ||
| )); | ||
| assert_ok!(Assets::set_metadata( | ||
| <AssetHubWestend as Chain>::RuntimeOrigin::signed(owner.clone()), | ||
| asset_id.into(), | ||
| vec![], | ||
| vec![], | ||
| 0, | ||
| )); | ||
|
|
||
| let new_reserved_balance = Balances::reserved_balance(owner.clone()); | ||
| let original_total_issuance = Balances::total_issuance(); | ||
|
|
||
| let deposit = new_reserved_balance - original_reserved_balance; | ||
| assert!(deposit != 0); // This ensures we are testing something. | ||
|
|
||
| assert_ok!(Assets::revoke_all_privileges( | ||
| <AssetHubWestend as Chain>::RuntimeOrigin::signed(owner.clone()), | ||
| asset_id.into(), | ||
| )); | ||
|
|
||
| assert_eq!(deposit, original_total_issuance - Balances::total_issuance()); | ||
|
|
||
| deposit | ||
| }); | ||
|
|
||
| let new_total_issuance = | ||
| Westend::execute_with(|| <Westend as WestendPallet>::Balances::total_issuance()); | ||
|
|
||
| assert_eq!(deposit, original_total_issuance - new_total_issuance); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.