Skip to content

Commit

Permalink
Small improvements, add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon committed Jan 9, 2022
1 parent bb58c10 commit 6328dd1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmd/osmosisd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion x/gamm/types/msg_lp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 8 additions & 0 deletions x/txfees/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion x/txfees/keeper/feedecorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 6328dd1

Please sign in to comment.