-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mint): fix pruning panic, add developer and community funding (#161)
* fix(app): make sure to signal ica host and credential module addition * feat(mint): add burning caps * feat(mint): add migration to fix utsp param denom error * chore(mint): don't fix the wrong stake tokens issue This migration will just replace the mint denom * chore(mint): make golangci-lint happy * chore(mint): fix tests * chore(mint): revert back to generic "stake" denom We configure "utsp" via manual genesis.json editing. The migration still writes "utsp" because it's fixing our bad behavior (we should've edited the genesis). * chore(mint): remove method impl for Burn interface * feat(mint): distribute developer and community funds (#167) * fix: disable CGO for node builds * feat(devnet): adding script to spin up local devnet (#160) * feat(mint): distribute developer and community funds This commit enables distribution of 2*10% off the newly-minted tokens to the x/distribution community pool, and the developer funding pool. The developer funding pool is represented as a standard Cosmos address, which should be determined at genesis time. Co-authored-by: Andrea Giacobino <no.andrea@gmail.com> Co-authored-by: PaddyMc <paddymchale@hotmail.com> Co-authored-by: Andrea Giacobino <no.andrea@gmail.com> Co-authored-by: PaddyMc <paddymchale@hotmail.com>
- Loading branch information
1 parent
a303670
commit 7796175
Showing
11 changed files
with
222 additions
and
25 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
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,22 @@ | ||
package testnetUpgrade20220706 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
mintTypes "github.com/elesto-dao/elesto/v2/x/mint/types" | ||
) | ||
|
||
type ExpectedKeeper interface { | ||
SetParams(ctx sdk.Context, params mintTypes.Params) | ||
MintCoins(ctx sdk.Context, amt sdk.Coins) error | ||
GetSupply(ctx sdk.Context, denom string) sdk.Coin | ||
} | ||
|
||
func Migrate(ctx sdk.Context, keeper ExpectedKeeper) error { | ||
// reset params, and hardcode the mint denom as "utsp" | ||
p := mintTypes.DefaultParams() | ||
p.MintDenom = "utsp" | ||
keeper.SetParams(ctx, p) | ||
|
||
return nil | ||
} |
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,75 @@ | ||
package testnetUpgrade20220706_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/elesto-dao/elesto/v2/app" | ||
"github.com/elesto-dao/elesto/v2/x/mint/migrations/testnetUpgrade20220706" | ||
mintTypes "github.com/elesto-dao/elesto/v2/x/mint/types" | ||
"github.com/stretchr/testify/require" | ||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types" | ||
) | ||
|
||
func (b *bogusMigrationKeeper) SetParams(ctx sdk.Context, params mintTypes.Params) { | ||
if b.failSetParams { | ||
panic("cannot set params") | ||
} | ||
} | ||
|
||
func (b *bogusMigrationKeeper) MintCoins(ctx sdk.Context, amt sdk.Coins) error { | ||
if b.failMint { | ||
return fmt.Errorf("cannot mint") | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (b *bogusMigrationKeeper) GetSupply(ctx sdk.Context, denom string) sdk.Coin { | ||
if b.failGetSupply { | ||
c := sdk.Coin{} | ||
c.Denom = "a" | ||
|
||
return c | ||
} | ||
for _, t := range b.supply { | ||
if t.Denom == denom { | ||
return t | ||
} | ||
} | ||
|
||
return sdk.Coin{} | ||
} | ||
|
||
type bogusMigrationKeeper struct { | ||
failSetParams bool | ||
failMint bool | ||
failBurn bool | ||
failGetSupply bool | ||
supply sdk.Coins | ||
} | ||
|
||
func TestMigrate(t *testing.T) { | ||
app := app.Setup(false) | ||
ctx := app.BaseApp.NewContext(false, tmproto.Header{}) | ||
|
||
testnetUpgrade20220706.Migrate(ctx, app.MintKeeper) | ||
|
||
require.Equal(t, "utsp", app.MintKeeper.GetParams(ctx).MintDenom) | ||
require.Equal(t, "stake", mintTypes.DefaultParams().MintDenom) | ||
} | ||
|
||
|
||
func TestFailSetParams(t *testing.T) { | ||
app := app.Setup(false) | ||
ctx := app.BaseApp.NewContext(false, tmproto.Header{}) | ||
|
||
keeper := &bogusMigrationKeeper{ | ||
failSetParams: true, | ||
} | ||
|
||
require.Panics(t, func() { | ||
_ = testnetUpgrade20220706.Migrate(ctx, keeper) | ||
}) | ||
} |
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