diff --git a/packages/abi-ts/tsconfig.vitest-temp.json b/packages/abi-ts/tsconfig.vitest-temp.json deleted file mode 100644 index 870d184048..0000000000 --- a/packages/abi-ts/tsconfig.vitest-temp.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "target": "es2021", - "types": [ - "node" - ], - "module": "esnext", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "outDir": "./dist", - "isolatedModules": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "emitDeclarationOnly": false, - "incremental": true, - "tsBuildInfoFile": "/Users/flomllr/git/latticexyz/mud/node_modules/.pnpm/vitest@0.31.4_jsdom@22.1.0/node_modules/vitest/dist/tsconfig.tmp.tsbuildinfo" - }, - "exclude": [ - "dist" - ] -} \ No newline at end of file diff --git a/packages/gas-report/tsconfig.vitest-temp.json b/packages/gas-report/tsconfig.vitest-temp.json deleted file mode 100644 index 67a094ca3e..0000000000 --- a/packages/gas-report/tsconfig.vitest-temp.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "target": "es2021", - "types": [ - "node" - ], - "module": "esnext", - "moduleResolution": "node", - "declaration": true, - "sourceMap": true, - "rootDir": ".", - "outDir": "./dist", - "isolatedModules": true, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "emitDeclarationOnly": false, - "incremental": true, - "tsBuildInfoFile": "/Users/flomllr/git/latticexyz/mud/node_modules/.pnpm/vitest@0.31.4_jsdom@22.1.0/node_modules/vitest/dist/tsconfig.tmp.tsbuildinfo" - }, - "include": [ - "ts" - ], - "exclude": [ - "dist" - ] -} \ No newline at end of file diff --git a/packages/store/gas-report.json b/packages/store/gas-report.json index 839855935a..0f0b50d14a 100644 --- a/packages/store/gas-report.json +++ b/packages/store/gas-report.json @@ -351,7 +351,7 @@ "file": "test/KeyEncoding.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register KeyEncoding table", - "gasUsed": 687791 + "gasUsed": 687778 }, { "file": "test/Mixed.t.sol", @@ -363,19 +363,19 @@ "file": "test/Mixed.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register Mixed table", - "gasUsed": 549609 + "gasUsed": 549596 }, { "file": "test/Mixed.t.sol", "test": "testSetAndGet", "name": "set record in Mixed", - "gasUsed": 103911 + "gasUsed": 103898 }, { "file": "test/Mixed.t.sol", "test": "testSetAndGet", "name": "get record from Mixed", - "gasUsed": 7181 + "gasUsed": 7168 }, { "file": "test/PackedCounter.t.sol", @@ -585,55 +585,55 @@ "file": "test/StoreCoreDynamic.t.sol", "test": "testGetSecondFieldLength", "name": "get field length (cold, 1 slot)", - "gasUsed": 7757 + "gasUsed": 7744 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetSecondFieldLength", "name": "get field length (warm, 1 slot)", - "gasUsed": 1752 + "gasUsed": 1739 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetThirdFieldLength", "name": "get field length (warm due to , 2 slots)", - "gasUsed": 7756 + "gasUsed": 7743 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetThirdFieldLength", "name": "get field length (warm, 2 slots)", - "gasUsed": 1752 + "gasUsed": 1739 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromSecondField", "name": "pop from field (cold, 1 slot, 1 uint32 item)", - "gasUsed": 20239 + "gasUsed": 19408 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromSecondField", "name": "pop from field (warm, 1 slot, 1 uint32 item)", - "gasUsed": 14250 + "gasUsed": 13418 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromThirdField", "name": "pop from field (cold, 2 slots, 10 uint32 items)", - "gasUsed": 22434 + "gasUsed": 17176 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromThirdField", "name": "pop from field (warm, 2 slots, 10 uint32 items)", - "gasUsed": 14446 + "gasUsed": 13187 }, { "file": "test/StoreCoreGas.t.sol", "test": "testAccessEmptyData", "name": "access non-existing record", - "gasUsed": 6198 + "gasUsed": 6185 }, { "file": "test/StoreCoreGas.t.sol", @@ -645,13 +645,13 @@ "file": "test/StoreCoreGas.t.sol", "test": "testAccessEmptyData", "name": "access dynamic field of non-existing record", - "gasUsed": 2045 + "gasUsed": 2032 }, { "file": "test/StoreCoreGas.t.sol", "test": "testAccessEmptyData", "name": "access length of dynamic field of non-existing record", - "gasUsed": 1121 + "gasUsed": 1108 }, { "file": "test/StoreCoreGas.t.sol", @@ -663,7 +663,7 @@ "file": "test/StoreCoreGas.t.sol", "test": "testDeleteData", "name": "delete record (complex data, 3 slots)", - "gasUsed": 6691 + "gasUsed": 6678 }, { "file": "test/StoreCoreGas.t.sol", @@ -681,67 +681,67 @@ "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "register subscriber", - "gasUsed": 60150 + "gasUsed": 58654 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "set record on table with subscriber", - "gasUsed": 71004 + "gasUsed": 70999 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "set static field on table with subscriber", - "gasUsed": 20780 + "gasUsed": 20507 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "delete record on table with subscriber", - "gasUsed": 16398 + "gasUsed": 16372 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "register subscriber", - "gasUsed": 60150 + "gasUsed": 58654 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "set (dynamic) record on table with subscriber", - "gasUsed": 164126 + "gasUsed": 164121 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "set (dynamic) field on table with subscriber", - "gasUsed": 23980 + "gasUsed": 24273 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "delete (dynamic) record on table with subscriber", - "gasUsed": 17383 + "gasUsed": 17357 }, { "file": "test/StoreCoreGas.t.sol", "test": "testPushToField", "name": "push to field (1 slot, 1 uint32 item)", - "gasUsed": 11994 + "gasUsed": 10241 }, { "file": "test/StoreCoreGas.t.sol", "test": "testPushToField", "name": "push to field (2 slots, 10 uint32 items)", - "gasUsed": 34748 + "gasUsed": 32918 }, { "file": "test/StoreCoreGas.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "StoreCore: register table", - "gasUsed": 609744 + "gasUsed": 609747 }, { "file": "test/StoreCoreGas.t.sol", @@ -765,13 +765,13 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetDynamicData", "name": "set complex record with dynamic data (4 slots)", - "gasUsed": 101831 + "gasUsed": 101818 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetDynamicData", "name": "get complex record with dynamic data (4 slots)", - "gasUsed": 4469 + "gasUsed": 4456 }, { "file": "test/StoreCoreGas.t.sol", @@ -807,7 +807,7 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set static field (1 slot)", - "gasUsed": 31550 + "gasUsed": 31579 }, { "file": "test/StoreCoreGas.t.sol", @@ -819,7 +819,7 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set static field (overlap 2 slot)", - "gasUsed": 30190 + "gasUsed": 30219 }, { "file": "test/StoreCoreGas.t.sol", @@ -831,31 +831,31 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set dynamic field (1 slot, first dynamic field)", - "gasUsed": 53074 + "gasUsed": 53942 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "get dynamic field (1 slot, first dynamic field)", - "gasUsed": 2214 + "gasUsed": 2201 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set dynamic field (1 slot, second dynamic field)", - "gasUsed": 31300 + "gasUsed": 32169 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "get dynamic field (1 slot, second dynamic field)", - "gasUsed": 2216 + "gasUsed": 2203 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetStaticData", "name": "set static record (1 slot)", - "gasUsed": 32137 + "gasUsed": 32124 }, { "file": "test/StoreCoreGas.t.sol", @@ -867,7 +867,7 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetStaticDataSpanningWords", "name": "set static record (2 slots)", - "gasUsed": 54641 + "gasUsed": 54628 }, { "file": "test/StoreCoreGas.t.sol", @@ -879,19 +879,19 @@ "file": "test/StoreCoreGas.t.sol", "test": "testUpdateInField", "name": "update in field (1 slot, 1 uint32 item)", - "gasUsed": 13032 + "gasUsed": 9585 }, { "file": "test/StoreCoreGas.t.sol", "test": "testUpdateInField", "name": "push to field (2 slots, 6 uint64 items)", - "gasUsed": 13834 + "gasUsed": 10022 }, { "file": "test/StoreHook.t.sol", "test": "testCallHook", "name": "call an enabled hook", - "gasUsed": 14588 + "gasUsed": 15038 }, { "file": "test/StoreHook.t.sol", @@ -927,97 +927,97 @@ "file": "test/tables/Callbacks.t.sol", "test": "testSetAndGet", "name": "Callbacks: set field", - "gasUsed": 56142 + "gasUsed": 57008 }, { "file": "test/tables/Callbacks.t.sol", "test": "testSetAndGet", "name": "Callbacks: get field (warm)", - "gasUsed": 2894 + "gasUsed": 2881 }, { "file": "test/tables/Callbacks.t.sol", "test": "testSetAndGet", "name": "Callbacks: push 1 element", - "gasUsed": 35052 + "gasUsed": 33292 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testOneSlot", "name": "StoreHooks: set field with one elements (cold)", - "gasUsed": 58148 + "gasUsed": 59012 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: set field (cold)", - "gasUsed": 58147 + "gasUsed": 59012 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: get field (warm)", - "gasUsed": 2896 + "gasUsed": 2883 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: push 1 element (cold)", - "gasUsed": 15147 + "gasUsed": 13389 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: pop 1 element (warm)", - "gasUsed": 11702 + "gasUsed": 10686 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: push 1 element (warm)", - "gasUsed": 13172 + "gasUsed": 11411 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: update 1 element (warm)", - "gasUsed": 34269 + "gasUsed": 30626 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: delete record (warm)", - "gasUsed": 7102 + "gasUsed": 7086 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: set field (warm)", - "gasUsed": 30308 + "gasUsed": 31173 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testThreeSlots", "name": "StoreHooks: set field with three elements (cold)", - "gasUsed": 80838 + "gasUsed": 81703 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTwoSlots", "name": "StoreHooks: set field with two elements (cold)", - "gasUsed": 80750 + "gasUsed": 81615 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testDelete", "name": "StoreHooks: delete record (cold)", - "gasUsed": 15967 + "gasUsed": 15954 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testGet", "name": "StoreHooks: get field (cold)", - "gasUsed": 8893 + "gasUsed": 8880 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", @@ -1029,19 +1029,19 @@ "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testLength", "name": "StoreHooks: get length (cold)", - "gasUsed": 5853 + "gasUsed": 5840 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testPop", "name": "StoreHooks: pop 1 element (cold)", - "gasUsed": 22188 + "gasUsed": 19126 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testUpdate", "name": "StoreHooks: update 1 element (cold)", - "gasUsed": 24324 + "gasUsed": 21069 }, { "file": "test/tightcoder/DecodeSlice.t.sol", @@ -1095,13 +1095,13 @@ "file": "test/Vector2.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register Vector2 field layout", - "gasUsed": 411032 + "gasUsed": 411019 }, { "file": "test/Vector2.t.sol", "test": "testSetAndGet", "name": "set Vector2 record", - "gasUsed": 33040 + "gasUsed": 33027 }, { "file": "test/Vector2.t.sol", diff --git a/packages/store/src/StoreCore.sol b/packages/store/src/StoreCore.sol index 64de1bacd6..38ef0ed0c7 100644 --- a/packages/store/src/StoreCore.sol +++ b/packages/store/src/StoreCore.sol @@ -17,7 +17,7 @@ import { Hook, HookLib } from "./Hook.sol"; import { BEFORE_SET_RECORD, AFTER_SET_RECORD, BEFORE_SPLICE_STATIC_DATA, AFTER_SPLICE_STATIC_DATA, BEFORE_SPLICE_DYNAMIC_DATA, AFTER_SPLICE_DYNAMIC_DATA, BEFORE_DELETE_RECORD, AFTER_DELETE_RECORD } from "./storeHookTypes.sol"; // TODO: use dynamicFieldIndex for methods acting on dynamic fields -// TODO: add the new methods (setStaticData, setDynamicData, spliceStaticData, spliceDynamicData) to IStore +// TODO: add the new methods (setStaticData, setDynamicData) to IStore // TODO: add code comments for all methods to World and StoreCore /** diff --git a/packages/world/src/modules/keysintable/KeysInTableHook.sol b/packages/world/src/modules/keysintable/KeysInTableHook.sol index bf22e694d0..1b54c852a8 100644 --- a/packages/world/src/modules/keysintable/KeysInTableHook.sol +++ b/packages/world/src/modules/keysintable/KeysInTableHook.sol @@ -73,7 +73,7 @@ contract KeysInTableHook is StoreHook { uint48, uint40, bytes calldata - ) public pure { + ) public { handleSet(tableId, keyTuple); } @@ -97,7 +97,7 @@ contract KeysInTableHook is StoreHook { uint40, bytes calldata, PackedCounter - ) public pure { + ) public { handleSet(tableId, keyTuple); } diff --git a/packages/world/src/modules/keysintable/KeysInTableModule.sol b/packages/world/src/modules/keysintable/KeysInTableModule.sol index b5c64cb8af..3305be20f0 100644 --- a/packages/world/src/modules/keysintable/KeysInTableModule.sol +++ b/packages/world/src/modules/keysintable/KeysInTableModule.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity >=0.8.0; -import { BEFORE_SET_RECORD, AFTER_SET_FIELD, BEFORE_DELETE_RECORD } from "@latticexyz/store/src/storeHookTypes.sol"; +import { BEFORE_SET_RECORD, AFTER_SPLICE_STATIC_DATA, AFTER_SPLICE_DYNAMIC_DATA, BEFORE_DELETE_RECORD } from "@latticexyz/store/src/storeHookTypes.sol"; import { ResourceType } from "../core/tables/ResourceType.sol"; import { Resource } from "../../Types.sol"; @@ -95,7 +95,11 @@ contract KeysInTableModule is Module { (success, returnData) = address(world).delegatecall( abi.encodeCall( world.registerStoreHook, - (sourceTableId, hook, BEFORE_SET_RECORD | AFTER_SET_FIELD | BEFORE_DELETE_RECORD) + ( + sourceTableId, + hook, + BEFORE_SET_RECORD | AFTER_SPLICE_STATIC_DATA | AFTER_SPLICE_DYNAMIC_DATA | BEFORE_DELETE_RECORD + ) ) ); } diff --git a/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol b/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol index 453450cfaf..65774a0093 100644 --- a/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol +++ b/packages/world/src/modules/keyswithvalue/KeysWithValueModule.sol @@ -2,7 +2,7 @@ pragma solidity >=0.8.0; import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol"; -import { BEFORE_SET_RECORD, BEFORE_SET_FIELD, AFTER_SET_FIELD, BEFORE_DELETE_RECORD } from "@latticexyz/store/src/storeHookTypes.sol"; +import { BEFORE_SET_RECORD, BEFORE_SPLICE_STATIC_DATA, AFTER_SPLICE_STATIC_DATA, BEFORE_SPLICE_DYNAMIC_DATA, AFTER_SPLICE_DYNAMIC_DATA, BEFORE_DELETE_RECORD } from "@latticexyz/store/src/storeHookTypes.sol"; import { Module } from "../../Module.sol"; import { IBaseWorld } from "../../interfaces/IBaseWorld.sol"; @@ -55,7 +55,16 @@ contract KeysWithValueModule is Module { (bool success, bytes memory returnData) = address(world).delegatecall( abi.encodeCall( world.registerStoreHook, - (sourceTableId, hook, BEFORE_SET_RECORD | BEFORE_SET_FIELD | AFTER_SET_FIELD | BEFORE_DELETE_RECORD) + ( + sourceTableId, + hook, + BEFORE_SET_RECORD | + BEFORE_SPLICE_STATIC_DATA | + AFTER_SPLICE_STATIC_DATA | + BEFORE_SPLICE_DYNAMIC_DATA | + AFTER_SPLICE_DYNAMIC_DATA | + BEFORE_DELETE_RECORD + ) ) ); if (!success) revertWithBytes(returnData);