Skip to content
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

Remove ERC721ASetOwnersExplicit extension #290

Merged
merged 2 commits into from
May 24, 2022
Merged

Remove ERC721ASetOwnersExplicit extension #290

merged 2 commits into from
May 24, 2022

Conversation

cygaar
Copy link
Collaborator

@cygaar cygaar commented May 24, 2022

The impetus for removing this extension is to simplify our codebase and remove code adds unnecessary complexity. This code was added as a fail safe when ERC721A was first written, but we've since added optimizations and other helpers that make this unnecessary. Like @Vectorized mentioned in the issue below, contract owners can use _initializeOwnershipAt at certain intervals to make transfers of large batch mints cheaper. Other than that scenario, it's not very necessary to explicitly set an ownership slot because the added cost of transferring an uninitialized slot isn't very high.

#289

// We assume the initialization worked due to less gas used by the 2nd txn
const receipt1 = await tx1.wait();
const receipt2 = await tx2.wait();
expect(receipt1.gasUsed.toNumber()).to.be.greaterThan(receipt2.gasUsed.toNumber());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a best-efforst heuristic to determine whether or not the initialization call worked because we can't directly access _packedOwnerships

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can access _ownershipAt, which is internal.

But big brain trick haha.

// We assume the initialization worked due to less gas used by the 2nd txn
const receipt1 = await tx1.wait();
const receipt2 = await tx2.wait();
expect(receipt1.gasUsed.toNumber()).to.be.greaterThan(receipt2.gasUsed.toNumber());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a best-efforst heuristic to determine whether or not the initialization call worked because we can't directly access _packedOwnerships

@Vectorized
Copy link
Collaborator

So many lines gone. Finally the itch got scratched. :)

LGTM.

@cygaar cygaar merged commit 9c64340 into main May 24, 2022
@cygaar cygaar deleted the remove_explicit branch May 24, 2022 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants