bound-layerable icon indicating copy to clipboard operation
bound-layerable copied to clipboard

Explore packing layerId into ERC721A _extraData

Open emo-eth opened this issue 3 years ago • 0 comments

We should always store layerId for base tokens upon binding, since they may be re-bound or rearranged, and the extra 100-200 gas to read the extraData from warm ownership slot is going to be cheaper than the layer seed calculation + lookup.

Since layer tokens are burned upon being bound, they should not store their layerId during the binding process.

It may be worth looking into calculating+storing the layerId for any token when transferring. The ownership/extraData storage slot will already be warm, but calculating will add at least 5000 gas on first transfer after reveal in worst cases (max 2 SLOADs for packed distributions, plus all comparison and calculation overhead - unsure on specific gas usage).

Minimizing gas usage during binding+arranging for end-user experience may be worth the added gas overhead during transfer - but a better gas analysis should be done.

emo-eth avatar Sep 22 '22 20:09 emo-eth