jcnelson / nftree

A scalable way to mint NFTs that earn their owners a yield in STX
47 stars 10 forks source link

Certain numbers of NFTs cause errors when generating merkle proofs. #4

Closed radicleart closed 2 years ago

radicleart commented 2 years ago

Just noticed that running ./nftree.js with certain numbers of NFTs causes nulls in the proof map and errors..


    "hashes": proof.map(function(h) { return h.toString('hex') }),

     TypeError: Cannot read property 'toString' of undefined
    at /Users/mikey/hubgit/radicle-solutions/nftree/src/nftree.js:188:48
    at Array.map (<anonymous>)
    at makeMerkleProof (/Users/mikey/hubgit/radicle-solutions/nftree/src/nftree.js:188:21)
    at processOneDirectory (/Users/mikey/hubgit/radicle-solutions/nftree/src/nftree.js:263:21)
    at main (/Users/mikey/hubgit/radicle-solutions/nftree/src/nftree.js:426:24)
    at Object.<anonymous> (/Users/mikey/hubgit/radicle-solutions/nftree/src/nftree.js:453:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)```

For example running with 3, 4 NFTs works but 5 errors and 6, 7, 8 works and 9 fails.
joeyfigaro commented 2 years ago

Running into same issue @jcnelson – if it helps, I was building with 18 images. CSV contains the expected info.

name,tickets
wanderer1.png, 10
wanderer2.png, 10
wanderer3.png, 10
wanderer4.png, 10
wanderer5.png, 10
wanderer6.png, 10
wanderer7.png, 10
wanderer8.png, 10
wanderer9.png, 10
wanderer10.png, 10
wanderer11.png, 10
wanderer12.png, 10
wanderer13.png, 100
wanderer14.png, 100
wanderer15.png, 100
wanderer16.png, 100
wanderer17.png, 100
wanderer18.png, 100
jcnelson commented 2 years ago

Yup, confirmed. Working on a fix.

jcnelson commented 2 years ago

Should be fixed now. Let me know if not.