metaplex-foundation / sugar

Candy Machine Rust CLI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Crash when verifying a collection with 0 NFTs

mcintyre94 opened this issue Β· comments

Issue description

  1. Create an assets directory. Add collection.png + collection.json:
{
  "name": "Cool Collection",
  "symbol": "COOL",
  "description": "Collection of some stuff on the blockchain.",
  "image": "collection.png",
  "attributes": [],
  "properties": {
    "files": [
      {
        "uri": "collection.png",
        "type": "image/png"
      }
    ]
  }
}
  1. Run sugar create-config, then sugar upload, then sugar launch

  2. Everything will upload and be deployed correctly, but the verification in sugar launch will error with a division by zero

I think this is a valid use case, eg. if you wanted to start with an empty collection and then have your app mint NFTs into it.

Relevant log output

$ sugar create-config
[1/2] 🍬 Sugar interactive config maker

Check out our Candy Machine config docs to learn about the options:
  -> https://docs.metaplex.com/tools/sugar/configuration

βœ” What is the price of each NFT? Β· 0.1
βœ” How many NFTs will you have in your candy machine? Β· 0
βœ” What is the symbol of your collection? Hit [ENTER] for no symbol. Β· COOL
βœ” What is the seller fee basis points? Β· 200
? What is your go live date? Many common formats are supported. If unsure, try YYYY-MM-DD HH:MM:SS [+/-]UTC-OFFSET or type 'now' for current time. For example 2022-05-02 18:00:00 +0000 for May 2, 2022 18:00:0
βœ” What is your go live date? Many common formats are supported. If unsure, try YYYY-MM-DD HH:MM:SS [+/-]UTC-OFFSET or type 'now' for current time. For example 2022-05-02 18:00:00 +0000 for May 2, 2022 18:00:00 UTC. Β· now
βœ” How many creator wallets do you have? (max limit of 4) Β· 1
βœ” Enter creator wallet address #1 Β· Fkc4FN7PPhyGsAcHPW3dBBJ4BvtYkDr2rBFBgFpvy3nB
βœ” Enter royalty percentage share for creator #1 (e.g., 70). Total shares must add to 100. Β· 100
? Which extra features do you want to use? (use [SPACEBAR] to select options you want and hit [ENTER] wh
βœ” Which extra features do you want to use? (use [SPACEBAR] to select options you want and hit [ENTER] when done) Β· 
βœ” What is your SOL treasury address? Β· Fkc4FN7PPhyGsAcHPW3dBBJ4BvtYkDr2rBFBgFpvy3nB
βœ” What upload method do you want to use? Β· Bundlr
βœ” Do you want to retain update authority on your NFTs? We HIGHLY recommend you choose yes. Β· yes
βœ” Do you want your NFTs to remain mutable? We HIGHLY recommend you choose yes. Β· yes

[2/2] πŸ“ Saving config file

Saving config to file: "config.json"

Successfully generated the config file. πŸŽ‰ 

βœ… Command successful.

$ sugar upload
[1/4] πŸ—‚  Loading assets
Found 1 asset pair(s), uploading files:
+--------------------+
| images    |      1 |
| metadata  |      1 |
+--------------------+

[2/4] πŸ–₯  Initializing upload
β–ͺβ–ͺβ–ͺβ–ͺβ–ͺ Connected
Funding address:
  -> pubkey: 9AUvdLggr4DezH1FEHFBVqQPNUF9q6sZGTYoPMyum2sk
  -> lamports: 99243 (β—Ž 0.000099243)
Signature: zkMvNMg3fRyDgdNuNUDQxy5zKEr34JQHuvJDSff1CTD1cE6SD15t1V1F2uWiUQW9QUtTix3Q4CySihrYfGUvDEM

[3/4] πŸ“€ Uploading image files 

Sending data: (Ctrl+C to abort)
[00:00:01] Upload successful β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 1/1

[4/4] πŸ“€ Uploading metadata files 

Sending data: (Ctrl+C to abort)
[00:00:00] Upload successful β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 1/1

1/1 asset pair(s) uploaded.

βœ… Command successful.

$ sugar launch
Starting Sugar launch... πŸš€ 

>>> sugar validate

[1/1] πŸ—‚  Loading assets
β–ͺβ–ͺβ–ͺβ–ͺβ–ͺ Validating 1 metadata file(s)...

Validation complete, your metadata file(s) look good.

>>> sugar upload

[1/4] πŸ—‚  Loading assets
Found 1 asset pair(s), uploading files:
+--------------------+
| images    |      0 |
| metadata  |      0 |
+--------------------+

....no files need uploading, skipping remaining steps.

1/1 asset pair(s) uploaded.

>>> sugar deploy

[1/3] 🍬 Creating candy machine
Candy machine ID: DqfEXKYn8Nct9xaY8A5xj2DUNkwZw8cJKXWS1Wwqt4oK

[2/3] πŸ“¦ Creating and setting the collection NFT for candy machine
Collection mint ID: DCBN7vi2nqQARtE4GQfVcgm58gAgvHCjvs99UfGJtnrm

[3/3] πŸ“ Writing config lines

All config lines deployed.

>>> sugar verify

[1/2] 🍬 Loading candy machine
β–ͺβ–ͺβ–ͺβ–ͺβ–ͺ Completed

[2/2] πŸ“ Verification
Verifying 0 config line(s): (Ctrl+C to abort)
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 0/0
thread 'main' panicked at 'attempt to divide by zero', src/verify/process.rs:97:25

Priority this issue should have

Low (slightly annoying)