Closed code423n4 closed 3 years ago
If all NFTs share a common prefix
They will not. Currently the URI is a URL pointing to our server, however this is a temporary measure until the UI is better able to read IPFS data. At that stage the URI will be the IPFS hash. It is tempting to assume the first two characters of the IPFS hash are constant (so we could use the _baseURI) as generally all the ones you'll see start Qm
, I have looked into this because if we assume this then we can save the hash as bytes32 instead of a string and save storage slots. However those first two characters are not necessarily constant and so we can't save them as bytes32 or use the _baseURI feature.
closing as the base URI will not always be the same.
Handle
cmichel
Vulnerability details
Both
RCNftHubL1
andRCNftHubL2
contracts do not set the_baseURI()
which is the prefix of anytokenURI
.Impact
If all NFTs share a common prefix, it's more efficient to set it in the
_baseURI()
instead of setting and storing it individually in eachsetTokenURI
call.Recommended Mitigation Steps
If there's a common prefix, set it in the
_baseURI()
.