Skip to content

Backport minimum commission staking parameter from the cosmos-sdk #8

Merged
evan-forbes merged 7 commits into
release/v1.1.xfrom
lydia/backport-min-comiss
Jan 12, 2022
Merged

Backport minimum commission staking parameter from the cosmos-sdk #8
evan-forbes merged 7 commits into
release/v1.1.xfrom
lydia/backport-min-comiss

Conversation

@lydia-pierce

Copy link
Copy Markdown
Collaborator

This PR is a combination of reverting the code we had previously merged into Chihuahua from Juno, and adding some code from the sdk.

We give credit to @marbar3778 and Binary Holdings for being crucial in this PR.

Key changes

  • Bumps to the latest stable sdk version that is slightly modified to backport upcoming changes to the staking module to add a minimum commission fee (sdk changelog here)
  • Adds minimum commission fee as a parameter to the staking module
  • Stops validators from creating or changing to a commission fee below that of the minimum commission fee
  • Forces validator below the new minimum commission fee to change to the minimum commission fee

Testing in place

  • Uses unit tests provided by the backported PR
  • Local network: provides instructions and scripts to replicate

lydia.pierce@principia.edu and others added 5 commits January 9, 2022 19:21
* Evan/backported min commish (#3)

* try out new update

* add scripts to test the update

* try without loading empty bytes

* register services to the same configurator

* replace cosmos-sdk with pomifer fork

* udpate go mod to new cosmos-sdk version

* go mod tidy
@evan-forbes evan-forbes changed the title Lydia/backport min comiss Backport minimum commission staking parameter from the cosmos-sdk Jan 10, 2022
Comment on lines +3 to +27
set -o errexit -o nounset

CHAINID="test"

# Build genesis file incl account for passed address
coins="100000000000stake,100000000000samoleans"
chihuahuad init $CHAINID --chain-id $CHAINID

# modify the gov params to be super short
sed -i 's#"max_deposit_period": "172800s"#"max_deposit_period": "1s"#g' ~/.chihuahua/config/genesis.json
sed -i 's#"voting_period": "172800s"#"voting_period": "30s"#g' ~/.chihuahua/config/genesis.json

chihuahuad keys add validator --keyring-backend="test"
chihuahuad add-genesis-account $(chihuahuad keys show validator -a --keyring-backend="test") $coins
chihuahuad gentx validator 5000000000stake --keyring-backend="test" --chain-id $CHAINID --commission-rate "0.01"
chihuahuad collect-gentxs

# Set proper defaults and change ports
sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.chihuahua/config/config.toml
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' ~/.chihuahua/config/config.toml
sed -i 's/timeout_propose = "3s"/timeout_propose = "1s"/g' ~/.chihuahua/config/config.toml
sed -i 's/index_all_keys = false/index_all_keys = true/g' ~/.chihuahua/config/config.toml

# Start the chihuahua
chihuahuad start No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we're happy to remove these scripts, but wanted to provide them for anyone wanting to test a local testnet upgrade

Comment thread app/app.go Outdated
Comment thread app/app.go
// RegisterUpgradeHandlers returns upgrade handlers
func (app *App) RegisterUpgradeHandlers(cfg module.Configurator) {
app.UpgradeKeeper.SetUpgradeHandler(v1UpgradeName, func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
minCommissionRate := sdk.NewDecWithPrec(5, 2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we didn't move the 5 out as a constant here, as we would just delete it later. To change in the future, we only have to change the staking parameter.

lydia.pierce@principia.edu added 2 commits January 9, 2022 22:20
@tac0turtle

Copy link
Copy Markdown

to preface this, this won't bump everyones commission to 5% this still needs to be added to the sdk.

@evan-forbes

evan-forbes commented Jan 10, 2022

Copy link
Copy Markdown
Contributor

to preface this, this won't bump everyones commission to 5% this still needs to be added to the sdk.

I think we included this in the upgrade handler, it seemed to bump the commission up on our local testnet

edit: and the most recent testnet

@lydia-pierce lydia-pierce changed the base branch from v1.1.0 to release/v1.1.x January 10, 2022 17:07
@Highlander-maker

Copy link
Copy Markdown

Hey, will validators need to upgrade or will the chain continue as is?

@evan-forbes

Copy link
Copy Markdown
Contributor

Hey, will validators need to upgrade or will the chain continue as is?

Validators will need to upgrade at a specific tbd height, as this upgrade is consensus breaking

@evan-forbes evan-forbes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

testnet was successful!

I think we can merge this PR and create a tagged version after we address any lingering nit picks or questions

@evan-forbes evan-forbes merged commit afbd106 into release/v1.1.x Jan 12, 2022
lydia-pierce pushed a commit that referenced this pull request Mar 23, 2022
@lydia-pierce lydia-pierce deleted the lydia/backport-min-comiss branch November 4, 2022 14:39
woof-chihuahua pushed a commit that referenced this pull request Jan 8, 2025
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