Skip to content

Commit

Permalink
try more splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
dk1a committed Jan 7, 2024
1 parent 7b14d92 commit 1e85721
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 32 deletions.
28 changes: 14 additions & 14 deletions packages/world-modules/gas-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions packages/world/gas-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
5 changes: 1 addition & 4 deletions packages/world/src/modules/core/CoreModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---
Expand Down
7 changes: 5 additions & 2 deletions packages/world/src/modules/core/CoreModule2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 0 additions & 2 deletions packages/world/src/modules/core/CoreSystem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,7 +17,6 @@ import { WorldRegistrationSystem } from "./implementations/WorldRegistrationSyst
contract CoreSystem is
IWorldErrors,
AccessManagementSystem,
BatchCallSystem,
ModuleInstallationSystem,
StoreRegistrationSystem,
WorldRegistrationSystem
Expand Down
3 changes: 2 additions & 1 deletion packages/world/src/modules/core/CoreSystem2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ 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
* @notice This system aggregates all World functionalities externalized from the World contract, aiming to keep the World contract's bytecode lean.
* @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.
}
4 changes: 2 additions & 2 deletions packages/world/test/World.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---
Expand Down

0 comments on commit 1e85721

Please sign in to comment.