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): introduce basket params API #962

Closed
wants to merge 4 commits into from

Conversation

technicallyty
Copy link
Contributor

Description

  • introduces param structure to state.proto
  • introduces rpc methods to update params
  • places dummy impl in params.go to appease interface guard

Closes: n/a


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 Mar 31, 2022

Codecov Report

❗ No coverage uploaded for pull request base (master@d0977e6). Click here to learn what that means.
The diff coverage is 0.00%.

@@            Coverage Diff            @@
##             master     #962   +/-   ##
=========================================
  Coverage          ?   72.96%           
=========================================
  Files             ?      198           
  Lines             ?    23365           
  Branches          ?        0           
=========================================
  Hits              ?    17048           
  Misses            ?     5004           
  Partials          ?     1313           
Flag Coverage Δ
experimental-codecov 72.86% <0.00%> (?)
stable-codecov 67.82% <0.00%> (?)

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

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.

As mentioned in #960, it looks like we may not update to Cosmos SDK v0.46 for Regen Ledger v4.0. We can still add the proto updates and the message implementations but we won't be able to migrate until after v4.0.

Depending on what we do for credit class fee, we should do the same here for basket fee.

Also, make sure you run make proto-format.

Comment on lines +90 to +104
// BasketFee is a valid coin denom and amount that may be used as the fee
// for basket creation.
message BasketFee {
// This table is controlled via governance.
option (cosmos.orm.v1alpha1.table) = {
id : 13,
primary_key : {fields : "denom"}
};

// denom is the denom of the fee required to create a basket.
string denom = 1;

// amount is the amount of the fee required to create a basket.
string amount = 2;
}
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned in #960 in relation to the credit class fee, I think we only want to support a single fee. We named the parameter basket_creation_fee and copied the implementation for credit class fee but I don't actually recall any conversations about supporting multiple fees.

Suggested change
// BasketFee is a valid coin denom and amount that may be used as the fee
// for basket creation.
message BasketFee {
// This table is controlled via governance.
option (cosmos.orm.v1alpha1.table) = {
id : 13,
primary_key : {fields : "denom"}
};
// denom is the denom of the fee required to create a basket.
string denom = 1;
// amount is the amount of the fee required to create a basket.
string amount = 2;
}
// BasketFee is a valid coin denom and amount that may be used as the fee
// for basket creation.
message BasketFee {
// This table is controlled via governance.
option (cosmos.orm.v1alpha1.singleton) = {
id : 13,
primary_key : {fields : "denom"}
};
// fee is the fee required to create a basket.
cosmos.base.v1beta1.Coin fee = 1
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

using Coin works as long as it's not the primary key, ORM can't handle imported messages as PK's. i think the denom/amount separation is necessary

Copy link
Member

Choose a reason for hiding this comment

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

we don't need a primary key with a singleton. it just has one instance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right - so then we aren't concerned with fees in other denoms? if we're just going with the amount of $regen only, we could just store the amount string

Copy link
Member

Choose a reason for hiding this comment

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

We just want one fee (could be multiple coins). So just a singleton with repeated Coins

Comment on lines +24 to +26
// UpdateClassFee is a governance method that allows for the addition and removal of fees to be used for the
// basket creation fee.
rpc UpdateBasketFee(MsgUpdateBasketFee) returns (MsgUpdateBasketFeeResponse);
Copy link
Member

@ryanchristo ryanchristo Mar 31, 2022

Choose a reason for hiding this comment

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

Suggested change
// UpdateClassFee is a governance method that allows for the addition and removal of fees to be used for the
// basket creation fee.
rpc UpdateBasketFee(MsgUpdateBasketFee) returns (MsgUpdateBasketFeeResponse);
// UpdateClassFee is a governance method that updates the basket creation fee.
rpc UpdateBasketFee(MsgUpdateBasketFee) returns (MsgUpdateBasketFeeResponse);

Comment on lines +162 to +174
// MsgUpdateBasketFee is the Msg/UpdateBasketFee request type.
message MsgUpdateBasketFee {

// root_address is the address of the signer.
// This MUST equal the address of the gov module for the tx to succeed.
string root_address = 1;

// add_fees defines a list of coins to append to the list of fees that can be used in the basket creation fee.
repeated cosmos.base.v1beta1.Coin add_fees = 2;

// remove_fee_denoms defines a list of denoms to remove from the list of basket creation fees.
repeated string remove_fee_denoms = 3;
}
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned above, I think we want to support a single basket fee and this should update that single fee.

@ryanchristo ryanchristo changed the title feat(ecocredit/basket) introduce basket params API feat(ecocredit/basket): introduce basket params API Mar 31, 2022
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 would prefer if we avoid a -> a pattern


// amount is the amount of the fee required to create a basket.
string amount = 2;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally would be if we don't do a -> a pattern (saving in a key concatenation of the value)

@technicallyty technicallyty marked this pull request as draft April 9, 2022 02:18
@ryanchristo ryanchristo changed the title feat(ecocredit/basket): introduce basket params API feat(x/ecocredit): introduce basket params API Jul 11, 2022
@ryanchristo
Copy link
Member

closing in favor of #1349

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.

4 participants