From 26e9b47502bc76609cd1227ceaa91f944a3113d5 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll <kingersoll@gmail.com> Date: Thu, 17 Aug 2023 04:30:03 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: dk1a <dk1a@protonmail.com> --- .changeset/grumpy-geckos-raise.md | 2 +- packages/world/src/AccessControl.sol | 4 ++-- packages/world/src/World.sol | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.changeset/grumpy-geckos-raise.md b/.changeset/grumpy-geckos-raise.md index bd7cf3a633..7a39454259 100644 --- a/.changeset/grumpy-geckos-raise.md +++ b/.changeset/grumpy-geckos-raise.md @@ -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. diff --git a/packages/world/src/AccessControl.sol b/packages/world/src/AccessControl.sol index d296d93bbb..ae42b34b02 100644 --- a/packages/world/src/AccessControl.sol +++ b/packages/world/src/AccessControl.sol @@ -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) { diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index fdfae2f5c3..da03421008 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -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); @@ -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); @@ -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); @@ -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);