Skip to content

Commit

Permalink
Mm2.1 extended error #550 (#923)
Browse files Browse the repository at this point in the history
* Add and implement MmError

* Add WithdrawError returned from 'MmCoin::withdraw'
* Collect 'available' and 'required' info within GenerateTxError
* Add other internal error types

* Add BalanceError returned from my_balance

* Add more error types
* Add Web3RpcError,
* Refactor the ordered_mature_unspents, list_unspent_ordered methods to return an extended error
* Rename MmRpcError to UtxoRpcError

* Refactor MmError mapping
* Separate mm_error into several modules
* Rename into_mm_and() to into_mm()
* add into_mm_fut

* Implement MarketMaker2 RPC protocol v2
* Add lp_protocol, dispatcher_v2, dispatcher_legacy modules
* Change the coins::withdraw function signature
* Add HttpStatusCode trait
* Refactor test_withdraw_and_send to use v2 protocol
* Add test_mm2rpc test_withdraw_legacy, test_withdraw_not_sufficient_balance

* Upgrade the trade_preimage RPC call to the mmrpc 2.0
* Move lp_swap::trade_preimage and dependent types to the separated lp_swap::trade_preimage module
* Change the trade_preimage_rpc function signature
* Extend CheckBalanceError and move it to the separated check_balance module
* Refactor test_maker_trade_preimage, test_taker_trade_preimage to use v2 protocol
* Add test_trade_preimage_not_sufficient_balance, test_trade_preimage_legacy, test_trade_preimage_dynamic_fee_not_sufficient_balance tests

* Remove boilerplate
* Add lp_coinfind_or_err and CoinFindError
* Replace lp_coinfind with lp_coinfind_or_err in coins::withdraw, trade_preimage_rpc

* Move functions that check the trade balance to check_balance module
* Move check_my_coin_balance_for_swap, check_other_coin_balance_for_swap, check_base_coin_balance_for_swap

* Make a compile time checking if an error type is tagged
* Add ser_error, ser_error_derive crates
* Remove a runtime checking if an error type is tagged
* Fill out the mm_error documentation with the examples

* Fix rustfmt warnings

* Add missing ser_error, ser_error_derive crates

* Fix PR issues
* Rename 'into_mm' to 'map_to_mm', 'into_mm_fut' to 'map_to_mm_fut'
* Remove CoinFindError::NoCoinsContext error variant, replace it with the panic
  • Loading branch information
sergeyboyko0791 authored May 3, 2021
1 parent 4fbe21e commit a632a47
Show file tree
Hide file tree
Showing 45 changed files with 4,057 additions and 1,599 deletions.
26 changes: 26 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ common = { path = "mm2src/common" }
crc = "1.8"
crc32fast = { version = "1.2", features = ["std", "nightly"] }
crossbeam = "0.7"
derive_more = "0.99"
either = "1.6"
ethereum-types = { version = "0.4", default-features = false, features = ["std", "serialize"] }
enum-primitive-derive = "0.1"
Expand Down Expand Up @@ -98,6 +99,8 @@ serde = "1.0"
serde_bencode = "0.2"
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_derive = "1.0"
ser_error = { path = "mm2src/derives/ser_error" }
ser_error_derive = { path = "mm2src/derives/ser_error_derive" }
serialization = { git = "https://github.com/artemii235/parity-bitcoin.git" }
serialization_derive = { git = "https://github.com/artemii235/parity-bitcoin.git" }
sp-trie = "2.0.0"
Expand Down Expand Up @@ -142,6 +145,8 @@ members = [
"mm2src/floodsub",
"mm2src/mm2_libp2p",
"mm2src/gossipsub",
"mm2src/derives/ser_error",
"mm2src/derives/ser_error_derive",
]

# The backtrace disables build.define("HAVE_DL_ITERATE_PHDR", "1"); for android which results in "unknown" function
Expand Down
3 changes: 3 additions & 0 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ byteorder = "1.3"
bytes = "0.4"
chain = { git = "https://github.com/artemii235/parity-bitcoin.git" }
common = { path = "../common" }
derive_more = "0.99"
ethabi = { git = "https://github.com/artemii235/ethabi" }
ethcore-transaction = { git = "https://github.com/artemii235/parity-ethereum.git" }
ethereum-types = { version = "0.4", default-features = false, features = ["std", "serialize"] }
Expand Down Expand Up @@ -49,6 +50,8 @@ serde = "1.0"
serde_derive = "1.0"
serde_json = { version = "1.0", features = ["preserve_order", "raw_value"] }
serialization = { git = "https://github.com/artemii235/parity-bitcoin.git" }
ser_error = { path = "../derives/ser_error" }
ser_error_derive = { path = "../derives/ser_error_derive" }
sha2 = "0.8"
sha3 = "0.8"
# One of web3 dependencies is the old `tokio-uds 0.1.7` which fails cross-compiling to ARM.
Expand Down
Loading

0 comments on commit a632a47

Please sign in to comment.