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): credit type gov handler #1015

Merged
merged 31 commits into from
Apr 21, 2022

Conversation

technicallyty
Copy link
Contributor

@technicallyty technicallyty commented Apr 13, 2022

Description

  • adds and registers gov handler for credit type proposals
  • implements CLI cmd for creating proposals
  • moves some code around that was causing import cycles (namely between x/ecocredit and x/ecocredit/coref

To reduce diff footprint, i've added follow ups here: #1016

Closes: #1005


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)

app/app.go Outdated Show resolved Hide resolved
x/ecocredit/client/core/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/expected_keepers.go Show resolved Hide resolved
x/ecocredit/module/module.go Show resolved Hide resolved
@technicallyty
Copy link
Contributor Author

technicallyty commented Apr 13, 2022

--- FAIL: TestSimAppExportAndBlockedAddrs (0.22s)
panic: parameter uploadAccess not registered [recovered]
	panic: parameter uploadAccess not registered

😱 not sure what this is??

@codecov
Copy link

codecov bot commented Apr 13, 2022

Codecov Report

Merging #1015 (00001e9) into master (5819dcb) will increase coverage by 0.10%.
The diff coverage is 64.42%.

@@            Coverage Diff             @@
##           master    #1015      +/-   ##
==========================================
+ Coverage   59.74%   59.85%   +0.10%     
==========================================
  Files         226      231       +5     
  Lines       22765    22840      +75     
==========================================
+ Hits        13601    13670      +69     
- Misses       7843     7844       +1     
- Partials     1321     1326       +5     
Flag Coverage Δ
experimental-codecov 59.70% <64.07%> (+0.05%) ⬆️
stable-codecov 53.41% <64.07%> (+0.11%) ⬆️

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

@technicallyty technicallyty changed the title feat: introduce gov handler for credit types feat: credit type gov handler Apr 13, 2022
@technicallyty technicallyty marked this pull request as ready for review April 13, 2022 03:58
@aleem1314
Copy link
Contributor

aleem1314 commented Apr 13, 2022

--- FAIL: TestSimAppExportAndBlockedAddrs (0.22s)
panic: parameter uploadAccess not registered [recovered]
	panic: parameter uploadAccess not registered

scream not sure what this is??

Looks like something to do with cosmwasm. Might be related to.

Copy link
Collaborator

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

I suggest to better separate integration tests from unit tests, and to the latter at the unit level.

x/ecocredit/server/abci_test.go Outdated Show resolved Hide resolved
x/ecocredit/expected_keepers.go Show resolved Hide resolved
x/ecocredit/server/abci_test.go Outdated Show resolved Hide resolved
@ryanchristo ryanchristo changed the title feat: credit type gov handler feat(x/ecocredit): credit type gov handler Apr 17, 2022
x/ecocredit/core/msg_credit_type.go Show resolved Hide resolved
x/ecocredit/server/core/new_credit_type.go Outdated Show resolved Hide resolved
x/ecocredit/server/expected_keepers.go Outdated Show resolved Hide resolved
x/ecocredit/server/core/proposal_handler.go Outdated Show resolved Hide resolved
x/ecocredit/core/msg_credit_type_proposal.go Show resolved Hide resolved
Comment on lines +14 to +16
if len(m.Unit) == 0 {
return sdkerrors.ErrInvalidRequest.Wrap("unit cannot be empty")
}
Copy link
Member

Choose a reason for hiding this comment

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

I think #429 would be nice to have alongside these updates but this could be added as a followup.

app/stable_appconfig.go Outdated Show resolved Hide resolved
proto/regen/ecocredit/v1/types.proto Show resolved Hide resolved
x/ecocredit/client/core/proposal.go Outdated Show resolved Hide resolved

func TxCreditTypeProposalCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "credit-type-proposal [proposal-title] [proposal-description] [credit_type_abbreviation] [credit_type_name] [units] [precision] [flags]",
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a lot of positional arguments. I think we shouldn't even implement this and just let people submit a JSON proposal. I don't expect this to be called more than 5-10 times ever in production

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is that how most folks submit proposals? i could change it to a single argument (json file)

Copy link
Member

@ryanchristo ryanchristo Apr 19, 2022

Choose a reason for hiding this comment

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

I think aaron is referring to the gov command:

regen tx gov submit-proposal --proposal="path/to/proposal.json" --from mykey

Where proposal.json includes:

{
  "title": "Add Biochar Credit Type",
  "description": "Add Biochar credit type to the list of allowed credit types",
  "type": "CreditTypeProposal",
  "credit_type": {
    "abbreviation": "BC",
    "name": "biochar",
    "unit": "tonnes of organic carbon",
    "precision": 6,
  },
  "deposit": "10regen"
}

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if the above works and it should be tested before removing the command implemented here. If not, I think a json or yaml file might be nice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah ok didn't know of that one. removed the cli command - fa42e6d

Copy link
Member

Choose a reason for hiding this comment

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

Does it work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

didnt see your last comment 🥲, wasn't able to get this working. maybe we can take a look tomorrows standup? can just revert the removal if we cant get it going

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Let's try tomorrow and then revert if we can't get it going.

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

ryanchristo commented Apr 20, 2022

Can we add a unit test for the command as it looks like we might migrate away from integration tests? #1041

Moving forward, we will treat cli tests as a last priority and as a nice to have in the backlog.

@technicallyty technicallyty merged commit 0ad686d into master Apr 21, 2022
@technicallyty technicallyty deleted the ty/1005-credit_type_gov_handler branch April 21, 2022 23:07
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.

Use Gov Handler for custom credit type proposals
5 participants