-
Notifications
You must be signed in to change notification settings - Fork 96
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
Subscription id too long #7
Comments
Thanks for letting me know! Currently the subIds are restricted to 39 characters. This limit is an optimisation so that the subId can be stored inline in the subscription object I just checked snort and it's sending 45 characters. I pushed an update to master that increases the limit to 63, please pull and rebuild. BTW, thank you for your early beta testing! Just a warning: I have a change I'm working on that will require a DB rebuild. It saves 16 bytes per event and 16 bytes for every e/p tag. When I roll this out you'll have to |
This worked well, thank you! |
@hoytech running my shiny new strfry instance (with sub id max-length now at 63) and looking at logs I periodically still see this:
Taking a look at NIP-01 which is the only place that defines them at all, it says this:
I think either strfry needs to accept arbitrarily long subscription id’s or better, submit a PR to NIP-01 that defines the max length of a cc @fiatjaf |
The It's a shame that clients send such long subIds, since these are echoed back on every EVENT, so it adds up to a lot of wasted bandwidth. There's a minor efficiency advantage to using a static sized buffer for this, but if really needed I can make it a configurable length. |
It's better to chase the clients and ask them to shorten their ids. |
@hoytech I turned on verbose logging for reqs and saw a 100 char sub id. It has an 81 char random hash, then an underscore and then the url of my relay. what about sha256-ing the incoming sub id string before storing - would that be too big a performance hit?
Really? Why not specify the max length of a subscription ID so relays can legitimately reject a potential bad actor vector? |
Unfortunately we can't hash the subIds because we need to echo it back to the client. |
ah so. Leaving the |
FWIW, I did an nslookup on an IP address for a client that tried to connect and received the subId too long error and the IP resolved to api.nostr.watch. |
Ya, so a little code spelunking in the nostr-watch github turns this up in many places:
…which yields an 81 character random string. So @fiatjaf we should at this point ask @dskvr to make those subid’s shorter? edit: also @hoytech : nostream is sending this to clients: see also: nostr-protocol/nips#240 |
Thanks for looking into this! Good to know where that's coming from. Using The |
Nice job finding the culprit. |
I started a relayer wss://nos.lol
https://snort.social is having problems: [wss://nos.lol] NOTICE: ERROR: bad req: subscription id too long
https://astral.ninja seems to work better.
The text was updated successfully, but these errors were encountered: