solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.51k stars 2.04k forks source link

[Compressed NFTs] Transfer with zero length proof #5092

Open raulriera opened 1 year ago

raulriera commented 1 year ago

Description

From the docs the recommendation is to prune it from the proofs but that results in an empty array and the transfer will fail.

In the TypeScript code example above, we are first taking a slice of our "full proof", starting at the beginning of the array, and ensuring we only have proof.length - canopyDepth number of proof values. This will remove the portion of the proof that is already stored on-chain in the tree's canopy.

There are situations where the canopyDepth and full proof are the same resulting in a zero length proof that will fail a transfer with Proof is empty. Example NFT would be any of the Tensorians NFTs https://www.tensor.trade/trade/tensorians

ngundotra commented 11 months ago

@raulriera I haven't heard of any issues with zero length proofs, but if you can provide a code sample I can take a look.

I'll add a test to the test suite & then close this issue.

cc @richwardwu