-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(world,store): add ERC165 checks for all registration methods #1458
Conversation
🦋 Changeset detectedLatest commit: a709876 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
cccdb2f
to
6820bf8
Compare
f001e2e
to
886dea4
Compare
@@ -0,0 +1,21 @@ | |||
[ |
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 added .gitattributes
in another PR but might be worth adding here to land it sooner to suppress these codegen diffs for now:
https://github.com/latticexyz/mud/pull/1354/files#diff-618cd5b83d62060ba3d027e314a21ceaf75d36067ff820db126642944145393e
|
||
// ERC-165 Interface ID (see https://eips.ethereum.org/EIPS/eip-165) | ||
bytes4 constant SYSTEM_HOOK_INTERFACE_ID = ISystemHook.onBeforeCallSystem.selector ^ | ||
ISystemHook.onAfterCallSystem.selector; |
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 noticed IModule
above includes ERC165.supportsInterface.selector
but this does not. Any reason?
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.
good catch, should be included
packages/store/src/IStoreHook.sol
Outdated
IStoreHook.onBeforeSetField.selector ^ | ||
IStoreHook.onAfterSetField.selector ^ | ||
IStoreHook.onBeforeDeleteRecord.selector ^ | ||
IStoreHook.onAfterDeleteRecord.selector; |
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.
same here, seems to be missing ERC165.supportsInterface.selector
?
IWorldContextConsumer._msgSender.selector ^ | ||
IWorldContextConsumer._msgValue.selector ^ | ||
IWorldContextConsumer._world.selector ^ | ||
ERC165.supportsInterface.selector; |
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.
is it necessary to define the inherited selectors as well as our own?
and if so would it be easier to do the whole interface ID instead of each selector (caveat: I don't know what the bitshifting is doing here)?
bytes4 constant DELEGATION_CONTROL_INTERFACE_ID = IDelegationControl.verify.selector ^
WORLD_CONTEXT_CONSUMER_INTERFACE_ID ^
ERC165_INTERFACE_ID;
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.
agree this is cleaner, and should work since ^
(bitwise XOR) is commutative and associative
packages/store/src/ERC165.sol
Outdated
bytes4 constant ERC165_INTERFACE_ID = ERC165.supportsInterface.selector; | ||
|
||
// See https://eips.ethereum.org/EIPS/eip-165 | ||
interface ERC165 { |
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.
should it be IERC165
for consistency?
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.
agree
function _msgSender() external view returns (address); | ||
function _msgValue() external view returns (uint256); | ||
function _world() external view returns (address); |
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 are these needed?
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.
need them to be public to be part of the interface to be able to distinguish a WorldContextConsumer
contract
The base branch was changed.
aa3284f
to
a2f73b3
Compare
merging since there were no significant changes since the last approval, just implementation of review feedback and rebasing |
No description provided.