NFT Signatures - remallnfts vs. search performance
Solution 1. Vector table
Overview:
Pros:
similar architecture to
addaddressremallnftsworks as spec'dVector can be emptied in single call without iterating through all the objects. This allows for remallnfts to work flawlessly
Allows transfer address and burnaddress to work as spec’d
Cons:
Limit on number of NFTs that can be mapped
Requires limit on number of NFTs that can be mapped to any single FIO Address due to vector search linear compute time on checking existing entries and checking for items to remove. Like addpubaddress vector but more limited since it iterates with a larger object
Requires update to support
get_nfts_hashCan’t do it unless all the data is duplicated in another table mapped by sha256 (fioaddress+chaincode+contractaddress+tokenid => hash)
If mapped, we would need an admin cleanup task these cannot be deleted with all vector entries w/ remallnfts, back to square one.
Does this support
get_nfts_contract?
Solution 2. Multi-index container
Overview:
Pros:
Unlimited NFTs due to use of multi index container
Good search time adding/removing small entries
Supports
get_nfts_hash
Cons:
Cannot automatically remove all NFTs.
Can do 5 at a time, newest to oldest or vice versa
By making
remallnftshave less custom error responses and removing some other checks I may be able to salvage enough cpu time to clean out more NFTs in a single call.
Updates required to remove NFTs for a FIO Address in
xferaddress,burnaddress, andburnexpired.For
xferaddressTransfer the address immediately
Enter the Address into the
burnnftsqueue.This blocks the adding of new NFTs to the Address.
Block addition of new NFTs for that FIO Address as long as it is in the
burnnftsqueue
For
burnaddressProceed with burn as currently spec’d (burn the Address immediately).
Enter the Address into the
burnnftsqueue.This blocks the adding of new NFTs to the Address.
A new user can re-register the address, but if they attempt to add an NFT they would be blocked until the Address is cleared from the
burnnftsqueue.
For
burnexpired, we would need to iterate through the burning of NFTS for every FIO Address that is getting burnedProceed with burnexpired as currently spec’d (burn all Addresses even if they have mapped NFTS)
Enter the address into the
burnnftsqueue if there are NFTs.This blocks the adding of new NFTs to the Address.
A new user can re-register the address, but if they attempt to add an NFT they would be blocked until the Address is cleared from the
burnnftsqueue.
TBD:
Need to spec out the
burnnftstable
Discussion
Based on discussion with Adam, Pawel, and Eric:
Proceed with Solution #2
@Adam Androulidakis will spec out the NFT Signature updates required to accommodate the
burnnftsqueue. ( https://fioprotocol.atlassian.net/browse/BD-2839 )@Adam Androulidakis spec out new
burnnftsadmin call ( https://fioprotocol.atlassian.net/browse/BD-2843 )@Casey Gardiner will spec out any updates to
burnexpired(Also tracked in https://fioprotocol.atlassian.net/browse/BD-2843 )