diff --git a/CHANGELOG.md b/CHANGELOG.md index 4964f48603b..c0ae79b13e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Features +- [#741](https://github.com/osmosis-labs/osmosis/pull/741) Allow node operators to set a second min gas price for arbitrage txs. - [#623](https://github.com/osmosis-labs/osmosis/pull/623) Use gosec for staticly linting for common non-determinism issues in SDK applications. ## Minor improvements & Bug Fixes diff --git a/app/ante.go b/app/ante.go index 1da32f39f79..553e1d9b44b 100644 --- a/app/ante.go +++ b/app/ante.go @@ -53,18 +53,20 @@ func NewAnteHandler( ) } +// TODO: Abstract this function better. We likely need a parse `osmosis-mempool` config section. func parseArbGasFromConfig(appOpts servertypes.AppOptions) sdk.Dec { arbMinFeeInterface := appOpts.Get("osmosis-mempool.arbitrage-min-gas-fee") arbMinFee := txfeeskeeper.DefaultArbMinGasFee if arbMinFeeInterface != nil { arbMinFeeStr, ok := arbMinFeeInterface.(string) if !ok { - panic("Invalidly configured osmosis-mempool.arbitrage-min-gas-fee") + panic("invalidly configured osmosis-mempool.arbitrage-min-gas-fee") } var err error + // pre-pend 0 to allow the config to start with a decimal, e.g. ".01" arbMinFee, err = sdk.NewDecFromStr("0" + arbMinFeeStr) if err != nil { - panic(fmt.Errorf("Invalidly configured osmosis-mempool.arbitrage-min-gas-fee, err= %v", err)) + panic(fmt.Errorf("invalidly configured osmosis-mempool.arbitrage-min-gas-fee, err= %v", err)) } } return arbMinFee diff --git a/cmd/osmosisd/cmd/root.go b/cmd/osmosisd/cmd/root.go index cff6b747a13..ab303a4ad39 100644 --- a/cmd/osmosisd/cmd/root.go +++ b/cmd/osmosisd/cmd/root.go @@ -111,8 +111,8 @@ func initAppConfig() (string, interface{}) { [osmosis-mempool] # This is the minimum gas fee any arbitrage tx should have, denominated in uosmo per gas -# Default value of ".01" then means that a tx with 1 million gas costs (.01 uosmo/gas) * 1_000_000 gas = .01 osmo -arbitrage-min-gas-fee = ".01" +# Default value of ".005" then means that a tx with 1 million gas costs (.005 uosmo/gas) * 1_000_000 gas = .005 osmo +arbitrage-min-gas-fee = ".005" ` return OsmosisAppTemplate, OsmosisAppCfg diff --git a/x/gamm/types/msg_lp.go b/x/gamm/types/msg_lp.go index 9aae0e27539..f661e48cfb7 100644 --- a/x/gamm/types/msg_lp.go +++ b/x/gamm/types/msg_lp.go @@ -7,7 +7,8 @@ const ( RemoveLiquidity ) -// SwapMsg defines a simple interface for getting the token denoms on a swap message route. +// LiquidityChangeMsg defines a simple interface for determining if an LP msg +// is removing or adding liquidity. type LiquidityChangeMsg interface { LiquidityChangeType() LiquidityChangeType } diff --git a/x/txfees/README.md b/x/txfees/README.md index 03a5553b39b..b5fb27783d5 100644 --- a/x/txfees/README.md +++ b/x/txfees/README.md @@ -20,6 +20,14 @@ Currently the only supported metadata & spot price calculator is using a GAMM po * The simple alternative is only check fee equivalency at a txs entry into the mempool, which allows someone to manipulate price down to have many txs enter the chain at low cost. * Another alternative is to use TWAP instead of Spot Price once it is available on-chain * The former concern isn't very worrisome as long as some nodes have 0 min tx fees. +* A separate min-gas-fee can be set on every node for arbitrage txs. Methods of detecting an arb tx atm + * does start token of a swap = final token of swap (definitionally correct) + * does it have multiple swap messages, with different tx ins. If so, we assume its an arb. + * This has false positives, but is intended to avoid the obvious solution of splitting an arb into multiple messages. + * We record all denoms seen across all swaps, and see if any duplicates. (TODO) + * Contains both JoinPool and ExitPool messages in one tx. + * Has some false positives. + * These false positives seem like they primarily will get hit during batching of many distinct operations, not really in one atomic action. ## New SDK messages diff --git a/x/txfees/keeper/feedecorator.go b/x/txfees/keeper/feedecorator.go index 368fb59e571..50ed362b08a 100644 --- a/x/txfees/keeper/feedecorator.go +++ b/x/txfees/keeper/feedecorator.go @@ -8,7 +8,10 @@ import ( "github.com/osmosis-labs/osmosis/x/txfees/types" ) -var DefaultArbMinGasFee sdk.Dec = sdk.NewDecWithPrec(1, 2) // .01uosmo/gas +// DefaultArbMinGasFee if its not set in a config somewhere. +// currently 0 uosmo/gas to preserve functionality with old node software +// TODO: Bump after next minor version. (in 6.2+) +var DefaultArbMinGasFee sdk.Dec = sdk.ZeroDec() // MempoolFeeDecorator will check if the transaction's fee is at least as large // as the local validator's minimum gasFee (defined in validator config).