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

Complex ft integration tests (phase 2) #418

Merged
merged 20 commits into from
Mar 7, 2023

Conversation

pgoos
Copy link
Contributor

@pgoos pgoos commented Mar 1, 2023

This PR implements the following integration test scenarios:

// # Mint + Burn rate
// - burn rate should not apply when tokens are received by the issuer because of minting
//
// # Mint + Send commission
// - send commission should not apply when tokens are received by the issuer because of minting
//
// # Burn + Burn rate
// - burn rate should not apply when tokens are burnt
//
// # Burn + Send commission
// - send commission should not apply when tokens are burnt
//
// # Burn + Freeze
// - when someone wants to burn more than is allowed by non-frozen balance tx should fail
//
// # Burn rate + Freeze
// - when burn rate causes a non-frozen balance to be exceeded, tx should fail
//
// # Burn rate + Send Commission + Freeze
// - when there is enough unfrozen coins for the burn rate, but not enough for commission (and vice versa), tx should fail


This change is Reviewable

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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @miladz68, @pgoos, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/assetft_test.go line 2015 at r3 (raw file):

// TestAssetFTSendCommissionRate_OnMinting verifies send commission rate is not applied on received minted tokens
func TestAssetFTSendCommissionRate_OnMinting(t *testing.T) {

How about merge this test and burning rate? The same comment all tests where you do the same for commission and burn rates.
@miladz68 @ysv @wojtek-coreum what to you think ?

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.

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

Copy link
Contributor Author

@pgoos pgoos 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: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @dzmitryhil, @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/assetft_test.go line 2015 at r3 (raw file):

Previously, dzmitryhil (Dzmitry Hil) wrote…

How about merge this test and burning rate? The same comment all tests where you do the same for commission and burn rates.
@miladz68 @ysv @wojtek-coreum what to you think ?

done. Merged burn rate and send commission rate cases on minting/burning scenarios

Copy link
Contributor

@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.

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @pgoos, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/assetft_test.go line 2015 at r3 (raw file):

Previously, pgoos (Piotr Gesicki) wrote…

done. Merged burn rate and send commission rate cases on minting/burning scenarios

I am still seeing 2 tests here.


integration-tests/modules/assetft_test.go line 1960 at r4 (raw file):

// TestAssetFTBurnRate_OnMinting verifies both burn rate and send commision rate are not applied on received minted tokens
func TestAssetFTBurnRate_SendCommissionRate_OnMinting(t *testing.T) {

Maybe TestAssetFT_RatesAreNotAppliedOnMinting is a better name ? wdyt ?


integration-tests/modules/assetft_test.go line 2002 at r4 (raw file):

	requireT.NoError(err)
	tokenIssuedEvents, err := event.FindTypedEvents[*assetfttypes.EventIssued](res.Events)

you don't need to assert this event, we already do it in other test and that is enough.


integration-tests/modules/assetft_test.go line 2186 at r4 (raw file):

	requireT.NoError(err)
	tokenIssuedEvents, err := event.FindTypedEvents[*assetfttypes.EventIssued](res.Events)

same comment, asserting event is not needed.


integration-tests/modules/assetft_test.go line 2194 at r4 (raw file):

		FromAddress: issuer.String(),
		ToAddress:   recipient.String(),
		Amount:      sdk.NewCoins(sdk.NewCoin(denom, sdk.NewInt(500))),

let's send 550 so after freeze and burn, there is still 50 balance available.


integration-tests/modules/assetft_test.go line 2287 at r4 (raw file):

	)

	// Issue an fungible token

an => a


integration-tests/modules/assetft_test.go line 2386 at r4 (raw file):

// TestAssetFTFreeze_WithBurnRate_WithSendCommissionRate_1 verifies that
// it is not possible apply a burn rate on sending tokens - outside of freezing limit (when send commission rate value is within limit)

possible => possible to


integration-tests/modules/assetft_test.go line 2387 at r4 (raw file):

// TestAssetFTFreeze_WithBurnRate_WithSendCommissionRate_1 verifies that
// it is not possible apply a burn rate on sending tokens - outside of freezing limit (when send commission rate value is within limit)
func TestAssetFTFreeze_WithBurnRate_WithSendCommissionRate_1(t *testing.T) {

this test postfixed with 1 and the next test are exactly the same, the only difference is burn and commision rates. maybe you can merge them into a single table test.

Copy link
Collaborator

@wojtek-coreum wojtek-coreum 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 r4, all commit messages.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @pgoos, @silverspase, and @ysv)


integration-tests/modules/assetft_test.go line 2254 at r4 (raw file):

}

