You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For nightfall client's 'incoming-viewing-key' request, it stores given 'zkpPrivateKeys' and 'nullifierKeys' in memory,
then it tries to use these to sync client commitments using nightfall-client/src/services/commitment-sync.mjs's clientCommitmentSync exported function.
clientCommitmentSync implementation
given a ‘zkpPrivateKey’ and a ‘nullifierKey’ get all transactions, for each transaction:
get all non-zero commitments
conditional: only for ‘transfer’ transaction (identifies by compressedSecrets being not [ZERO,ZERO]) where we have the first non-zero commitment stored
try to decrypt that commitement using the provided ‘zkpPrivateKey’ and ‘nullifierKey’
However, the condition is:
countCommitments([nonZeroCommitments[0]])===0
where countCommitments returns a Promise but is comapred to a numeric literal so condition will never be met (supposedly) which means it will not decrypt any commitments already stored prior to the 'incoming-viewing-key' request.
Mitigation
Probably should 'await' the call to countCommitments
Maybe create a test-case for that use-case
The call to decryptCommitment is also not awaited for which could be intentional but will resume before sync is over and has implications with regards to error handling
The text was updated successfully, but these errors were encountered:
For nightfall client's 'incoming-viewing-key' request, it stores given 'zkpPrivateKeys' and 'nullifierKeys' in memory,
then it tries to use these to sync client commitments using
nightfall-client/src/services/commitment-sync.mjs
'sclientCommitmentSync
exported function.clientCommitmentSync
implementationgiven a ‘zkpPrivateKey’ and a ‘nullifierKey’ get all transactions, for each transaction:
However, the condition is:
where
countCommitments
returns a Promise but is comapred to a numeric literal so condition will never be met (supposedly) which means it will not decrypt any commitments already stored prior to the 'incoming-viewing-key' request.Mitigation
countCommitments
decryptCommitment
is also not awaited for which could be intentional but will resume before sync is over and has implications with regards to error handlingThe text was updated successfully, but these errors were encountered: