mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
CW-519 Enable built-in Tor (#1950)
* tor wip * Enable tor on iOS * Prevent app lag when node is exceptionally slow (usually over tor) * fix: logic in daemonBlockchainHeight refresh fix: storing tor state * Pin ledger_flutter_plus dependency to fix builds * bump arti version * wip * add single httpclient * route everything I was able to catch trough the built-in tor node * Enable proxy for http.Client [run tests] * add tor proxy support to cw_evm, cw_tron and cw_polygon [run tests] * remove log pollution, cleanup [skip slack] * fix tests not working in latest main [skip slack] [run tests] * remove cw_wownero import * fix build issues * migrate all remaining calls to use ProxyWrapper add a CI action to enforce using ProxyWrapper instead of http/http.dart to prevent leaks * fix tor background sync (will work on test builds after #2142 is merged and this PR is rebased on top) * wip [skip ci] * relicense to GPLv3 add socks5 license, build fixes * use ProxyWrapper instead of http in robinhood * Revert "relicense to GPLv3" * feat(cw_bitcoin): support socks proxy and CakeTor * fix(tor): migrate OCP and EVM over to ProxyWrapper() * chore: cleanup fix: show tor loading screen when app is starting * fix: tor switch properly dismisses fullscreen loading dialog fix: connectToNode after tor startup on app start * fix(tor): status check for xmr/wow/zano * fix(tor): onramper request fix * fix(api): ServicesResponse is now being cached and doesn't fetch data everytime DashboardViewModel is being rebuilt fix(tor): do not fallback to clearnet when tor failed. fix(tor): do not leak connections during app startup chore: refactor bootstrap() function to be separated into bootstrapOffline and bootstrapOnline fix(cw_bitcoin): migrate payjoin to use ProxyWrapper * [skip ci] remove print * address comments from review * fix: derusting tor implementation Instead of rust-based Arti I've moved back to the OG C++ tor implementation. This fixed all issues we had with Tor. - onion services now work - all requests are going through without random errors - we don't have to navigate a maze of multiple forks of multiple packages - fully working `torrc` config file (probably will be needed for Tari). - logging for Tor client - and so on. feat: network logging tab feat: use built-in proxy on Tails - this should resolve all issues for Tails users (needs testing though) * fix conflicts with main bump https to fix build issue relax store() call * fix(cw_wownero): tor connection fix(tor): connection issues * fix(cw_evm): add missing chainId fix(cw_core): solana rpc fix * feat: mark tor as experimental fix: drop anonpay onion authority fix: drop fiatapi onion authority fix: drop trocador onion authority fix: disable networkimage when tor is enabled fix: handle cakepay errors gracefully * fix re-formatting [skip ci] * changes from review * Delete android/.kotlin/sessions/kotlin-compiler-2468481326039681181.salive * fix missing imports * Update pubspec_base.yaml --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
parent
18c2ba9366
commit
5082dc20f3
139 changed files with 2754 additions and 878 deletions
|
@ -146,7 +146,25 @@ int getUnlockedBalance({int accountIndex = 0}) =>
|
|||
|
||||
int getCurrentHeight() => currentWallet?.blockChainHeight() ?? 0;
|
||||
|
||||
int getNodeHeightSync() => currentWallet?.daemonBlockChainHeight() ?? 0;
|
||||
|
||||
int cachedNodeHeight = 0;
|
||||
bool isHeightRefreshing = false;
|
||||
int getNodeHeightSync() {
|
||||
if (isHeightRefreshing == false) {
|
||||
(() async {
|
||||
try {
|
||||
isHeightRefreshing = true;
|
||||
final wptrAddress = currentWallet!.ffiAddress();
|
||||
cachedNodeHeight = await Isolate.run(() async {
|
||||
return monero.Wallet_daemonBlockChainHeight(Pointer.fromAddress(wptrAddress));
|
||||
});
|
||||
} finally {
|
||||
isHeightRefreshing = false;
|
||||
}
|
||||
})();
|
||||
}
|
||||
return cachedNodeHeight;
|
||||
}
|
||||
|
||||
bool isConnectedSync() => currentWallet?.connected() != 0;
|
||||
|
||||
|
@ -202,7 +220,6 @@ Future<bool> setupNodeSync(
|
|||
}
|
||||
|
||||
void startRefreshSync() {
|
||||
currentWallet!.refreshAsync();
|
||||
currentWallet!.startRefresh();
|
||||
}
|
||||
|
||||
|
@ -228,7 +245,7 @@ void storeSync({bool force = false}) async {
|
|||
return monero.Wallet_synchronized(Pointer.fromAddress(addr));
|
||||
});
|
||||
if (lastStorePointer == addr &&
|
||||
lastStoreHeight + 5000 > currentWallet!.blockChainHeight() &&
|
||||
lastStoreHeight + 75000 > currentWallet!.blockChainHeight() &&
|
||||
!synchronized &&
|
||||
!force) {
|
||||
return;
|
||||
|
|
|
@ -17,6 +17,7 @@ import 'package:cw_core/pending_transaction.dart';
|
|||
import 'package:cw_core/sync_status.dart';
|
||||
import 'package:cw_core/transaction_direction.dart';
|
||||
import 'package:cw_core/unspent_coins_info.dart';
|
||||
import 'package:cw_core/utils/proxy_wrapper.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_core/wallet_base.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
|
@ -207,6 +208,14 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
|
||||
@override
|
||||
Future<void> connectToNode({required Node node}) async {
|
||||
String socksProxy = node.socksProxyAddress ?? '';
|
||||
printV("bootstrapped: ${CakeTor.instance.bootstrapped}");
|
||||
printV(" enabled: ${CakeTor.instance.enabled}");
|
||||
printV(" port: ${CakeTor.instance.port}");
|
||||
printV(" started: ${CakeTor.instance.started}");
|
||||
if (CakeTor.instance.enabled) {
|
||||
socksProxy = "127.0.0.1:${CakeTor.instance.port}";
|
||||
}
|
||||
try {
|
||||
syncStatus = ConnectingSyncStatus();
|
||||
await monero_wallet.setupNodeSync(
|
||||
|
@ -216,7 +225,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
useSSL: node.isSSL,
|
||||
isLightWallet: false,
|
||||
// FIXME: hardcoded value
|
||||
socksProxyAddress: node.socksProxyAddress);
|
||||
socksProxyAddress: socksProxy);
|
||||
|
||||
await monero_wallet.setTrustedDaemon(node.trusted);
|
||||
syncStatus = ConnectedSyncStatus();
|
||||
|
|
|
@ -66,11 +66,11 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
path: "."
|
||||
ref: cake-update-v2
|
||||
resolved-ref: "59fdf29d72068e0522a96a8953ed7272833a9f57"
|
||||
ref: cake-update-v4
|
||||
resolved-ref: "437dadd0bd9bf73ec6a551299577799341f6486a"
|
||||
url: "https://github.com/cake-tech/blockchain_utils"
|
||||
source: git
|
||||
version: "3.3.0"
|
||||
version: "4.3.0"
|
||||
bluez:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -599,10 +599,10 @@ packages:
|
|||
description:
|
||||
path: "."
|
||||
ref: cake-update-v2
|
||||
resolved-ref: "93440dc5126369b873ca1fccc13c3c1240b1c5c2"
|
||||
resolved-ref: "084fb7bf13ec42d74f26ac08c883ce07c10fca7e"
|
||||
url: "https://github.com/cake-tech/on_chain.git"
|
||||
source: git
|
||||
version: "3.7.0"
|
||||
version: "6.2.0"
|
||||
package_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -779,11 +779,21 @@ packages:
|
|||
socks5_proxy:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: socks5_proxy
|
||||
sha256: "616818a0ea1064a4823b53c9f7eaf8da64ed82dcd51ed71371c7e54751ed5053"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
path: "."
|
||||
ref: "27ad7c2efae8d7460325c74b90f660085cbd0685"
|
||||
resolved-ref: "27ad7c2efae8d7460325c74b90f660085cbd0685"
|
||||
url: "https://github.com/LacticWhale/socks_dart"
|
||||
source: git
|
||||
version: "2.1.0"
|
||||
socks_socket:
|
||||
dependency: transitive
|
||||
description:
|
||||
path: "."
|
||||
ref: e6232c53c1595469931ababa878759a067c02e94
|
||||
resolved-ref: e6232c53c1595469931ababa878759a067c02e94
|
||||
url: "https://github.com/sneurlax/socks_socket"
|
||||
source: git
|
||||
version: "1.1.1"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -860,10 +870,19 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: timing
|
||||
sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe"
|
||||
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
version: "1.0.1"
|
||||
tor_binary:
|
||||
dependency: transitive
|
||||
description:
|
||||
path: "."
|
||||
ref: cb811c610871a9517d47134b87c2f590c15c96c5
|
||||
resolved-ref: cb811c610871a9517d47134b87c2f590c15c96c5
|
||||
url: "https://github.com/MrCyjaneK/flutter-tor_binary"
|
||||
source: git
|
||||
version: "4.7.14"
|
||||
tuple:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue