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

Fix Damus Mutiny NWC #1954

Closed
alltheseas opened this issue Jan 30, 2024 · 24 comments
Closed

Fix Damus Mutiny NWC #1954

alltheseas opened this issue Jan 30, 2024 · 24 comments
Labels
1.7 regression Something that was working before now doesn't zaps

Comments

@alltheseas
Copy link
Collaborator

Problem confirmed as originating from Damus by @benthecarman

nostrability/nostrability#13

@alltheseas alltheseas added zaps regression Something that was working before now doesn't 1.7 labels Jan 30, 2024
@benthecarman
Copy link
Contributor

benthecarman commented Jan 30, 2024

Doing some testing and mutiny never gets the request, this is how we construct our filter. The timestamp is the timestamp of the last event we processed

https://github.com/MutinyWallet/mutiny-node/blob/master/mutiny-core/src/nostr/nwc.rs#L269

@jb55
Copy link
Collaborator

jb55 commented Jan 30, 2024

damus works with many NWC implementations, why do we have to make an exception for mutiny? I'm confused.

@benthecarman
Copy link
Contributor

damus works with many NWC implementations, why do we have to make an exception for mutiny? I'm confused.

same with mutiny, just want to figure out why damus <> mutiny doesn't work when damus seems to work with everything else and mutiny seems to work with everything else

@jb55
Copy link
Collaborator

jb55 commented Feb 5, 2024 via email

@alltheseas
Copy link
Collaborator Author

On Mon, Feb 05, 2024 at 07:12:04AM -0800, alltheseas wrote:

Received a NWC failure report. Tracking down which wallet

https://damus.io/nevent1qqsw8ckv64n0ax3a82a6crrrfn47856y7trlevs7e5jw2f4gz98ducqpzfmhxue69uhk7enxvd5xz6tw9ec82cspr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qydhwumn8ghj7mn0wd68ytfj9eax2cn9v3jk2tnrd3hh2eqpzamhxue69uhkv6tvw3jhytnwdaehgu3wwa5kueg7e93pa

This is probably someone just trying to scan a lightning invoice
thinking this will somehow attach the wallet, this seems to be a very
common problem.

maybe we need to hide this under advanced or something.

Confirmed this one was a newbie trying to set up a wallet that does not support NWC (strike). Maybe a list of compatible wallets fixes this #1976

@benthecarman
Copy link
Contributor

benthecarman commented Feb 7, 2024

i found the issue here

I can get it to work with the NWC URI:

nostr+walletconnect://975e6b43d84057d134e1e1a5ca5205157d0bc3b1e76f54ddfe8b1a7862db67fd?relay=wss://relay.mutinywallet.com&secret=507f0f3fb5e2397723d57466dc9ef99d7dd511dc24967d24ddaa5371151210a0

but mutiny/rust-nostr produces them like

nostr+walletconnect://975e6b43d84057d134e1e1a5ca5205157d0bc3b1e76f54ddfe8b1a7862db67fd?relay=wss%3A%2F%2Frelay.mutinywallet.com%2F&secret=507f0f3fb5e2397723d57466dc9ef99d7dd511dc24967d24ddaa5371151210a0

the difference being that the relay url is uri encoded

the spec does have the url as uri encoded so I would say this is a damus bug

https://github.com/nostr-protocol/nips/blob/master/47.md#example-connection-string

Maybe a good sanity check would be to have it try to connect to the relay when configuring NWC

@alltheseas
Copy link
Collaborator Author

https://damus.io/nevent1qqs89z4zq9xmwfjd2ffzatlr3r2f0ver8s9x7c7ha9xsfnqjtl5rxmqpz4mhxue69uhk2er9dchxummnw3ezumrpdejqzrthwden5te0dehhxtnvdakqz9rhwden5te0wfjkccte9ejxzmt4wvhxjmcpzpmhxue69uhkummnw3ezuamfdejs3z6t3y

Still doesn’t make sense to me because we use the standard ios url parser and i find it hard to believe it doesn’t handle url decoding

@jb55

@ynniv
Copy link

ynniv commented Mar 9, 2024

Hah, I thought I was just doing it wrong. This might fix the issue: #2037

@alltheseas
Copy link
Collaborator Author

Hah, I thought I was just doing it wrong. This might fix the issue: #2037

@ynniv what specifically was the issue, and what does your patch do?

@ynniv
Copy link

ynniv commented Mar 9, 2024

RelayPool caches connections to relays. Since you don't want w.xyz and w.xyz/ to create two connections, it normalizes URLs by trimming any trailing slashes. Unfortunately, it isn't always normalizing the URL when asking for an existing connection, so it ends up thinking that relay isn't available. My PR normalizes the requested URL so that doesn't happen.

This might actually be causing a lot of issues beyond NWC

@ynniv
Copy link

ynniv commented Mar 9, 2024

@benthecarman 's example isn't what it seems. The encoded parameter isn't confusing Damus, it's confusing us:

I can get it to work with the NWC URI:

[...]relay=wss://relay.mutinywallet.com&[...]

but mutiny/rust-nostr produces them like

[...]relay=wss%3A%2F%2Frelay.mutinywallet.com%2F&[...]

Notice the %2F (slash) before the ampersand.

@TonyGiorgio
Copy link

TonyGiorgio commented Mar 24, 2024

So is this fixed or a PR fixing it? I see the problem is tracked down but no reference PR and the issue is still opened.

@alltheseas
Copy link
Collaborator Author

#2037

PR is started. @jb55 asked for modifications to the proposed PR

@ericholguin
Copy link
Collaborator

Daniel's patch does what Will was asking for, as discussed in #2072

@alltheseas
Copy link
Collaborator Author

Thanks @ericholguin.

Did not notice the nwc test cases @danieldaquino ran on the relay slash issue. If this pr fixes nwc 🔥

@alltheseas
Copy link
Collaborator Author

@danieldaquino advised we might have to do more in depth testing to confirm that the relay slash issue fix, also fixes Mutiny NWC

@alltheseas
Copy link
Collaborator Author

Adding as bonus points to sprint 12, as this is related to the recently fixed relay slash / cannot remove relay issue, and affects user experience negatively @danieldaquino @jb55

@benthecarman
Copy link
Contributor

Our latest release no longer has the trailing slash

@ericholguin
Copy link
Collaborator

Can confirm this is fixed in both existing apple store version and upcoming release

@jb55
Copy link
Collaborator

jb55 commented Apr 7, 2024

Really? People say it's not working

@ericholguin ericholguin reopened this Apr 7, 2024
@ericholguin
Copy link
Collaborator

Looks like Damus needs to be restarted for the relay connection to go through. Not sure why.

@alltheseas
Copy link
Collaborator Author

@ericholguin advised that there is something bigger than Mutiny outstanding - Alby also affected

@alltheseas
Copy link
Collaborator Author

How might we communicate NWC relay is different than a note relay?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.7 regression Something that was working before now doesn't zaps
Projects
Archived in project
Development

No branches or pull requests

6 participants