stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

Faucet ratelimit not correct

Open CharlieC3 opened this issue 1 year ago • 0 comments

Describe the bug When using the STX faucet, a ratelimit is applied to the request. However, the condition which determines when to block or allow a request pulls its non-stacking and stacking faucet request historical data from the same source, resulting in some requests being blocked when they should not be.

To Reproduce Steps to reproduce the behavior:

  1. Request non-stacking amount from faucet to a testnet Stacks address and wait for the TX to settle. This will be allowed
  2. Request a stacking amount from faucet to the same Stacks address. This will be denied despite a stacking faucet request never being sent before.

Expected behavior A faucet request should only rate limit someone if they've made a successful faucet request in like-kind (stacking=false vs stacking=true)

Console log

04/10/2024, 10:36:59.413 AM	request completed -> /extended/v1/faucets/stx?address=ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV -> 200 -> POST
04/10/2024, 11:38:00.303 AM	STX faucet rate limit hit for address ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV
04/10/2024, 11:38:00.304 AM	request completed -> /extended/v1/faucets/stx?address=ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV&stacking=true -> 429 -> POST
04/10/2024, 11:46:52.351 AM	STX faucet rate limit hit for address ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV
04/10/2024, 11:46:52.352 AM	request completed -> /extended/v1/faucets/stx?address=ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV&stacking=true -> 429 -> POST
04/10/2024, 11:47:40.629 AM	STX faucet rate limit hit for address ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV
04/10/2024, 11:47:40.630 AM	request completed -> /extended/v1/faucets/stx?address=ST1X0WKFDX7K2BD6FK4XJMCX3M4BZETDKWF353FGV&stacking=true -> 429 -> POST

CharlieC3 avatar Apr 10 '24 17:04 CharlieC3