Skip to content

feat(txfee): add priority transaction fee support for tendermint coins#2282

Draft
dimxy wants to merge 3 commits intodevfrom
tendermint-priority-fee
Draft

feat(txfee): add priority transaction fee support for tendermint coins#2282
dimxy wants to merge 3 commits intodevfrom
tendermint-priority-fee

Conversation

@dimxy
Copy link
Collaborator

@dimxy dimxy commented Nov 26, 2024

Continuing adding priority transaction fee requested in issue #1848, now for Tendermint.
There are three priority levels for tx fees: low, average and high, allowing to users to set higher priority for their transactions by paying more fees.
Cosmos has a registry for its chain ecosystem: https://github.com/cosmos/chain-registry which contains suggested priority tx fees for different coins.
The priority fees from the Cosmos registry should be added in the coins file (for the platform coin only) like:

"coin":"ATOM",
        "protocol":{
            "type":"TENDERMINT",
            "protocol_data": {
                ...
                "priority_gas_prices": [0.1, 0.2, 0.3]
            },
        },
   }

To set priority level with withdraw, WithdrawFee::CosmosGasPriority variant is added.
To set priority for swaps, set_swap_transaction_fee_policy() implemented for TendermintCoin.

CosmosGasPriority {
gas_limit: u64,
gas_price_option: TendermintPriorityFeeOption,
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we extend existing option CosmosGas?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I did this like EthGasEip1559 option (which is also a dedicated variant to set priority tx fee for eth).
Also, if we combine mutually exclusive gas_price: f64 and gas_price_option: TendermintPriorityFeeOption in CosmosGas, this would require extra checks in the code.

@smk762
Copy link

smk762 commented Feb 10, 2025

I assume this will require updates to the coins repo? How often do the priority values change? Does set_swap_transaction_fee_policy involve a new config param in MM2.json?

@dimxy
Copy link
Collaborator Author

dimxy commented Feb 10, 2025

I assume this will require updates to the coins repo? How often do the priority values change? Does set_swap_transaction_fee_policy involve a new config param in MM2.json?

Yes we need to set "priority_gas_prices": [0.1, 0.2, 0.3] in the coin file. We could get them from cosmos registry (they maintain those params for each chain).

It was supposed that GUI will call set_swap_transaction_fee_policy (low, medium, priority) before starting a swap (after asking the user which one the user prefers).
I am going also to add this param to coins file, to be able to set as the default option.

@onur-ozkan
Copy link

Please ping me once this is ready for review. It's tagged with status: in progress label and has conflicts at the moment.`

@shamardy shamardy marked this pull request as draft June 11, 2025 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants