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

[r2r] gui-auth & enable_v2 rpc implementation #1335

Merged
merged 71 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b0cefff
implement validation strcuture
onur-ozkan Jul 5, 2022
cbb30d6
add signed_message to payload if exists
onur-ozkan Jul 6, 2022
f5912ae
update doc-comment of `drop_mutability` macro
onur-ozkan Jul 6, 2022
e366fff
update `fn sign_message_hash`
onur-ozkan Jul 6, 2022
85a6404
fill `gui_auth_message_prefix` fields for tests
onur-ozkan Jul 6, 2022
9efd6bc
create and implement `trait GuiAuthMessages`
onur-ozkan Jul 6, 2022
a59f4bd
save development state
onur-ozkan Jul 6, 2022
6a79d3c
save development state
onur-ozkan Jul 6, 2022
84ec84f
save development state
onur-ozkan Jul 6, 2022
903edf3
save development state
onur-ozkan Jul 7, 2022
19ffa09
save development state
onur-ozkan Jul 7, 2022
f83f5b3
save development state
onur-ozkan Jul 7, 2022
6f36e60
save development state
onur-ozkan Jul 8, 2022
469e093
save development state
onur-ozkan Jul 8, 2022
e7bada5
save development state
onur-ozkan Jul 8, 2022
944a354
save development state
onur-ozkan Jul 10, 2022
3bdc56b
finalize `fn enable_v2` implementation
onur-ozkan Jul 11, 2022
697e7d5
force UTC tz for gui-auth signed messages
onur-ozkan Jul 12, 2022
e02b13c
optimize `Web3Transport` initialization
onur-ozkan Jul 12, 2022
5fee6a8
Merge branch 'dev' of github.com:KomodoPlatform/atomicDEX-API into gu…
onur-ozkan Jul 12, 2022
2a5e084
save development state
onur-ozkan Jul 12, 2022
423ca6e
inline `Web3Transport` initialization functions
onur-ozkan Jul 12, 2022
0466601
Update Cargo.toml
onur-ozkan Jul 12, 2022
4c6453f
update version handling of eth coins
onur-ozkan Jul 12, 2022
74ce301
provide better error handling
onur-ozkan Jul 13, 2022
a75014a
simplify `generate_gui_auth_signed_validation`
onur-ozkan Jul 13, 2022
ad5a67d
save development state
onur-ozkan Jul 15, 2022
1e013e1
save development state
onur-ozkan Jul 19, 2022
a8de7e6
save development state
onur-ozkan Jul 19, 2022
38430a9
save p.o.c state
onur-ozkan Jul 19, 2022
8eed30b
save development state
onur-ozkan Jul 20, 2022
0f77653
exclude `activate_eth_coin`
onur-ozkan Jul 20, 2022
4e99578
finalize `eth_and_erc20_activations` functionality
onur-ozkan Jul 20, 2022
933e439
save development state
onur-ozkan Jul 20, 2022
e0d797e
save development state
onur-ozkan Jul 20, 2022
38be805
fix `check --tests`
onur-ozkan Jul 20, 2022
c588ecd
finish `register_token_info` fn
onur-ozkan Jul 20, 2022
e314ba3
implement `erc20_token_activation` rpc
onur-ozkan Jul 20, 2022
92c9a71
map errors for eth/erc20 activation
onur-ozkan Jul 21, 2022
b453c15
fix wasm build failure
onur-ozkan Jul 21, 2022
78942e1
fix fmt
onur-ozkan Jul 21, 2022
e89a9ec
rename `EthActivationRequest` to `EthActivationV2Request`
onur-ozkan Jul 21, 2022
5be5b83
optimize implementation
onur-ozkan Jul 21, 2022
0b3a42b
drop mutability after updates
onur-ozkan Jul 21, 2022
fd860b5
save development state
onur-ozkan Jul 21, 2022
e19e072
make `fn enable_token` less bloat
onur-ozkan Jul 22, 2022
254a72e
make `enable_tokens` less bloat
onur-ozkan Jul 22, 2022
9004d58
finalize review fixes
onur-ozkan Jul 22, 2022
c903a29
update errors
onur-ozkan Jul 22, 2022
ece5bdd
update visibility & privacy modifiers in `eth.rs`
onur-ozkan Jul 22, 2022
d3ee874
make `get_token_balance_by_address` async fn
onur-ozkan Jul 22, 2022
ec33738
avoid using hard-coded ticker for gui-auth
onur-ozkan Jul 25, 2022
619487a
fix review note
onur-ozkan Jul 26, 2022
214df5c
optimize pr stage
onur-ozkan Jul 26, 2022
d9de507
optimize `send_request` of wasm
onur-ozkan Jul 26, 2022
4e00a1f
fix wasm compilation
onur-ozkan Jul 27, 2022
81c67c6
fix pr notes
onur-ozkan Jul 27, 2022
c038188
fix formatting
onur-ozkan Jul 27, 2022
198a83a
Merge branch 'dev' into gui-auth-implementation
onur-ozkan Jul 27, 2022
be59129
update `get_public_address` to uncompress format for ethereum
onur-ozkan Jul 28, 2022
300791e
no need to clone Erc20TokenInfo for `get_token_balance_by_address`
onur-ozkan Jul 28, 2022
7bf4e57
update `InvalidSwapContractAddr` and `InvalidFallbackSwapContract` ma…
onur-ozkan Jul 28, 2022
af3ed50
refactor `AsyncMutex` to std one for `eth20_tokens_infos` of `EthCoin…
onur-ozkan Jul 29, 2022
31605e5
fix pr notes
onur-ozkan Aug 2, 2022
8c37c20
fix pr reviews
onur-ozkan Aug 3, 2022
528bdb3
fix pr reviews
onur-ozkan Aug 3, 2022
bc60c20
create `Web3Transport::single_node` fn
onur-ozkan Aug 3, 2022
5975d6a
update `start_history_background_fetching` return type
onur-ozkan Aug 3, 2022
a691c94
Revert "update `start_history_background_fetching` return type"
onur-ozkan Aug 4, 2022
a67c162
remove `tx_history` for eth v2 activation
onur-ozkan Aug 4, 2022
9c011f2
fix
onur-ozkan Aug 4, 2022
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
9 changes: 1 addition & 8 deletions mm2src/coins/eth/v2_activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ pub struct EthActivationV2Request {
pub gas_station_policy: GasStationPricePolicy,
pub mm2: Option<u8>,
#[serde(default)]
Copy link
Collaborator

@shamardy shamardy Aug 4, 2022

Choose a reason for hiding this comment

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

I guess this #[serde(default)] is not needed anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I missed it, thanks!

pub tx_history: bool,
pub required_confirmations: Option<u64>,
}

Expand Down Expand Up @@ -218,12 +217,6 @@ pub async fn eth_coin_from_conf_and_request_v2(

let sign_message_prefix: Option<String> = json::from_value(conf["sign_message_prefix"].clone()).ok();

let initial_history_state = if req.tx_history {
HistorySyncState::NotStarted
} else {
HistorySyncState::NotEnabled
};

let mut map = NONCE_LOCK.lock().unwrap();
let nonce_lock = map.entry(ticker.to_string()).or_insert_with(new_nonce_lock).clone();

Expand All @@ -241,7 +234,7 @@ pub async fn eth_coin_from_conf_and_request_v2(
gas_station_policy: req.gas_station_policy,
web3,
web3_instances,
history_sync_state: Mutex::new(initial_history_state),
history_sync_state: Mutex::new(HistorySyncState::NotEnabled),
ctx: ctx.weak(),
required_confirmations,
chain_id: conf["chain_id"].as_u64(),
Expand Down
13 changes: 4 additions & 9 deletions mm2src/coins_activation/src/eth_with_token_activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use coins::{eth::{v2_activation::{eth_coin_from_conf_and_request_v2, Erc20Protoc
Erc20TokenInfo, EthCoin, EthCoinType},
my_tx_history_v2::TxHistoryStorage,
CoinBalance, CoinProtocol, MarketCoinOps, MmCoin};
use common::{log::error, mm_metrics::MetricsArc, Future01CompatExt};
use futures::future::{abortable, AbortHandle};
use common::{mm_metrics::MetricsArc, Future01CompatExt};
use futures::future::AbortHandle;
use mm2_core::mm_ctx::MmArc;
use mm2_err_handle::prelude::*;
use mm2_number::BigDecimal;
Expand Down Expand Up @@ -105,7 +105,7 @@ pub struct EthWithTokensActivationRequest {
}

impl TxHistory for EthWithTokensActivationRequest {
fn tx_history(&self) -> bool { self.platform_request.tx_history }
fn tx_history(&self) -> bool { false }
}

impl TokenOf for EthCoin {
Expand Down Expand Up @@ -230,11 +230,6 @@ impl PlatformWithTokensActivationOps for EthCoin {
_storage: impl TxHistoryStorage + Send + 'static,
_initial_balance: BigDecimal,
) -> AbortHandle {
error!(
"tx_history is not allowed for {}. It works very slowly and requires a lot of disk space.",
self.ticker()
);
let (_, abort_handle) = abortable(async {});
abort_handle
unimplemented!()
}
}