-
Notifications
You must be signed in to change notification settings - Fork 670
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
Conversation
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.
contracts/interfaces/IEntryPoint.sol
Outdated
import "./UserOperation.sol"; | ||
import "./IStakeManager.sol"; | ||
import "./IAggregator.sol"; | ||
import "./INonceManager.sol"; | ||
|
||
interface IEntryPoint is IStakeManager, INonceManager { | ||
interface IEntryPoint is IStakeManager, INonceManager, OpenZeppelin.IERC165 { |
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.
why should the IEntryPoint inherit from ERC165 ? (you later manually remove it, so maybe it should not be in the interface itself...
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.
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 │ │ ║ |
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.
cost 40 per op? 250 per 10 ?
test/entrypoint.test.ts
Outdated
|
||
describe('ERC-165', function () { | ||
it('should return true for EntryPoint interface IDs', async function () { | ||
const epInterface = IEntryPoint__factory.createInterface() |
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.
I miss a sample for: how a bundler can check the current entryPoint adddress it has is OK ?
test/entrypoint.test.ts
Outdated
const res1 = await entryPoint.supportsInterface(epInterfaceID) | ||
const res2 = await entryPoint.supportsInterface(smInterfaceID) | ||
const res3 = await entryPoint.supportsInterface(nmInterfaceID) | ||
const res4 = await entryPoint.supportsInterface(epPureInterfaceID) |
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.
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.
This comment was marked as resolved.
Sorry, something went wrong.
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 |
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.
why do you exclude it? see comment in the contract.
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.