-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[enhancement] global fee calculation #1848
Comments
Thanks a lot for bringing our attention to this very important enhancement/fix. I already started fixing UTXO fees here #1842, I shall continue working on this and fixing fees for other coin types in the upcoming sprints.
We can borrow the approach used for lightning channels/on-chain operations where we specify a target number of blocks for every target/priority to make this configurable For swaps, I am not sure if it's the right approach to allow priorities other than high priority since locktimes are involved and we don't want swap transactions to take time to confirm specially the spending transactions.
As far as I know, transaction size is only important for UTXO fees, we can add that as part of the UTXO transaction details.
Totally agree, in addition to what was proposed in this issue, we should also try to optimize the etomic swap contract to use less fees if possible. |
the expected fees we show for EVM swaps are higher then the actual fees used in the real tx: #853 |
related #854 |
Hi Right now we send two requests to calculate let web3_tx = match self
.web3
.eth()
.transaction(TransactionId::Hash(trace.transaction_hash.unwrap()))
.await
{
Ok(tx) => tx,
Err(e) => {
ctx.log.log(
"",
&[&"tx_history", &self.ticker],
&ERRL!(
"Error {} on getting transaction {:?}",
e,
trace.transaction_hash.unwrap()
),
);
continue;
},
};
let web3_tx = match web3_tx {
Some(t) => t,
None => {
ctx.log.log(
"",
&[&"tx_history", &self.ticker],
&ERRL!("No such transaction {:?}", trace.transaction_hash.unwrap()),
);
continue;
},
};
mm_counter!(ctx.metrics, "tx.history.response.count", 1, "coin" => self.ticker.clone(), "method" => "tx_detail_by_hash");
let receipt = match self
.web3
.eth()
.transaction_receipt(trace.transaction_hash.unwrap())
.await
{
Ok(r) => r,
Err(e) => {
ctx.log.log(
"",
&[&"tx_history", &self.ticker],
&ERRL!(
"Error {} on getting transaction {:?} receipt",
e,
trace.transaction_hash.unwrap()
),
);
continue;
},
};
let fee_coin = match &self.coin_type {
EthCoinType::Eth => self.ticker(),
EthCoinType::Erc20 { platform, .. } => platform.as_str(),
};
let fee_details: Option<EthTxFeeDetails> = match receipt {
Some(r) => {
let gas_used = r.gas_used.unwrap_or_default();
let gas_price = web3_tx.gas_price.unwrap_or_default();
// It's relatively safe to unwrap `EthTxFeeDetails::new` as it may fail
// due to `u256_to_big_decimal` only.
// Also TX history is not used by any GUI and has significant disadvantages.
Some(EthTxFeeDetails::new(gas_used, gas_price, fee_coin).unwrap())
},
None => None,
}; Although
we can use |
Relating to the high tendermint fees - these should be able to be derived from https://docs.ethermint.zone/basics/gas.html |
TODO: add rpc to set custom gas limit for swap evm calls |
May i ask why we need/want that? It sounds dangerous to me... if you set the limits too low, tx will be reverted... if you are the maker and takerpaymentspend is reverted, the swap is not even shown as failed on maker, only on taker... so if you don't watch the swap live, you will not notice that if failed... to refund those swaps, you also need to edit the swap JSON, remove all events after makerpayment from it and refund manually. |
The idea was if a swap failed with low gas the GUI may suggest to the user to increase gas limit. |
Internally we discussed that this feature can be helpful for extra flexibility with gas management. If your experience suggests it would create more problems than solve, let's not do it. |
the feature to try same swap with higher limits can be useful, i just wanted to point out that it will not always work (because other side needs to change the settings too) and that we will need to fix the problem that such failed swaps show up as successful on maker... simply check
while the tx is actually reverted: https://polygonscan.com/tx/0x2d4045feb2f25e0eb351fca6e9ea1a9bba851c178c6e2552a65947377712640b |
current behaviour: network fees are much higher than the actual recommended/required network fee. This applies to normal withdraw transactions and swaps - and affects pretty much all assets.
reproduction steps: create transaction / swap and compare relevant transaction fee(s) with other wallets (same asset).
tested wallets: ledger, trezor, metamask, keplr
expected behaviour: API evaluates the fee based on actual network metrics / simulations and uses a dynamic value (propose 3 levels: low priority, default/normal priority, high priority). Furthermore, and as part of the tx-preimage gen or TX preparation / simulation, we want to provide additional information such as the size of the transaction (in bytes), the actual fee and price per byte (sat per byte, ...) etc. and in order to align with other implementations.
ultimate goal: We need to reliably propose a affordable and competitive TX fee - for all assets and all transaction types.
related:
#710
#1847
#1835
https://docs.cosmos.network/v0.47/basics/gas-fees
https://docs.cosmos.network/main/run-node/txs#simulating-a-transaction
The text was updated successfully, but these errors were encountered: