Open icc-romeu opened 3 months ago
We should probably dedupe upfront based on timestamp and id, which can help with downloading it multiple times. And then we should probably look when downloading to also include the timestamp in the filename. Then we'll never have clashes.
The promise.all does help in keeping things faster instead of doing it sequentially.
What do you think?
The problem with the Promise.all
approach is that:
I just added a patch in the meanwhile to do a for
loop. As it is checking the filesystem for the file it only downloads once. It is sequential, but it is only downloading once per credential.
Ah of course, we don't need the timestamp for it. Well then we can just dedupe up front to only download the tails file for each registry once. There's still a slight chance of error if multiple processes (different presentation flows) are executing at the same then
We are facing an error during a proof presentation while downloading the tails file to check the revocation status of anoncreds.
The proof includes multiple fields from the same credential, and it seems Credo is trying to download the tails file for each of the fields, although it is the same credential. Hence, it may end up storing the same file multiple times, and I think that if the hash is calculated each time, at some point it may be calculated while one of those downloads are being stored, and then it fails with
Hash of downloaded file does not match expected hash
.This does not always happen, and it makes sense if it is a race condition.
I reviewed the code and I think this should be sequential and not a
Promise.all
:https://github.com/openwallet-foundation/credo-ts/blob/6faff7dd08458053af43d58cf16e6e7854648cb6/packages/anoncreds/src/anoncreds-rs/AnonCredsRsHolderService.ts#L848