MystenLabs / sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
https://sui.io
Apache License 2.0
6.26k stars 11.21k forks source link

Unable to use `sui-faucet` on local sui network that is started using `sui genesis-ceremony` #16420

Open KevL-99 opened 9 months ago

KevL-99 commented 9 months ago

Goal

After starting a local sui network using sui genesis-ceremony, start sui-faucet and get some gas coins

Issue

  1. Lack of documentation on running sui-faucet on a local network started using sui genesis-ceremony
  2. sui faucet returns an error when there are 0 gas coins
  3. After an ad-hoc modification of simple_faucet.rs, sui-faucet runs but unable to request gas coins

Steps to reproduce the issue

  1. Start up fullnodes and validators by running cargo run --bin sui-node -- --config-path <path/to/validator/or/fullnode/config/files>
  2. Run sui client gas, there are no gas coins owned by the active address
  3. run cargo run --bin sui-faucet -- --write-ahead-log /tmp/faucet.wal, the faucet will give error: mpsc bounded channel requires buffer > 0, the problem is caused by lines 124 and 125 of simple_faucet.rs, containing mpsc::channel(coins.len()), but there are no coins! So I manually changed it to mpsc::channel(100), the faucet then starts up
  4. make a request to the faucet:
    curl --location --request POST <local faucet address> \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "FixedAmountRequest": {
            "recipient": "<active sui address>"
        }
    }'
  5. Faucet log gives error
    ERROR sui_faucet::faucet::simple_faucet: Timeout when getting gas coin from the queue uuid=927d9127-e430-4da9-9f8c-f150c214dd34
    WARN sui_faucet::faucet::simple_faucet: Failed getting gas coin, try later!
    WARN sui_faucet: Failed to request gas: NoGasCoinAvailable uuid=927d9127-e430-4da9-9f8c-f150c214dd34
    WARN sui_faucet::metrics_layer: Request failed in 5.01s, code: 500
  6. curl command gives error response {"transferredGasObjects":[],"error":"Timed out waiting for a coin from the gas coin pool"}
  7. If I dosui genesis -f and sui start, the start the faucet, the addresses seem to have some gas coin right off the start, so I was able to start the faucet without changing mpsc::channel(coins.len()), and the curl command gives gas coin to the active address
Darm0n commented 4 months ago

hi, did you start the faucet service successfully?

KevL-99 commented 3 months ago

hi, did you start the faucet service successfully?

No. However I was able to use sui genesis -f --benchmark-ips to start a local network with an arbitrary number of machines/IP addresses, and the faucet was usable with this method.