feat(faucet): gno address and email/token mapping#153
Conversation
✅ Deploy Preview for gnochess canceled.
|
✅ Deploy Preview for gnochess-signup-form ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
copy of #152 ... 😂 |
Closes #148 - Register in redis the gno address as key and email/token as values - Add a pseudo endpoint to retrieve email and token from gno adresses
ba35228 to
47ebffb
Compare
|
I suggest we use this method instead: #163. |
The faucet: switching a No front change needed. No dependency on Redis needed (we can keep it for other reason, but we don't depend on it for the competition). It offers a way to have a whitelist system to prevent Dust Attacks and DOS more easily aswell as having a filtered leaderboard. And it's about using blockchains instead of databases, which is a part of my job :) |
faucet/main.go
Outdated
| } | ||
| } | ||
|
|
||
| // getEmail detects the presence of `addr` form value, if present returns the |
There was a problem hiding this comment.
I propose to put this in a lambda functions
|
|
||
| // Parse the request to extract the address | ||
| // XXX copied from prepareFundMiddleware, don't have time to refactor without unit tests! | ||
| var request faucet.Request |
There was a problem hiding this comment.
Maybe create a function getFaucetRequest() faucet.Request since this ~20 lines are used twice.
There was a problem hiding this comment.
not ideal because it would also have to return the error string and code for http.Error() arguments, I prefer to keep it like that.
Redis is still required for the signup page to store generated tokens, and for the gnochess faucet to ensure that provided token has been effectively generated by the signup page. |
Closes #148
How to test
You need a redis running :
and a redis-cli
Prepare a claimable token (this is what the signup page is doing on submit), using redis-cli :
Run the faucet using this command (the default value of
--redis-urlwill match the address of the running docker container, so we don't need to provide it) :Run the node and the gnochess web as usual.
Connect to your gnochess instance with your browser, remove any previous local storage and submit your token:
You should have no error.
In redis-cli, ensure that the gno address has been stored :
Finally take that address (in normal condition, this address should come from the leaderboard) and go to your faucet URL, append the
?addr=g10trepc80pt9h4ed4tqwm8rgqk4g8rjaer4cqgvquery string :Please do that testing to ensure that works properly, it's late and I may have made mistakes! thanks in advance 🙏