From 1e85721243e399bcfeb585b7153aad0e3229ea28 Mon Sep 17 00:00:00 2001 From: dk1a Date: Sun, 7 Jan 2024 09:47:26 +0300 Subject: [PATCH] try more splitting --- packages/world-modules/gas-report.json | 28 +++++++++---------- packages/world/gas-report.json | 14 +++++----- .../world/src/modules/core/CoreModule.sol | 5 +--- .../world/src/modules/core/CoreModule2.sol | 7 +++-- .../world/src/modules/core/CoreSystem.sol | 2 -- .../world/src/modules/core/CoreSystem2.sol | 3 +- packages/world/test/World.t.sol | 4 +-- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/packages/world-modules/gas-report.json b/packages/world-modules/gas-report.json index e7b29257cd..694f09b96a 100644 --- a/packages/world-modules/gas-report.json +++ b/packages/world-modules/gas-report.json @@ -75,13 +75,13 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallComposite", "name": "install keys in table module", - "gasUsed": 1429299 + "gasUsed": 1428994 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "install keys in table module", - "gasUsed": 1429299 + "gasUsed": 1428994 }, { "file": "test/KeysInTableModule.t.sol", @@ -93,13 +93,13 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallSingleton", "name": "install keys in table module", - "gasUsed": 1429299 + "gasUsed": 1428994 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "install keys in table module", - "gasUsed": 1429299 + "gasUsed": 1428994 }, { "file": "test/KeysInTableModule.t.sol", @@ -117,7 +117,7 @@ "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "install keys in table module", - "gasUsed": 1429299 + "gasUsed": 1428994 }, { "file": "test/KeysInTableModule.t.sol", @@ -135,7 +135,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "install keys with value module", - "gasUsed": 660744 + "gasUsed": 660675 }, { "file": "test/KeysWithValueModule.t.sol", @@ -153,7 +153,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "install keys with value module", - "gasUsed": 660744 + "gasUsed": 660675 }, { "file": "test/KeysWithValueModule.t.sol", @@ -165,7 +165,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "install keys with value module", - "gasUsed": 660744 + "gasUsed": 660675 }, { "file": "test/KeysWithValueModule.t.sol", @@ -183,7 +183,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "install keys with value module", - "gasUsed": 660744 + "gasUsed": 660675 }, { "file": "test/KeysWithValueModule.t.sol", @@ -267,7 +267,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "register a callbound delegation", - "gasUsed": 118295 + "gasUsed": 118143 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -279,7 +279,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromSystemDelegation", "name": "register a systembound delegation", - "gasUsed": 115851 + "gasUsed": 115699 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -291,7 +291,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "register a timebound delegation", - "gasUsed": 112789 + "gasUsed": 112637 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -303,7 +303,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 689656 + "gasUsed": 689600 }, { "file": "test/UniqueEntityModule.t.sol", @@ -315,7 +315,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 656142 + "gasUsed": 656109 }, { "file": "test/UniqueEntityModule.t.sol", diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 72eea18fab..6642d2fc87 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -45,13 +45,13 @@ "file": "test/BatchCall.t.sol", "test": "testBatchCallFromReturnData", "name": "call systems with batchCallFrom", - "gasUsed": 46336 + "gasUsed": 52587 }, { "file": "test/BatchCall.t.sol", "test": "testBatchCallReturnData", "name": "call systems with batchCall", - "gasUsed": 45206 + "gasUsed": 51515 }, { "file": "test/World.t.sol", @@ -69,7 +69,7 @@ "file": "test/World.t.sol", "test": "testCallFromUnlimitedDelegation", "name": "register an unlimited delegation", - "gasUsed": 47623 + "gasUsed": 47547 }, { "file": "test/World.t.sol", @@ -93,7 +93,7 @@ "file": "test/World.t.sol", "test": "testRegisterFunctionSelector", "name": "Register a function selector", - "gasUsed": 83149 + "gasUsed": 83139 }, { "file": "test/World.t.sol", @@ -105,19 +105,19 @@ "file": "test/World.t.sol", "test": "testRegisterRootFunctionSelector", "name": "Register a root function selector", - "gasUsed": 80433 + "gasUsed": 80423 }, { "file": "test/World.t.sol", "test": "testRegisterSystem", "name": "register a system", - "gasUsed": 164238 + "gasUsed": 164215 }, { "file": "test/World.t.sol", "test": "testRegisterTable", "name": "Register a new table in the namespace", - "gasUsed": 645230 + "gasUsed": 645112 }, { "file": "test/World.t.sol", diff --git a/packages/world/src/modules/core/CoreModule.sol b/packages/world/src/modules/core/CoreModule.sol index ed14ed2296..63073bcf0a 100644 --- a/packages/world/src/modules/core/CoreModule.sol +++ b/packages/world/src/modules/core/CoreModule.sol @@ -115,14 +115,11 @@ contract CoreModule is Module { * @dev Iterates through known function signatures and registers them. */ function _registerFunctionSelectors() internal { - string[17] memory functionSignatures = [ + string[15] memory functionSignatures = [ // --- AccessManagementSystem --- "grantAccess(bytes32,address)", "revokeAccess(bytes32,address)", "transferOwnership(bytes32,address)", - // --- BatchCallSystem --- - "batchCall((bytes32,bytes)[])", - "batchCallFrom((address,bytes32,bytes)[])", // --- ModuleInstallationSystem --- "installModule(address,bytes)", // --- StoreRegistrationSystem --- diff --git a/packages/world/src/modules/core/CoreModule2.sol b/packages/world/src/modules/core/CoreModule2.sol index d8376ddc98..793597a411 100644 --- a/packages/world/src/modules/core/CoreModule2.sol +++ b/packages/world/src/modules/core/CoreModule2.sol @@ -98,10 +98,13 @@ contract CoreModule2 is Module { function _registerFunctionSelectors() internal { (address coreSystem, ) = Systems.get(CORE_SYSTEM_ID); - string[2] memory functionSignatures = [ + string[4] memory functionSignatures = [ // --- BalanceTransferSystem --- "transferBalanceToNamespace(bytes32,bytes32,uint256)", - "transferBalanceToAddress(bytes32,address,uint256)" + "transferBalanceToAddress(bytes32,address,uint256)", + // --- BatchCallSystem --- + "batchCall((bytes32,bytes)[])", + "batchCallFrom((address,bytes32,bytes)[])" ]; for (uint256 i = 0; i < functionSignatures.length; i++) { diff --git a/packages/world/src/modules/core/CoreSystem.sol b/packages/world/src/modules/core/CoreSystem.sol index b2d93a592d..ed2f17f34b 100644 --- a/packages/world/src/modules/core/CoreSystem.sol +++ b/packages/world/src/modules/core/CoreSystem.sol @@ -4,7 +4,6 @@ pragma solidity >=0.8.21; import { IWorldErrors } from "../../IWorldErrors.sol"; import { AccessManagementSystem } from "./implementations/AccessManagementSystem.sol"; -import { BatchCallSystem } from "./implementations/BatchCallSystem.sol"; import { ModuleInstallationSystem } from "./implementations/ModuleInstallationSystem.sol"; import { StoreRegistrationSystem } from "./implementations/StoreRegistrationSystem.sol"; import { WorldRegistrationSystem } from "./implementations/WorldRegistrationSystem.sol"; @@ -18,7 +17,6 @@ import { WorldRegistrationSystem } from "./implementations/WorldRegistrationSyst contract CoreSystem is IWorldErrors, AccessManagementSystem, - BatchCallSystem, ModuleInstallationSystem, StoreRegistrationSystem, WorldRegistrationSystem diff --git a/packages/world/src/modules/core/CoreSystem2.sol b/packages/world/src/modules/core/CoreSystem2.sol index 47240cd0db..f3be3c4cc5 100644 --- a/packages/world/src/modules/core/CoreSystem2.sol +++ b/packages/world/src/modules/core/CoreSystem2.sol @@ -4,6 +4,7 @@ pragma solidity >=0.8.21; import { IWorldErrors } from "../../IWorldErrors.sol"; import { BalanceTransferSystem } from "./implementations/BalanceTransferSystem.sol"; +import { BatchCallSystem } from "./implementations/BatchCallSystem.sol"; /** * @title Core System for World @@ -11,6 +12,6 @@ import { BalanceTransferSystem } from "./implementations/BalanceTransferSystem.s * @dev Aggregates multiple system implementations for the World. * Split into multiple systems because of the bytecode size limit. */ -contract CoreSystem2 is BalanceTransferSystem { +contract CoreSystem2 is BalanceTransferSystem, BatchCallSystem { // Currently, no additional functionality is added in this aggregate contract. } diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index f7169c61ae..170d316424 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -231,8 +231,8 @@ contract WorldTest is Test, GasReporter { coreSystem2.transferBalanceToNamespace.selector, coreSystem2.transferBalanceToAddress.selector, // --- BatchCallSystem --- - coreSystem.batchCall.selector, - coreSystem.batchCallFrom.selector, + coreSystem2.batchCall.selector, + coreSystem2.batchCallFrom.selector, // --- ModuleInstallationSystem --- coreSystem.installModule.selector, // --- StoreRegistrationSystem ---