Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faucet use queuing to avoid nonce errors #131

Closed
ethanfrey opened this issue Sep 21, 2018 · 2 comments
Closed

Faucet use queuing to avoid nonce errors #131

ethanfrey opened this issue Sep 21, 2018 · 2 comments

Comments

@ethanfrey
Copy link
Contributor

ethanfrey commented Sep 21, 2018

There is epic iov-one/tools#72 for many enhancements on faucet. Furthermore, we discuss a rewrite on top of iov-core.

This is a larger project of > 1 week of time, however is not pressing yet. However, we would like to have a stable faucet that doesn't error if there is too much usage for the paris event.

There are better solutions with multiple accounts that can send in parallel, but the "simplest" solution is that all http requests issue a message on a channel, there is one worker that processes them sequentially using BroadcastTxCommit, to ensure the tx is writen before starting another. It can even perform an eg. 50 ms sleep after that to avoid any races between block writing and abci queries. It will then wait for another request to write to the chain, which may be immediate, or may be hours in the future.

This should be sufficient to have a semi-stable faucet hooked into the wallet ui at the paris demo if many people try it. This then buys time to do #72 without haste.

@ethanfrey
Copy link
Contributor Author

Please decide if we do this approach, or the k8 stateful set alternative before starting this task.

General feel is that best focus is on code side

@lehajam
Copy link
Contributor

lehajam commented Sep 24, 2018

I've been thinking of using a mutex to lock the faucet and make each call sync which is somehow an implementation of the above with the queue handled by gin gonic and the handler used as the worker.
Have a look at iov-one/tools#75 for an exemple of this would look like. I added some tests to highlight the issue and this solution seems to work and is rather cheap to implement.
Have a look and let me know your thoughts.

@lehajam lehajam closed this as completed Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants