Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Mar 27, 2024
1 parent a5dd773 commit 9c956b0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cmd/osmosisd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -543,15 +542,15 @@ 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)
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)
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
Expand Down

0 comments on commit 9c956b0

Please sign in to comment.