// TestAssetFTFreezeAndBurnRate verifies that it is not possible apply a burn rate on sending tokens - outside of freezing limit

possible to apply


integration-tests/modules/assetft_test.go line 2494 at r4 (raw file):

	})

	// try send from recipient1 to recipient2. Tx should fail because burn rate value

try to

Copy link
Collaborator

@wojtek-coreum wojtek-coreum 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, 11 unresolved discussions (waiting on @pgoos, @silverspase, and @ysv)

a discussion (no related file):
Please remove Piotr/ from PR title


@pgoos pgoos changed the title Piotr/complex ft integration tests Complex ft integration tests (phase 2) Mar 3, 2023
Copy link
Contributor Author

@pgoos pgoos 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: 0 of 1 files reviewed, 11 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)

a discussion (no related file):

Previously, wojtek-coreum (Wojtek) wrote…

Please remove Piotr/ from PR title

Done.



integration-tests/modules/assetft_test.go line 2015 at r3 (raw file):

Previously, miladz68 (milad) wrote…

I am still seeing 2 tests here.

what are you referring to @miladz68 ?


integration-tests/modules/assetft_test.go line 1960 at r4 (raw file):

Previously, miladz68 (milad) wrote…

Maybe TestAssetFT_RatesAreNotAppliedOnMinting is a better name ? wdyt ?

Done.

Code quote:

TestAssetFTBurnRate_SendCommissionRate_OnMinting(

integration-tests/modules/assetft_test.go line 2002 at r4 (raw file):

Previously, miladz68 (milad) wrote…

you don't need to assert this event, we already do it in other test and that is enough.

removed.


integration-tests/modules/assetft_test.go line 2186 at r4 (raw file):

Previously, miladz68 (milad) wrote…

same comment, asserting event is not needed.

removed.


integration-tests/modules/assetft_test.go line 2194 at r4 (raw file):

Previously, miladz68 (milad) wrote…

let's send 550 so after freeze and burn, there is still 50 balance available.

updated to 550.

Code quote:

TestAssetFTFreezeAndBurn

integration-tests/modules/assetft_test.go line 2254 at r4 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

possible to apply

Done.


integration-tests/modules/assetft_test.go line 2287 at r4 (raw file):

Previously, miladz68 (milad) wrote…

an => a

done


integration-tests/modules/assetft_test.go line 2386 at r4 (raw file):

Previously, miladz68 (milad) wrote…

possible => possible to

Done.


integration-tests/modules/assetft_test.go line 2494 at r4 (raw file):

Previously, wojtek-coreum (Wojtek) wrote…

try to

done

Copy link
Contributor

@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.

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @pgoos, @silverspase, @wojtek-coreum, and @ysv)

Copy link
Contributor Author

@pgoos pgoos 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: 0 of 1 files reviewed, 5 unresolved discussions (waiting on @miladz68, @silverspase, @wojtek-coreum, and @ysv)


integration-tests/modules/assetft_test.go line 2387 at r4 (raw file):

Previously, miladz68 (milad) wrote…

this test postfixed with 1 and the next test are exactly the same, the only difference is burn and commision rates. maybe you can merge them into a single table test.

updated. Created table driven test

miladz68
miladz68 previously approved these changes Mar 3, 2023
Copy link
Contributor

@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.

Reviewed 1 of 1 files at r6, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @silverspase, @wojtek-coreum, and @ysv)

wojtek-coreum
wojtek-coreum previously approved these changes Mar 7, 2023
Copy link
Collaborator

@wojtek-coreum wojtek-coreum 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 r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @silverspase and @ysv)

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 @silverspase and @ysv)

dzmitryhil
dzmitryhil previously approved these changes Mar 7, 2023
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.

Reviewed 1 of 1 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

@pgoos pgoos dismissed stale reviews from dzmitryhil and wojtek-coreum via 0fb0a33 March 7, 2023 13:49
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.

Reviewed 1 of 1 files at r8, 1 of 1 files at r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

Copy link
Collaborator

@wojtek-coreum wojtek-coreum 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 r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @silverspase and @ysv)

@pgoos pgoos merged commit 93ca77c into master Mar 7, 2023
@pgoos pgoos deleted the piotr/complex-ft-integration-tests branch March 7, 2023 14:08
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.

4 participants