The site went down after midnight last night following our recent changes. The root cause was a bug in rewards introduced by upgrading our ORM (more on that later).
The bug led rewards to payout
86743171000 sats
rather than the intended 8774 sats
... 867 bitcoin in rewards.This made the site crash in various contexts when trying to express the rewards, rewarded stacker balances, or rewarded stacker stacked tallies (nearly everywhere) because our API layer expects 32bit signed ints.
The mistake has been fixed and the reward reversed where possible. However, one stacker managed to withdraw
20610000 sats
that they didn't - in reality - earn before we could correct the mistake.If we can manage to get the sats back, I'll drip all those sats back into the rewards pool over the next couple months.
If the stacker that withdrew them is reading this and values sats earned more than sats taken, I'll voluntarily give you a nice chuck of what you withdrew. It's ultimately my fault and I should pay for the mistake, but I'd prefer to give those sats back to the community.
the bug
The latest version of our ORM started returning type
String
for the result of postgresql SUM
aggregates. Rewards add (+
) the sum
of all revenue earned to the sum
of all donated sats. The sum of all revenue yesterday was 8674317 msats
and the donation sum was 1000000 msats
.Because they were strings and not numbers, they got concatenated rather than added like numbers. What should have been
8774317 msats
(8774 sats
) became 86743171000000 msats
(86743171000 sats
) ... the result of visually joining the numbers together.A couple days before we deployed the changes, when talking about the upgrade, I wrote to @ekzyis:
... if [a value that comes our of our ORM] ever ends up getting stored back in the DB, be paranoid. Currently they never go back to the DB after coming out ... except with earning [ie rewards] which only uses BigInts in js.
Apparently they ceased being returned as BigInts after the upgrade yesterday and I wasn't as paranoid as I should've been. Anyway, rewards should be functional and accurate again. I'll continue working on solving some of the other wonkiness that occurred as a result of the upgrade before deploying some of the features we have in the pipe.
... +1 for the pro-type-safety devs out there