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

AA-176: Add ERC-165 "supportsInterface" to the EntryPoint #331

Merged
merged 7 commits into from
Aug 21, 2023

Conversation

forshtat
Copy link
Collaborator

@forshtat forshtat commented Aug 20, 2023

Note: due to 'StakeManager', 'NonceManager' being 'abstract' and only parts of the EntryPoint, and due to IEntryPoint inheriting from all interfaces, the implementation looks a little weird.

I think this this is fine, though.

Note: due to 'StakeManager', 'NonceManager' being 'abstract' and only
parts of the EntryPoint, and due to IEntryPoint inheriting from all
interfaces, the implementation looks a little weird.

I this this is fine, though.
import "./UserOperation.sol";
import "./IStakeManager.sol";
import "./IAggregator.sol";
import "./INonceManager.sol";

interface IEntryPoint is IStakeManager, INonceManager {
interface IEntryPoint is IStakeManager, INonceManager, OpenZeppelin.IERC165 {
Copy link
Contributor

Choose a reason for hiding this comment

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

why should the IEntryPoint inherit from ERC165 ? (you later manually remove it, so maybe it should not be in the interface itself...

Copy link
Contributor

Choose a reason for hiding this comment

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

actually, maybe its good, so a bundler can work only with IEntryPoint, not with EntryPoint contract itself.

╚══════════════════════════╧════════╝

╔════════════════════════════════╤═══════╤═══════════════╤════════════════╤═════════════════════╗
║ handleOps description │ count │ total gasUsed │ per UserOp gas │ per UserOp overhead ║
║ │ │ │ (delta for │ (compared to ║
║ │ │ │ one UserOp) │ account.exec()) ║
╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢
║ simple │ 1 │ 81899 │ │ ║
║ simple │ 1 │ 81943 │ │ ║
Copy link
Contributor

Choose a reason for hiding this comment

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

cost 40 per op? 250 per 10 ?


describe('ERC-165', function () {
it('should return true for EntryPoint interface IDs', async function () {
const epInterface = IEntryPoint__factory.createInterface()
Copy link
Contributor

Choose a reason for hiding this comment

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

I miss a sample for: how a bundler can check the current entryPoint adddress it has is OK ?

const res1 = await entryPoint.supportsInterface(epInterfaceID)
const res2 = await entryPoint.supportsInterface(smInterfaceID)
const res3 = await entryPoint.supportsInterface(nmInterfaceID)
const res4 = await entryPoint.supportsInterface(epPureInterfaceID)
Copy link
Contributor

Choose a reason for hiding this comment

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

better:

expect(await entryPoint.supoprtsInterface). to.be.true

@@ -39,6 +39,15 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuard
*/
uint256 public constant SIG_VALIDATION_FAILED = 1;

/// @inheritdoc OpenZeppelin.IERC165
function supportsInterface(bytes4 interfaceId) public view virtual override(OpenZeppelin.ERC165, OpenZeppelin.IERC165) returns (bool) {
return interfaceId == (type(IEntryPoint).interfaceId ^ type(IStakeManager).interfaceId ^ type(INonceManager).interfaceId) ||

This comment was marked as resolved.

src/Utils.ts Outdated
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return iface.getSighash(it.name!)
})
.filter(it => it !== '0x01ffc9a7') // remove the IERC165 method itself
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you exclude it? see comment in the contract.

@drortirosh drortirosh merged commit da37cc2 into develop Aug 21, 2023
@drortirosh drortirosh deleted the AA-176-add-support-erc165 branch August 21, 2023 11:46
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