Skip to content

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

Merged
frangio merged 13 commits into
OpenZeppelin:masterfrom
Amxx:refactor/virtualERC165
Feb 18, 2021
Merged

Refactor ERC165 to use function overriding instead of storage.#2505
frangio merged 13 commits into
OpenZeppelin:masterfrom
Amxx:refactor/virtualERC165

Conversation

@Amxx

@Amxx Amxx commented Feb 2, 2021

Copy link
Copy Markdown
Collaborator

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
@Amxx Amxx force-pushed the refactor/virtualERC165 branch from cdcc30e to 0604e82 Compare February 12, 2021 22:52

@frangio frangio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking great.

Comment thread contracts/mocks/ERC165Mock.sol Outdated
@Amxx Amxx marked this pull request as ready for review February 17, 2021 17:56
Comment thread test/introspection/ERC165.test.js Outdated
this.mock = await ERC165Mock.new();
});

it('register interface', async function () {

@frangio frangio Feb 17, 2021

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

frangio commented Feb 17, 2021

Copy link
Copy Markdown
Contributor

I've implemented the changes I suggested above.

@frangio frangio left a comment

Copy link
Copy Markdown
Contributor

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 disabled auto-merge 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