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 core params API #960

Closed
wants to merge 5 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)

"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
)

var _, _, _, _ legacytx.LegacyMsg = &MsgAddCreditType{}, &MsgUpdateClassCreatorAllowlist{}, &MsgToggleAllowlist{}, &MsgUpdateClassFee{}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

each of these can be placed in their own file, just lumping them in here for now to appease the CI

@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     #960   +/-   ##
=========================================
  Coverage          ?   72.93%           
=========================================
  Files             ?      198           
  Lines             ?    23375           
  Branches          ?        0           
=========================================
  Hits              ?    17049           
  Misses            ?     5010           
  Partials          ?     1316           
Flag Coverage Δ
experimental-codecov 72.83% <0.00%> (?)
stable-codecov 67.83% <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.

This is looking good and I'm excited for the gov module updates.

That being said, 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.

I think we should avoid batch updates to these parameters and each update should warrant its own proposal. Curious to hear what @clevinson and @aaronc think.

Also, make sure you run make proto-format.

Comment on lines +267 to +281
// CreditClassFee is a valid coin denom and amount that may be used as the fee
// for credit class creation.
message CreditClassFee {
// 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 credit class.
string denom = 1;

// amount is the amount of the fee required to create a credit class.
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.

Do we want to support multiple fees? Should this be a singleton table?

I known I already brought this up in the previous pull request and the two of us moved on because the current live implementation uses repeated but I'm pretty sure we only want to support a single set fee (and we want the fee to be in REGEN).

Even though the current implementation uses repeated, the name of the field is credit_class_fee and I think this is actually an oversight. Looking back at the original issue and pull request, I don't see any mention of multiple fees (#351 and #375) nor do I recall conversations about supporting multiple fees.

Also, we should use cosmos.base.v1beta1.Coin.

Suggested change
// CreditClassFee is a valid coin denom and amount that may be used as the fee
// for credit class creation.
message CreditClassFee {
// 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 credit class.
string denom = 1;
// amount is the amount of the fee required to create a credit class.
string amount = 2;
}
// CreditClassFee is the fee required to create a credit class.
message CreditClassFee {
// 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 credit class.
cosmos.base.v1beta1.Coin fee = 1
}

Comment on lines +51 to +52
// AddCreditType is a governance method that allows the addition of new credit types to the network.
rpc AddCreditType(MsgAddCreditType) returns (MsgAddCreditTypeResponse);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// AddCreditType is a governance method that allows the addition of new credit types to the network.
rpc AddCreditType(MsgAddCreditType) returns (MsgAddCreditTypeResponse);
// AddCreditType is a governance method that adds new credit types to the network.
rpc AddCreditType(MsgAddCreditType) returns (MsgAddCreditTypeResponse);

Comment on lines +54 to +56
// UpdateClassCreatorAllowlist is a governance method that allows for the addition and removal of addresses from the class creation allowlist.
// note: the allowlist is only effective when the allowlist parameter is set to false.
rpc UpdateClassCreatorAllowlist(MsgUpdateClassCreatorAllowlist) returns (MsgUpdateClassCreatorAllowlistResponse);
Copy link
Member

Choose a reason for hiding this comment

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

In line with AllowedAskDenoms and the current allowed_class_creators param, I think we should update the name here to include AllowedClassCreator or AllowedCreditClassCreator.

I also think we should have two methods here, one for adding a credit class creator and one for removing a credit class creator. Adding and removing credit class creators are significant actions and I think each credit class creator added or removed warrants its own proposal.

Suggested change
// UpdateClassCreatorAllowlist is a governance method that allows for the addition and removal of addresses from the class creation allowlist.
// note: the allowlist is only effective when the allowlist parameter is set to false.
rpc UpdateClassCreatorAllowlist(MsgUpdateClassCreatorAllowlist) returns (MsgUpdateClassCreatorAllowlistResponse);
// AddAllowedCreditClassCreator is a governance method that adds an address to the list of allowed credit class creators.
rpc AddAllowedCreditClassCreator(MsgAddAllowedCreditClassCreator) returns (MsgAddAllowedCreditClassCreatorResponse);
// RemoveAllowedCreditClassCreator is a governance method that removes an address from the list of allowed credit class creators.
rpc RemoveAllowedCreditClassCreator(MsgRemoveAllowedCreditClassCreator) returns (MsgRemoveAllowedCreditClassCreatorResponse);

Comment on lines +58 to +61
// ToggleAllowlist is a governance method that toggles the network allowlist to on or off.
// when on, the class creator allowlist is used to enforce which addresses may create classes.
// when off, any address may create classes.
rpc ToggleAllowlist(MsgToggleAllowlist) returns (MsgToggleAllowlistResponse);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// ToggleAllowlist is a governance method that toggles the network allowlist to on or off.
// when on, the class creator allowlist is used to enforce which addresses may create classes.
// when off, any address may create classes.
rpc ToggleAllowlist(MsgToggleAllowlist) returns (MsgToggleAllowlistResponse);
// ToggleCreditClassAllowlist is a governance method that toggles the network allowlist to on or off.
// when on, the class creator allowlist is used to enforce which addresses may create classes.
// when off, any address may create classes.
rpc ToggleCreditClassAllowlist(MsgToggleCreditClassAllowlist) returns (MsgToggleCreditClassAllowlistResponse);

Comment on lines +63 to +65
// UpdateClassFee is a governance method that allows for the addition and removal of fees to be used for the
// class creation fee.
rpc UpdateClassFee(MsgUpdateClassFee) returns (MsgUpdateClassFeeResponse);
Copy link
Member

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
// class creation fee.
rpc UpdateClassFee(MsgUpdateClassFee) returns (MsgUpdateClassFeeResponse);
// UpdateCreditClassFee is a governance method that updates the credit class creation fee.
rpc UpdateCreditClassFee(MsgUpdateCreditClassFee) returns (MsgUpdateCreditClassFeeResponse);

Comment on lines +337 to +346
// MsgAddCreditType is the Msg/AddCreditType request type.
message MsgAddCreditType {

// 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;

// credit_types defines a credit type to add to the credit types parameter.
repeated CreditType credit_types = 2;
}
Copy link
Member

Choose a reason for hiding this comment

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

Either we should rename this message to MsgAddCreditTypes or we should only allow one credit type to be updated at a time. Similar to adding and removing credit class creators, adding a credit types is a significant action and I think each credit type added warrants its own proposal.

Suggested change
// MsgAddCreditType is the Msg/AddCreditType request type.
message MsgAddCreditType {
// 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;
// credit_types defines a credit type to add to the credit types parameter.
repeated CreditType credit_types = 2;
}
// MsgAddCreditType is the Msg/AddCreditType request type.
message MsgAddCreditType {
// 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;
// credit_types defines a credit type to add to the credit types parameter.
CreditType credit_type = 2;
}

Comment on lines +351 to +363
// MsgUpdateClassCreatorAllowlist is the Msg/UpdateClassCreatorAllowlist request type.
message MsgUpdateClassCreatorAllowlist{

// 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_creators is a list of addresses to add to the allowed class creator list
repeated string add_creators = 2;

// remove_creators is a list of addresses to remove from the allowed class creator list
repeated string remove_creators = 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 this should be split into two methods, one for adding a single credit class creator and one for removing a single credit class creator.

Comment on lines +375 to +376
// setting defines the boolean value to set the allowlist on or off.
bool setting = 2;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// setting defines the boolean value to set the allowlist on or off.
bool setting = 2;
// enabled determines whether the credit class creator allowlist is enabled.
bool enabled = 2;

Comment on lines +382 to +394
// MsgUpdateClassFee is the Msg/UpdateClassFee request type.
message MsgUpdateClassFee {

// 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 class creation fee.
repeated cosmos.base.v1beta1.Coin add_fees = 2;

// remove_fee_denoms defines a list of denoms to remove from the list of class 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 credit class fee and this should update that single fee.

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

closing in favor of #1354

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.

2 participants