You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(indexer): a pending log would have been written as a trade in block zero
blockNumber and logIndex are nullable in viem's type because a log from a
pending block has neither. Every insert site coerced that to zero with `?? 0n`,
which would write a real trade attached to block zero at a log index colliding
with that block's genuine first log — and the foreign key would have accepted
it, because block zero exists.
getLogs over a fixed range never returns a pending log, so this should be
unreachable. That is the argument for refusing rather than defaulting: an
unreachable state that silently produces a plausible row is worse than one that
fails the tick and retries the range.
Pending logs are now rejected before anything is sorted, since sorting them as
zero placed them ahead of every real log in the range.
Found by sweeping for the placeholder shape that produced the last three bugs:
a value that stands in for an impossible state, typechecks forever, and is
indistinguishable from a real one once written.
0 commit comments