dcgtc / dgrants

Decentralized Grant platform that implements quadratic funding.
GNU Affero General Public License v3.0
84 stars 39 forks source link

Fixing whitelist #525

Closed aj-maz closed 2 years ago

aj-maz commented 2 years ago

Whenever we fetch the whitelist I will cache it and in case of not being able to fetch the whitelist, I will use the cached one.

Also, put the fallback strategy into a new function so adding "Additionally we should add a fallback URL for the whitelist which could be a different IPFS gateway or HTTP server" must be pretty straightforward whenever the fallback URL is ready.

Suggestion: Using the cache for whitelisting while trying to fetch whitelist, will give slightly better UX with faster load time

fixed #459

aj-maz commented 2 years ago

LGTM! Btw @Ajand would it make sense to move this into utils ? (just curious cause data.ts seems to be growing in size)

I think it makes so much sense to make it a pure function and put it into the utils. I also needed to use this util in #526

gdixon commented 2 years ago

How are we handling cache invalidation here? What happens when new grants are added to the whitelist?

metafraction commented 2 years ago

@Ajand feel free to create a new issue to move to utils, or you can also update this PR

aj-maz commented 2 years ago

How are we handling cache invalidation here? What happens when new grants are added to the whitelist?

I haven't handled that but what's your opinion on validating whitelist objects on the filterWhiteListed helper function?

mds1 commented 2 years ago

How are we handling cache invalidation here? What happens when new grants are added to the whitelist?

@gdixon It seems we always try to fetch from the whitelist URL and upon a successful fetch save the new data to the cache, so I don't think we need any additional cache invalidation behavior do we? Since it's always updated when possible + we only use as a fallback

gdixon commented 2 years ago

Ahh, I misread, right you are!! 😅

aj-maz commented 2 years ago
metafraction commented 2 years ago

rather than merging main into this branch, it's better to rebase against main (since we use the rebase workflow) - try pulling latest main and then switch to this branch and git rebase main