Skip to content

update tor to 0.4.8.9#794

Merged
woodser merged 1 commit intohaveno-dex:masterfrom
preland:issue789
Mar 20, 2024
Merged

update tor to 0.4.8.9#794
woodser merged 1 commit intohaveno-dex:masterfrom
preland:issue789

Conversation

@preland
Copy link
Copy Markdown
Contributor

@preland preland commented Feb 25, 2024

This PR updates the Tor browser version to 13.0.6 and the tor binary version to 0.4.8.9. It does so by using a self-updated fork of netlayer. The fork of netlayer uses this PR directly, as the most current version of the tor binary on bisq-network/tor-binary is 0.4.7.10.

Ideally, using forks and commits in this way would not happen. However, the tor-binary PR hasn't been merged or meaningfully addressed after 3 months, and netlayer seems to be continually abandoned and forked. Unsure how to proceed, if not in this way.

(Addresses #789 )

@preland preland requested a review from woodser as a code owner February 25, 2024 02:29
@woodser
Copy link
Copy Markdown
Contributor

woodser commented Feb 25, 2024

Cool, we can fork netlayer if that lets us move forward.

I'm getting this error in the app with this PR applied:

image

And this stacktrace:

Feb-25 11:00:49.463 [JavaFX Application Thread] INFO  haveno.core.app.WalletAppSetup: Initialize WalletAppSetup with monero-java version 0.8.10 
Feb-25 11:00:49.466 [PriceRequest @ http://elaxlgigphpicy5q7pi5wkz2ko2vgjbq4576vic7febmx4xcxvk6deqd.onion/] ERROR h.n.p2p.network.TorNetworkNode: Error at getSocksProxy java.lang.IllegalArgumentException: Parameter specified as non-null is null: method org.berndpruenster.netlayer.tor.Tor.getProxy, parameter proxyHost
	at org.berndpruenster.netlayer.tor.Tor.getProxy(Tor.kt)
	at org.berndpruenster.netlayer.tor.Tor.getProxy$default(Tor.kt:240)
	at org.berndpruenster.netlayer.tor.Tor.getProxy(Tor.kt)
	at haveno.network.p2p.network.TorNetworkNode.getSocksProxy(TorNetworkNode.java:114)
	at haveno.network.Socks5ProxyProvider.getSocks5ProxyInternal(Socks5ProxyProvider.java:85)
	at haveno.network.Socks5ProxyProvider.getSocks5Proxy(Socks5ProxyProvider.java:68)
	at haveno.network.http.HttpClientImpl.getSocks5Proxy(HttpClientImpl.java:332)
	at haveno.network.http.HttpClientImpl.doRequest(HttpClientImpl.java:145)
	at haveno.network.http.HttpClientImpl.get(HttpClientImpl.java:127)
	at haveno.core.provider.price.PriceProvider.getAll(PriceProvider.java:55)
	at haveno.core.provider.price.PriceRequest.lambda$requestAllPrices$0(PriceRequest.java:50)
	at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
	at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
	at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Feb 25, 2024

I’ll look into that; I should also note that I have already had to change the netlayer fork a bit to fix some odd errors (for example, the directory path to the tor binary for macOS was set to “tor.real” instead of….. just “tor”. My guess is this is something similar but for the proxy setting

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Feb 28, 2024

This fixes the error, however I am unsure if it is actually correct behavior.

The issue with the code before was that the if statement that I changed ran with a null socksProxy but streamIsolation was set to false, the code within the if statement would execute, despite the stream variable never being initialized by the if statement above it.

What it now does is create and announce an onion address, wait around a bit, complain with "Exhausted price provider list, looping to beginning", create another onion address, and repeat until the app is closed. Probably not correct behavior. I am currently unsure exactly why socksProxy is null/why streamIsolation is false, I'll need to look into that further.

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 10, 2024

Thanks for this. Please rebase on the latest master. We'll need to change the preland repo to haveno, but we can do that after tested.

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 10, 2024

Failing with a dependency verification. Run ./gradlew --write-verification-metadata sha256 to fix.

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 11, 2024

I think the error was just a fluke; I haven't been able to reproduce it

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 11, 2024

Great news. @napoly updated us to the latest TOR from Bisq in #810, which fixes the error we saw in this PR:

Error at getSocksProxy java.lang.IllegalArgumentException: Parameter specified as non-null is null: method org.berndpruenster.netlayer.tor.Tor.getProxy, parameter proxyHost.

Please rebase once more, removing the fix you made in TorNetworkNode.java, and I will test in Ubuntu ARM64. Thanks!

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 11, 2024

This is working for me on mac. :)

I guess next step would be to transition from the preland repo to haveno then.

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 11, 2024

That sounds good! When such a repo exists, I can port it to that one instead

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 12, 2024

The netlayer repo is ready for your update: https://github.com/haveno-dex/netlayer

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 12, 2024

FYI this does not change the behavior on master, which works on macOS as a native ARM64 app, but fails on Ubuntu ARM64 VM on macOS with this error, suggesting x86 version is still being used somewhere?

Mar-12 13:04:36.567 [StartTor] INFO  o.b.netlayer.tor.Tor: Starting Tor 
Mar-12 13:04:36.585 [ERR] ERROR o.b.netlayer.tor.Tor: rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2 
Mar-12 13:04:36.685 [ERR] ERROR o.b.netlayer.tor.Tor:   
Mar-12 13:04:36.686 [StartTor] ERROR h.n.p2p.network.TorNetworkNode: Starting tor node failed org.berndpruenster.netlayer.tor.TorCtlException: Could not setup Tor
	at org.berndpruenster.netlayer.tor.NativeTor.<init>(NativeTor.kt:106)
	at org.berndpruenster.netlayer.tor.NativeTor.<init>(NativeTor.kt:55)
	at org.berndpruenster.netlayer.tor.NativeTor.<init>(NativeTor.kt)
	at haveno.network.p2p.network.NewTor.getTor(NewTor.java:107)
	at haveno.network.p2p.network.TorNetworkNode.lambda$createTorAndHiddenService$10(TorNetworkNode.java:172)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.io.IOException: java.io.IOException: Tor exited with value 133
	at org.berndpruenster.netlayer.tor.TorContext.installAndStartTorOp(TorContext.kt:392)
	at org.berndpruenster.netlayer.tor.NativeTor.<init>(NativeTor.kt:66)
	... 8 common frames omitted
Caused by: java.io.IOException: Tor exited with value 133
	at org.berndpruenster.netlayer.tor.TorContext.installAndStartTorOp(TorContext.kt:354)
	... 9 common frames omitted

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 13, 2024

Hey, we're pushing towards a next release. Hoping the netlayer repo can be updated and this can make it in? :)

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 14, 2024

Switching over to the netlayer repo can occur as soon as the repo is ready.

The aforementioned error mentions Rosetta, which is MacOS's general-purpose translation error (doesn't exist on non-MacOS as far as I know); in addition, it seems to be having issues with accessing the linux linker for some reason, which is also quite odd.

This may be related to this issue mentioned on Docker; I think we can safely ignore this unless someone on native ARM64 or a non-MacOS VM has the issue as well.

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 14, 2024

think we can safely ignore this unless someone on native ARM64 or a non-MacOS VM has the issue as well.

Agreed. It's not introducing any new issue.

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 18, 2024

Awaiting your update @preland.

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 18, 2024

Currently working on it; I just opened up a PR on the tor-binary repo because the original links no longer work

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 18, 2024

(That commit will fail for now, as I can't verify tor-binary because it can't find it until the link is updated)

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 18, 2024

Thanks, I've merged your PR to tor-binary.

By the way, I think the last obstacle to supporting arm64 is to use the tor binary for arm64. Currently it's downloading and trying to use x86_64 binary.

However, it's not necessary for this PR, which merely upgrades tor support across what is already supported.

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 18, 2024

Something to note for arm64 tor support is that they only officially support arm64 for Mac and for android; so for linux arm64 we would have to use the android version (Another thing to note is that the current version of tor we have updated to does not have android arm64, only macos arm64)

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 18, 2024

Something to note for arm64 tor support is that they only officially support arm64 for Mac and for android; so for linux arm64 we would have to use the android version (Another thing to note is that the current version of tor we have updated to does not have android arm64, only macos arm64)

Ok, best to forget that now then, and proceed with the update across what we already support.

Copy link
Copy Markdown
Contributor

@woodser woodser left a comment

Choose a reason for hiding this comment

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

Great, this is working. :)

