-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a generic interface for ownership storage hitchhiking #323
Conversation
contracts/ERC721A.sol
Outdated
_packedOwnerships[tokenId] = | ||
_addressToUint256(from) | | ||
(block.timestamp << BITPOS_START_TIMESTAMP) | | ||
(_extraData(from, address(0), _unpackExtraData(prevOwnershipPacked)) << BITPOS_EXTRA_DATA) | | ||
BITMASK_BURNED | | ||
BITMASK_NEXT_INITIALIZED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of my new tests for the behavior of _extraData
failed for burns on my machine. I was able to track it back to the _addressToUint256(from)
part in the above code. Replacing it with (_addressToUint256(from) & ((1 << 160) - 1)) |
, so zeroing the leading 96bits solved the issue. I have no idea why _addressToUint256
seems to produce dirty uint256
s though. @Vectorized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the compiler didn't clean the bits.
I have added some changes to ensure that.
Ok, did some changes:
|
A quick draft implementation for #322 "Allowing general storage hitchhiking".