-
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
feat(ETH): add gas_limit coins param to override default values #2137
Conversation
do we need both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! I have some suggestions and question
I have a set of the same gas limit constants in MM2 and this param allows to override any of them (just for sake of completeness). You may override only one or few or no one at all |
first of all, code works fine, i can set the different limits in coins file i collected some gas values for couple different tokens:
i know, some values are missing, but i guess that the following things are true:
so maybe we should change the default limits a bit
|
I found in metamask that they multiply calculated gas limit by 1,5 for contract calls. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have the same nit about the unwrap_or
s, LGTM otherwise :)
I am for this approach as I think it's the best one but it will not work for custom tokens. Maybe for custom tokens I can add higher const values when implementing them. If we follow this approach, for any new token added to config, it should be tested with the default low limits for transactions and swaps before adding the P.S. for custom tokens they will not be used for cross-chain swaps most probably but will be used to be traded on same chain using the upcoming liquidity routing feature (1inch or uniswap integration) so these will have different gas limits calculations. |
Maybe yet we could add some token categories in the coins file and create different gas limit defaults for them (like proxied/non-proxied). |
was thinking about that too, but i guess it only makes sense if proxied tokens are detected automatically by mm2 and then higher limits are applied... like default * 1.5 (this would work for EURE-PLG20, but it's the only such token i found so far, so idk if other proxied tokens need other limits... and if the detection is not done automatically, we can simply define higher limits for each of such tokens manually in the coins file with the existing "gas_limit" structure some differences in gas consumption are still a bit of a mystery to me, eg from the tokens i tested so far (30 or so), this values would work (incl. EURE-PLG20, the proxied token)
and excluding EURE-PLG20 this values are fine
but i have only tested PLG20, AVX20 and BEP20 tokens... from the main coins i also tested FTM and KCS, but not the tokens on those chains |
if coin_conf["gas_limit"].is_null() { | ||
Ok(Default::default()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already handled by serde(default)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if "gas_limit" is null serde returns invalid type: null
error. I wanted to handle this differently (to return the default) than any bad values (to fail)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
@KomodoPlatform/qa I guess @cipig already added some gas limits to some coins here KomodoPlatform/coins#1074 , KomodoPlatform/coins#1075 but the new |
I guess I can merge this since docs PR is already open and under review plus @cipig already uses it and it works. |
* dev: feat(nft-swap): add standalone maker contract and proxy support (#2100) feat(ETH): add `gas_limit` coins param to override default values (#2137) feat(tendermint): implement better sequence resolving logic (#2164) ci(artifact): add target for macos on apple silicon (#2163) fix(helpers): extend http to ws address conversion (#2166) fix(makerbot): add "testcoin" to provider options (#2161) fix(hd_wallet): make extended pubkey of hd wallet generic (#2159) fix(docker-tests): implement containers runtime directories (#2162) feat(tendermint): improve the `max` handling for tendermint withdraw (#2155) revert #2158 (comment) (#2160) ci(artifacts): upload build artifacts with in-tree script (#2158) test(tendermint): migrate to local/offline containerized testnets (#2128) use easingthemes/ssh-deploy@v5.0.3 for all builds except windows (#2157) chore(bin): rename mm2 binaries to kdf (#2126)
* dev: (22 commits) chore(release): bump mm2 version to 2.2.0-beta (KomodoPlatform#2188) ci(docker-tests): ignore tendermint IBC tests for now (KomodoPlatform#2185) feat(nft-swap): complete refund methods (KomodoPlatform#2129) chore(release): add changelog entries for v2.1.0-beta (KomodoPlatform#2165) fix(zcoin): don't force low r signing to generate htlc pubkey for zcoin (KomodoPlatform#2184) chore(rust-analyzer): add rust-analyzer into the workspace toolchain (KomodoPlatform#2179) chore: migrate .cargo/config to .cargo/config.toml to avoid deprecation warning (KomodoPlatform#2177) fix(swaps): ensure taker payment spend confirmations (KomodoPlatform#2176) feat(nft-swap): add standalone maker contract and proxy support (KomodoPlatform#2100) feat(ETH): add `gas_limit` coins param to override default values (KomodoPlatform#2137) feat(tendermint): implement better sequence resolving logic (KomodoPlatform#2164) ci(artifact): add target for macos on apple silicon (KomodoPlatform#2163) fix(helpers): extend http to ws address conversion (KomodoPlatform#2166) fix(makerbot): add "testcoin" to provider options (KomodoPlatform#2161) fix(hd_wallet): make extended pubkey of hd wallet generic (KomodoPlatform#2159) fix(docker-tests): implement containers runtime directories (KomodoPlatform#2162) feat(tendermint): improve the `max` handling for tendermint withdraw (KomodoPlatform#2155) revert KomodoPlatform#2158 (comment) (KomodoPlatform#2160) ci(artifacts): upload build artifacts with in-tree script (KomodoPlatform#2158) test(tendermint): migrate to local/offline containerized testnets (KomodoPlatform#2128) ...
In PR #2051 there were added several gas limit constants to allocate gas price more precisely for different swap operations and for sending coin and tokens, instead of the old single capped value. However there are also erc20 tokens which are called over proxy contracts, which require more gas.
This PR:
Fixes #2135
Sample of
gas_limit
(with all available limit values) in the coins file:Both
gas_limit
and all of its params are optional.