Skip to content
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): eip1559 gas fee estimator and rpcs #2051

Merged
merged 79 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
cde2dbd
add simple eip1559 gas price estimator
dimxy Dec 29, 2023
85e8fb2
change fn get_eip1559_gas_price to async to use as nested call
dimxy Jan 17, 2024
ca60f7d
add rpc to start/stop gas fee estimator loop and get estimated values
dimxy Jan 17, 2024
6788529
fix fmt
dimxy Jan 17, 2024
976628b
add test calls to infura and blocknative gas price prediction api
dimxy Feb 11, 2024
ee85d20
refactor on review notes:
dimxy Feb 24, 2024
9e34949
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy Feb 25, 2024
42316c1
fix fmt
dimxy Feb 25, 2024
aa8660c
Implement proposal.
Feb 27, 2024
3e69a31
Refactor a bit.
Feb 27, 2024
2031b73
remove unused fee estimator errors
dimxy Mar 7, 2024
c87658a
rename get esimated fee rpc
dimxy Mar 7, 2024
61a80a9
add doc comments
dimxy Mar 8, 2024
46ceacc
rename gas fee estimation fn like in eip1559 terms
dimxy Mar 8, 2024
3413447
refactor fee estimator error dsc
dimxy Mar 8, 2024
9347f10
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy Mar 13, 2024
1b4180f
remove discontinued gas station call, use join to call alternate gas …
dimxy Mar 13, 2024
8750b6b
fix fmt
dimxy Mar 13, 2024
504657e
remove gas station remnants
dimxy Mar 13, 2024
fc4ca71
refactor to support typed txns (used test eth dependency repo), renam…
dimxy Mar 4, 2024
00f7f41
add eip1559 fee support to eth withdraw (still use test eth tx repo)
dimxy Mar 7, 2024
65a2174
add swap txfee policy
dimxy Mar 12, 2024
a56d2c3
refactor to reuse tx builder code
dimxy Mar 13, 2024
8ebb655
add eip1559 fee to swap txns (pre-TPU)
dimxy Mar 15, 2024
0743471
add get_swap_transaction_fee_policy rpc for eth coin
dimxy Mar 18, 2024
9081aa5
refactor get_estimated_fees rpc to use lp_coinfind_or_err
dimxy Mar 18, 2024
acd048b
fix fmt
dimxy Mar 19, 2024
d7de499
fix estimated base fee adjustment
dimxy Mar 22, 2024
9086052
always use high priority fee for gas estimation
dimxy Mar 22, 2024
90e585b
add different eth gas limit consts for swap operations
dimxy Mar 22, 2024
61b8fdc
add include_refund_fee param to show only required fee for lock funds…
dimxy Mar 22, 2024
220db97
fix get_eip1559_gas_fee after rebase
dimxy Mar 22, 2024
24f7644
fix clippy & fmt, fix missed param in get_sender_trade_fee tests
dimxy Mar 22, 2024
25d80f4
fix updated fn get_sender_trade_fee() gas limit calc and tests
dimxy Mar 23, 2024
431c5ce
fix gas limit consts for watcher; swap_watcher_tests with eth erc20 a…
dimxy Mar 23, 2024
67214d2
add eth type1 and type2 support in signed_tx_from_web3_tx fn
dimxy Mar 24, 2024
dae6645
fix fmt
dimxy Mar 24, 2024
df5daa2
fix parse web3 tx type0
dimxy Mar 25, 2024
098eaa2
add tests for type0 and type2 eth swap
dimxy Mar 25, 2024
86a8172
fix fmt
dimxy Mar 25, 2024
a62d7a4
add handling of errors from updated mm2-parity-ethereum lib
dimxy Mar 30, 2024
8230a89
refactor TransactionRequest creation
dimxy Mar 30, 2024
90f362a
add eth wasm test to sign priority fee tx
dimxy Mar 30, 2024
27a9743
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy Mar 30, 2024
b21a186
fix comment
dimxy Mar 30, 2024
bc67d5b
refactor fee per gas determination
dimxy Mar 31, 2024
a16f2ae
refactor signed_tx_from_web3_tx fn using tx builder
dimxy Mar 31, 2024
66f8ff7
more refactor signed_tx_from_web3_tx fn: use match
dimxy Mar 31, 2024
0ec27e9
refactor getting gas price and fee per gas
dimxy Apr 1, 2024
e473517
fix comment
dimxy Apr 4, 2024
7fa8d1f
fix due to changes in gas api provider response
dimxy Apr 4, 2024
a13fbfb
moved FeeEstimatorContext to eth platform coin
dimxy Apr 4, 2024
0435273
added comment
dimxy Apr 4, 2024
d607ae3
added memo comments
dimxy Apr 4, 2024
342d3f4
fix updated eth and web3 lib dependency urls
dimxy Apr 8, 2024
531f1af
refactor on review notes
dimxy Apr 8, 2024
789ec76
refactor on review notes:
dimxy Apr 9, 2024
d59387c
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy Apr 9, 2024
1793bb7
fix fmt
dimxy Apr 9, 2024
086a711
fix clippy err
dimxy Apr 9, 2024
7229e34
add 'gas_fee_estimator' param to 'coins' conf
dimxy Apr 13, 2024
48db16c
add 'max_eth_tx_type' to coins file and check tx type on signing
dimxy Apr 13, 2024
f0371e5
refactor estimated gas fee code to use wei internally (to make it lik…
dimxy Apr 13, 2024
b2e0677
add eip1559 fee per gas option to sign_raw_transaction rpc
dimxy Apr 13, 2024
8cb846c
refactor gas limit constants
dimxy Apr 13, 2024
fffe24a
refactor swap code to add named constants indicating when refund fee …
dimxy Apr 13, 2024
ebe4cad
fix getting 'max_eth_tx_type' to look for it also in token conf to al…
dimxy Apr 13, 2024
54b60a6
add check result for wasm sign raw tx test
dimxy Apr 14, 2024
898a89d
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy Apr 16, 2024
9169bcb
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy May 9, 2024
b3a84d6
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy May 9, 2024
7cbe03d
fix build err
dimxy May 10, 2024
9de585b
fix eip1559 trezor signature parsing
dimxy May 10, 2024
c516fd1
fix fmt
dimxy May 10, 2024
902c0e3
refactor init_fee_estimator
dimxy May 13, 2024
dbe8de0
Merge branch 'dev' into eip1559-gas-fee-estimate
dimxy May 14, 2024
20d16d9
fix review notes
dimxy May 17, 2024
a785274
move eip1559 swap policy methods to a trait
dimxy May 17, 2024
1cbf2f2
return swap policy docker tests (lost in merge)
dimxy May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions mm2src/adex_cli/src/rpc_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! *Note: it's expected that the following data types will be moved to mm2_rpc::data when mm2 is refactored to be able to handle them*
//!

use mm2_rpc::data::legacy::{ElectrumProtocol, GasStationPricePolicy, UtxoMergeParams};
use mm2_rpc::data::legacy::{ElectrumProtocol, UtxoMergeParams};
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize)]
Expand All @@ -23,12 +23,6 @@ pub(crate) struct EnableRequest {
#[serde(skip_serializing_if = "Option::is_none")]
fallback_swap_contract: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
gas_station_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
gas_station_decimals: Option<u8>,
#[serde(skip_serializing_if = "Option::is_none")]
gas_station_policy: Option<GasStationPricePolicy>,
#[serde(skip_serializing_if = "Option::is_none")]
mm2: Option<u8>,
#[serde(default)]
tx_history: bool,
Expand Down
6 changes: 3 additions & 3 deletions mm2src/coins/Cargo.toml
laruh marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ derive_more = "0.99"
ed25519-dalek = "1.0.1"
enum_derives = { path = "../derives/enum_derives" }
ethabi = { version = "17.0.0" }
ethcore-transaction = { git = "https://github.com/KomodoPlatform/mm2-parity-ethereum.git" }
ethcore-transaction = { git = "https://github.com/KomodoPlatform/mm2-parity-ethereum.git", rev = "mm2-v2.1.1" }
ethereum-types = { version = "0.13", default-features = false, features = ["std", "serialize"] }
ethkey = { git = "https://github.com/KomodoPlatform/mm2-parity-ethereum.git" }
ethkey = { git = "https://github.com/KomodoPlatform/mm2-parity-ethereum.git", rev = "mm2-v2.1.1" }
# Waiting for https://github.com/rust-lang/rust/issues/54725 to use on Stable.
#enum_dispatch = "0.1"
futures01 = { version = "0.1", package = "futures" }
Expand Down Expand Up @@ -112,7 +112,7 @@ url = { version = "2.2.2", features = ["serde"] }
uuid = { version = "1.2.2", features = ["fast-rng", "serde", "v4"] }
# One of web3 dependencies is the old `tokio-uds 0.1.7` which fails cross-compiling to ARM.
# We don't need the default web3 features at all since we added our own web3 transport using shared HYPER instance.
web3 = { git = "https://github.com/KomodoPlatform/rust-web3", tag = "v0.19.0", default-features = false }
web3 = { git = "https://github.com/KomodoPlatform/rust-web3", tag = "v0.20.0", default-features = false }
zbase32 = "0.1.2"
zcash_client_backend = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }
zcash_extras = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }
Expand Down
7 changes: 4 additions & 3 deletions mm2src/coins/coin_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ impl From<Web3RpcError> for ValidatePaymentError {
match e {
Web3RpcError::Transport(tr) => ValidatePaymentError::Transport(tr),
Web3RpcError::InvalidResponse(resp) => ValidatePaymentError::InvalidRpcResponse(resp),
Web3RpcError::Internal(internal) | Web3RpcError::Timeout(internal) => {
ValidatePaymentError::InternalError(internal)
},
Web3RpcError::Internal(internal)
| Web3RpcError::Timeout(internal)
| Web3RpcError::NumConversError(internal)
| Web3RpcError::InvalidGasApiConfig(internal) => ValidatePaymentError::InternalError(internal),
Web3RpcError::NftProtocolNotSupported => ValidatePaymentError::NftProtocolNotSupported,
}
}
Expand Down
Loading
Loading