zk-kit
zk-kit copied to clipboard
feat(utils): use multiple sources to download snark artifacts
I don't really know why we see bad gateway errors in the ci when attempting to fetch the artifacts. https://github.com/privacy-scaling-explorations/zk-kit/actions/runs/8837164770/job/24265411154#step:9:666
As an improvement (hopefully fix), I am thinking about a retry mechanism:
- use
[[unpkgCdn, jsdelivrCdn], github]urls list - randomly sort the cdns part
- try the next one if the 1st cdn tried failed
- repeat
- the ultimate fallback would be the snark artifacts github repo raw url. We can leverage the release tags urls, ex: https://github.com/privacy-scaling-explorations/snark-artifacts/tree/@zk-kit/[email protected]/packages/eddsa Luckily the url structure on github also matches what unpkg and jsdelivr use.
The random sorting would happen on each download attempts (whether it is for a a different proof, or different artifact for a same proof...), which should protect us against throttling (if that is the root cause of the bad gateway issues...)