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

Refactor ERC165 to use function overriding instead of storage. #2505

Merged
merged 13 commits into from
Feb 18, 2021

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Feb 2, 2021

ERC165: Uses virtual/override on the supportsInterface function instead of mapping

This reduces the storage footprint of ERC165 compliant contract, thus reducing the gas cost of deploying and configuring such contracts.

PR Checklist

  • Tests
  • Documentation
  • Changelog entry

@Amxx Amxx marked this pull request as draft February 8, 2021 19:39
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

Looking great.

contracts/mocks/ERC165Mock.sol Outdated Show resolved Hide resolved
@Amxx Amxx marked this pull request as ready for review February 17, 2021 17:56
@@ -9,6 +9,12 @@ contract('ERC165', function (accounts) {
this.mock = await ERC165Mock.new();
});

it('register interface', async function () {
Copy link
Contributor

@frangio frangio Feb 17, 2021

Choose a reason for hiding this comment

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

I think this test should be removed since it pertains to ERC165Storage and not plain ERC165.

@@ -2,9 +2,9 @@

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this entire file can be deleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But then ERC165Storage should not be abstract, right ?

@frangio
Copy link
Contributor

frangio commented Feb 17, 2021

I've implemented the changes I suggested above.

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

LGTM!

@frangio frangio enabled auto-merge (squash) February 18, 2021 18:57
@frangio frangio enabled auto-merge (squash) February 18, 2021 18:58
@frangio frangio merged commit e733b24 into OpenZeppelin:master Feb 18, 2021
@Amxx Amxx deleted the refactor/virtualERC165 branch February 18, 2021 19:40
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