diff --git a/CHANGELOG.md b/CHANGELOG.md index ccde68e942f..46c2f9268bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,8 +50,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#8535](https://github.com/osmosis-labs/osmosis/pull/8535) Prevent Setting Invalid Before Send Hook * [#8310](https://github.com/osmosis-labs/osmosis/pull/8310) Taker fee share * [#8494](https://github.com/osmosis-labs/osmosis/pull/8494) Add additional events in x/lockup, x/superfluid, x/concentratedliquidity -* [#8581](https://github.com/osmosis-labs/osmosis/pull/8581) Add ledger signing to smart account module -* [#8573](https://github.com/osmosis-labs/osmosis/pull/8573) Increase unauthenticated gas to fix fee token issue +* [#8581](https://github.com/osmosis-labs/osmosis/pull/8581) feat: add ledger signing to smart account module +* [#8573](https://github.com/osmosis-labs/osmosis/pull/8573) fix: increase unauthenticated gas to fix fee token issue +* [#8598](https://github.com/osmosis-labs/osmosis/pull/8598) feat: param changes for block and cost per byte * [#8609](https://github.com/osmosis-labs/osmosis/pull/8609) Exempt `UnrestrictedPoolCreatorWhitelist` addresses from pool creation fee ### Config diff --git a/app/upgrades/v26/constants.go b/app/upgrades/v26/constants.go index 63d7437030a..d14e031e06d 100644 --- a/app/upgrades/v26/constants.go +++ b/app/upgrades/v26/constants.go @@ -13,6 +13,15 @@ const ( // MaximumUnauthenticatedGas for smart account transactions to verify the fee payer MaximumUnauthenticatedGas = uint64(250_000) + + // BlockMaxBytes is the max bytes for a block, 3mb + BlockMaxBytes = int64(3000000) + + // BlockMaxGas is the max gas allowed in a block + BlockMaxGas = int64(300000000) + + // CostPerByte is the gas cost per byte + CostPerByte = uint64(30) ) var Upgrade = upgrades.Upgrade{ diff --git a/app/upgrades/v26/upgrades.go b/app/upgrades/v26/upgrades.go index 96ce9105239..ea0627c2f8c 100644 --- a/app/upgrades/v26/upgrades.go +++ b/app/upgrades/v26/upgrades.go @@ -6,6 +6,7 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" "github.com/cosmos/cosmos-sdk/types/module" + cmttypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/osmosis-labs/osmosis/v25/app/keepers" @@ -60,6 +61,23 @@ func CreateUpgradeHandler( authenticatorParams.MaximumUnauthenticatedGas = MaximumUnauthenticatedGas keepers.SmartAccountKeeper.SetParams(ctx, authenticatorParams) + // Set the next block limits + defaultConsensusParams := cmttypes.DefaultConsensusParams().ToProto() + defaultConsensusParams.Block.MaxBytes = BlockMaxBytes // previously 5000000 + defaultConsensusParams.Block.MaxGas = BlockMaxGas // unchanged + err = keepers.ConsensusParamsKeeper.ParamsStore.Set(ctx, defaultConsensusParams) + if err != nil { + return nil, err + } + + // Increase the tx size cost per byte to 30 to reduce the exploitability of bandwidth amplification problems. + accountParams := keepers.AccountKeeper.GetParams(ctx) + accountParams.TxSizeCostPerByte = CostPerByte // increase from 20 to 30 + err = keepers.AccountKeeper.Params.Set(ctx, accountParams) + if err != nil { + return nil, err + } + return migrations, nil } } diff --git a/app/upgrades/v26/upgrades_test.go b/app/upgrades/v26/upgrades_test.go index 8589446ee3b..80a475be3fb 100644 --- a/app/upgrades/v26/upgrades_test.go +++ b/app/upgrades/v26/upgrades_test.go @@ -4,6 +4,7 @@ import ( "testing" "time" + cmttypes "github.com/cometbft/cometbft/types" "github.com/stretchr/testify/suite" "cosmossdk.io/core/appmodule" @@ -49,6 +50,8 @@ func (s *UpgradeTestSuite) TestUpgrade() { s.PrepareTradingPairTakerFeeTest() s.PrepareIncreaseUnauthenticatedGasTest() + s.PrepareChangeBlockParamsTest() + s.PrepareCostPerByteTest() // Run the upgrade dummyUpgrade(s) @@ -59,6 +62,8 @@ func (s *UpgradeTestSuite) TestUpgrade() { s.ExecuteTradingPairTakerFeeTest() s.ExecuteIncreaseUnauthenticatedGasTest() + s.ExecuteChangeBlockParamsTest() + s.ExecuteCostPerByteTest() } func dummyUpgrade(s *UpgradeTestSuite) { @@ -115,3 +120,28 @@ func (s *UpgradeTestSuite) ExecuteIncreaseUnauthenticatedGasTest() { authenticatorParams := s.App.SmartAccountKeeper.GetParams(s.Ctx) s.Require().Equal(authenticatorParams.MaximumUnauthenticatedGas, v26.MaximumUnauthenticatedGas) } + +func (s *UpgradeTestSuite) PrepareChangeBlockParamsTest() { + defaultConsensusParams := cmttypes.DefaultConsensusParams().ToProto() + defaultConsensusParams.Block.MaxBytes = 1 + defaultConsensusParams.Block.MaxGas = 1 + s.App.ConsensusParamsKeeper.ParamsStore.Set(s.Ctx, defaultConsensusParams) +} + +func (s *UpgradeTestSuite) ExecuteChangeBlockParamsTest() { + consParams, err := s.App.ConsensusParamsKeeper.ParamsStore.Get(s.Ctx) + s.Require().NoError(err) + s.Require().Equal(consParams.Block.MaxBytes, v26.BlockMaxBytes) + s.Require().Equal(consParams.Block.MaxGas, v26.BlockMaxGas) +} + +func (s *UpgradeTestSuite) PrepareCostPerByteTest() { + accountParams := s.App.AccountKeeper.GetParams(s.Ctx) + accountParams.TxSizeCostPerByte = 0 + s.App.AccountKeeper.Params.Set(s.Ctx, accountParams) +} + +func (s *UpgradeTestSuite) ExecuteCostPerByteTest() { + accountParams := s.App.AccountKeeper.GetParams(s.Ctx) + s.Require().Equal(accountParams.TxSizeCostPerByte, v26.CostPerByte) +}