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(ecocredit): remove unnecessary fields in events #1044

Merged
merged 16 commits into from
May 4, 2022

Conversation

technicallyty
Copy link
Contributor

@technicallyty technicallyty commented Apr 20, 2022

Description

Ref: #1035


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)

@codecov
Copy link

codecov bot commented Apr 20, 2022

Codecov Report

Merging #1044 (224240b) into master (c160e04) will decrease coverage by 6.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1044      +/-   ##
==========================================
- Coverage   68.91%   62.88%   -6.03%     
==========================================
  Files         218      213       -5     
  Lines       21350    19426    -1924     
==========================================
- Hits        14713    12217    -2496     
- Misses       5288     5929     +641     
+ Partials     1349     1280      -69     
Flag Coverage Δ
experimental-codecov ?
stable-codecov 62.88% <100.00%> (+0.01%) ⬆️

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

@technicallyty technicallyty marked this pull request as ready for review April 25, 2022 18:10
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 although we might need to make adjustments for the basket changes because we are currently not bumping the basket proto version in this next release.

proto/regen/ecocredit/basket/v1/events.proto Outdated Show resolved Hide resolved
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.

We shouldn't be marking the event messages as deprecated, only the credits field within the events that have it as deprecated. We should also avoid DEPRECATED in all caps and follow the same format as the sdk. We don't need to return the credits in the events if they are deprecated and we can specify that in the deprecated comment and revert 4e607ee.

proto/regen/ecocredit/basket/v1/events.proto Outdated Show resolved Hide resolved
proto/regen/ecocredit/basket/v1/events.proto Outdated Show resolved Hide resolved
proto/regen/ecocredit/basket/v1/events.proto Outdated Show resolved Hide resolved
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.

This is a step in the right direction but the current changes only partially solve the issue. We are still returning a lot of unnecessary fields for events and we should further refine. I would be happy to do a pair-programming session on this to provide clarity on the proposed changes.

I also think it might be helpful to take a look at the group module and how minimal those events are. I do think it would be nice to include the address such as the admin, issuer, etc, which is not included in the group events, but not necessary because that information can be queried using the main identifier included in the event.

https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/group/v1/events.proto

proto/regen/ecocredit/marketplace/v1/events.proto Outdated Show resolved Hide resolved
x/ecocredit/server/marketplace/update_sell_orders.go Outdated Show resolved Hide resolved
Copy link
Contributor

@aleem1314 aleem1314 left a comment

Choose a reason for hiding this comment

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

lgtm

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.

I also think it might be helpful to take a look at the group module and how minimal those events are. I do think it would be nice to include the address such as the admin, issuer, etc, which is not included in the group events, but not necessary because that information can be queried using the main identifier included in the event.

https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/group/v1/events.proto

For the update events in core...

  • EventClassAdminUpdated
  • EventClassIssuersUpdated
  • EventClassMetadataUpdated
  • EventProjectAdminUpdated
  • EventProjectMetadataUpdated

...we could reduce the fields to just the identifier that was updated, which is how it is done in the group module. To avoid dragging this out, I can approve and we can get these changes merged and then address my comments in a followup. I think this is a step in the right direction and would be happy to do pair-programming on the proposed changes if you would prefer to handle them in this pull request. Otherwise I think we should keep the issue open after merging these changes.

@technicallyty
Copy link
Contributor Author

I also think it might be helpful to take a look at the group module and how minimal those events are. I do think it would be nice to include the address such as the admin, issuer, etc, which is not included in the group events, but not necessary because that information can be queried using the main identifier included in the event.
https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/group/v1/events.proto

For the update events in core...

  • EventClassAdminUpdated
  • EventClassIssuersUpdated
  • EventClassMetadataUpdated
  • EventProjectAdminUpdated
  • EventProjectMetadataUpdated

...we could reduce the fields to just the identifier that was updated, which is how it is done in the group module. To avoid dragging this out, I can approve and we can get these changes merged and then address my comments in a followup. I think this is a step in the right direction and would be happy to do pair-programming on the proposed changes if you would prefer to handle them in this pull request. Otherwise I think we should keep the issue open after merging these changes.

i'm ok with either merging or you can just take over this PR 👍🏻

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.

This is a step in the right direction. Approving and merging but keeping the issue open and will add a followup pull request. I started making adjustments but stumbled into a bit of a rabbit hole with how we've been writing events and how I think we can improve and I think a separate pull request would make more sense with the updates I would like to make.

@ryanchristo ryanchristo enabled auto-merge (squash) May 3, 2022 23:56
@ryanchristo ryanchristo merged commit b237a50 into master May 4, 2022
@ryanchristo ryanchristo deleted the ty/1035-events_cleanup branch May 4, 2022 00:34
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.

3 participants