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(ecocredit): allow denom proposal handler #1072

Merged
merged 42 commits into from
May 6, 2022

Conversation

technicallyty
Copy link
Contributor

@technicallyty technicallyty commented May 2, 2022

Description

  • adds gov handler for ask denoms

Closes: #1045


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 May 2, 2022

Codecov Report

Merging #1072 (419a93c) into master (8231250) will decrease coverage by 6.24%.
The diff coverage is 65.29%.

@@            Coverage Diff             @@
##           master    #1072      +/-   ##
==========================================
- Coverage   68.05%   61.81%   -6.25%     
==========================================
  Files         206      207       +1     
  Lines       20839    19063    -1776     
==========================================
- Hits        14182    11783    -2399     
- Misses       5352     6025     +673     
+ Partials     1305     1255      -50     
Flag Coverage Δ
experimental-codecov ?
stable-codecov 61.81% <65.29%> (+0.11%) ⬆️

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

proto/regen/ecocredit/v1/events.proto Outdated Show resolved Hide resolved
x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/core/msg_credit_type.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_ask_denom.go Outdated Show resolved Hide resolved
@technicallyty technicallyty marked this pull request as ready for review May 2, 2022 22:18
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. I didn't add suggestions for all the changes needed but we should consistently refer to this either "ask denom" or "allowed denom". I think I prefer the latter as this will be less work when we introduce buy orders and the proto state message is currently AllowedDenom.

proto/regen/ecocredit/marketplace/v1/types.proto Outdated Show resolved Hide resolved
x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_test.go Outdated Show resolved Hide resolved
x/ecocredit/server/marketplace/add_ask_denom.go Outdated Show resolved Hide resolved
return err
}
askDenom := p.AllowedDenom
if err := k.stateStore.AllowedDenomTable().Insert(sdk.WrapSDKContext(ctx), &api.AllowedDenom{
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need remove ask denom? With params, we could update KeyAllowedAskDenoms param to remove denom.

Copy link
Contributor Author

@technicallyty technicallyty May 4, 2022

Choose a reason for hiding this comment

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

I think its preferred to have them in ORM even if we lose the ability to remove denoms. if its needed, i could add another handler for removing denoms, or we can wait til v0.46 where we will do msg_server based parameters management, and we can have more robust adding/removing/updating commands

technicallyty and others added 2 commits May 4, 2022 08:48
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
x/ecocredit/marketplace/msg_allowed_denom_proposal.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go Outdated Show resolved Hide resolved
x/ecocredit/marketplace/msg_allowed_denom_test.go Outdated Show resolved Hide resolved
proto/regen/ecocredit/v1/events.proto Outdated Show resolved Hide resolved
x/ecocredit/server/core/add_credit_type.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.

Not sure what's causing the following error:

--- FAIL: TestInitCmd (0.08s)
panic: allow-denom-proposal flag redefined: output [recovered]
	panic: allow-denom-proposal flag redefined: output

x/ecocredit/server/proposal.go Outdated Show resolved Hide resolved
x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
@ryanchristo ryanchristo changed the title feat(ecocredit): ask denom proposal handler feat(ecocredit): allow denom proposal handler May 5, 2022
@ryanchristo
Copy link
Member

ryanchristo commented May 5, 2022

Was attempting to manually test and it looks like the command is not included in the list of available commands.

@technicallyty
Copy link
Contributor Author

Was attempting to manually test and it looks like the command is not included in the list of available commands.

are you running the correct command? it's showing up for me when i do regen tx gov submit-proposal. should be the first one listed.

@ryanchristo
Copy link
Member

are you running the correct command?

Whoops. I was not. Looks like the credit type proposal command is listed in regen tx ecocredit -h. I saw that and assumed it would be the same for allow denom proposal. The credit type proposal is in both at the moment. Testing now.

@technicallyty
Copy link
Contributor Author

are you running the correct command?

Whoops. I was not. Looks like the credit type proposal command is listed in regen tx ecocredit -h. I saw that and assumed it would be the same for allow denom proposal. The credit type proposal is in both at the moment. Testing now.

ahh ok, i think having it show up in ecocredit's tx commands might cause errors.. if you are willing to test that lmk, i can remove if it bugs out

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! Tested with the updated example and again with a new denom. Would be nice to query allowed denoms from the CLI and to include those changes here.

  • submit a proposal (used updated example)
  • able to query proposal and confirmed fields
  • unable to confirm denom included in allowed denoms using the CLI
  • confirmed denom included in allowed denoms using gRPC endpoint

x/ecocredit/client/marketplace/proposal.go Outdated Show resolved Hide resolved
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
@technicallyty
Copy link
Contributor Author

technicallyty commented May 5, 2022

Nice work! Tested with the updated example and again with a new denom. Would be nice to query allowed denoms from the CLI and to include those changes here.

  • submit a proposal (used updated example)
  • able to query proposal and confirmed fields
  • unable to confirm denom included in allowed denoms using the CLI
  • confirmed denom included in allowed denoms using gRPC endpoint

opened #1093 for the 3rd check. i would prefer to do in a follow up, might be overwhelming for an additional reviewer to consume in one go here imo

@ryanchristo
Copy link
Member

ryanchristo commented May 5, 2022

tx ecocredit credit-type-proposal throws the error Error: unknown flag: --from and tx gov submit-proposal credit-type-proposal throws the error Error: unable to resolve type URL /regen.ecocredit.v1.CreditTypeProposal.

opened #1093 for the 3rd check. i would prefer to do in a follow up, might be overwhelming for an additional reviewer to consume in one go here imo

Can we maybe add fixes to credit type proposal to the issue and handle in one pull request then? Adding the query command will be a small amount of changes and I'm assuming these fixes would be too.

@technicallyty
Copy link
Contributor Author

tx ecocredit credit-type-proposal throws the error Error: unknown flag: --from and tx gov submit-proposal credit-type-proposal throws the error Error: unable to resolve type URL /regen.ecocredit.v1.CreditTypeProposal.

opened #1093 for the 3rd check. i would prefer to do in a follow up, might be overwhelming for an additional reviewer to consume in one go here imo

Can we maybe add fixes to credit type proposal to the issue and handle in one pull request then? Adding the query command will be a small amount of changes and I'm assuming these fixes would be too.

just added those fixes in 6fd0058 👍🏻

@ryanchristo
Copy link
Member

just added those fixes in 6fd0058 👍🏻

Tested. No longer listed in tx ecocredit and successfully added with tx gov submit-proposal.

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.

tACK. Nice work. 💪

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

@technicallyty technicallyty enabled auto-merge (squash) May 6, 2022 14:59
@technicallyty technicallyty merged commit ea43f14 into master May 6, 2022
@technicallyty technicallyty deleted the ty/1045-ask_denom_gov_handler branch May 6, 2022 15:41
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.

Gov handler for marketplace AskDenoms
3 participants