[LSP8] Discussion - truncation of `bytes32` tokenId for keyTypes Mapping
Opened this issue · 0 comments
CJ42 commented
To Be Discussed
One of the limitation of the Mapping key type is when dealing with bytes32
tokenIds, such as NFTs.
Since LSP2 defines that a key of type Mapping will truncate on the right side, this can cause collisions if the first 20 bytes of two token IDs are the same. This can be the case when the LSP8 Token ID Type is 3
(string
).
Such data keys that are susceptibles to this issue can be the following:
Examples
From the actual LSP8 specs
{
"name": "LSP8MetadataTokenURI:<address|uint256|bytes32|string>",
"key": "0x1339e76a390b7b9ec9010000<address|uint256|bytes32|string>",
"keyType": "Mapping",
"valueType": "(bytes4,string)",
"valueContent": "(Bytes4,URI)"
}
Example of a possible LSP8 data key
{
"name": "WinningBidder:<bytes32-tokenId>",
"key": "0x2651e040e5e018ae36310000<address>",
"keyType": "Mapping",
"valueType": "address",
"valueContent": "Address"
}
Question
How can a schema be defined that avoids the truncation, and prevent this potential collision?