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): update genesis import & export to use v1 api #977

Merged
merged 26 commits into from
Apr 15, 2022

Conversation

aleem1314
Copy link
Contributor

@aleem1314 aleem1314 commented Apr 4, 2022

Description

Closes: #976


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)

@aleem1314 aleem1314 changed the title wip: migrate genesis refactor(ecocredit): update genesis import & export to use v1 api Apr 4, 2022
@aleem1314 aleem1314 marked this pull request as ready for review April 8, 2022 12:13
x/ecocredit/client/testsuite/tx.go Outdated Show resolved Hide resolved
x/ecocredit/server/server_test.go Show resolved Hide resolved
x/ecocredit/simulation/genesis.go Show resolved Hide resolved
x/ecocredit/genesis.go Show resolved Hide resolved
@aaronc
Copy link
Member

aaronc commented Apr 8, 2022

If we need to check invariants in validation, we should just import to an in memory orm db and run the invariants. Does that make sense?

@aleem1314 aleem1314 marked this pull request as draft April 10, 2022 15:20
@aleem1314 aleem1314 requested a review from ryanchristo April 11, 2022 07:40
@aleem1314 aleem1314 marked this pull request as ready for review April 11, 2022 07:40
@codecov
Copy link

codecov bot commented Apr 11, 2022

Codecov Report

Merging #977 (1c66a72) into master (0a35fad) will decrease coverage by 10.90%.
The diff coverage is 60.36%.

❗ Current head 1c66a72 differs from pull request most recent head 5f50723. Consider uploading reports for the commit 5f50723 to get more accurate results

@@             Coverage Diff             @@
##           master     #977       +/-   ##
===========================================
- Coverage   60.14%   49.24%   -10.91%     
===========================================
  Files         221      221               
  Lines       23493    23334      -159     
===========================================
- Hits        14130    11490     -2640     
- Misses       8043    10595     +2552     
+ Partials     1320     1249       -71     
Flag Coverage Δ
experimental-codecov 49.13% <60.36%> (-10.90%) ⬇️
stable-codecov 42.02% <60.36%> (-11.88%) ⬇️

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

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.

this is great work 👏🏻 just a few comments/suggestions

x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis.go Show resolved Hide resolved
x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis.go 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 looking great. Very nice work. A few questions and comments.

x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis_test.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis_test.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis_test.go Outdated Show resolved Hide resolved
x/ecocredit/core/genesis_test.go Outdated Show resolved Hide resolved
aleem1314 and others added 3 commits April 12, 2022 10:11
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.

didnt catch these in my last review, but should be good to go after this

x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
"address":"gydQIvR2RUi0N1RJnmgOLVSkcd4=",
"batch_id":"1",
"tradable":"90.003",
"retired":"9.997"
Copy link
Contributor

Choose a reason for hiding this comment

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

we could add escrowed balance here as a test case

Copy link
Member

Choose a reason for hiding this comment

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

Looks like this might have been overlooked. We should include a test case with a positive escrowed amount.

Copy link
Member

Choose a reason for hiding this comment

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

It also looks like you are missing a BatchBalance validation.

Copy link
Member

Choose a reason for hiding this comment

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

Also CreditType and BatchSupply validation.

Copy link
Contributor Author

@aleem1314 aleem1314 Apr 14, 2022

Choose a reason for hiding this comment

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

Looks like this might have been overlooked. We should include a test case with a positive escrowed amount.

713955d

Also CreditType and BatchSupply validation.

Added validation for CreditType. Batch balance & supply validation is already covered by ValidateGenesis.

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. One minor suggestion, message field validation as you proposed, and changes to include escrowed.

x/ecocredit/core/genesis_test.go 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.

Updates look great. The proto message validation is a nice add. A few more comments.

x/ecocredit/core/genesis.go Show resolved Hide resolved
x/ecocredit/core/genesis.go Outdated Show resolved Hide resolved
"address":"gydQIvR2RUi0N1RJnmgOLVSkcd4=",
"batch_id":"1",
"tradable":"90.003",
"retired":"9.997"
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this might have been overlooked. We should include a test case with a positive escrowed amount.

"address":"gydQIvR2RUi0N1RJnmgOLVSkcd4=",
"batch_id":"1",
"tradable":"90.003",
"retired":"9.997"
Copy link
Member

Choose a reason for hiding this comment

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

It also looks like you are missing a BatchBalance validation.

"address":"gydQIvR2RUi0N1RJnmgOLVSkcd4=",
"batch_id":"1",
"tradable":"90.003",
"retired":"9.997"
Copy link
Member

Choose a reason for hiding this comment

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

Also CreditType and BatchSupply validation.

aleem1314 and others added 2 commits April 14, 2022 16:42
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
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 looks great. Very nice work.

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

@ryanchristo ryanchristo enabled auto-merge (squash) April 15, 2022 03:57
@ryanchristo ryanchristo merged commit b21763e into master Apr 15, 2022
@ryanchristo ryanchristo deleted the aleem/ecocredit-genesis-migration branch April 15, 2022 04:00
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.

update ecocredit genesis to use v1 types
4 participants