Giter VIP home page Giter VIP logo

faucet's People

Contributors

0xsarvesh avatar abhayks1 avatar benjaminbollen avatar dependabot[bot] avatar gulshanvasnani avatar puneet-khushwani-eth avatar schemar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

faucet's Issues

Faucet should have a compatible license

Faucet depends on libraries like Web3.
Faucet is currently licensed under MIT, which is most likely incompatible to Web3.

Check the licenses of the dependencies and select a valid license for Faucet.
Faucet should have the least restricted valid license possible.

Faucet factory can be simplified

Faucet type can be made an enum kind and switch case can be simplified by binding instantiation with the type of the enum instead of a string.

Faucet server dies in case of errors

Below are some logs which might be the cause. (Implementer might need to dig deeper into the logs)

error: could not fill address {"service":"faucet","chain":"1406","error":"EnoughFundException: Beneficiary already has enough balance.","timestamp":"2019-07-24T07:38:04.668Z"}

(node:1134) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined at Server.<anonymous> (/home/centos/faucet/src/Server.ts:165:53) at Generator.next (<anonymous>) at fulfilled (/home/centos/faucet/src/Server.ts:4:58) at processTicksAndRejections (internal/process/task_queues.js:86:5) (node:1134) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

the faucet should respond `.on('transactionHash', ...)`

using npm i @types/web3 we ran into some issues to import the web3

motication for this ticket: when funding multiple addresses in the tests, it is desirable for all funding transaction to get sent together, so that they can get mined together; reducing the overall wait time for the test to start.

Run a robust faucet and document the usage

This is a follow-up ticket to #12.

#12 already created all necessary keys, funded them, and started the faucet to run with the new chains
(@gulshanvasnani please confirm).

Tasks in this issue:

  • Run the faucet in a way where it automatically restarts whenever the process crashes.
  • Document privately for OST how to use the faucet (especially address and port).

Faucet should respond immediately

Story

As a faucet
I want to respond to fill requests quicker
Because I don't want to block the connection for longer than necessary

Scenario

Given that a faucet is running
When it receives a request from a client
Then it returns the txHash as soon as possible
And closes the connection without waiting for a receipt from web3

Info

We can send the transaction with web3 and return the transaction hash to the client upon the transaction hash event from web3. We don't need to wait for the entire PromiEvent of the transaction to resolve.

Must be done in the implementations of the interface method Faucet::fill(). Maybe abstract it into something shared that is injected? Or maybe the EthNode?

Faucet should be limited

User Story

As a faucet operator
I want to limit the amount of funds an account can request
Because I want to be more fair in funds distribution

Scenarios

Scenario 1 (in line with the current behavior)
Given that an account is not funded above the limit
When a fill request for that account is made
Then the account is funded the configured amount

Scenario 2
Given that an account is funded above the limit
When a fill request for that account is made
Then the account is not funded
And the server returns an understandable error to the client

Info

  • We understand that this system is not safe from abuse. An attacker could create any number of accounts and fund them.
  • Another approach to funding limitation would be a rate limit. However, a rate limit requires a much more sophisticated implementation. It is currently not worth the effort, but may be added at a later stage.
  • The maximum funding should be set in the configuration of the faucet.
  • The faucet should check the balance (on-chain with the node) before funding an account.

Faucet crashed on Socket hang up

info: Sending 10000000000000000000 EIP20 tokens to 0xFbc7Be4B193a784194643f76C431B9f9F5896F23. {"service":"faucet"}
info: Sent 10000000000000000000 coins to 0x567aAcdF8BEf39F26BC13eF8F9A91C5B408d9960. TxHash: 0x4dcecade1bc20e6a092ea5bc13b40aa2aeb0c899d266c463e337b77aaed8946b {"service":"faucet"}
info: Sending 10000000000000000000 EIP20 tokens to 0x916e31AeACa9be6794ae1B545206abe133e02481. {"service":"faucet"}
info: Sending 10000000000000000000 coins to 0xEC16590B2ed77e2C6deBC61e6D8Aa8Fc93A8D85A. {"service":"faucet"}
info: Sent 10000000000000000000 coins to 0xEC16590B2ed77e2C6deBC61e6D8Aa8Fc93A8D85A. TxHash: 0x077abe50ac1c223ecf067f4309055e4a26f755ef097a4ba4601d9e8720746001 {"service":"faucet"}
info: Sent 10000000000000000000 EIP20 tokens to 0x916e31AeACa9be6794ae1B545206abe133e02481. TxHash: 0x2e328769af64530dbf1c6b5ce858d0bb78499ae886e72155d6a0942bc114140b {"service":"faucet"}
info: Sent 10000000000000000000 EIP20 tokens to 0xFbc7Be4B193a784194643f76C431B9f9F5896F23. TxHash: 0x28c59e2ae7e4bca8373c1a8c0ae5e9152f97e7207fee2eb750349da4c5f2b512 {"service":"faucet"}
info: Sending 10000000000000000000 coins to 0xCDA20F0395F440E536A56a4feEd9921B928E1752. {"service":"faucet"}
info: Sending 10000000000000000000 EIP20 tokens to 0x7539675BE2C6627f233837E2A5e6956F4d5D05Bf. {"service":"faucet"}
info: Sent 10000000000000000000 EIP20 tokens to 0x7539675BE2C6627f233837E2A5e6956F4d5D05Bf. TxHash: 0x83a28c2b7cad209c1bdfacf7fa9c7b82bbd8140ca91eab5c2a2ad37383ad5131 {"service":"faucet"}
info: Sent 10000000000000000000 coins to 0xCDA20F0395F440E536A56a4feEd9921B928E1752. TxHash: 0xc62a780be3c42c6647e92f3173f57ced00536c6c64e660329afed4ec80c23bf1 {"service":"faucet"}
info: Sending 10000000000000000000 coins to 0x1623CAcca91B19eA40875AB045C59e55b71DD8f4. {"service":"faucet"}
info: Sending 10000000000000000000 EIP20 tokens to 0xfb1749AE5cf6440f9a3BCcF82f0D544399a29C0d. {"service":"faucet"}
info: Sent 10000000000000000000 coins to 0x1623CAcca91B19eA40875AB045C59e55b71DD8f4. TxHash: 0x1d270cc68d4d1f46087ff802431c49271b17601824fbcb6272f5e9391f830502 {"service":"faucet"}
info: Sent 10000000000000000000 EIP20 tokens to 0xfb1749AE5cf6440f9a3BCcF82f0D544399a29C0d. TxHash: 0x3df129f0d400edc1889b02efff83716ddb5ed17fedef8033b6327ce07e8e62bd {"service":"faucet"}
info: Sending 10000000000000000000 EIP20 tokens to 0x6931c132756cD97667901fBBA24Bb609075943fE. {"service":"faucet"}
info: Sending 10000000000000000000 coins to 0xf80df4aE45AbC2F6278317aCFf1E9cBFd856ade1. {"service":"faucet"}
info: Sent 10000000000000000000 coins to 0xf80df4aE45AbC2F6278317aCFf1E9cBFd856ade1. TxHash: 0xd2af62c484a5d5744a0c5e3ed2e14f967683caa6d7f7f375e61b932dc6f9db1b {"service":"faucet"}
info: Sent 10000000000000000000 EIP20 tokens to 0x6931c132756cD97667901fBBA24Bb609075943fE. TxHash: 0xbd50c071ef842ee41e82f613aa2c927eb3280798b1afd9cf07c31adf9d657614 {"service":"faucet"}
error: uncaughtException: socket hang up
Error: socket hang up
    at createHangUpError (_http_client.js:330:15)
    at Socket.socketOnEnd (_http_client.js:431:23)
    at Socket.emit (events.js:202:15)
    at endReadableNT (_stream_readable.js:1132:12)
    at processTicksAndRejections (internal/process/next_tick.js:76:17) {"error":{"code":"ECONNRESET"},"stack":"Error: socket hang up\n    at createHangUpError (_http_client.js:330:15)\n    at Socket.socketOnEnd (_http_client.js:431:23)\n    at Socket.emit (events.js:202:15)\n    at endReadableNT (_stream_readable.js:1132:12)\n    at processTicksAndRejections (internal/process/next_tick.js:76:17)","exception":true,"date":"Tue Mar 19 2019 17:08:46 GMT+0000 (Coordinated Universal Time)","process":{"pid":31084,"uid":1000,"gid":1000,"cwd":"/home/faucet/faucet","execPath":"/usr/bin/node","version":"v11.11.0","argv":["/usr/bin/node","/home/faucet/faucet/build/faucet.js","3","200","-p","60500"],"memoryUsage":{"rss":76255232,"heapTotal":33308672,"heapUsed":27508216,"external":194915}},"os":{"loadavg":[0,0,0],"uptime":379094},"trace":[{"column":15,"file":"_http_client.js","function":"createHangUpError","line":330,"method":null,"native":false},{"column":23,"file":"_http_client.js","function":"Socket.socketOnEnd","line":431,"method":"socketOnEnd","native":false},{"column":15,"file":"events.js","function":"Socket.emit","line":202,"method":"emit","native":false},{"column":12,"file":"_stream_readable.js","function":"endReadableNT","line":1132,"method":null,"native":false},{"column":17,"file":"internal/process/next_tick.js","function":"processTicksAndRejections","line":76,"method":null,"native":false}],"service":"faucet"}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @openst/[email protected] start: `tsc && node build/faucet.js "3" "200" "-p" "60500"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @openst/[email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/faucet/.npm/_logs/2019-03-19T17_08_49_727Z-debug.log

Fix indentation

Update the eslint configuration to use 2 spaces for indentation.

Fix linting

After #18 was fixed and the linter was set up correctly, it revealed issues that cannot be auto-fixed.

  • Fix all issues (with --fix and manually).
  • Add linting to travis to enforce correct linting in the future.

Unfinished issues should have a comment about it

As a developer
I want to see the status of a ticket inside the ticket
Because it wastes time going through all related PRs and possibly tickets.

Given that you worked on a ticket and assigned it to a PR
When the PR does not fully solve the ticket (no Fixes #111)
Then you should add a comment to the ticket about what's done and what is still open.

/cc @benjaminbollen

Update faucet for new chains

⚠️ You can ask @benjaminbollen if you require SSH access.

New Test Nets

1407 and 1406 are new testnet chains. We want to enable the faucet with base tokens for them so that we can use them.
That means they need to be funded with base tokens on the side chains.

  • You need to create new keys for the new chains (see the README or ask @schemar).
  • You need to ask Bala to fund the new accounts.
  • You need to know which ports on the mosaic-chains machine forward to which chain node (ask @benjaminbollen or @schemar if you don't know how to find this out).

ℹ️ To get inspiration you can look at the existing configs for other chains.
ℹ️ If you forget the password we decided on for the accounts, please call @benjaminbollen or @schemar on zoom.

Ropsten

Make sure ropsten is still sufficiently funded as well.

Remove

Remove 200 and 1414 from the config and don't start them with the faucet.

Environment variable support for account passwords

Currently to run faucets for multiple chains, multiple passwords are kept in a password file. The password file has no knowledge of chain account password belongs to.
This becomes problematic for devops for maintaining password files.

Proposal is to support environment variables in below format.

export ACCOUNT_PASSWORD_{chainid}={account_password}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.