From e9c5cbae931cab4adda42d98a8cf1882e9d02294 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 22:26:42 +0100 Subject: [PATCH 1/9] add version to world --- packages/world/src/World.sol | 4 +++- packages/world/src/interfaces/IWorldKernel.sol | 7 ++++++- packages/world/test/Factories.t.sol | 6 +++--- packages/world/test/World.t.sol | 6 +++--- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index 1c80c16249..2c97161168 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -34,12 +34,14 @@ import { CORE_MODULE_NAME } from "./modules/core/constants.sol"; contract World is StoreRead, IStoreData, IWorldKernel { using ResourceSelector for bytes32; + + bytes32 public constant version = "0.0.0"; address public immutable creator; constructor() { creator = msg.sender; StoreCore.initialize(); - emit HelloWorld(); + emit HelloWorld(version); } /** diff --git a/packages/world/src/interfaces/IWorldKernel.sol b/packages/world/src/interfaces/IWorldKernel.sol index 1dc9f602ad..8f25b0114f 100644 --- a/packages/world/src/interfaces/IWorldKernel.sol +++ b/packages/world/src/interfaces/IWorldKernel.sol @@ -39,7 +39,12 @@ interface IWorldCall { * registered functions selectors from the `CoreModule`. */ interface IWorldKernel is IWorldModuleInstallation, IWorldCall, IWorldErrors { - event HelloWorld(); + event HelloWorld(bytes32 indexed version); + + /** + * The version of the World. + */ + function version() external view returns (bytes32); /** * The immutable original deployer of the World. diff --git a/packages/world/test/Factories.t.sol b/packages/world/test/Factories.t.sol index 9cc72f6a3d..8cf4565c5f 100644 --- a/packages/world/test/Factories.t.sol +++ b/packages/world/test/Factories.t.sol @@ -16,7 +16,7 @@ import { ROOT_NAMESPACE } from "../src/constants.sol"; contract FactoriesTest is Test { event ContractDeployed(address addr, uint256 salt); event WorldDeployed(address indexed newContract); - event HelloWorld(); + event HelloWorld(bytes32 indexed version); function calculateAddress( address deployingAddress, @@ -58,8 +58,8 @@ contract FactoriesTest is Test { address calculatedAddress = calculateAddress(worldFactoryAddress, bytes32(0), type(World).creationCode); // Check for HelloWorld event from World - vm.expectEmit(true, false, false, false); - emit HelloWorld(); + vm.expectEmit(false, false, false, false); + emit HelloWorld(""); // Check for WorldDeployed event from Factory vm.expectEmit(true, false, false, false); diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 1d168ead9a..190e29e0ed 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -143,7 +143,7 @@ contract RevertSystemHook is SystemHook { contract WorldTest is Test, GasReporter { using ResourceSelector for bytes32; - event HelloWorld(); + event HelloWorld(bytes32 indexed version); event HookCalled(bytes data); event SystemHookCalled(bytes data); event WorldTestSystemLog(string log); @@ -180,8 +180,8 @@ contract WorldTest is Test, GasReporter { function testConstructorAndInitialize() public { CoreModule coreModule = new CoreModule(); - vm.expectEmit(true, true, true, true); - emit HelloWorld(); + vm.expectEmit(false, false, false, false); + emit HelloWorld(""); IBaseWorld newWorld = IBaseWorld(address(new World())); // Expect the creator to be the original deployer From 18622707be200c58a2204cfbc2200e6b25ec3996 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 23:02:41 +0100 Subject: [PATCH 2/9] export const --- packages/world/src/World.sol | 10 ++++++---- packages/world/src/constants.sol | 2 ++ packages/world/src/interfaces/IWorldKernel.sol | 4 ++-- packages/world/test/World.t.sol | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index 2c97161168..d8d23e37e1 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -10,7 +10,7 @@ import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; import { System } from "./System.sol"; import { ResourceSelector } from "./ResourceSelector.sol"; -import { ROOT_NAMESPACE, ROOT_NAME } from "./constants.sol"; +import { WORLD_VERSION, ROOT_NAMESPACE, ROOT_NAME } from "./constants.sol"; import { AccessControl } from "./AccessControl.sol"; import { SystemCall } from "./SystemCall.sol"; import { WorldContextProvider } from "./WorldContext.sol"; @@ -34,14 +34,16 @@ import { CORE_MODULE_NAME } from "./modules/core/constants.sol"; contract World is StoreRead, IStoreData, IWorldKernel { using ResourceSelector for bytes32; - - bytes32 public constant version = "0.0.0"; address public immutable creator; + function worldVersion() public pure returns (bytes32) { + return WORLD_VERSION; + } + constructor() { creator = msg.sender; StoreCore.initialize(); - emit HelloWorld(version); + emit HelloWorld(WORLD_VERSION); } /** diff --git a/packages/world/src/constants.sol b/packages/world/src/constants.sol index a4a2538803..573fca505a 100644 --- a/packages/world/src/constants.sol +++ b/packages/world/src/constants.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; +bytes32 constant WORLD_VERSION = "0.0.0"; + bytes16 constant ROOT_NAMESPACE = 0; bytes16 constant ROOT_NAME = 0; bytes32 constant UNLIMITED_DELEGATION = bytes32(abi.encodePacked(ROOT_NAMESPACE, bytes16("unlimited.d"))); diff --git a/packages/world/src/interfaces/IWorldKernel.sol b/packages/world/src/interfaces/IWorldKernel.sol index 8f25b0114f..d5b1c5cec4 100644 --- a/packages/world/src/interfaces/IWorldKernel.sol +++ b/packages/world/src/interfaces/IWorldKernel.sol @@ -39,12 +39,12 @@ interface IWorldCall { * registered functions selectors from the `CoreModule`. */ interface IWorldKernel is IWorldModuleInstallation, IWorldCall, IWorldErrors { - event HelloWorld(bytes32 indexed version); + event HelloWorld(bytes32 indexed worldVersion); /** * The version of the World. */ - function version() external view returns (bytes32); + function worldVersion() external view returns (bytes32); /** * The immutable original deployer of the World. diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 190e29e0ed..3705ce688f 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -143,7 +143,7 @@ contract RevertSystemHook is SystemHook { contract WorldTest is Test, GasReporter { using ResourceSelector for bytes32; - event HelloWorld(bytes32 indexed version); + event HelloWorld(bytes32 indexed worldVersion); event HookCalled(bytes data); event SystemHookCalled(bytes data); event WorldTestSystemLog(string log); From b4e264102334a99756fd757020ede7d1efc7edc5 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 23:03:10 +0100 Subject: [PATCH 3/9] emit HelloStore --- packages/store/src/IStore.sol | 4 ++++ packages/store/src/StoreCore.sol | 5 ++++- packages/store/src/StoreRead.sol | 5 +++++ packages/store/src/constants.sol | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/store/src/IStore.sol b/packages/store/src/IStore.sol index 68df303f9e..ddbd1baae9 100644 --- a/packages/store/src/IStore.sol +++ b/packages/store/src/IStore.sol @@ -7,6 +7,10 @@ import { Schema } from "./Schema.sol"; import { IStoreHook } from "./IStoreHook.sol"; interface IStoreRead { + event HelloStore(bytes32 indexed storeVersion); + + function storeVersion() external view returns (bytes32); + function getFieldLayout(bytes32 tableId) external view returns (FieldLayout fieldLayout); function getValueSchema(bytes32 tableId) external view returns (Schema valueSchema); diff --git a/packages/store/src/StoreCore.sol b/packages/store/src/StoreCore.sol index c2b81a57a8..7afee7f58e 100644 --- a/packages/store/src/StoreCore.sol +++ b/packages/store/src/StoreCore.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; +import { STORE_VERSION } from "./constants.sol"; import { Bytes } from "./Bytes.sol"; import { Storage } from "./Storage.sol"; import { Memory } from "./Memory.sol"; @@ -16,7 +17,7 @@ import { Hook, HookLib } from "./Hook.sol"; import { StoreHookLib, StoreHookType } from "./StoreHook.sol"; library StoreCore { - // note: the preimage of the tuple of keys used to index is part of the event, so it can be used by indexers + event HelloStore(bytes32 indexed version); event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); event StoreSetField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes data); event StoreDeleteRecord(bytes32 tableId, bytes32[] keyTuple); @@ -27,6 +28,8 @@ library StoreCore { * Consumers must call this function in their constructor. */ function initialize() internal { + emit HelloStore(STORE_VERSION); + // StoreSwitch uses the storeAddress to decide where to write data to. // If StoreSwitch is called in the context of a Store contract (storeAddress == address(this)), // StoreSwitch uses internal methods to write data instead of external calls. diff --git a/packages/store/src/StoreRead.sol b/packages/store/src/StoreRead.sol index ced24eb297..31208deb72 100644 --- a/packages/store/src/StoreRead.sol +++ b/packages/store/src/StoreRead.sol @@ -1,12 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; +import { STORE_VERSION } from "./constants.sol"; import { IStoreRead } from "./IStore.sol"; import { StoreCore } from "./StoreCore.sol"; import { FieldLayout } from "./FieldLayout.sol"; import { Schema } from "./Schema.sol"; contract StoreRead is IStoreRead { + function storeVersion() public pure returns (bytes32) { + return STORE_VERSION; + } + function getFieldLayout(bytes32 tableId) public view virtual returns (FieldLayout fieldLayout) { fieldLayout = StoreCore.getFieldLayout(tableId); } diff --git a/packages/store/src/constants.sol b/packages/store/src/constants.sol index a5f580b6ec..f39fc0671c 100644 --- a/packages/store/src/constants.sol +++ b/packages/store/src/constants.sol @@ -1,6 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; +bytes32 constant STORE_VERSION = "0.0.0"; + /* Shared constants */ // Total byte length of an EVM word From dff767336eede3a77da82500a4e853f5b686a0f6 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 23:08:17 +0100 Subject: [PATCH 4/9] add test for HelloStore emission --- packages/store/test/StoreMock.t.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 packages/store/test/StoreMock.t.sol diff --git a/packages/store/test/StoreMock.t.sol b/packages/store/test/StoreMock.t.sol new file mode 100644 index 0000000000..d75bfeba68 --- /dev/null +++ b/packages/store/test/StoreMock.t.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +import { Test } from "forge-std/Test.sol"; +import { GasReporter } from "@latticexyz/gas-report/src/GasReporter.sol"; +import { STORE_VERSION } from "../src/constants.sol"; +import { StoreCore } from "../src/StoreCore.sol"; +import { StoreMock } from "../test/StoreMock.sol"; +import { StoreSwitch } from "../src/StoreSwitch.sol"; + +contract StoreMockTest is Test { + event HelloStore(bytes32 indexed storeVersion); + + function testStoreMockConstrctor() public { + vm.expectEmit(true, true, true, true); + emit HelloStore(STORE_VERSION); + new StoreMock(); + } +} From 7ac8257981bc8356ebde7923ca1bc49a3a63e732 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 23:10:31 +0100 Subject: [PATCH 5/9] improve emission test --- packages/world/test/Factories.t.sol | 6 +++--- packages/world/test/World.t.sol | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/world/test/Factories.t.sol b/packages/world/test/Factories.t.sol index 8cf4565c5f..e14bec0ccb 100644 --- a/packages/world/test/Factories.t.sol +++ b/packages/world/test/Factories.t.sol @@ -11,7 +11,7 @@ import { WorldFactory } from "../src/factories/WorldFactory.sol"; import { IWorldFactory } from "../src/factories/IWorldFactory.sol"; import { InstalledModules } from "../src/tables/InstalledModules.sol"; import { NamespaceOwner } from "../src/tables/NamespaceOwner.sol"; -import { ROOT_NAMESPACE } from "../src/constants.sol"; +import { WORLD_VERSION, ROOT_NAMESPACE } from "../src/constants.sol"; contract FactoriesTest is Test { event ContractDeployed(address addr, uint256 salt); @@ -58,8 +58,8 @@ contract FactoriesTest is Test { address calculatedAddress = calculateAddress(worldFactoryAddress, bytes32(0), type(World).creationCode); // Check for HelloWorld event from World - vm.expectEmit(false, false, false, false); - emit HelloWorld(""); + vm.expectEmit(true, true, true, true); + emit HelloWorld(WORLD_VERSION); // Check for WorldDeployed event from Factory vm.expectEmit(true, false, false, false); diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 3705ce688f..bed18100fb 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -22,7 +22,7 @@ import { EchoSubscriber } from "@latticexyz/store/test/EchoSubscriber.sol"; import { World } from "../src/World.sol"; import { System } from "../src/System.sol"; import { ResourceSelector } from "../src/ResourceSelector.sol"; -import { ROOT_NAMESPACE, ROOT_NAME, UNLIMITED_DELEGATION } from "../src/constants.sol"; +import { WORLD_VERSION, ROOT_NAMESPACE, ROOT_NAME, UNLIMITED_DELEGATION } from "../src/constants.sol"; import { Resource } from "../src/Types.sol"; import { WorldContextProvider, WORLD_CONTEXT_CONSUMER_INTERFACE_ID } from "../src/WorldContext.sol"; import { SystemHookLib, SystemHook } from "../src/SystemHook.sol"; @@ -180,8 +180,8 @@ contract WorldTest is Test, GasReporter { function testConstructorAndInitialize() public { CoreModule coreModule = new CoreModule(); - vm.expectEmit(false, false, false, false); - emit HelloWorld(""); + vm.expectEmit(true, true, true, true); + emit HelloWorld(WORLD_VERSION); IBaseWorld newWorld = IBaseWorld(address(new World())); // Expect the creator to be the original deployer From 48697cc51bc887cff0442e166821de84b75bff05 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 15:16:22 -0700 Subject: [PATCH 6/9] Create soft-fans-wink.md --- .changeset/soft-fans-wink.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .changeset/soft-fans-wink.md diff --git a/.changeset/soft-fans-wink.md b/.changeset/soft-fans-wink.md new file mode 100644 index 0000000000..add3beb520 --- /dev/null +++ b/.changeset/soft-fans-wink.md @@ -0,0 +1,16 @@ +--- +"@latticexyz/store": minor +"@latticexyz/world": minor +--- + +Add protocol version with corresponding getter and event on deploy + +```solidity +world.worldVersion(); +world.storeVersion(); // a World is also a Store +``` + +```solidity +event HelloWorld(bytes32 indexed worldVersion); +event HelloStore(bytes32 indexed storeVersion); +``` From 9db8777da1e29ff1e515e75ab48be2e717d3ad90 Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 23:19:31 +0100 Subject: [PATCH 7/9] move version to its own file --- packages/store/src/StoreCore.sol | 2 +- packages/store/src/StoreRead.sol | 2 +- packages/store/src/constants.sol | 2 -- packages/store/src/version.sol | 4 ++++ packages/store/test/StoreMock.t.sol | 2 +- packages/world/src/World.sol | 3 ++- packages/world/src/constants.sol | 2 -- packages/world/src/version.sol | 4 ++++ packages/world/test/Factories.t.sol | 3 ++- packages/world/test/World.t.sol | 3 ++- 10 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 packages/store/src/version.sol create mode 100644 packages/world/src/version.sol diff --git a/packages/store/src/StoreCore.sol b/packages/store/src/StoreCore.sol index 7afee7f58e..2e9fe89b25 100644 --- a/packages/store/src/StoreCore.sol +++ b/packages/store/src/StoreCore.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import { STORE_VERSION } from "./constants.sol"; +import { STORE_VERSION } from "./version.sol"; import { Bytes } from "./Bytes.sol"; import { Storage } from "./Storage.sol"; import { Memory } from "./Memory.sol"; diff --git a/packages/store/src/StoreRead.sol b/packages/store/src/StoreRead.sol index 31208deb72..63aa645da7 100644 --- a/packages/store/src/StoreRead.sol +++ b/packages/store/src/StoreRead.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import { STORE_VERSION } from "./constants.sol"; +import { STORE_VERSION } from "./version.sol"; import { IStoreRead } from "./IStore.sol"; import { StoreCore } from "./StoreCore.sol"; import { FieldLayout } from "./FieldLayout.sol"; diff --git a/packages/store/src/constants.sol b/packages/store/src/constants.sol index f39fc0671c..a5f580b6ec 100644 --- a/packages/store/src/constants.sol +++ b/packages/store/src/constants.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -bytes32 constant STORE_VERSION = "0.0.0"; - /* Shared constants */ // Total byte length of an EVM word diff --git a/packages/store/src/version.sol b/packages/store/src/version.sol new file mode 100644 index 0000000000..9f024319ad --- /dev/null +++ b/packages/store/src/version.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +bytes32 constant STORE_VERSION = "0.0.0"; diff --git a/packages/store/test/StoreMock.t.sol b/packages/store/test/StoreMock.t.sol index d75bfeba68..641ff8f528 100644 --- a/packages/store/test/StoreMock.t.sol +++ b/packages/store/test/StoreMock.t.sol @@ -3,7 +3,7 @@ pragma solidity >=0.8.0; import { Test } from "forge-std/Test.sol"; import { GasReporter } from "@latticexyz/gas-report/src/GasReporter.sol"; -import { STORE_VERSION } from "../src/constants.sol"; +import { STORE_VERSION } from "../src/version.sol"; import { StoreCore } from "../src/StoreCore.sol"; import { StoreMock } from "../test/StoreMock.sol"; import { StoreSwitch } from "../src/StoreSwitch.sol"; diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index d8d23e37e1..c01ef6926c 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -8,9 +8,10 @@ import { StoreCore } from "@latticexyz/store/src/StoreCore.sol"; import { Bytes } from "@latticexyz/store/src/Bytes.sol"; import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol"; +import { WORLD_VERSION } from "./version.sol"; import { System } from "./System.sol"; import { ResourceSelector } from "./ResourceSelector.sol"; -import { WORLD_VERSION, ROOT_NAMESPACE, ROOT_NAME } from "./constants.sol"; +import { ROOT_NAMESPACE, ROOT_NAME } from "./constants.sol"; import { AccessControl } from "./AccessControl.sol"; import { SystemCall } from "./SystemCall.sol"; import { WorldContextProvider } from "./WorldContext.sol"; diff --git a/packages/world/src/constants.sol b/packages/world/src/constants.sol index 573fca505a..a4a2538803 100644 --- a/packages/world/src/constants.sol +++ b/packages/world/src/constants.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -bytes32 constant WORLD_VERSION = "0.0.0"; - bytes16 constant ROOT_NAMESPACE = 0; bytes16 constant ROOT_NAME = 0; bytes32 constant UNLIMITED_DELEGATION = bytes32(abi.encodePacked(ROOT_NAMESPACE, bytes16("unlimited.d"))); diff --git a/packages/world/src/version.sol b/packages/world/src/version.sol new file mode 100644 index 0000000000..bd7a91f4d6 --- /dev/null +++ b/packages/world/src/version.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity >=0.8.0; + +bytes32 constant WORLD_VERSION = "0.0.0"; diff --git a/packages/world/test/Factories.t.sol b/packages/world/test/Factories.t.sol index e14bec0ccb..5887d42ddb 100644 --- a/packages/world/test/Factories.t.sol +++ b/packages/world/test/Factories.t.sol @@ -4,6 +4,7 @@ pragma solidity >=0.8.0; import { Test, console } from "forge-std/Test.sol"; import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; +import { WORLD_VERSION } from "../src/version.sol"; import { World } from "../src/World.sol"; import { CoreModule } from "../src/modules/core/CoreModule.sol"; import { Create2Factory } from "../src/factories/Create2Factory.sol"; @@ -11,7 +12,7 @@ import { WorldFactory } from "../src/factories/WorldFactory.sol"; import { IWorldFactory } from "../src/factories/IWorldFactory.sol"; import { InstalledModules } from "../src/tables/InstalledModules.sol"; import { NamespaceOwner } from "../src/tables/NamespaceOwner.sol"; -import { WORLD_VERSION, ROOT_NAMESPACE } from "../src/constants.sol"; +import { ROOT_NAMESPACE } from "../src/constants.sol"; contract FactoriesTest is Test { event ContractDeployed(address addr, uint256 salt); diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index bed18100fb..d2ef66b4d0 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -19,10 +19,11 @@ import { StoreHookLib } from "@latticexyz/store/src/StoreHook.sol"; import { RevertSubscriber } from "@latticexyz/store/test/RevertSubscriber.sol"; import { EchoSubscriber } from "@latticexyz/store/test/EchoSubscriber.sol"; +import { WORLD_VERSION } from "../src/version.sol"; import { World } from "../src/World.sol"; import { System } from "../src/System.sol"; import { ResourceSelector } from "../src/ResourceSelector.sol"; -import { WORLD_VERSION, ROOT_NAMESPACE, ROOT_NAME, UNLIMITED_DELEGATION } from "../src/constants.sol"; +import { ROOT_NAMESPACE, ROOT_NAME, UNLIMITED_DELEGATION } from "../src/constants.sol"; import { Resource } from "../src/Types.sol"; import { WorldContextProvider, WORLD_CONTEXT_CONSUMER_INTERFACE_ID } from "../src/WorldContext.sol"; import { SystemHookLib, SystemHook } from "../src/SystemHook.sol"; From 2f52324671adb65f398982f40ef9e6705ee1e61e Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Fri, 15 Sep 2023 23:30:34 +0100 Subject: [PATCH 8/9] fix test --- packages/store/ts/storeEventsAbi.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/store/ts/storeEventsAbi.test.ts b/packages/store/ts/storeEventsAbi.test.ts index 37242457f6..2ed7748ff2 100644 --- a/packages/store/ts/storeEventsAbi.test.ts +++ b/packages/store/ts/storeEventsAbi.test.ts @@ -7,6 +7,7 @@ import IStoreAbi from "../out/IStore.sol/IStore.abi.json"; describe("storeEventsAbi", () => { it("should match the store ABI", () => { const expectedAbi = IStoreAbi.filter((item) => item.type === "event") + .filter((item) => item.name !== "HelloStore") .map((item) => ({ // just return data that abitype cares about type: item.type, From 5750ea18ed4a70d84e7d3f2d79cdf22c5013436a Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Sat, 16 Sep 2023 12:06:20 +0100 Subject: [PATCH 9/9] generate new gas report --- packages/store/gas-report.json | 4 +- packages/world/gas-report.json | 98 +++++++++++++++++----------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/packages/store/gas-report.json b/packages/store/gas-report.json index 06772c450b..759445e420 100644 --- a/packages/store/gas-report.json +++ b/packages/store/gas-report.json @@ -309,7 +309,7 @@ "file": "test/KeyEncoding.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register KeyEncoding table", - "gasUsed": 697905 + "gasUsed": 697846 }, { "file": "test/Mixed.t.sol", @@ -1059,7 +1059,7 @@ "file": "test/Vector2.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register Vector2 field layout", - "gasUsed": 421491 + "gasUsed": 421468 }, { "file": "test/Vector2.t.sol", diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 30962ed0d7..bf61f4f8be 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -39,73 +39,73 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallComposite", "name": "install keys in table module", - "gasUsed": 1519335 + "gasUsed": 1519229 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "install keys in table module", - "gasUsed": 1519335 + "gasUsed": 1519229 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "set a record on a table with keysInTableModule installed", - "gasUsed": 183388 + "gasUsed": 183368 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallSingleton", "name": "install keys in table module", - "gasUsed": 1519335 + "gasUsed": 1519229 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "install keys in table module", - "gasUsed": 1519335 + "gasUsed": 1519229 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "change a composite record on a table with keysInTableModule installed", - "gasUsed": 28498 + "gasUsed": 28499 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "delete a composite record on a table with keysInTableModule installed", - "gasUsed": 251457 + "gasUsed": 251524 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "install keys in table module", - "gasUsed": 1519335 + "gasUsed": 1519229 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "change a record on a table with keysInTableModule installed", - "gasUsed": 27221 + "gasUsed": 27222 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "delete a record on a table with keysInTableModule installed", - "gasUsed": 132823 + "gasUsed": 132934 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "install keys with value module", - "gasUsed": 728346 + "gasUsed": 728282 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "Get list of keys with a given value", - "gasUsed": 7508 + "gasUsed": 7531 }, { "file": "test/KeysWithValueModule.t.sol", @@ -117,115 +117,115 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "install keys with value module", - "gasUsed": 728346 + "gasUsed": 728282 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "set a record on a table with KeysWithValueModule installed", - "gasUsed": 157348 + "gasUsed": 157349 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "install keys with value module", - "gasUsed": 728346 + "gasUsed": 728282 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "change a record on a table with KeysWithValueModule installed", - "gasUsed": 126291 + "gasUsed": 126292 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "delete a record on a table with KeysWithValueModule installed", - "gasUsed": 49099 + "gasUsed": 49188 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "install keys with value module", - "gasUsed": 728346 + "gasUsed": 728282 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "set a field on a table with KeysWithValueModule installed", - "gasUsed": 163792 + "gasUsed": 163837 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "change a field on a table with KeysWithValueModule installed", - "gasUsed": 128551 + "gasUsed": 128596 }, { "file": "test/query.t.sol", "test": "testCombinedHasHasValueNotQuery", "name": "CombinedHasHasValueNotQuery", - "gasUsed": 141196 + "gasUsed": 141334 }, { "file": "test/query.t.sol", "test": "testCombinedHasHasValueQuery", "name": "CombinedHasHasValueQuery", - "gasUsed": 69053 + "gasUsed": 69145 }, { "file": "test/query.t.sol", "test": "testCombinedHasNotQuery", "name": "CombinedHasNotQuery", - "gasUsed": 184150 + "gasUsed": 184265 }, { "file": "test/query.t.sol", "test": "testCombinedHasQuery", "name": "CombinedHasQuery", - "gasUsed": 121994 + "gasUsed": 122086 }, { "file": "test/query.t.sol", "test": "testCombinedHasValueNotQuery", "name": "CombinedHasValueNotQuery", - "gasUsed": 117772 + "gasUsed": 117864 }, { "file": "test/query.t.sol", "test": "testCombinedHasValueQuery", "name": "CombinedHasValueQuery", - "gasUsed": 19164 + "gasUsed": 19210 }, { "file": "test/query.t.sol", "test": "testHasQuery", "name": "HasQuery", - "gasUsed": 27950 + "gasUsed": 27973 }, { "file": "test/query.t.sol", "test": "testHasQuery1000Keys", "name": "HasQuery with 1000 keys", - "gasUsed": 7068010 + "gasUsed": 7068033 }, { "file": "test/query.t.sol", "test": "testHasQuery100Keys", "name": "HasQuery with 100 keys", - "gasUsed": 672230 + "gasUsed": 672253 }, { "file": "test/query.t.sol", "test": "testHasValueQuery", "name": "HasValueQuery", - "gasUsed": 9259 + "gasUsed": 9282 }, { "file": "test/query.t.sol", "test": "testNotValueQuery", "name": "NotValueQuery", - "gasUsed": 62652 + "gasUsed": 62744 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -237,7 +237,7 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "call a system via a callbound delegation", - "gasUsed": 49383 + "gasUsed": 49406 }, { "file": "test/StandardDelegationsModule.t.sol", @@ -249,37 +249,37 @@ "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "call a system via a timebound delegation", - "gasUsed": 38474 + "gasUsed": 38497 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 787645 + "gasUsed": 787582 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "get a unique entity nonce (non-root module)", - "gasUsed": 67456 + "gasUsed": 67523 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 771167 + "gasUsed": 771103 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "get a unique entity nonce (root module)", - "gasUsed": 67456 + "gasUsed": 67523 }, { "file": "test/World.t.sol", "test": "testCall", "name": "call a system via the World", - "gasUsed": 19564 + "gasUsed": 19587 }, { "file": "test/World.t.sol", @@ -291,25 +291,25 @@ "file": "test/World.t.sol", "test": "testCallFromUnlimitedDelegation", "name": "call a system via an unlimited delegation", - "gasUsed": 19950 + "gasUsed": 19973 }, { "file": "test/World.t.sol", "test": "testDeleteRecord", "name": "Delete record", - "gasUsed": 13886 + "gasUsed": 13930 }, { "file": "test/World.t.sol", "test": "testPushToField", "name": "Push data to the table", - "gasUsed": 93261 + "gasUsed": 93239 }, { "file": "test/World.t.sol", "test": "testRegisterFallbackSystem", "name": "Register a fallback system", - "gasUsed": 75414 + "gasUsed": 75393 }, { "file": "test/World.t.sol", @@ -321,13 +321,13 @@ "file": "test/World.t.sol", "test": "testRegisterFunctionSelector", "name": "Register a function selector", - "gasUsed": 96008 + "gasUsed": 95987 }, { "file": "test/World.t.sol", "test": "testRegisterNamespace", "name": "Register a new namespace", - "gasUsed": 146378 + "gasUsed": 146357 }, { "file": "test/World.t.sol", @@ -339,19 +339,19 @@ "file": "test/World.t.sol", "test": "testRegisterTable", "name": "Register a new table in the namespace", - "gasUsed": 685344 + "gasUsed": 685323 }, { "file": "test/World.t.sol", "test": "testSetField", "name": "Write data to a table field", - "gasUsed": 41899 + "gasUsed": 41943 }, { "file": "test/World.t.sol", "test": "testSetRecord", "name": "Write data to the table", - "gasUsed": 41344 + "gasUsed": 41388 }, { "file": "test/WorldDynamicUpdate.t.sol", @@ -369,12 +369,12 @@ "file": "test/WorldDynamicUpdate.t.sol", "test": "testUpdateInField", "name": "updateInField 1 item (cold)", - "gasUsed": 35373 + "gasUsed": 35351 }, { "file": "test/WorldDynamicUpdate.t.sol", "test": "testUpdateInField", "name": "updateInField 1 item (warm)", - "gasUsed": 22578 + "gasUsed": 22556 } ]