-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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] updates to enable faucet web app #20846
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
largely looks good, excited to see the faucet web app go live!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, this is p dope
// Check if the request was successful. | ||
if !resp.status().is_success() { | ||
return Err(( | ||
StatusCode::INTERNAL_SERVER_ERROR, | ||
FaucetError::Internal("Verification failed".to_string()), | ||
)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be a 400 instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's handled below
then what could be a possible receive response but is not success?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I mostly handle this case in case some weird stuff comes back from cloudflare...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking much cleaner, thank you! Left a couple more comments on how to make best use of the entry
API.
## Description This PR updates the faucet service to support requests from Faucet Web, which for testnet are authenticated via a token. It keeps track of each ip address and the number of requests, and limits to a predefined number of requests per a time window. In authenticated mode, it expects that requests go through `/v1/faucet_web_gas`. If requests go through the original `/v1/gas`, they will be under strict rate limit. In addition, it adds a new route `/health`, and moves the logic of `/` to this new route. The old route `/` has a redirect logic to the `faucet.sui.io` web app for requesting tokens. Finally, the CLI is updated to error if `sui client faucet` is called on the testnet network, and provides a message with the url to open to request tokens. ## Test plan Added tests for the logic on cleaning up the list of banned IPs once the reset time passes. `cargo test -p sui-faucet -- server` --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [x] CLI: `sui client faucet` will now instruct users to use the Faucet Web App (faucet.sui.io) to request testnet tokens. For devnet/localhost, behaviour is unchanged. - [ ] Rust SDK:
## Description This PR updates the faucet service to support requests from Faucet Web, which for testnet are authenticated via a token. It keeps track of each ip address and the number of requests, and limits to a predefined number of requests per a time window. In authenticated mode, it expects that requests go through `/v1/faucet_web_gas`. If requests go through the original `/v1/gas`, they will be under strict rate limit. In addition, it adds a new route `/health`, and moves the logic of `/` to this new route. The old route `/` has a redirect logic to the `faucet.sui.io` web app for requesting tokens. Finally, the CLI is updated to error if `sui client faucet` is called on the testnet network, and provides a message with the url to open to request tokens. ## Test plan Added tests for the logic on cleaning up the list of banned IPs once the reset time passes. `cargo test -p sui-faucet -- server` --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [x] CLI: `sui client faucet` will now instruct users to use the Faucet Web App (faucet.sui.io) to request testnet tokens. For devnet/localhost, behaviour is unchanged. - [ ] Rust SDK:
Description
This PR updates the faucet service to support requests from Faucet Web, which for testnet are authenticated via a token. It keeps track of each ip address and the number of requests, and limits to a predefined number of requests per a time window. In authenticated mode, it expects that requests go through
/v1/faucet_web_gas
. If requests go through the original/v1/gas
, they will be under strict rate limit.In addition, it adds a new route
/health
, and moves the logic of/
to this new route. The old route/
has a redirect logic to thefaucet.sui.io
web app for requesting tokens.Finally, the CLI is updated to error if
sui client faucet
is called on the testnet network, and provides a message with the url to open to request tokens.Test plan
Added tests for the logic on cleaning up the list of banned IPs once the reset time passes.
cargo test -p sui-faucet -- server
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.
sui client faucet
now instructs users to use the Faucet web app (faucet.sui.io) to request Testnet tokens. For Devnet and localhost, behavior is unchanged.