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

[Cherry pick] faucet web #20899

Conversation

stefan-mysten
Copy link
Member

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:
  • 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:
Copy link

vercel bot commented Jan 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 16, 2025 0:20am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2025 0:20am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jan 16, 2025 0:20am

@stefan-mysten stefan-mysten requested review from ebmifa and a team January 16, 2025 00:13
@stefan-mysten stefan-mysten temporarily deployed to sui-typescript-aws-kms-test-env January 16, 2025 00:13 — with GitHub Actions Inactive
@stefan-mysten stefan-mysten deleted the cherry_pick_faucet_web branch January 16, 2025 00:25
@stefan-mysten stefan-mysten restored the cherry_pick_faucet_web branch January 16, 2025 03:10
@stefan-mysten stefan-mysten deleted the cherry_pick_faucet_web branch January 16, 2025 03:28
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

Successfully merging this pull request may close these issues.

1 participant