feat(ETH): add eth access list (experimental)
This is an experimental PR to evaluate whether we can use EIP-2930 access lists. EVM access lists (added to a transaction calling a contract) may reduce gas consumption when a contract is called. Access list specified addresses and EVM slots which this contract is used and EVM preloads them in memory. EVM operations with such preloaded objects are charged with less gas.
This PR allows to use access lists to swap transactions. The access lists are created with eth_createAccessList rpc with some customisation (namely, removing an access list item pointing to the etomic contract itself which does not reduce gas). Tests show that such customised lists provide saving of 200 to 400 gas units for a call.
To use access lists in swaps a bool "use_access_list" param is added to coins. I added printing of tx gasUsed in one docker eth test where one can see gas with or without access list (by changing "use_access_list" param in eth test coin config).
attn: @cipig
Also added: 'version' to swap negotiation protocol. New features (eip1559 or access list) won't be used in swap txns if other node has older version.
Fixed:
getting max_eth_tx_type and gas_fee_estimator params from the platform coin if enable_eth_with_tokens rpc is used to activate coins (previously worked only when enable rpc). Problems solved: gas fee estimator did not start and eip1559 txns were not created.
This PR becomes important because evm tx type activation by version is added here - allows to do evm swaps with old nodes. Also a few fixes for that code related to settings in the coins file was added here. @shamardy
I tried testing this for https://github.com/KomodoPlatform/komodo-docs-mdx/pull/293 but I end up with
{
"mmrpc": "2.0",
"error": "Gas fee estimation not supported for this coin",
"error_path": "get_estimated_fees",
"error_trace": "get_estimated_fees:206]",
"error_type": "CoinNotSupported",
"id": null
}
from request
{
"userpass": "{{userpass}}",
"mmrpc": "2.0",
"method": "start_eth_fee_estimator",
"params": {
"coin": "ETH"
}
// "id": null // Accepted values: Integers
}
Is something needed in the coins file, or specific params needed during the coin activation? Which coins are (or will be) supported? I've attempted with both enable and enable_eth_with_tokens methods on 2.2.0-beta_35de663
Is something needed in the coins file, or specific params needed during the coin activation?
Gas fee estimator is supported for ETH-like coins with EIP-1559 implemented. To enabled it platform coin ('ETH') should have param: "gas_fee_estimator": "provider" (or "simple") If "provider" is set then MM2.json needs a config for the provider:
"gas_api": {"provider": "Blocknative", "url": "https://api.blocknative.com"},
(btw proposals to improve this or make similar to other configs appreciated)
@dimxy @shamardy could you please clarify what the priority of this feature (when its preferable to have it in production)? I see this pr is focusing on legacy swap. also @dimxy fix the conflicts please if you think that this feature is r2r
@dimxy @shamardy could you please clarify what the priority of this feature (when its preferable to have it in production)? I see this pr is focusing on legacy swap. also @dimxy fix the conflicts please if you think that this feature is r2r
This PR initially was optional, for studying eth access lists in swaps. However when testing it I realised that we need remote-node-version activated support for eip2930/eip1559 eth transactions (this is needed not only for this PR but for already merged code for priority fee). So I added this version activation in this PR and would like to have it merged
Closing this PR because access lists did not show considerable advantage. Also, we decided to implement version in a different way