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

refactor!: manual payout only #68

Merged
merged 10 commits into from
Jun 3, 2024
Merged

refactor!: manual payout only #68

merged 10 commits into from
Jun 3, 2024

Conversation

Reecepbcups
Copy link
Collaborator

@Reecepbcups Reecepbcups commented May 30, 2024

closes #56
closes #27

Summary

  • Removes automatic inflation based payouts per comment
  • Payouts are done directly in sdk.Coin now instead of percents (with automatic inflation being removed).
  • Leaving empty params for future additions as needed

TODO

  • Cleanup
  • Adding e2e test
  • make local-image and make local-image-cov is confusing. We should just use -cov only and have it named local-image

@Reecepbcups Reecepbcups changed the title refactor: manual payout only (excl: e2e) refactor!: manual payout only (excl: e2e) May 30, 2024
api/manifest/v1/tx.pulsar.go Fixed Show fixed Hide fixed
api/manifest/v1/tx.pulsar.go Fixed Show fixed Hide fixed
api/manifest/v1/tx.pulsar.go Fixed Show fixed Hide fixed
x/manifest/types/msgs.go Fixed Show fixed Hide fixed
x/manifest/types/tx.pb.go Fixed Show fixed Hide fixed
@Reecepbcups
Copy link
Collaborator Author

make local-image and make local-image-cov is confusing. We should just use -cov only and have it named local-image

Copy link

codecov bot commented May 30, 2024

Codecov Report

Attention: Patch coverage is 82.41758% with 16 lines in your changes missing coverage. Please review.

Project coverage is 72.94%. Comparing base (218c0f5) to head (21de617).

Files Patch % Lines
x/manifest/types/msgs.go 81.81% 5 Missing and 1 partial ⚠️
x/manifest/client/cli/tx.go 80.76% 4 Missing and 1 partial ⚠️
x/manifest/keeper/keeper.go 66.66% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
+ Coverage   72.31%   72.94%   +0.63%     
==========================================
  Files          33       31       -2     
  Lines        1795     1678     -117     
==========================================
- Hits         1298     1224      -74     
+ Misses        432      403      -29     
+ Partials       65       51      -14     

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

@Reecepbcups Reecepbcups changed the title refactor!: manual payout only (excl: e2e) refactor!: manual payout only May 30, 2024
@Reecepbcups Reecepbcups marked this pull request as ready for review June 2, 2024 01:26
@fmorency fmorency self-requested a review June 3, 2024 12:57
Copy link
Collaborator

@fmorency fmorency left a comment

Choose a reason for hiding this comment

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

Thanks, @Reecepbcups, this is awesome!

Some small comments and nit, nothing major.

interchaintest/helpers/manifest.go Outdated Show resolved Hide resolved
proto/manifest/v1/genesis.proto Outdated Show resolved Hide resolved
x/manifest/keeper/keeper.go Outdated Show resolved Hide resolved
return fmt.Errorf("invalid payout: %v for address: %s", p, addr)
}

if err := k.mintCoinsToAccount(ctx, sdkAddr, coin); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Am I correct to believe this function still allows partial minting if an error occurs in a later iteration?

Can we mitigate this by performing all the address and coin checks first?

The operation can still fail for insert reason in the SDK. Is there a way to avoid partial minting at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Partial minting is not possible in the SDK. Either everything in the Tx is successful for none of it is. Atomnic Txs are not yet in the SDK. maybe SDK v0.52

},
{
desc: "duplicate address",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should keep this check and test. Duplicate addresses should be avoided.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

21de617

Added duplicate test to validate (CLI) and in the MsgServer. Also added to e2e to validate it's deterministic (i.e. reason I did not use a map given the last issue we had, I still need to look more into)

Comment on lines +93 to +95
if c.shouldFail {
require.Error(t, err)
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should check the balances on failure to see if we didn't perform partial minting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ref: partial minting is not possible in the SDK - #68 (comment)

@fmorency fmorency merged commit 53591a6 into main Jun 3, 2024
15 checks passed
@fmorency fmorency deleted the reece/coin-payout-approach branch June 3, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants