-
Notifications
You must be signed in to change notification settings - Fork 437
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
Bug: Hub/Shuttle is streaming delete events but when queried hubs for latest state it says that its in merge state #2025
Comments
Hmm, so, what's seems to be happening here is that there are two verification add messages for the same address and fid. one from May 27, with message hash "TsGP1MUa9rTjaNY42whm4ztP0KI" and When the June 2 message is merged, it correctly overwrites and deletes the May 2 one, because hubs have a unique constraint on the address. There is no remove message. A remove is message is not required to cause a delete, because a newer message will overwrite an older one (especially for verifications and UserDataAdd). It looks like the events have made it into your kafka stream out of order. There's not enough information here to say what caused this. If you could provide the createdat and deletedat timestamps for these two messages from shuttle's Note that the message timestamp is different. Even though the delete event timestamp is newer, the timestamp of the message is older than the timestamp of the message in the merge event. So, a workaround would be to check for this. To summarize,
|
Thanks for the response @sanjayprabhu
|
It's valid at the protocol level to keep sending messages. Newer messages will always overwrite older messages. You can keep changing your UserData.DISPLAY_NAME 50 times, and it will generate 50 merges and 49 deletes. Only the message with the latest timestamp is valid, and in the messages table there will be only one that's not marked deleted. The above example seems to be for a different FID, but we can walk through that
I'm not sure why the delete event is after (even if it's by less than 1 ms), I checked the code and the callbacks should be called in order (delete first, then merge): One potential reason is the they are not part of the same event, that's unlikely, but I'll double check to make sure. You can add some logs in your MessageHandler to confirm, but the delete callback should be happening before the merge. |
Note, these are all different message hashes. The user is submitting multiple verification messages for the same eth address. The hub is doing the right thing by deleting the old message and merging the latest message and generating a event for each. The events are for unique messages, they are not duplicates |
The problem with relying on the timestamp is, merge and delete events of same message hash will have the same timestamp. This can cause problem in our system because if they arrive in different order we won't know which is latest. In the above example as you rightly said, second message: third message -> we are not modifying anything in our handler, it processes in the order we receive. As you pointed out delete_at of |
Hey @chetankashetti, sorry for the delay. EDIT See below comment instead. |
One other point worth mentioning: if you look at how Shuttle is implemented (make sure you're running the latest version, as some code may have changed), you can see that Shuttle always processes the deleted messages before the merged message: hub-monorepo/packages/shuttle/src/shuttle/hubEventProcessor.ts Lines 52 to 63 in fcb76cd
Given this, you can safely always treat Just know that if you create your own handlers (I know you're not doing this—I'm just mentioning for completeness) and you don't use the |
What is the bug?
Basically we are receiving delete events from Shuttle but when we check for hub using the
getAllVerificationMessagesByFid
it says its in added state. we are assuming whenever MESSAGE_TYPE_VERIFICATION_ADD_ETH_ADDRESS appears withmerge state -> we add to our system
delete state -> remove from our system
prune state -> remove from our system
revoke state -> remove from our system
correct us if we're wrong.
for ex. FID - 284564. If you observe we're adding a a timestamp when we receive called
event_timestamp
. delete event is coming without any remove event.There are thousands of such FIDs which are getting affected with this issue. please try to investigate this. as its our top priority.
Feel free to reach me out if more details are needed in this issue. farcaster-dc: chetansk
We are live streaming all the events to kafka where we noticed this. you can stream using shuttle which can
This is happening for lot of FIDs where delete events are coming but seems like there's no actual deletion happened.
The text was updated successfully, but these errors were encountered: