Skip to content

Commit

Permalink
v3 Upgrade Params (#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
arhamchordia authored Aug 30, 2024
1 parent 5aacc03 commit 3b83f60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
21 changes: 15 additions & 6 deletions app/upgrades/v3/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ func CreateUpgradeHandler(

// Set rate-limit params
keepers.RatelimitKeeper.SetParams(ctx, ratelimittypes.DefaultParams())

// Set pfm params
err = keepers.PFMRouterKeeper.SetParams(ctx, pfmtypes.DefaultParams())
if err != nil {
return nil, err
}

// fee market params
// TODO: change values from default after discussion
ctx.Logger().Info("Setting dynamicfees/feemarket params...")
err = setFeeMarketParams(ctx, keepers.FeeMarketKeeper)
if err != nil {
return nil, err
Expand All @@ -77,11 +77,20 @@ func CreateUpgradeHandler(

func setFeeMarketParams(ctx sdk.Context, feemarketKeeper *feemarketkeeper.Keeper) error {
feemarketParams := feemarkettypes.DefaultParams()
feemarketParams.MinBaseGasPrice = math.LegacyMustNewDecFromStr("0.10000000000000000")
feemarketParams.MaxBlockUtilization = uint64(120_000_000)
feemarketParams.FeeDenom = appparams.DefaultBondDenom
feemarketParams.Enabled = true

// update params
feemarketParams.Alpha = math.LegacyMustNewDecFromStr("0.003000000000000000")
feemarketParams.Beta = math.LegacyMustNewDecFromStr("0.980000000000000000")
feemarketParams.Delta = math.LegacyMustNewDecFromStr("0.001500000000000000")
feemarketParams.DistributeFees = true
feemarketParams.Enabled = true
feemarketParams.FeeDenom = appparams.DefaultBondDenom
feemarketParams.Gamma = math.LegacyMustNewDecFromStr("0.008000000000000000")
feemarketParams.MaxBlockUtilization = uint64(120000000)
feemarketParams.MaxLearningRate = math.LegacyMustNewDecFromStr("0.125000000000000000")
feemarketParams.MinBaseGasPrice = math.LegacyMustNewDecFromStr("0.100000000000000000")
feemarketParams.MinLearningRate = math.LegacyMustNewDecFromStr("0.075000000000000000")
feemarketParams.Window = uint64(7)

feemarketState := feemarkettypes.NewState(feemarketParams.Window, feemarketParams.MinBaseGasPrice, feemarketParams.MinLearningRate)
err := feemarketKeeper.SetParams(ctx, feemarketParams)
Expand Down
14 changes: 11 additions & 3 deletions app/upgrades/v3/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,18 @@ func (s *UpgradeTestSuite) TestUpgrade() {
feemarketParams, err := keepers.FeeMarketKeeper.GetParams(ctx)
s.Require().NoError(err, "Error getting feemarket params after upgrade")
expectedFeeMarketParams := feemarkettypes.DefaultParams()
expectedFeeMarketParams.MinBaseGasPrice = math.LegacyMustNewDecFromStr("0.10000000000000000")
expectedFeeMarketParams.MaxBlockUtilization = uint64(120000000)
expectedFeeMarketParams.FeeDenom = "uqsr"
expectedFeeMarketParams.Alpha = math.LegacyMustNewDecFromStr("0.003000000000000000")
expectedFeeMarketParams.Beta = math.LegacyMustNewDecFromStr("0.980000000000000000")
expectedFeeMarketParams.Delta = math.LegacyMustNewDecFromStr("0.001500000000000000")
expectedFeeMarketParams.DistributeFees = true
expectedFeeMarketParams.Enabled = true
expectedFeeMarketParams.FeeDenom = "uqsr"
expectedFeeMarketParams.Gamma = math.LegacyMustNewDecFromStr("0.008000000000000000")
expectedFeeMarketParams.MaxBlockUtilization = uint64(120000000)
expectedFeeMarketParams.MaxLearningRate = math.LegacyMustNewDecFromStr("0.125000000000000000")
expectedFeeMarketParams.MinBaseGasPrice = math.LegacyMustNewDecFromStr("0.100000000000000000")
expectedFeeMarketParams.MinLearningRate = math.LegacyMustNewDecFromStr("0.075000000000000000")
expectedFeeMarketParams.Window = uint64(7)
s.Require().Equal(expectedFeeMarketParams, feemarketParams, "Fee market params do not match expected values after upgrade")
}

Expand Down

0 comments on commit 3b83f60

Please sign in to comment.