-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LastLoggedIn still broken 😮💨 #2588
Comments
We've narrowed this down to likely being related to return (await sbp('chelonia/kv/get', contractID, KV_KEYS.LAST_LOGGED_IN))?.data || Object.create(null) And related code, e.g.: get data () {
if (!encryptedData) return
if (isSignedData(encryptedData.data)) {
return encryptedData.data.valueOf()
}
return encryptedData.data
}, Note there's the same issue in return (await sbp('chelonia/kv/get', identityContractID, KV_KEYS.UNREAD_MESSAGES))?.data || {} And who knows, maybe that's related to fixing #2442 too? |
I've been investigating this issue, and, while I can see on The update happens by calling const getUpdatedLastLoggedIn = async (contractID) => {
const current = await sbp('gi.actions/group/kv/fetchLastLoggedIn', { contractID })
return { ...current, [identityContractID]: nowString }
}
const data = await getUpdatedLastLoggedIn(contractID)
await sbp('chelonia/kv/set', contractID, KV_KEYS.LAST_LOGGED_IN, data, {
encryptionKeyId: await sbp('chelonia/contract/currentKeyIdByName', contractID, 'cek'),
signingKeyId: await sbp('chelonia/contract/currentKeyIdByName', contractID, 'csk'),
onconflict: getUpdatedLastLoggedIn
}) This is supposed to be append-only, so no entries can be lost. There is an exception. If we look at: 'gi.actions/group/kv/fetchLastLoggedIn': async ({ contractID }: { contractID: string }) => {
const kvData = await sbp('chelonia/kv/get', contractID, KV_KEYS.LAST_LOGGED_IN)
// kvData could be falsy if the server returns 404
if (kvData) {
// Note: this could throw an exception if there's a signature or decryption
// issue
return kvData.data
}
return Object.create(null)
}, Note that Before, it was possible for I've tried to reproduce this issue locally, and decryption (or signature) errors do indeed result in an exception being thrown (which effectively would stop updates to |
We've figured out that #2633 is in fact the fix for this issue due to |
Problem
The
uCHELONIA_STATE
:The other state:
One other potential problem is that we use
new Date()
to get this value:The user's clock could be wrong.
Solution
new Date(sbp('chelonia/time'))
instead of nakednew Date()
The text was updated successfully, but these errors were encountered: