decred / dcrdex

The Decred Decentralized Exchange (DEX), powered by atomic-swaps.
Other
187 stars 96 forks source link

ETH PreSwap feeSuggestion does not seem to be using current base fee, but the maxFeeRate #2136

Closed chappjc closed 1 year ago

chappjc commented 1 year ago

For some reason I have PreOrder doing this: https://github.com/decred/dcrdex/blob/998ddd23602f7bf67c9fef5050cf6c0d44ccba26/client/core/core.go#L5221-L5226

That is, c.feeSuggestion instead of c.feeSuggestionAny, which would ask the wallet. The comment says server rates only for the swap init, but this is an estimate and shouldn't it be realistic?

chappjc commented 1 year ago

Although it gets trickier because ETH's FeeRate() method is based on the baseRate * 2 + tip formula used to set a recommended max fee rate for a transaction. However, if we're interested in an estimate of what the swap fees are likely to be, that's almost double.

buck54321 commented 1 year ago

Using c.feeSuggestion is fine for utxo assets, but is obviously wrong for eth, since server always just reports maxfeerate. We could use c.feeSuggestionAny. It's just an estimate. Or we could ignore the FeeSuggestion in PreSwap and MaxOrder and use baseRate + tip.

chappjc commented 1 year ago

Let's have at least PreSwap ignore the input and use base + tip it has internally.