-
Notifications
You must be signed in to change notification settings - Fork 202
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(store,world): rename ambiguous elements [N-03] #2091
Changes from 2 commits
aaf31c2
504e606
c06c1af
8a9d31e
c37c553
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ contract World is StoreData, IWorldKernel { | |
/** | ||
* @dev Prevents the World contract from calling itself. | ||
*/ | ||
modifier requireNoCallback() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not blocking but I feel like we could expand the docs here to explain why this modifier is here and important to be used, esp since this relates to a now-fixed vulnerability There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added issue here: #2106 |
||
modifier prohibitDirectCallback() { | ||
if (msg.sender == address(this)) { | ||
revert World_CallbackNotAllowed(msg.sig); | ||
} | ||
|
@@ -64,7 +64,7 @@ contract World is StoreData, IWorldKernel { | |
* @param coreModule The core module to initialize the World with. | ||
* @dev Only the initial creator can initialize. This can be done only once. | ||
*/ | ||
function initialize(IModule coreModule) public requireNoCallback { | ||
function initialize(IModule coreModule) public prohibitDirectCallback { | ||
// Only the initial creator of the World can initialize it | ||
if (msg.sender != creator) { | ||
revert World_AccessDenied(ROOT_NAMESPACE_ID.toString(), msg.sender); | ||
|
@@ -85,7 +85,7 @@ contract World is StoreData, IWorldKernel { | |
* @param args Arguments for module installation. | ||
* @dev The caller must own the root namespace. | ||
*/ | ||
function installRootModule(IModule module, bytes memory args) public requireNoCallback { | ||
function installRootModule(IModule module, bytes memory args) public prohibitDirectCallback { | ||
AccessControl.requireOwner(ROOT_NAMESPACE_ID, msg.sender); | ||
_installRootModule(module, args); | ||
} | ||
|
@@ -131,7 +131,7 @@ contract World is StoreData, IWorldKernel { | |
bytes calldata staticData, | ||
PackedCounter encodedLengths, | ||
bytes calldata dynamicData | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to the namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -151,7 +151,7 @@ contract World is StoreData, IWorldKernel { | |
bytes32[] calldata keyTuple, | ||
uint48 start, | ||
bytes calldata data | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to the namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -175,7 +175,7 @@ contract World is StoreData, IWorldKernel { | |
uint40 startWithinField, | ||
uint40 deleteCount, | ||
bytes calldata data | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to the namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -195,7 +195,7 @@ contract World is StoreData, IWorldKernel { | |
bytes32[] calldata keyTuple, | ||
uint8 fieldIndex, | ||
bytes calldata data | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -217,7 +217,7 @@ contract World is StoreData, IWorldKernel { | |
uint8 fieldIndex, | ||
bytes calldata data, | ||
FieldLayout fieldLayout | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -240,7 +240,7 @@ contract World is StoreData, IWorldKernel { | |
uint8 fieldIndex, | ||
bytes calldata data, | ||
FieldLayout fieldLayout | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -260,7 +260,7 @@ contract World is StoreData, IWorldKernel { | |
bytes32[] calldata keyTuple, | ||
uint8 dynamicFieldIndex, | ||
bytes calldata data | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -280,7 +280,7 @@ contract World is StoreData, IWorldKernel { | |
bytes32[] calldata keyTuple, | ||
uint8 dynamicFieldIndex, | ||
bytes calldata dataToPush | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -300,7 +300,7 @@ contract World is StoreData, IWorldKernel { | |
bytes32[] calldata keyTuple, | ||
uint8 dynamicFieldIndex, | ||
uint256 byteLengthToPop | ||
) public virtual requireNoCallback { | ||
) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -314,7 +314,7 @@ contract World is StoreData, IWorldKernel { | |
* @param keyTuple Array of keys identifying the record to delete. | ||
* @dev Requires the caller to have access to the table's namespace or name. | ||
*/ | ||
function deleteRecord(ResourceId tableId, bytes32[] calldata keyTuple) public virtual requireNoCallback { | ||
function deleteRecord(ResourceId tableId, bytes32[] calldata keyTuple) public virtual prohibitDirectCallback { | ||
// Require access to namespace or name | ||
AccessControl.requireAccess(tableId, msg.sender); | ||
|
||
|
@@ -338,7 +338,7 @@ contract World is StoreData, IWorldKernel { | |
function call( | ||
ResourceId systemId, | ||
bytes memory callData | ||
) external payable virtual requireNoCallback returns (bytes memory) { | ||
) external payable virtual prohibitDirectCallback returns (bytes memory) { | ||
return SystemCall.callWithHooksOrRevert(msg.sender, systemId, callData, msg.value); | ||
} | ||
|
||
|
@@ -354,7 +354,7 @@ contract World is StoreData, IWorldKernel { | |
address delegator, | ||
ResourceId systemId, | ||
bytes memory callData | ||
) external payable virtual requireNoCallback returns (bytes memory) { | ||
) external payable virtual prohibitDirectCallback returns (bytes memory) { | ||
// If the delegator is the caller, call the system directly | ||
if (delegator == msg.sender) { | ||
return SystemCall.callWithHooksOrRevert(msg.sender, systemId, callData, msg.value); | ||
|
@@ -402,7 +402,7 @@ contract World is StoreData, IWorldKernel { | |
/** | ||
* @dev Fallback function to call registered function selectors. | ||
*/ | ||
fallback() external payable requireNoCallback { | ||
fallback() external payable prohibitDirectCallback { | ||
(ResourceId systemId, bytes4 systemFunctionSelector) = FunctionSelectors._get(msg.sig); | ||
|
||
if (ResourceId.unwrap(systemId) == 0) revert World_FunctionSelectorNotFound(msg.sig); | ||
|
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.
can we name this
resourceWithHooks
?"element" is a term we've never used before and I think "resource" is more consistent: https://www.notion.so/latticexyz/MUD-naming-conventions-terminology-66e11356a1934465b2aa1a951c61a299