From 46d4da31ec9a874d30ec436a476710137dea77b2 Mon Sep 17 00:00:00 2001
From: mattverse <mattpark1028@gmail.com>
Date: Mon, 25 Mar 2024 12:05:56 +0900
Subject: [PATCH 1/6] Bump max gas wanted per tx

---
 cmd/osmosisd/cmd/root.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go
index c6316517c91..a0b7f6f2be4 100644
--- a/cmd/osmosisd/cmd/root.go
+++ b/cmd/osmosisd/cmd/root.go
@@ -614,7 +614,7 @@ func initAppConfig() (string, interface{}) {
 [osmosis-mempool]
 # This is the max allowed gas any tx.
 # This is only for local mempool purposes, and thus	is only ran on check tx.
-max-gas-wanted-per-tx = "25000000"
+max-gas-wanted-per-tx = "60000000"
 
 # This is the minimum gas fee any arbitrage tx should have, denominated in uosmo per gas
 # Default value of ".1" then means that a tx with 1 million gas costs (.1 uosmo/gas) * 1_000_000 gas = .1 osmo

From 7460d5ac9ae061b8e435eb5b104320261596068e Mon Sep 17 00:00:00 2001
From: mattverse <mattpark1028@gmail.com>
Date: Mon, 25 Mar 2024 12:49:11 +0900
Subject: [PATCH 2/6] Add changelog

---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 252e4a64f7b..f84d3f3ef1a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -69,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 * [#7768](https://github.com/osmosis-labs/osmosis/pull/7768) Allow governance module account to transfer any CL position
 * [#7746](https://github.com/osmosis-labs/osmosis/pull/7746) Make forfeited incentives redeposit into the pool instead of sending to community pool
 * [#7785](https://github.com/osmosis-labs/osmosis/pull/7785) Remove reward claiming during position transfers
+* [#7833](https://github.com/osmosis-labs/osmosis/pull/7883) Bump max gas wanted per tx to 6 mil
 
 ## v23.0.8-iavl-v1 & v23.0.8
 

From f70451194ca3863f8ac9b81453d1b12753de5019 Mon Sep 17 00:00:00 2001
From: mattverse <mattpark1028@gmail.com>
Date: Tue, 26 Mar 2024 16:42:03 +0900
Subject: [PATCH 3/6] Add app default values

---
 cmd/osmosisd/cmd/root.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go
index a0b7f6f2be4..01e5283f3f0 100644
--- a/cmd/osmosisd/cmd/root.go
+++ b/cmd/osmosisd/cmd/root.go
@@ -100,11 +100,15 @@ type DenomUnitMap struct {
 }
 
 const (
-	mempoolConfigName            = "osmosis-mempool"
+	mempoolConfigName     = "osmosis-mempool"
+	maxGasWantedPerTxName = "max-gas-wanted-per-tx"
+
 	arbitrageMinGasFeeConfigName = "arbitrage-min-gas-fee"
 	oldArbitrageMinGasFeeValue   = ".005"
 	newArbitrageMinGasFeeValue   = "0.1"
 
+	newMaxGasWantedPerTxValue = "60000000"
+
 	consensusConfigName     = "consensus"
 	timeoutCommitConfigName = "timeout_commit"
 )
@@ -507,6 +511,8 @@ func overwriteAppTomlValues(serverCtx *server.Context) error {
 		// Get setting
 		currentArbitrageMinGasFeeValue := serverCtx.Viper.Get(mempoolConfigName + "." + arbitrageMinGasFeeConfigName)
 
+		serverCtx.Viper.Set(mempoolConfigName+"."+maxGasWantedPerTxName, newMaxGasWantedPerTxValue)
+
 		// .x format at 0.x format are both valid.
 		if currentArbitrageMinGasFeeValue == oldArbitrageMinGasFeeValue || currentArbitrageMinGasFeeValue == "0"+oldArbitrageMinGasFeeValue {
 			// Set new value in viper

From 04519d0140d09538da9c7249332f4525f0557bb5 Mon Sep 17 00:00:00 2001
From: Adam Tucker <adamleetucker@outlook.com>
Date: Tue, 26 Mar 2024 20:01:58 -0600
Subject: [PATCH 4/6] drive by correct overwriteAppTomlValues logic

---
 cmd/osmosisd/cmd/root.go | 75 ++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 41 deletions(-)

diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go
index 01e5283f3f0..bfcbdbeb62e 100644
--- a/cmd/osmosisd/cmd/root.go
+++ b/cmd/osmosisd/cmd/root.go
@@ -508,57 +508,50 @@ func overwriteAppTomlValues(serverCtx *server.Context) error {
 	} else {
 		// app.toml exists
 
-		// Get setting
-		currentArbitrageMinGasFeeValue := serverCtx.Viper.Get(mempoolConfigName + "." + arbitrageMinGasFeeConfigName)
-
+		// Set new values in viper
 		serverCtx.Viper.Set(mempoolConfigName+"."+maxGasWantedPerTxName, newMaxGasWantedPerTxValue)
+		serverCtx.Viper.Set(mempoolConfigName+"."+arbitrageMinGasFeeConfigName, newArbitrageMinGasFeeValue)
 
-		// .x format at 0.x format are both valid.
-		if currentArbitrageMinGasFeeValue == oldArbitrageMinGasFeeValue || currentArbitrageMinGasFeeValue == "0"+oldArbitrageMinGasFeeValue {
-			// Set new value in viper
-			serverCtx.Viper.Set(mempoolConfigName+"."+arbitrageMinGasFeeConfigName, newArbitrageMinGasFeeValue)
+		defer func() {
+			if err := recover(); err != nil {
+				fmt.Printf("failed to write to %s: %s\n", configFilePath, err)
+			}
+		}()
 
-			defer func() {
-				if err := recover(); err != nil {
-					fmt.Printf("failed to write to %s: %s\n", configFilePath, err)
-				}
-			}()
-
-			// Check if the file is writable
-			if fileInfo.Mode()&os.FileMode(0200) != 0 {
-				// Read the entire content of the file
-				content, err := os.ReadFile(configFilePath)
-				if err != nil {
-					return err
-				}
+		// Check if the file is writable
+		if fileInfo.Mode()&os.FileMode(0200) != 0 {
+			// Read the entire content of the file
+			content, err := os.ReadFile(configFilePath)
+			if err != nil {
+				return err
+			}
 
-				// Convert the content to a string
-				fileContent := string(content)
+			// Convert the content to a string
+			fileContent := string(content)
 
-				// Find the index of the search line
-				index := strings.Index(fileContent, arbitrageMinGasFeeConfigName)
-				if index == -1 {
-					return fmt.Errorf("search line not found in the file")
-				}
+			// Find the index of the search line
+			index := strings.Index(fileContent, arbitrageMinGasFeeConfigName)
+			if index == -1 {
+				return fmt.Errorf("search line not found in the file")
+			}
 
-				// Find the opening and closing quotes
-				openQuoteIndex := strings.Index(fileContent[index:], "\"")
-				openQuoteIndex += index
+			// Find the opening and closing quotes
+			openQuoteIndex := strings.Index(fileContent[index:], "\"")
+			openQuoteIndex += index
 
-				closingQuoteIndex := strings.Index(fileContent[openQuoteIndex+1:], "\"")
-				closingQuoteIndex += openQuoteIndex + 1
+			closingQuoteIndex := strings.Index(fileContent[openQuoteIndex+1:], "\"")
+			closingQuoteIndex += openQuoteIndex + 1
 
-				// Replace the old value with the new value
-				newFileContent := fileContent[:openQuoteIndex+1] + newArbitrageMinGasFeeValue + fileContent[closingQuoteIndex:]
+			// Replace the old value with the new value
+			newFileContent := fileContent[:openQuoteIndex+1] + newArbitrageMinGasFeeValue + fileContent[closingQuoteIndex:]
 
-				// Write the modified content back to the file
-				err = os.WriteFile(configFilePath, []byte(newFileContent), 0644)
-				if err != nil {
-					return err
-				}
-			} else {
-				fmt.Println("app.toml is not writable. Cannot apply update. Please consder manually changing arbitrage-min-gas-fee to " + newArbitrageMinGasFeeValue)
+			// Write the modified content back to the file
+			err = os.WriteFile(configFilePath, []byte(newFileContent), 0644)
+			if err != nil {
+				return err
 			}
+		} else {
+			fmt.Println("app.toml is not writable. Cannot apply update. Please consder manually changing arbitrage-min-gas-fee to " + newArbitrageMinGasFeeValue + "and max-gas-wanted-per-tx to " + newMaxGasWantedPerTxValue)
 		}
 	}
 	return nil

From a5dd773f673118a8cc1b3e34a43372da6ece1143 Mon Sep 17 00:00:00 2001
From: Adam Tucker <adam@osmosis.team>
Date: Tue, 26 Mar 2024 21:04:35 -0500
Subject: [PATCH 5/6] remove extra line in changelog

---
 CHANGELOG.md | 1 -
 1 file changed, 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index faa16fa81ce..b64d68e7803 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -88,7 +88,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 * [#514](https://github.com/osmosis-labs/cosmos-sdk/pull/514) Let gov hooks return an error
 * [#580](https://github.com/osmosis-labs/cosmos-sdk/pull/580) Less time intensive slashing migration
 
-
 ## v23.0.8-iavl-v1 & v23.0.8
 
 * [#7769](https://github.com/osmosis-labs/osmosis/pull/7769) Set and default timeout commit to 3s. Add flag to prevent custom overrides if not desired.

From 9c956b0dae50726d587326817c5f0224235181b9 Mon Sep 17 00:00:00 2001
From: Adam Tucker <adamleetucker@outlook.com>
Date: Tue, 26 Mar 2024 20:06:02 -0600
Subject: [PATCH 6/6] clean up

---
 cmd/osmosisd/cmd/root.go | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go
index bfcbdbeb62e..8bdbed86ed2 100644
--- a/cmd/osmosisd/cmd/root.go
+++ b/cmd/osmosisd/cmd/root.go
@@ -100,14 +100,13 @@ type DenomUnitMap struct {
 }
 
 const (
-	mempoolConfigName     = "osmosis-mempool"
-	maxGasWantedPerTxName = "max-gas-wanted-per-tx"
+	mempoolConfigName = "osmosis-mempool"
 
-	arbitrageMinGasFeeConfigName = "arbitrage-min-gas-fee"
-	oldArbitrageMinGasFeeValue   = ".005"
-	newArbitrageMinGasFeeValue   = "0.1"
+	arbitrageMinGasFeeConfigName          = "arbitrage-min-gas-fee"
+	recommendedNewArbitrageMinGasFeeValue = "0.1"
 
-	newMaxGasWantedPerTxValue = "60000000"
+	maxGasWantedPerTxName                = "max-gas-wanted-per-tx"
+	recommendedNewMaxGasWantedPerTxValue = "60000000"
 
 	consensusConfigName     = "consensus"
 	timeoutCommitConfigName = "timeout_commit"
@@ -509,8 +508,8 @@ func overwriteAppTomlValues(serverCtx *server.Context) error {
 		// app.toml exists
 
 		// Set new values in viper
-		serverCtx.Viper.Set(mempoolConfigName+"."+maxGasWantedPerTxName, newMaxGasWantedPerTxValue)
-		serverCtx.Viper.Set(mempoolConfigName+"."+arbitrageMinGasFeeConfigName, newArbitrageMinGasFeeValue)
+		serverCtx.Viper.Set(mempoolConfigName+"."+maxGasWantedPerTxName, recommendedNewMaxGasWantedPerTxValue)
+		serverCtx.Viper.Set(mempoolConfigName+"."+arbitrageMinGasFeeConfigName, recommendedNewArbitrageMinGasFeeValue)
 
 		defer func() {
 			if err := recover(); err != nil {
@@ -543,7 +542,7 @@ func overwriteAppTomlValues(serverCtx *server.Context) error {
 			closingQuoteIndex += openQuoteIndex + 1
 
 			// Replace the old value with the new value
-			newFileContent := fileContent[:openQuoteIndex+1] + newArbitrageMinGasFeeValue + fileContent[closingQuoteIndex:]
+			newFileContent := fileContent[:openQuoteIndex+1] + recommendedNewArbitrageMinGasFeeValue + fileContent[closingQuoteIndex:]
 
 			// Write the modified content back to the file
 			err = os.WriteFile(configFilePath, []byte(newFileContent), 0644)
@@ -551,7 +550,7 @@ func overwriteAppTomlValues(serverCtx *server.Context) error {
 				return err
 			}
 		} else {
-			fmt.Println("app.toml is not writable. Cannot apply update. Please consder manually changing arbitrage-min-gas-fee to " + newArbitrageMinGasFeeValue + "and max-gas-wanted-per-tx to " + newMaxGasWantedPerTxValue)
+			fmt.Println("app.toml is not writable. Cannot apply update. Please consder manually changing arbitrage-min-gas-fee to " + recommendedNewArbitrageMinGasFeeValue + "and max-gas-wanted-per-tx to " + recommendedNewMaxGasWantedPerTxValue)
 		}
 	}
 	return nil