UO uses paymaster, paymaster is new to the pool, queries chain for balance and adds to cache, sees the balance from 1
Deposit event from (1) is notified to the pool, balance is added to the balance from (2)
Since there is no ordering guarantee between (2) and (3) you can end up with either balance or 2x balance in the cache.
Instead process events as a reset event, and just query the chain for a balance after an event.
Proposed Changes
Race
Since there is no ordering guarantee between (2) and (3) you can end up with either balance or 2x balance in the cache. Instead process events as a reset event, and just query the chain for a balance after an event.