daimo-eth / daimo

Your own bank, on ethereum
https://daimo.com
GNU General Public License v3.0
330 stars 27 forks source link

Crash on logging into existing account #1181

Closed dcposch closed 1 week ago

dcposch commented 2 weeks ago

Summary

I logged back into my account and got an app crash. Debug log reveals error under isNativeETH call.

On prod API + latest testflight app:

{
  "Platform": "ios 17.6 phone",
  "Version": "1.9.1 #438",
  "Commit": "0a575621 production",
  "Notifications": "enabled",
  "Key Security": "secure enclave",
  "amountSeparator": "."
}
dcposch commented 2 weeks ago
image
dcposch commented 2 weeks ago

Investigation

this comes from the following change

 export type PreSwapTransfer = {
-  coin: ForeignCoin;
+  coin: ForeignToken;

https://github.com/daimo-eth/daimo/pull/1178/files#diff-9eab1d56a27be76232c70c1f6bff31c5e9f293f835ad991068443cbd680b9d91L41

issue is that this changes the Account StoredModel. user accounts stored locally have recentTransfers: DisplayOpEvent[], which can have preSwapTransfer

cc @kayleegeorge

fix coming soon. i have a way to do this that'll also catch account stored model type changes going forward

dcposch commented 2 weeks ago

Test plan

Add a unit test that loads examples of old serialized accounts. These will be more complete accounts, not the empty ones currently in account.test.ts. Ensure correct migration.