Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

tests for assets pallet #8487

Merged
merged 7 commits into from
Apr 1, 2021
Merged

tests for assets pallet #8487

merged 7 commits into from
Apr 1, 2021

Conversation

ferrell-code
Copy link
Contributor

A few tests for assets pallet relates to #8470 :).

//force asset status to change min_balance > balance
assert_ok!(Assets::force_asset_status(Origin::root(), 0, 1, 1, 1, 1, 101, true, false));
assert_eq!(Assets::balance(0, 1), 100);
//asset in practice becomes frozen until balance >= min_balance
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows for accounts to have less than min balance, not sure if that is problematic or not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when you transfer 1 asset to this user. Will they accept the 1 asset or will it kill the account?

frame/assets/src/tests.rs Outdated Show resolved Hide resolved
frame/assets/src/tests.rs Outdated Show resolved Hide resolved
@bkchr bkchr requested a review from shawntabrizi March 30, 2021 08:47
@bkchr bkchr added A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit labels Mar 30, 2021
ferrell-code and others added 2 commits March 30, 2021 14:15
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
@shawntabrizi
Copy link
Member

@ferrell-code please add one check about the behavior of an account with below min-balance after force_asset_status, then it all looks good to me. :)

@shawntabrizi
Copy link
Member

I dont think you quite tested what I was interested to see.

A asset has min balance 30, and the user has 50 balance.

Then we increase asset min balance to 100. Currently the user's account is alive with 50 balance.

Then we give the user 1 balance so they have 51. Their new balance, still under the min balance, should trigger cleanup.

@shawntabrizi
Copy link
Member

But otherwise I am happy to merge. Very nice tests 👍

@shawntabrizi
Copy link
Member

bot merge

@ghost
Copy link

ghost commented Apr 1, 2021

Trying merge.

@ghost
Copy link

ghost commented Apr 1, 2021

Merge failed: "At least 2 approving reviews are required by reviewers with write access."

@shawntabrizi shawntabrizi requested a review from bkchr April 1, 2021 10:54
@shawntabrizi
Copy link
Member

shawntabrizi commented Apr 1, 2021

@ferrell-code do you have a Polkadot or Kusama address? Please post it here.

@ferrell-code
Copy link
Contributor Author

Not with any thing in them 👀, use these 15zKd25HoSDPHCn1HjuuHTioXLT7PA2pZQ8gYjFsHW4r96qS
DSSYqgJqdE6HmFAXpiq3y6eZ5FYZ3ZxmX3joRBkh345mxEN

@bkchr bkchr merged commit 619947e into paritytech:master Apr 1, 2021
@ferrell-code ferrell-code deleted the assets-tests branch April 1, 2021 23:24
hirschenberger pushed a commit to hirschenberger/substrate that referenced this pull request Apr 14, 2021
* tests for assets

* Update frame/assets/src/tests.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update frame/assets/src/tests.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* add force asset status check

* remove TODO

* actually remove TODO

* add force asset status tests

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants