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

111 faucet rate limiter #269

Merged
16 commits merged into from
Apr 6, 2022
Merged

111 faucet rate limiter #269

16 commits merged into from
Apr 6, 2022

Conversation

blackode
Copy link
Contributor

Description

Provide a limit for the number of faucet transactions within the period of time.

Fixes #111

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Configuration

The following two variables has been set in config.exs

# Faucet rate limit in Number of transactions.
config :archethic, :faucet_rate_limit, 3

# Faucet rate limit Expiry time in milliseconds (one hour)
config :archethic, :faucet_rate_limit_expiry, 3_600_000

How Has This Been Tested?

Make 4 faucet transactions within an hour. At present limited to only three transactions per hour. When you try to make fourth transaction, you will get a flash "Archived address" and time left to retry

  • Faucet Controller Test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@blackode blackode changed the base branch from master to develop March 30, 2022 13:11
lib/archethic_web/controllers/faucet_controller.ex Outdated Show resolved Hide resolved
lib/archethic_web/faucet_rate_limiter.ex Outdated Show resolved Hide resolved
lib/archethic_web/faucet_rate_limiter.ex Outdated Show resolved Hide resolved
lib/archethic_web/supervisor.ex Outdated Show resolved Hide resolved
lib/archethic_web/controllers/faucet_controller.ex Outdated Show resolved Hide resolved
config/config.exs Show resolved Hide resolved
@blackode blackode requested a review from a user March 30, 2022 16:49
@blackode blackode requested a review from a user March 31, 2022 11:00
@apoorv-2204
Copy link
Contributor

Able to withdraw from different nodes. IDK if it is a issue .

image

@blackode
Copy link
Contributor Author

blackode commented Apr 2, 2022

#269 (comment)
@apoorv-2204 can you show me how did you test this?

@apoorv-2204
Copy link
Contributor

apoorv-2204 commented Apr 2, 2022

#269 (comment) @apoorv-2204 can you show me how did you test this?

Hello,, docker build -t aen . There are 3 nodes and 3 endpoints So I think we can with draw 3 times from each nodes.May be we have to implement logic at txn level, to avoid being withdrawn from multiple nodes?? IDK

Copy link
Contributor

@apoorv-2204 apoorv-2204 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

From Testing: I was able to withdraw 3-times from each of the node.

@ghost ghost merged commit 1b4babe into develop Apr 6, 2022
@ghost ghost deleted the 111-faucet-rate-limiter branch April 6, 2022 08:47
@ghost ghost mentioned this pull request Apr 27, 2022
@ghost ghost added feature New feature request UI Invole user interface labels May 3, 2022
ghost pushed a commit that referenced this pull request May 6, 2022
@blackode blackode removed the request for review from roychowdhuryrohit-dev May 6, 2022 23:26
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request UI Invole user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add faucet rate limiter
2 participants