CRITICAL: shore-up math double-subtracts cash — unreserved banks bankrupted without consulting the bond market #119

Closed
opened 2026-10-01 15:31:08 +00:00 by Winnie · 0 comments
Owner

Found by the v0.6.0 review (issue #118). Game.shoreUpNeed (game.go:596-607) computes:

need = bills + (reserveNeed − cash)   when reserveNeed > cash
borrow = need − cash = bills + reserveNeed − 2×cash

The − cash appears twice. The correct borrow target is bills + reserveNeed − cash, so post-bills cash lands on the reserve. Consequences:

  • A bank with bills covered but reserve unmet (bills < cash < reserveNeed) computes short <= 0, so NO force-borrow is attempted at all, and the reserve check then flags it unshored and bankrupts it WITHOUT the bond market being consulted — directly contradicting the #88 ruling that only a position the market cannot shore is insolvent. The market is never asked.
  • A bank with cash < bills under-borrows by its own cash, ends the turn below reserve, and dies the next turn the same way.

Evidence: scratch test (cash=3000, bills=1050, reserve=5000, 9500 standing in the market): short=50, bank borrowed 950, flagged "cannot meet the 10% reserve: the bond market could not shore up 1050" and went insolvent — with the market full. A live 80-turn spectate had all 3 bankruptcies reserve-triggered with zero successful shore-up borrows. This math was carried from the original #75 code when #114 unified it into shoreUpNeed.

Found by the v0.6.0 review (issue #118). Game.shoreUpNeed (game.go:596-607) computes: need = bills + (reserveNeed − cash) when reserveNeed > cash borrow = need − cash = bills + reserveNeed − 2×cash The `− cash` appears twice. The correct borrow target is bills + reserveNeed − cash, so post-bills cash lands on the reserve. Consequences: - A bank with bills covered but reserve unmet (bills < cash < reserveNeed) computes short <= 0, so NO force-borrow is attempted at all, and the reserve check then flags it unshored and bankrupts it WITHOUT the bond market being consulted — directly contradicting the #88 ruling that only a position the market cannot shore is insolvent. The market is never asked. - A bank with cash < bills under-borrows by its own cash, ends the turn below reserve, and dies the next turn the same way. Evidence: scratch test (cash=3000, bills=1050, reserve=5000, 9500 standing in the market): short=50, bank borrowed 950, flagged "cannot meet the 10% reserve: the bond market could not shore up 1050" and went insolvent — with the market full. A live 80-turn spectate had all 3 bankruptcies reserve-triggered with zero successful shore-up borrows. This math was carried from the original #75 code when #114 unified it into shoreUpNeed.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Winnie/bankwars#119
No description provided.