-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Incosistent order of Registrar Actions
@Y3drk noted a weird behavior:
Before I added the ByDecodedReferrer filter to the useRegistarActions call in ENSAwards, I noticed that while no new registrar actions show up, something weird is going on with the animation (see the attached video).
Namely, the last row kept changing. I monitored it for a few iterations of the query and noticed that the API returns a different set of latest registrar-actions (ordered by their timestamp) nearly each time the query refetches. Take a look at the example JSON file (results of a few sequential queries made to the API) I attached. Only the last item keeps changing, and it seems like the rotation of these records is periodic.
I believe it is due to the fact that they share the same exact timestamp, and when ordering, the ties are resolved inconsistently, but I didn't have time to check it in the code.
From the quick investigation, it seems that the reason is indeed the sorting by timestamp, which can be ambiguous in the case of actions with the same timestamp. However, it is not confirmed yet, and therefore needs further validation.
The file find-registrar-actions.ts has the following function, which seems to be the place responsible for this:
/**
* Build SQL for order clause from provided order param.
*/
function buildOrderByClause(order: RegistrarActionsOrder): SQL {
switch (order) {
case RegistrarActionsOrders.LatestRegistrarActions:
return desc(schema.registrarActions.timestamp);
}
}Metadata
Metadata
Assignees
Labels
Type
Projects
Status