I think the only thing left to do is remove your additions to verification-metadata.xml referring to the pokkst and preland repos.

Comment thread gradle/verification-metadata.xml Outdated
<sha256 value="6af31b34813f2de4e201e1d33d51e0b497180e4d48f139e17b22302ac5c36b2b" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.pokkst.tor-binary" name="tor-binary-geoip" version="09d93d2537d14cdab34a8949c5fc81436b14fccc">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All these pokkst repositories can be removed.

Comment thread gradle/verification-metadata.xml Outdated
<sha256 value="3c1bdaeb73dcdb3074ab4620181749a3b7957f06aad2b9443938480728f4f569" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="com.github.preland.netlayer" name="tor" version="0d3b9a7ea42ea31a08be2d174c81b3daaf5edda9">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All these preland repositories can be removed.

@woodser
Copy link
Copy Markdown
Contributor

woodser commented Mar 19, 2024

Thanks, ideally you should squash your commits to 1 as well, but I can do that and enter a commit message as well.

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 19, 2024

Got it; I'll squash the commits

@preland
Copy link
Copy Markdown
Contributor Author

preland commented Mar 19, 2024

Commits have been squashed

@woodser woodser self-requested a review March 19, 2024 21:16
@woodser woodser merged commit a476181 into haveno-dex:master Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants