Repository navigation
Add Tor support for Ethereum, fix clearnet image loads in Tor mode - #1479
Open
kroplabeskidu wants to merge 3 commits into
Open
kroplabeskidu wants to merge 3 commits into
kroplabeskidu wants to merge 3 commits into
Conversation
web3dart was handed a plain http Client, so ETH and ERC-20 RPC could not use Tor and the coin was flagged as not Tor-ready. Give it an IOClient wrapping a SOCKS5-proxied HttpClient instead, the same way Solana does it, and do the same for the node connection test. Also add the usual node tor/clearnet mismatch check and set torSupport.
Nano and Banano already send every request through Tor, and Fact0rn uses the regular ElectrumX client, so they only needed the torSupport flag. The Stellar node test proxied its first request but then created a StellarSDK with the default client, so the follow-up ledger query went out directly.
Image.network and SvgPicture.network use their own HTTP clients and ignore the Tor setting, so token logos, exchange and coin logos, CakePay card images, ShopinBit attachments and theme previews were fetched directly even in Tor mode. Add TorAwareNetworkImage and TorAwareSvgNetworkLoader, which go through the app's HTTP wrapper, and use them at all call sites.
Member
|
Just FYI we have been reviewing this, it's not being ignored |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ETH has been flagged as not Tor-ready because web3dart only takes an http
Client, which has no proxy support. It does work with anIOClientaround adart:ioHttpClient, and that can be pointed at the Tor SOCKS5 proxy withSocksTCPClient.assignToHttpClient, the same way the Solana RPC client is set up. So this adds Tor support for ETH and ERC-20 tokens: wallet RPC, the node connection test, the usual node tor/clearnet mismatch check, andtorSupport => true.While going through the other coins and Tor code paths I found a few more things:
torSupportflag, so users got the warning for nothing. I also settorEnabledon the Fact0rn default node, like Peercoin's.StellarSDKwithout the proxied client, so the ledger query went out directly.Image.networkandSvgPicture.networkignore the Tor setting. Token logos, exchange/coin logos in the swap flow, CakePay card images, ShopinBit attachments and theme previews were fetched directly in Tor mode. I addedTorAwareNetworkImageandTorAwareSvgNetworkLoader, which go through the existingHTTPwrapper, and switched all call sites to them. Like the rest of the wrapper, they fail instead of falling back to clearnet when Tor is enabled but not connected.Epic, MWC and Xelis connect from their native libs with no proxy option, so they keep the warning.
One behaviour change: with Tor on and an ETH node set to clearnet-only, you now get
NodeTorMismatchConfigException, same as Solana/Stellar.I added a test that runs
eth_blockNumberthrough a fake SOCKS5 server and checks that the hostname is sent to the proxy, plus one for the direct path when Tor is off. The fullflutter testpasses in the stackwallet-ci image (604 passed, 4 skipped), and the changed files pass the format check. A few of the touched files weren't formatted on staging yet, so their diffs include formatting changes.