Skip to content

Commit

Permalink
changing proof window
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Jan 6, 2025
1 parent 9a484e4 commit ef20b49
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
5 changes: 3 additions & 2 deletions app/upgrades/v440/commont_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package v440_test

import (
"fmt"
mintkeeper "github.com/jackalLabs/canine-chain/v4/x/jklmint/keeper"
"testing"

mintkeeper "github.com/jackalLabs/canine-chain/v4/x/jklmint/keeper"

authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/golang/mock/gomock"
Expand Down Expand Up @@ -180,7 +181,7 @@ func (suite *UpgradeTestKeeper) SetupSuite() {

func (suite *UpgradeTestKeeper) reset() {
storageKeeper, filetreeKeeper, _, _, encCfg, ctx := SetUpKeepers(suite.T())

_ = suite.mintKeeper
queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry)
types.RegisterQueryServer(queryHelper, filetreeKeeper)
queryClient := types.NewQueryClient(queryHelper)
Expand Down
1 change: 0 additions & 1 deletion app/upgrades/v440/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ func (suite *UpgradeTestKeeper) TestUpgrade() {
})

suite.Require().Equal(25000, i)

}
17 changes: 16 additions & 1 deletion app/upgrades/v440/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v440

import (
_ "embed"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -41,11 +42,25 @@ func (u *Upgrade) Name() string {
// Handler implements upgrades.Upgrade
func (u *Upgrade) Handler() upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {

var newWindow int64 = 7200
params := u.mk.GetParams(ctx)
params.TokensPerBlock = 3_830_000
u.mk.SetParams(ctx, params)

storageParams := u.sk.GetParams(ctx)
oldProofWindow := storageParams.ProofWindow

storageParams.CheckWindow = 300
storageParams.ProofWindow = newWindow
u.sk.SetParams(ctx, storageParams)

files := u.sk.GetAllFileByMerkle(ctx)
for _, file := range files {
if file.ProofInterval == oldProofWindow { // updating default files to the new window
file.ProofInterval = newWindow
u.sk.SetFile(ctx, file)
}
}
err := upgrades.RecoverFiles(ctx, u.sk, UpgradeData, plan.Height, "v4.4.0")
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions x/jklmint/keeper/mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ func (k Keeper) BlockMint(ctx sdk.Context) {

mintedNum := params.TokensPerBlock
// minted, found := k.GetMintedBlock(ctx, ctx.BlockHeight()-1)
//if found {
// if found {
// mintedNum = minted.Minted
//}
//var bpy int64 = (365 * 24 * 60 * 60) / 6
// var bpy int64 = (365 * 24 * 60 * 60) / 6
//
//newMintForBlock := utils.GetMintForBlock(mintedNum, bpy, params.MintDecrease)

Check failure on line 103 in x/jklmint/keeper/mint.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)
//
Expand Down
1 change: 0 additions & 1 deletion x/jklmint/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
if err != nil {
panic(err)
}

}

// RegisterInvariants registers the capability module's invariants.
Expand Down

0 comments on commit ef20b49

Please sign in to comment.