Why Nostr? What is Njump?
2024-11-01 02:56:21

Alex Gleason 🐍🚬 on Nostr: Good evening witches and wizards! I would like to tell you the story of the spookiest ...

Good evening witches and wizards!

I would like to tell you the story of the spookiest bug #Ditto has ever seen. And I'm happy to announce that on this All Hallows Eve, and I worked together to make the spectral ghost visible and vanquish it! 👻

The story begins with (Verita84), who faced this problem so bad he actually left Nostr and went back to the Fediverse.

The problem being: that no matter how hard he tried, he could not log in. He tried other browsers, deleted all data, turned his computer off and back on again. But although it worked perfectly 100% of the time on his other device, it worked 0% of the time on this device.

As the months went on, we received a few complaints here and there from people saying they could NEVER log in to Ditto on a particular device. But our team could never reproduce this problem. So it eluded us. But we would occasionally still hear rare complaints of it.

Well today was experiencing the exact same issue. So I added more logs, and he sent screenshots and videos, and we collaborated for several hours. I carefully combed through every line of code in the whole flow, and absolutely nothing was wrong!

Finally I thought to find the NIP-46 event in the Ditto logs, and it occurred to me to check its timestamp. Because there is a 10 second limit on these events, after which the relay would silently reject them.

Strangely, the event's created_at timestamp was actually 12 seconds _before_ the Ditto log timestamp... Hmm...

I assumed he must have a very slow computer, or network connection. But he assured me it was very fast. I raised the limit from 10 seconds to 1 minute anyway. And you know what? IT FUCKING WORKED.

(I also added special treatment for ephemeral events in Ditto, so they would throw an error if they didn't get streamed out, instead of just absorbing it.)

But I told him, since his network was so slow, he would have to wait 12 seconds to log in... But to my surprise, he told me he didn't wait 12 seconds at all. It was instantaneous.

And then it dawned on me. THE CLOCK ON HIS COMPUTER WAS WRONG.

HE TESTED HIS CLOCK, AND IT WAS 12 SECONDS BEHIND!!!!!!!

Date.now() in JavaScript was getting the time from his OS, and his OS had a wrong clock! So the event was getting rejected as being too old.

Holy shit! I couldn't believe it! I still can't believe it! Months of anxiety and terror finally resolved by a fucking clock.

So my friends, remember that this Halloween, the scariest thing is not goblins and ghosts. it's time. Time ages us and destroys us. But it is a reality we have to live with. Let us embrace death! To accept the afterlife is to be free.

Thank you very much my spooky friends and have a Happy Halloween! 👻 🎃 💀

https://gitlab.com/soapbox-pub/ditto/-/merge_requests/576
My man fixed the issue and found the root cause. Something that also been bugging him for months!

LETS GO!



Author Public Key
npub1q3sle0kvfsehgsuexttt3ugjd8xdklxfwwkh559wxckmzddywnws6cd26p