-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v5 upgrade with only incentives and gravity updates * go.mod major version v4 -> v5 * go 1.15 -> 1.16 * Update prost_build and somm_proto * Generate somm_proto for v5 * Fix proto import path bug and regenerate protos * Fix linter * Pin to ubuntu version in releaser * Set incentives cutoff height
- Loading branch information
1 parent
318442d
commit 7e2062d
Showing
93 changed files
with
3,677 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ on: | |
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Unit tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*.*.*" | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.16] | ||
os: [ubuntu-latest] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- uses: actions/checkout@v3 | ||
- run: go test github.com/peggyjv/sommelier/.../x/... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# v5 upgrade | ||
|
||
This upgrade moves Sommelier to major version 5. | ||
|
||
## Summary of changes | ||
|
||
* Add the incentives module to provide a way of distributing community pool funds on a per-block, pro-rata basis to incentivize stakers while cellar TVL is built over time into a meaningful staking return | ||
* Pin to a version of the gravity module with ledger support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package v5 | ||
|
||
// UpgradeName defines the on-chain upgrade name for the Sommelier v5 upgrade | ||
const UpgradeName = "v5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package v5 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
appparams "github.com/peggyjv/sommelier/v5/app/params" | ||
incentiveskeeper "github.com/peggyjv/sommelier/v5/x/incentives/keeper" | ||
incentivestypes "github.com/peggyjv/sommelier/v5/x/incentives/types" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
incentivesKeeper incentiveskeeper.Keeper, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
ctx.Logger().Info("v5 upgrade: entering handler") | ||
|
||
// We must manually run InitGenesis for incentives so we can adjust their values during the upgrade process. | ||
// Setting the consensus version to 1 prevents RunMigrations from running InitGenesis itself. | ||
fromVM[incentivestypes.ModuleName] = mm.Modules[incentivestypes.ModuleName].ConsensusVersion() | ||
|
||
ctx.Logger().Info("v5 upgrade: initializing incentives genesis state") | ||
incentivesInitGenesis(ctx, incentivesKeeper) | ||
|
||
ctx.Logger().Info("v5 upgrade: running migrations and exiting handler") | ||
return mm.RunMigrations(ctx, configurator, fromVM) | ||
} | ||
} | ||
|
||
// Launch the incentives module with 2 SOMM per block distribution and a cutoff height 5 million blocks past | ||
// the upgrade height | ||
func incentivesInitGenesis(ctx sdk.Context, incentivesKeeper incentiveskeeper.Keeper) { | ||
genesisState := incentivestypes.DefaultGenesisState() | ||
|
||
upgradeHeight := uint64(7766725) | ||
incentivesBlocks := uint64(5000000) | ||
|
||
params := incentivestypes.Params{ | ||
DistributionPerBlock: sdk.NewCoin(appparams.BaseCoinUnit, sdk.NewInt(2000000)), | ||
IncentivesCutoffHeight: upgradeHeight + incentivesBlocks, | ||
} | ||
genesisState.Params = params | ||
|
||
incentiveskeeper.InitGenesis(ctx, incentivesKeeper, genesisState) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.