status-mobile icon indicating copy to clipboard operation
status-mobile copied to clipboard

Add keyUID to table when migrating from v1 to v2

Open cammellos opened this issue 1 year ago • 0 comments

When migrating from v1 to v2, there's a field that is not being computed for the accounts table:

https://github.com/status-im/status-go/blob/c9ee0e04c25d9079bf8a4b9617ad10df6d33fff8/appdatabase/migrations/sql/1683627613_accounts_and_keycards_improvements.up.sql#L8

This CHECK constrainst fails from account of the app v1, since key_uid is blank.

To overcome this we need a migration outside our normal migration system to calculate keyUID:

	keyUID := sha256.Sum256(crypto.FromECDSAPub(&a.privateKey.PublicKey))

If that can be done at the SQL layer, better, but not sure it's feasible/possible. It would have to be a migration outside our normal migration process.

I can provide some databases for the old version and there's already some tests running them, ping me for the setup.

cammellos avatar May 15 '24 16:05 cammellos