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(community): add switchover param #1704

Merged

Conversation

rhuairahrighairidh
Copy link
Member

@rhuairahrighairidh rhuairahrighairidh commented Sep 8, 2023

Add a timestamp to the communiity params for when the incentive changes take effect.

Description

This uses the new style params instead of the params module. It makes it slightly more inconvenient to do a gov proposal, but saves re-writing the params when we eventually upgrade the sdk.

Checklist

  • PR is against master or a release branch (not feature branch)
  • Security questionnaire reviewed for changes to answers since step 1
  • Code is well tested
    • All public methods have unit tests
    • New features/capabilities have an e2e test
    • Migrations are unit tested
  • Blockchain and Cosmos SDK Gotchas reviewed
  • Migrations written Leaving migrations out to unblock @drklee3 on Add RewardsPerSecond param to x/community module #1707
    • in migration files added directly to master branch, write module migrations generically so both mainnet and testnet can use them. if the change is consensus breaking to a module, the module’s consensus version is incremented and the migration is registered to the module’s services.
    • migrations are fully unit tested to ensure state changes are made correctly
    • record any release branch migrations needed in the feature tech spec document, to be added when the release branch is created
  • Protonet testnet genesis file updated
  • Documentation updated (module spec, proto file comments, and godoc comments)
    • I'll leave spec updates to a later PR. I've added a card to track
  • APIs have been updated and are backwards compatible
    • APIs: evm json-rpc, rest, grpc
  • CLI commands have been updated
  • Changelog has been updated as necessary.

@rhuairahrighairidh rhuairahrighairidh changed the title feat(incentive): add switchover param feat(community): add switchover param Sep 8, 2023
import "time"

var (
DefaultUpgradeTimeDisableInflation = time.Time{}
Copy link
Member

Choose a reason for hiding this comment

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

Should we use a non-zero/default value for the default time and enforce it in Validate()?

In case we're doing Time.After() or Time.Before() checks when using the value on switchover, empty value might cause issues since it's considered earlier

Copy link
Contributor

@DracoLi DracoLi Sep 14, 2023

Choose a reason for hiding this comment

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

The inflation upgrade logic will currently handle unset times by upgrading if unset to ensure vanilla kava chain always have new inflation logic enabled. https://github.com/Kava-Labs/kava/pull/1706/files#diff-15d449f4515711b278439f4600052557555689d56ea115a58619aa3061738906R23

Copy link
Member

Choose a reason for hiding this comment

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

Agree with @DracoLi here, new chains should default to new logic to match mainnet behavior after the upgrade time

Copy link
Contributor

@DracoLi DracoLi left a comment

Choose a reason for hiding this comment

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

does the internal testnet genesis also need to be updated?

@rhuairahrighairidh
Copy link
Member Author

does the internal testnet genesis also need to be updated?

I updated protonet genesis, going off the assumption that protonet follows master, and internal testnet follows latest release.

47416b3d1af6dfd31bab479d78b24cdbb677be31
master
Copy link
Member Author

Choose a reason for hiding this comment

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

@evgeniy-scherbina I saw you pinned this commit recently, is it ok to change back to master?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes

Copy link
Member

@pirtleshell pirtleshell left a comment

Choose a reason for hiding this comment

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

looks good 👍

x/community/keeper/grpc_query.go Outdated Show resolved Hide resolved
@@ -0,0 +1,20 @@
package types
Copy link
Member

Choose a reason for hiding this comment

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

though super simple, i think these public methods should have tests.


// Validate checks the params are valid
func (p Params) Validate() error {
return nil
Copy link
Member

Choose a reason for hiding this comment

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

i'd add a comment here noting why p.UpgradeTimeDisableInflation.IsZero() is still a valid state (zero time means disable inflation on the block 1)

Copy link
Member Author

Choose a reason for hiding this comment

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

added some doc comments to the proto files where the param is defined

drklee3 and others added 6 commits September 18, 2023 09:49
* Add RewardsPerSecond param to community

* Update rewards per second param to int

* Add rewards_per_second to protonet genesis

* Use default rewards per second of 744191

* Include value if negative in Validate error

* Rename RewardsPerSecond param to StakingRewardsPerSecond

* Add changelog entry

* Add param migration, update consensus version to 2

* Update proto docs
Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>
@rhuairahrighairidh rhuairahrighairidh marked this pull request as ready for review September 20, 2023 21:59
Copy link
Member

@drklee3 drklee3 left a comment

Choose a reason for hiding this comment

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

kvtool master template genesis needs to be updated to include the new params to fix the e2e test

@rhuairahrighairidh rhuairahrighairidh merged commit bc260d8 into master Sep 22, 2023
10 checks passed
@rhuairahrighairidh rhuairahrighairidh deleted the ro-incentive-restructuring-add-switchover-param branch September 22, 2023 16:05
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.

6 participants