Skip to content
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

Allow zero precision for ft tokens #787

Merged
merged 5 commits into from
Mar 4, 2024
Merged

Conversation

miladz68
Copy link
Contributor

@miladz68 miladz68 commented Feb 29, 2024

Description

Allow zero precision for ft tokens

Reviewers checklist:

  • Try to write more meaningful comments with clear actions to be taken.
  • Nit-picking should be unblocking. Focus on core issues.

Authors checklist

  • Provide a concise and meaningful description
  • Review the code yourself first, before making the PR.
  • Annotate your PR in places that require explanation.
  • Think and try to split the PR to smaller PR if it is big.

This change is Reviewable

@miladz68 miladz68 requested a review from a team as a code owner February 29, 2024 11:13
@miladz68 miladz68 requested review from dzmitryhil, ysv and wojtek-coreum and removed request for a team February 29, 2024 11:13
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.28%. Comparing base (ab054cc) to head (00d2061).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #787      +/-   ##
==========================================
+ Coverage   35.26%   35.28%   +0.01%     
==========================================
  Files         171      171              
  Lines       47469    47481      +12     
==========================================
+ Hits        16742    16754      +12     
  Misses      27482    27482              
  Partials     3245     3245              
Flag Coverage Δ
coreum 32.03% <ø> (+0.01%) ⬆️
coreum-integration-tests-modules 16.80% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @wojtek-coreum)


integration-tests/modules/assetft_test.go line 117 at r1 (raw file):

// TestAssetFTIssue tests issue functionality of fungible tokens.
func TestAssetFTIssue_ZeroPrecision(t *testing.T) {

I suggest to merge this test with TestAssetFTIssue.
I think we should move towards less code in our integration tests because they might become unmaintainable at some point.

you can change it to table test with 2 cases.
input args for tests is &assetfttypes.MsgIssue and output to assert (the only thing I find different) is expectedMetadata := banktypes.Metadata. Everything else seems to be same


x/asset/ft/keeper/keeper.go line 320 at r1 (raw file):

	// we are force to have single entry in denom units and also Display must be the
	// same as Base.
	if precision == 0 {

nit: maybe it makes sense to write unit-tests for this part if possible

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @miladz68, @wojtek-coreum, and @ysv)


x/asset/ft/keeper/keeper.go line 320 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

nit: maybe it makes sense to write unit-tests for this part if possible

agree

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 5 files reviewed, 1 unresolved discussion (waiting on @wojtek-coreum and @ysv)


integration-tests/modules/assetft_test.go line 117 at r1 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

I suggest to merge this test with TestAssetFTIssue.
I think we should move towards less code in our integration tests because they might become unmaintainable at some point.

you can change it to table test with 2 cases.
input args for tests is &assetfttypes.MsgIssue and output to assert (the only thing I find different) is expectedMetadata := banktypes.Metadata. Everything else seems to be same

Done.


x/asset/ft/keeper/keeper.go line 320 at r1 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

agree

Done.

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @miladz68 and @wojtek-coreum)


x/asset/ft/keeper/keeper_test.go line 155 at r2 (raw file):

}

func TestKeeper_Issue_ZeroPrecision(t *testing.T) {

sorry, my comment probably confused you.
I meant unit-tests for token issuance generally not only for Precision: 0, case

Code quote:

TestKeeper_Issue_ZeroPrecision

Copy link
Contributor Author

@miladz68 miladz68 left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @wojtek-coreum and @ysv)


x/asset/ft/keeper/keeper_test.go line 155 at r2 (raw file):

Previously, ysv (Yaroslav Savchuk) wrote…

sorry, my comment probably confused you.
I meant unit-tests for token issuance generally not only for Precision: 0, case

I still don't get it, we already have tests for token issuance both in unit and integration tests.

Copy link
Contributor

@ysv ysv left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @wojtek-coreum)

Copy link
Contributor

@dzmitryhil dzmitryhil left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @wojtek-coreum)

@miladz68 miladz68 merged commit 3230848 into master Mar 4, 2024
10 checks passed
@miladz68 miladz68 deleted the milad/allow-zero-precision branch March 4, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants