From c7e270b5ebcd127c54b277399c63d2f3c04a2c42 Mon Sep 17 00:00:00 2001 From: Fraser Scott Date: Fri, 19 Jan 2024 13:26:07 +0000 Subject: [PATCH] chore: remove unregisterSystem --- packages/world-modules/gas-report.json | 10 +++--- packages/world/gas-report.json | 6 ++-- .../interfaces/IWorldRegistrationSystem.sol | 2 -- .../world/src/modules/core/CoreModule.sol | 3 +- .../WorldRegistrationSystem.sol | 34 ------------------- packages/world/test/World.t.sol | 3 +- 6 files changed, 10 insertions(+), 48 deletions(-) diff --git a/packages/world-modules/gas-report.json b/packages/world-modules/gas-report.json index c3555343c8..e23e9335fc 100644 --- a/packages/world-modules/gas-report.json +++ b/packages/world-modules/gas-report.json @@ -267,7 +267,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "register a callbound delegation", - "gasUsed": 118210 + "gasUsed": 118198 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -279,7 +279,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromSystemDelegation", "name": "register a systembound delegation", - "gasUsed": 115763 + "gasUsed": 115751 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -291,7 +291,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "register a timebound delegation", - "gasUsed": 112686 + "gasUsed": 112674 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -303,7 +303,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 704190 + "gasUsed": 704155 }, { "file": "test/UniqueEntityModule.t.sol", @@ -315,7 +315,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 673093 + "gasUsed": 673081 }, { "file": "test/UniqueEntityModule.t.sol", diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 77c95b318e..0902b4669b 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -63,7 +63,7 @@ "file": "test/Factories.t.sol", "test": "testWorldFactory", "name": "deploy world via WorldFactory", - "gasUsed": 12708436 + "gasUsed": 12642897 }, { "file": "test/World.t.sol", @@ -117,13 +117,13 @@ "file": "test/World.t.sol", "test": "testRegisterRootFunctionSelector", "name": "Register a root function selector", - "gasUsed": 80468 + "gasUsed": 80445 }, { "file": "test/World.t.sol", "test": "testRegisterSystem", "name": "register a system", - "gasUsed": 164375 + "gasUsed": 164363 }, { "file": "test/World.t.sol", diff --git a/packages/world/src/codegen/interfaces/IWorldRegistrationSystem.sol b/packages/world/src/codegen/interfaces/IWorldRegistrationSystem.sol index 8a0264ec64..3121520454 100644 --- a/packages/world/src/codegen/interfaces/IWorldRegistrationSystem.sol +++ b/packages/world/src/codegen/interfaces/IWorldRegistrationSystem.sol @@ -20,8 +20,6 @@ interface IWorldRegistrationSystem { function registerSystem(ResourceId systemId, System system, bool publicAccess) external; - function unregisterSystem(ResourceId systemId) external; - function registerFunctionSelector( ResourceId systemId, string memory systemFunctionSignature diff --git a/packages/world/src/modules/core/CoreModule.sol b/packages/world/src/modules/core/CoreModule.sol index d6272c5e84..0637cd92f2 100644 --- a/packages/world/src/modules/core/CoreModule.sol +++ b/packages/world/src/modules/core/CoreModule.sol @@ -170,7 +170,7 @@ contract CoreModule is Module { _registerRootFunctionSelector(BATCH_CALL_SYSTEM_ID, functionSignaturesBatchCall[i]); } - string[15] memory functionSignaturesCoreRegistration = [ + string[14] memory functionSignaturesCoreRegistration = [ // --- ModuleInstallationSystem --- "installModule(address,bytes)", // --- StoreRegistrationSystem --- @@ -182,7 +182,6 @@ contract CoreModule is Module { "registerSystemHook(bytes32,address,uint8)", "unregisterSystemHook(bytes32,address)", "registerSystem(bytes32,address,bool)", - "unregisterSystem(bytes32)", "registerFunctionSelector(bytes32,string)", "registerRootFunctionSelector(bytes32,string,bytes4)", "registerDelegation(address,bytes32,bytes)", diff --git a/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol b/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol index d432866fc7..adfa8e4b52 100644 --- a/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol +++ b/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol @@ -171,40 +171,6 @@ contract WorldRegistrationSystem is System, IWorldErrors, LimitedCallContext { ResourceAccess._set(namespaceId, address(system), true); } - /** - * @notice Unregisters a system - * @dev Unregisters the system at the given ID - * @param systemId The unique identifier for the system - */ - function unregisterSystem(ResourceId systemId) public virtual { - // Require the provided system ID to have type RESOURCE_SYSTEM - if (systemId.getType() != RESOURCE_SYSTEM) { - revert World_InvalidResourceType(RESOURCE_SYSTEM, systemId, systemId.toString()); - } - - // Require the system's namespace to exist - ResourceId namespaceId = systemId.getNamespaceId(); - AccessControl.requireExistence(namespaceId); - - // Require the caller to own the namespace - AccessControl.requireOwner(namespaceId, _msgSender()); - - // Require the name to not be the namespace's root name - if (systemId.getName() == ROOT_NAME) revert World_InvalidResourceId(systemId, systemId.toString()); - - // Get the system at this system ID - address existingSystem = Systems._getSystem(systemId); - - // Systems = mapping from system ID to system address and public access flag - Systems._deleteRecord(systemId); - - // SystemRegistry = mapping from system address to system ID - SystemRegistry._deleteRecord(address(existingSystem)); - - // Delete the system access to its namespace - ResourceAccess._deleteRecord(namespaceId, address(existingSystem)); - } - /** * @notice Registers a new World function selector * @dev Creates a mapping between a World function and its associated system function diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 5d0712b86b..8a2cdf4758 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -225,7 +225,7 @@ contract WorldTest is Test, GasReporter { CoreRegistrationSystem coreRegistrationSystem = CoreRegistrationSystem( Systems.getSystem(CORE_REGISTRATION_SYSTEM_ID) ); - bytes4[23] memory coreFunctionSignatures = [ + bytes4[22] memory coreFunctionSignatures = [ // --- AccessManagementSystem --- AccessManagementSystem.grantAccess.selector, AccessManagementSystem.revokeAccess.selector, @@ -248,7 +248,6 @@ contract WorldTest is Test, GasReporter { coreRegistrationSystem.registerSystemHook.selector, coreRegistrationSystem.unregisterSystemHook.selector, coreRegistrationSystem.registerSystem.selector, - coreRegistrationSystem.unregisterSystem.selector, coreRegistrationSystem.registerFunctionSelector.selector, coreRegistrationSystem.registerRootFunctionSelector.selector, coreRegistrationSystem.registerDelegation.selector,