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

feat(x/ecocredit): implement MsgMintBatch and MsgSealBatch interfaces #991

Merged
merged 18 commits into from
Apr 11, 2022

Conversation

robert-zaremba
Copy link
Collaborator

@robert-zaremba robert-zaremba commented Apr 7, 2022

Description

Closes: #990


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@blushi
Copy link
Member

blushi commented Apr 8, 2022

@robert-zaremba is this ready for review?

@robert-zaremba robert-zaremba marked this pull request as ready for review April 8, 2022 10:33
@robert-zaremba
Copy link
Collaborator Author

is this ready for review?

Yes. I've just turned it off draft and pushed the tests.

Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Looking good. Nice work! A few comments and suggestions.

Comment on lines 21 to 30
{"invalid issuer", MsgMintBatchCredits{Issuer: "invalid"}, "issuer"},
{"invalid denom", MsgMintBatchCredits{Issuer: issuer, BatchDenom: "XXX"}, "invalid denom"},
{"invalid note",
MsgMintBatchCredits{Issuer: issuer, BatchDenom: batchDenom, Note: randstr.String(514)}, "note must"},
{"missing origin tx",
MsgMintBatchCredits{Issuer: issuer, BatchDenom: batchDenom}, "origin_tx is required"},

{"good-no-note", MsgMintBatchCredits{Issuer: issuer, BatchDenom: batchDenom, OriginTx: &batchOrigTx, Issuance: batchIssuances}, ""},
{"good-note", MsgMintBatchCredits{Issuer: issuer, BatchDenom: batchDenom, OriginTx: &batchOrigTx, Note: randstr.String(300),
Issuance: batchIssuances}, ""},
Copy link
Member

@ryanchristo ryanchristo Apr 8, 2022

Choose a reason for hiding this comment

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

Might be nice to give each field its own line to help with readability but ok to leave as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you think it's not readable? I find it easier to read if it doesn't consume significant amount of vertical space.

Copy link
Member

@ryanchristo ryanchristo Apr 8, 2022

Choose a reason for hiding this comment

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

It is readable but I do find it easier to read if each field is on its own line and does not go beyond the line width. As mentioned above, ok to leave as is.

{"good-no-note", MsgMintBatchCredits{Issuer: issuer, BatchDenom: batchDenom, OriginTx: &batchOrigTx, Issuance: batchIssuances}, ""},

vs

{
	"good-no-note",
	MsgMintBatchCredits{
		Issuer:     issuer,
		BatchDenom: batchDenom,
		OriginTx:   &batchOrigTx,
		Issuance:   batchIssuances,
	},
	"",
},

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

stack many of them and your test will take multiple of screens.

x/ecocredit/core/fixtures_test.go Outdated Show resolved Hide resolved
x/ecocredit/core/msg_mint_batch_credits.go Outdated Show resolved Hide resolved
Comment on lines +15 to +16
var errBadReq = sdkerrors.ErrInvalidRequest

Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? I would prefer to see sdkerrors.ErrInvalidRequest used directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

shorter lines are easier to read and don't require to break lines.

Copy link
Member

@ryanchristo ryanchristo Apr 8, 2022

Choose a reason for hiding this comment

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

I agree that shorter lines are easier to read. Curious why this applies here but not above. I still think there is more semantic value in using the sdk error directly given the amount of space saved here is minimal. Ok to leave as is though.

x/ecocredit/core/msg_mint_batch_credits_test.go Outdated Show resolved Hide resolved
@ryanchristo
Copy link
Member

Also looks like you have a minor issue with imports:

core/msg_mint_batch_credits_test.go:4:2: imported and not used: "fmt"

@ryanchristo ryanchristo changed the title feat: implement MsgMintBatch and MsgSealBatch interfaces feat(x/ecocredit): implement MsgMintBatch and MsgSealBatch interfaces Apr 8, 2022
Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Nice work! Looks good to me.

@ryanchristo
Copy link
Member

Looks like you missed an import:

undefined: testutil.GenAddress

@robert-zaremba robert-zaremba enabled auto-merge (squash) April 11, 2022 23:16
Copy link
Contributor

@technicallyty technicallyty left a comment

Choose a reason for hiding this comment

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

lgtm!

@robert-zaremba robert-zaremba merged commit 20783ad into master Apr 11, 2022
@robert-zaremba robert-zaremba deleted the robert/batch-minting-msg-interface branch April 11, 2022 23:19
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.

Add message implementations: MsgMintBatchCredits, MsgSealBatch
4 participants