Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: dk1a <[email protected]>
  • Loading branch information
holic and dk1a authored Aug 17, 2023
1 parent 8264c11 commit 26e9b47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .changeset/grumpy-geckos-raise.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- All `World` function selectors that previously had `bytes16 namespace, bytes16 name` arguments now use `bytes32 resourceSelector` instead.
This includes `setRecord`, `setField`, `pushToField`, `popFromField`, `updateInField`, `deleteRecord`, `call`, `grantAccess`, `revokeAccess`, `registerTable`,
`registerStoreHook`, `registerSystemHook`, `registerFunctionSelector`, `registerSystem` and `registerRootFunctionSelector`.
This changes aligns the `World` function selectors with the `Store` function selectors, reduces clutter, reduces gas cost and reduces the `World`'s contract size.
This change aligns the `World` function selectors with the `Store` function selectors, reduces clutter, reduces gas cost and reduces the `World`'s contract size.

- The `World`'s `registerHook` function is removed. Use `registerStoreHook` or `registerSystemHook` instead.

Expand Down
4 changes: 2 additions & 2 deletions packages/world/src/AccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ library AccessControl {

/**
* Check for ownership of the namespace of the given resource selector
* or identity of the caller to the own address.
* Reverts with AccessDenied the check fails.
* or identity of the caller to this contract's own address.
* Reverts with AccessDenied if the check fails.
*/
function requireOwnerOrSelf(bytes32 resourceSelector, address caller) internal view {
if (address(this) != caller && NamespaceOwner.get(resourceSelector.getNamespace()) != caller) {
Expand Down
8 changes: 4 additions & 4 deletions packages/world/src/World.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ contract World is StoreRead, IStoreData, IWorldKernel {
uint8 schemaIndex,
bytes calldata data,
Schema valueSchema
) public virtual override {
) public virtual {
// Require access to namespace or name
AccessControl.requireAccess(tableId, msg.sender);

Expand All @@ -105,7 +105,7 @@ contract World is StoreRead, IStoreData, IWorldKernel {
uint8 schemaIndex,
bytes calldata dataToPush,
Schema valueSchema
) public override {
) public virtual {
// Require access to namespace or name
AccessControl.requireAccess(tableId, msg.sender);

Expand All @@ -123,7 +123,7 @@ contract World is StoreRead, IStoreData, IWorldKernel {
uint8 schemaIndex,
uint256 byteLengthToPop,
Schema valueSchema
) public override {
) public virtual {
// Require access to namespace or name
AccessControl.requireAccess(tableId, msg.sender);

Expand Down Expand Up @@ -154,7 +154,7 @@ contract World is StoreRead, IStoreData, IWorldKernel {
* Delete a record in the table at the given tableId.
* Requires the caller to have access to the namespace or name.
*/
function deleteRecord(bytes32 tableId, bytes32[] calldata key, Schema valueSchema) public virtual override {
function deleteRecord(bytes32 tableId, bytes32[] calldata key, Schema valueSchema) public virtual {
// Require access to namespace or name
AccessControl.requireAccess(tableId, msg.sender);

Expand Down

0 comments on commit 26e9b47

Please sign in to comment.