From 8a6d3893d12f806f11ad94e59e98c39624b15ff3 Mon Sep 17 00:00:00 2001 From: alvrs Date: Sun, 24 Sep 2023 19:10:04 +0100 Subject: [PATCH 1/7] rename CallBatch to BatchCall --- packages/world/gas-report.json | 20 +++++++++---------- .../src/codegen/interfaces/IBaseWorld.sol | 4 ++-- ...llBatchSystem.sol => IBatchCallSystem.sol} | 4 ++-- .../world/src/modules/core/CoreModule.sol | 6 +++--- .../world/src/modules/core/CoreSystem.sol | 4 ++-- ...allBatchSystem.sol => BatchCallSystem.sol} | 4 ++-- .../test/{CallBatch.t.sol => BatchCall.t.sol} | 18 ++++++++--------- packages/world/test/World.t.sol | 4 ++-- 8 files changed, 32 insertions(+), 32 deletions(-) rename packages/world/src/codegen/interfaces/{ICallBatchSystem.sol => IBatchCallSystem.sol} (70%) rename packages/world/src/modules/core/implementations/{CallBatchSystem.sol => BatchCallSystem.sol} (89%) rename packages/world/test/{CallBatch.t.sol => BatchCall.t.sol} (89%) diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index d08185a933..7794304ac7 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -42,10 +42,10 @@ "gasUsed": 1326 }, { - "file": "test/CallBatch.t.sol", - "test": "testCallBatchReturnData", - "name": "call systems with callBatch", - "gasUsed": 45264 + "file": "test/BatchCall.t.sol", + "test": "testBatchCallReturnData", + "name": "call systems with batchCall", + "gasUsed": 45305 }, { "file": "test/World.t.sol", @@ -63,7 +63,7 @@ "file": "test/World.t.sol", "test": "testCallFromUnlimitedDelegation", "name": "register an unlimited delegation", - "gasUsed": 47695 + "gasUsed": 47739 }, { "file": "test/World.t.sol", @@ -87,31 +87,31 @@ "file": "test/World.t.sol", "test": "testRegisterFunctionSelector", "name": "Register a function selector", - "gasUsed": 83287 + "gasUsed": 83265 }, { "file": "test/World.t.sol", "test": "testRegisterNamespace", "name": "Register a new namespace", - "gasUsed": 121072 + "gasUsed": 121116 }, { "file": "test/World.t.sol", "test": "testRegisterRootFunctionSelector", "name": "Register a root function selector", - "gasUsed": 80571 + "gasUsed": 80549 }, { "file": "test/World.t.sol", "test": "testRegisterSystem", "name": "register a system", - "gasUsed": 162954 + "gasUsed": 162932 }, { "file": "test/World.t.sol", "test": "testRegisterTable", "name": "Register a new table in the namespace", - "gasUsed": 637709 + "gasUsed": 637753 }, { "file": "test/World.t.sol", diff --git a/packages/world/src/codegen/interfaces/IBaseWorld.sol b/packages/world/src/codegen/interfaces/IBaseWorld.sol index 53c74f4c5b..a8112b5dc0 100644 --- a/packages/world/src/codegen/interfaces/IBaseWorld.sol +++ b/packages/world/src/codegen/interfaces/IBaseWorld.sol @@ -9,7 +9,7 @@ import { IWorldKernel } from "../../interfaces/IWorldKernel.sol"; import { ICoreSystem } from "./ICoreSystem.sol"; import { IAccessManagementSystem } from "./IAccessManagementSystem.sol"; import { IBalanceTransferSystem } from "./IBalanceTransferSystem.sol"; -import { ICallBatchSystem } from "./ICallBatchSystem.sol"; +import { IBatchCallSystem } from "./IBatchCallSystem.sol"; import { IModuleInstallationSystem } from "./IModuleInstallationSystem.sol"; import { IWorldRegistrationSystem } from "./IWorldRegistrationSystem.sol"; @@ -23,7 +23,7 @@ interface IBaseWorld is ICoreSystem, IAccessManagementSystem, IBalanceTransferSystem, - ICallBatchSystem, + IBatchCallSystem, IModuleInstallationSystem, IWorldRegistrationSystem { diff --git a/packages/world/src/codegen/interfaces/ICallBatchSystem.sol b/packages/world/src/codegen/interfaces/IBatchCallSystem.sol similarity index 70% rename from packages/world/src/codegen/interfaces/ICallBatchSystem.sol rename to packages/world/src/codegen/interfaces/IBatchCallSystem.sol index b164789391..c2274c66b0 100644 --- a/packages/world/src/codegen/interfaces/ICallBatchSystem.sol +++ b/packages/world/src/codegen/interfaces/IBatchCallSystem.sol @@ -5,6 +5,6 @@ pragma solidity >=0.8.21; import { SystemCallData } from "./../../modules/core/types.sol"; -interface ICallBatchSystem { - function callBatch(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas); +interface IBatchCallSystem { + function batchCall(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas); } diff --git a/packages/world/src/modules/core/CoreModule.sol b/packages/world/src/modules/core/CoreModule.sol index e2213b77f8..4a16621eb7 100644 --- a/packages/world/src/modules/core/CoreModule.sol +++ b/packages/world/src/modules/core/CoreModule.sol @@ -29,7 +29,7 @@ import { Balances } from "../../codegen/tables/Balances.sol"; import { AccessManagementSystem } from "./implementations/AccessManagementSystem.sol"; import { BalanceTransferSystem } from "./implementations/BalanceTransferSystem.sol"; -import { CallBatchSystem } from "./implementations/CallBatchSystem.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"; @@ -106,8 +106,8 @@ contract CoreModule is Module { // --- BalanceTransferSystem --- "transferBalanceToNamespace(bytes32,bytes32,uint256)", "transferBalanceToAddress(bytes32,address,uint256)", - // --- CallBatchSystem --- - "callBatch((bytes32,bytes)[])", + // --- BatchCallSystem --- + "batchCall((bytes32,bytes)[])", // --- ModuleInstallationSystem --- "installModule(address,bytes)", // --- StoreRegistrationSystem --- diff --git a/packages/world/src/modules/core/CoreSystem.sol b/packages/world/src/modules/core/CoreSystem.sol index 61f56f26d7..875145cc47 100644 --- a/packages/world/src/modules/core/CoreSystem.sol +++ b/packages/world/src/modules/core/CoreSystem.sol @@ -5,7 +5,7 @@ import { IWorldErrors } from "../../interfaces/IWorldErrors.sol"; import { AccessManagementSystem } from "./implementations/AccessManagementSystem.sol"; import { BalanceTransferSystem } from "./implementations/BalanceTransferSystem.sol"; -import { CallBatchSystem } from "./implementations/CallBatchSystem.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 +18,7 @@ contract CoreSystem is IWorldErrors, AccessManagementSystem, BalanceTransferSystem, - CallBatchSystem, + BatchCallSystem, ModuleInstallationSystem, StoreRegistrationSystem, WorldRegistrationSystem diff --git a/packages/world/src/modules/core/implementations/CallBatchSystem.sol b/packages/world/src/modules/core/implementations/BatchCallSystem.sol similarity index 89% rename from packages/world/src/modules/core/implementations/CallBatchSystem.sol rename to packages/world/src/modules/core/implementations/BatchCallSystem.sol index 8cabb6ea90..add9e8d870 100644 --- a/packages/world/src/modules/core/implementations/CallBatchSystem.sol +++ b/packages/world/src/modules/core/implementations/BatchCallSystem.sol @@ -7,11 +7,11 @@ import { revertWithBytes } from "../../../revertWithBytes.sol"; import { SystemCallData } from "../types.sol"; -contract CallBatchSystem is System { +contract BatchCallSystem is System { /** * Batch calls to multiple systems into a single transaction, return the array of return data. */ - function callBatch(SystemCallData[] calldata systemCalls) public returns (bytes[] memory returnDatas) { + function batchCall(SystemCallData[] calldata systemCalls) public returns (bytes[] memory returnDatas) { IBaseWorld world = IBaseWorld(_world()); returnDatas = new bytes[](systemCalls.length); diff --git a/packages/world/test/CallBatch.t.sol b/packages/world/test/BatchCall.t.sol similarity index 89% rename from packages/world/test/CallBatch.t.sol rename to packages/world/test/BatchCall.t.sol index 8fab0a1baf..b2608a1a66 100644 --- a/packages/world/test/CallBatch.t.sol +++ b/packages/world/test/BatchCall.t.sol @@ -39,7 +39,7 @@ contract TestSystem is System { } } -contract CallBatchTest is Test, GasReporter { +contract BatchCallTest is Test, GasReporter { IBaseWorld world; bytes14 namespace = "namespace"; bytes16 name = "testSystem"; @@ -51,7 +51,7 @@ contract CallBatchTest is Test, GasReporter { world.initialize(new CoreModule()); } - function testCallBatch() public { + function testBatchCall() public { // Register a new system TestSystem system = new TestSystem(); world.registerSystem(systemId, system, true); @@ -61,7 +61,7 @@ contract CallBatchTest is Test, GasReporter { systemCalls[0] = SystemCallData(systemId, abi.encodeCall(TestSystem.increment, ())); vm.expectRevert("sender is not admin"); - world.callBatch(systemCalls); + world.batchCall(systemCalls); // Set the admin and increment the counter twice systemCalls = new SystemCallData[](3); @@ -70,10 +70,10 @@ contract CallBatchTest is Test, GasReporter { systemCalls[2] = SystemCallData(systemId, abi.encodeCall(TestSystem.increment, ())); vm.expectRevert("sender is not admin"); - world.callBatch(systemCalls); + world.batchCall(systemCalls); vm.prank(caller); - world.callBatch(systemCalls); + world.batchCall(systemCalls); assertEq(system.counter(), 2, "wrong counter value"); @@ -82,12 +82,12 @@ contract CallBatchTest is Test, GasReporter { systemCalls[0] = SystemCallData(systemId, abi.encodeCall(TestSystem.increment, ())); vm.prank(caller); - world.callBatch(systemCalls); + world.batchCall(systemCalls); assertEq(system.counter(), 3, "wrong counter value"); } - function testCallBatchReturnData() public { + function testBatchCallReturnData() public { // Register a new system TestSystem system = new TestSystem(); world.registerSystem(systemId, system, true); @@ -99,8 +99,8 @@ contract CallBatchTest is Test, GasReporter { systemCalls[1] = SystemCallData(systemId, abi.encodeCall(TestSystem.getStoreAddress, ())); vm.prank(caller); - startGasReport("call systems with callBatch"); - bytes[] memory returnDatas = world.callBatch(systemCalls); + startGasReport("call systems with batchCall"); + bytes[] memory returnDatas = world.batchCall(systemCalls); endGasReport(); assertEq(abi.decode(returnDatas[0], (address)), caller, "wrong address returned"); diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 684d54f896..31421afe2b 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -224,8 +224,8 @@ contract WorldTest is Test, GasReporter { // --- BalanceTransferSystem --- coreSystem.transferBalanceToNamespace.selector, coreSystem.transferBalanceToAddress.selector, - // --- CallBatchSystem --- - coreSystem.callBatch.selector, + // --- BatchCallSystem --- + coreSystem.batchCall.selector, // --- ModuleInstallationSystem --- coreSystem.installModule.selector, // --- StoreRegistrationSystem --- From c869e5e75c1d894679c049e36807e9a172b6419b Mon Sep 17 00:00:00 2001 From: alvrs Date: Sun, 24 Sep 2023 19:14:05 +0100 Subject: [PATCH 2/7] add batchCallFrom --- .../codegen/interfaces/IBatchCallSystem.sol | 4 +++- .../core/implementations/BatchCallSystem.sol | 19 ++++++++++++++++++- packages/world/src/modules/core/types.sol | 6 ++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/world/src/codegen/interfaces/IBatchCallSystem.sol b/packages/world/src/codegen/interfaces/IBatchCallSystem.sol index c2274c66b0..aa957a321d 100644 --- a/packages/world/src/codegen/interfaces/IBatchCallSystem.sol +++ b/packages/world/src/codegen/interfaces/IBatchCallSystem.sol @@ -3,8 +3,10 @@ pragma solidity >=0.8.21; /* Autogenerated file. Do not edit manually. */ -import { SystemCallData } from "./../../modules/core/types.sol"; +import { SystemCallData, SystemCallFromData } from "./../../modules/core/types.sol"; interface IBatchCallSystem { function batchCall(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas); + + function batchCallFrom(SystemCallFromData[] calldata systemCalls) external returns (bytes[] memory returnDatas); } diff --git a/packages/world/src/modules/core/implementations/BatchCallSystem.sol b/packages/world/src/modules/core/implementations/BatchCallSystem.sol index add9e8d870..e7bc1d0141 100644 --- a/packages/world/src/modules/core/implementations/BatchCallSystem.sol +++ b/packages/world/src/modules/core/implementations/BatchCallSystem.sol @@ -5,7 +5,7 @@ import { System } from "../../../System.sol"; import { IBaseWorld } from "../../../codegen/interfaces/IBaseWorld.sol"; import { revertWithBytes } from "../../../revertWithBytes.sol"; -import { SystemCallData } from "../types.sol"; +import { SystemCallData, SystemCallFromData } from "../types.sol"; contract BatchCallSystem is System { /** @@ -24,4 +24,21 @@ contract BatchCallSystem is System { returnDatas[i] = abi.decode(returnData, (bytes)); } } + + /** + * Batch calls to multiple systems into a single transaction, return the array of return data. + */ + function batchCallFrom(SystemCallFromData[] calldata systemCalls) public returns (bytes[] memory returnDatas) { + IBaseWorld world = IBaseWorld(_world()); + returnDatas = new bytes[](systemCalls.length); + + for (uint256 i; i < systemCalls.length; i++) { + (bool success, bytes memory returnData) = address(world).delegatecall( + abi.encodeCall(world.callFrom, (systemCalls[i].from, systemCalls[i].systemId, systemCalls[i].callData)) + ); + if (!success) revertWithBytes(returnData); + + returnDatas[i] = abi.decode(returnData, (bytes)); + } + } } diff --git a/packages/world/src/modules/core/types.sol b/packages/world/src/modules/core/types.sol index d7061059c7..60a7bfc971 100644 --- a/packages/world/src/modules/core/types.sol +++ b/packages/world/src/modules/core/types.sol @@ -7,3 +7,9 @@ struct SystemCallData { ResourceId systemId; bytes callData; } + +struct SystemCallFromData { + ResourceId systemId; + bytes callData; + address from; +} From 2986769d9087304d171702fdbb3abb13d602f0d8 Mon Sep 17 00:00:00 2001 From: alvrs Date: Sun, 24 Sep 2023 19:16:09 +0100 Subject: [PATCH 3/7] install batchCallFrom --- packages/world/src/modules/core/CoreModule.sol | 3 ++- packages/world/src/modules/core/types.sol | 2 +- packages/world/test/World.t.sol | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/world/src/modules/core/CoreModule.sol b/packages/world/src/modules/core/CoreModule.sol index 4a16621eb7..62d3e35723 100644 --- a/packages/world/src/modules/core/CoreModule.sol +++ b/packages/world/src/modules/core/CoreModule.sol @@ -98,7 +98,7 @@ contract CoreModule is Module { * Register function selectors for all CoreSystem functions in the World */ function _registerFunctionSelectors() internal { - string[18] memory functionSignatures = [ + string[19] memory functionSignatures = [ // --- AccessManagementSystem --- "grantAccess(bytes32,address)", "revokeAccess(bytes32,address)", @@ -108,6 +108,7 @@ contract CoreModule is Module { "transferBalanceToAddress(bytes32,address,uint256)", // --- BatchCallSystem --- "batchCall((bytes32,bytes)[])", + "batchCallFrom((address,bytes32,bytes)[])", // --- ModuleInstallationSystem --- "installModule(address,bytes)", // --- StoreRegistrationSystem --- diff --git a/packages/world/src/modules/core/types.sol b/packages/world/src/modules/core/types.sol index 60a7bfc971..8cb71ef19f 100644 --- a/packages/world/src/modules/core/types.sol +++ b/packages/world/src/modules/core/types.sol @@ -9,7 +9,7 @@ struct SystemCallData { } struct SystemCallFromData { + address from; ResourceId systemId; bytes callData; - address from; } diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 31421afe2b..68cd479fd3 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -216,7 +216,7 @@ contract WorldTest is Test, GasReporter { // Should have registered the core system function selectors CoreSystem coreSystem = CoreSystem(Systems.getSystem(world, CORE_SYSTEM_ID)); - bytes4[18] memory coreFunctionSignatures = [ + bytes4[19] memory coreFunctionSignatures = [ // --- AccessManagementSystem --- coreSystem.grantAccess.selector, coreSystem.revokeAccess.selector, @@ -226,6 +226,7 @@ contract WorldTest is Test, GasReporter { coreSystem.transferBalanceToAddress.selector, // --- BatchCallSystem --- coreSystem.batchCall.selector, + coreSystem.batchCallFrom.selector, // --- ModuleInstallationSystem --- coreSystem.installModule.selector, // --- StoreRegistrationSystem --- From af1d205f966c2c7ecc6f49e185adaf65787b974c Mon Sep 17 00:00:00 2001 From: alvrs Date: Sun, 24 Sep 2023 19:32:49 +0100 Subject: [PATCH 4/7] add tests for batch call from --- packages/world/test/BatchCall.t.sol | 68 ++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/packages/world/test/BatchCall.t.sol b/packages/world/test/BatchCall.t.sol index b2608a1a66..2380a18c25 100644 --- a/packages/world/test/BatchCall.t.sol +++ b/packages/world/test/BatchCall.t.sol @@ -7,14 +7,18 @@ import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; import { World } from "../src/World.sol"; import { System } from "../src/System.sol"; +import { UNLIMITED_DELEGATION } from "../src/constants.sol"; import { ResourceId, WorldResourceIdLib } from "../src/WorldResourceId.sol"; import { RESOURCE_SYSTEM } from "../src/worldResourceTypes.sol"; +import { IWorldErrors } from "../src/interfaces/IWorldErrors.sol"; import { IBaseWorld } from "../src/codegen/interfaces/IBaseWorld.sol"; import { CoreModule } from "../src/modules/core/CoreModule.sol"; -import { SystemCallData } from "../src/modules/core/types.sol"; +import { SystemCallData, SystemCallFromData } from "../src/modules/core/types.sol"; address constant caller = address(1); +address constant delegator = address(2); +address constant delegatee = address(3); contract TestSystem is System { address public admin; @@ -29,6 +33,9 @@ contract TestSystem is System { } function setAdmin(address newAdmin) public { + if (admin != address(0) && _msgSender() != admin) { + revert("sender is not admin"); + } admin = newAdmin; } @@ -106,4 +113,63 @@ contract BatchCallTest is Test, GasReporter { assertEq(abi.decode(returnDatas[0], (address)), caller, "wrong address returned"); assertEq(abi.decode(returnDatas[1], (address)), address(world), "wrong store returned"); } + + function testBatchCallFrom() public { + // Register a new system + TestSystem system = new TestSystem(); + world.registerSystem(systemId, system, true); + + // Try to increment the counter without creating a delegation + SystemCallFromData[] memory systemCalls = new SystemCallFromData[](1); + systemCalls[0] = SystemCallFromData(delegator, systemId, abi.encodeCall(TestSystem.increment, ())); + + vm.prank(delegatee); + vm.expectRevert(abi.encodeWithSelector(IWorldErrors.World_DelegationNotFound.selector, delegator, delegatee)); + world.batchCallFrom(systemCalls); + + // Create an unlimited delegation + vm.prank(delegator); + world.registerDelegation(delegatee, UNLIMITED_DELEGATION, new bytes(0)); + + // Try to increment the counter without setting the admin + vm.prank(delegatee); + vm.expectRevert("sender is not admin"); + world.batchCallFrom(systemCalls); + + // Set the admin and increment the counter twice + systemCalls = new SystemCallFromData[](4); + systemCalls[0] = SystemCallFromData(delegatee, systemId, abi.encodeCall(TestSystem.setAdmin, (delegator))); + systemCalls[1] = SystemCallFromData(delegator, systemId, abi.encodeCall(TestSystem.increment, ())); + systemCalls[2] = SystemCallFromData(delegator, systemId, abi.encodeCall(TestSystem.setAdmin, (delegatee))); + systemCalls[3] = SystemCallFromData(delegatee, systemId, abi.encodeCall(TestSystem.increment, ())); + + vm.prank(delegatee); + world.batchCallFrom(systemCalls); + + assertEq(system.counter(), 2, "wrong counter value"); + } + + function testBatchCallFromReturnData() public { + // Register a new system + TestSystem system = new TestSystem(); + world.registerSystem(systemId, system, true); + + // Create an unlimited delegation + vm.prank(delegator); + world.registerDelegation(delegatee, UNLIMITED_DELEGATION, new bytes(0)); + + // Batch call functions on the system + SystemCallFromData[] memory systemCalls = new SystemCallFromData[](2); + + systemCalls[0] = SystemCallFromData(delegatee, systemId, abi.encodeCall(TestSystem.msgSender, ())); + systemCalls[1] = SystemCallFromData(delegator, systemId, abi.encodeCall(TestSystem.msgSender, ())); + + vm.prank(delegatee); + startGasReport("call systems with batchCallFrom"); + bytes[] memory returnDatas = world.batchCallFrom(systemCalls); + endGasReport(); + + assertEq(abi.decode(returnDatas[0], (address)), delegatee, "wrong delegatee returned"); + assertEq(abi.decode(returnDatas[1], (address)), delegator, "wrong delegator returned"); + } } From d66fab21f9b9d2bd13b65f59e4f924d654372b8c Mon Sep 17 00:00:00 2001 From: alvarius Date: Sun, 24 Sep 2023 19:38:23 +0100 Subject: [PATCH 5/7] Create serious-plants-itch.md --- .changeset/serious-plants-itch.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .changeset/serious-plants-itch.md diff --git a/.changeset/serious-plants-itch.md b/.changeset/serious-plants-itch.md new file mode 100644 index 0000000000..71f8c1bb87 --- /dev/null +++ b/.changeset/serious-plants-itch.md @@ -0,0 +1,23 @@ +--- +"@latticexyz/world": major +--- + +- `IBaseWorld` now has a `batchCallFrom` method, which allows system calls via `callFrom` to be executed in batch. + +```solidity +import { SystemCallFromData } from "@latticexyz/world/modules/core/types.sol"; + +interface IBaseWorld { + function batchCallFrom(SystemCallFromData[] calldata systemCalls) external returns (bytes[] memory returnDatas); +} +``` + +- The `callBatch` method of `IBaseWorld` has been renamed to `batchCall` to align better with the `batchCallFrom` method. + +```diff +interface IBaseWorld { +- function callBatch(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas); ++ function batchCall(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas); +} +``` + From 558222c4a4a30853fa40221766d9022000fb9e64 Mon Sep 17 00:00:00 2001 From: alvrs Date: Sun, 24 Sep 2023 19:39:29 +0100 Subject: [PATCH 6/7] update gas report --- packages/world-modules/gas-report.json | 26 +++++++++++++------------- packages/world/gas-report.json | 8 +++++++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/world-modules/gas-report.json b/packages/world-modules/gas-report.json index 3e5655abe5..1dd64dfa2b 100644 --- a/packages/world-modules/gas-report.json +++ b/packages/world-modules/gas-report.json @@ -3,13 +3,13 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallComposite", "name": "install keys in table module", - "gasUsed": 1408400 + "gasUsed": 1408533 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "install keys in table module", - "gasUsed": 1408400 + "gasUsed": 1408533 }, { "file": "test/KeysInTableModule.t.sol", @@ -21,13 +21,13 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallSingleton", "name": "install keys in table module", - "gasUsed": 1408400 + "gasUsed": 1408533 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "install keys in table module", - "gasUsed": 1408400 + "gasUsed": 1408533 }, { "file": "test/KeysInTableModule.t.sol", @@ -45,7 +45,7 @@ "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "install keys in table module", - "gasUsed": 1408400 + "gasUsed": 1408533 }, { "file": "test/KeysInTableModule.t.sol", @@ -63,7 +63,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "install keys with value module", - "gasUsed": 649560 + "gasUsed": 649692 }, { "file": "test/KeysWithValueModule.t.sol", @@ -81,7 +81,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "install keys with value module", - "gasUsed": 649560 + "gasUsed": 649692 }, { "file": "test/KeysWithValueModule.t.sol", @@ -93,7 +93,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "install keys with value module", - "gasUsed": 649560 + "gasUsed": 649692 }, { "file": "test/KeysWithValueModule.t.sol", @@ -111,7 +111,7 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "install keys with value module", - "gasUsed": 649560 + "gasUsed": 649692 }, { "file": "test/KeysWithValueModule.t.sol", @@ -195,7 +195,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "register a callbound delegation", - "gasUsed": 117579 + "gasUsed": 117623 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -207,7 +207,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "register a timebound delegation", - "gasUsed": 112073 + "gasUsed": 112117 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -219,7 +219,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 676208 + "gasUsed": 676231 }, { "file": "test/UniqueEntityModule.t.sol", @@ -231,7 +231,7 @@ "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 643472 + "gasUsed": 643428 }, { "file": "test/UniqueEntityModule.t.sol", diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 7794304ac7..3243c97e71 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -41,11 +41,17 @@ "name": "AccessControl: requireOwner (warm)", "gasUsed": 1326 }, + { + "file": "test/BatchCall.t.sol", + "test": "testBatchCallFromReturnData", + "name": "call systems with batchCallFrom", + "gasUsed": 46608 + }, { "file": "test/BatchCall.t.sol", "test": "testBatchCallReturnData", "name": "call systems with batchCall", - "gasUsed": 45305 + "gasUsed": 45405 }, { "file": "test/World.t.sol", From 20285580903a35193511a7e3849cef04b2240616 Mon Sep 17 00:00:00 2001 From: alvrs Date: Mon, 25 Sep 2023 01:18:47 +0100 Subject: [PATCH 7/7] prettier --- .changeset/serious-plants-itch.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.changeset/serious-plants-itch.md b/.changeset/serious-plants-itch.md index 71f8c1bb87..b6fbe7134b 100644 --- a/.changeset/serious-plants-itch.md +++ b/.changeset/serious-plants-itch.md @@ -20,4 +20,3 @@ interface IBaseWorld { + function batchCall(SystemCallData[] calldata systemCalls) external returns (bytes[] memory returnDatas); } ``` -