diff --git a/.changeset/pre.json b/.changeset/pre.json index 0f93d8380b..890fc99b8a 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -57,6 +57,7 @@ "fuzzy-cars-stare", "giant-masks-carry", "great-cooks-dream", + "grumpy-files-heal", "grumpy-geckos-raise", "itchy-kids-relax", "itchy-shoes-appear", @@ -86,6 +87,7 @@ "pink-tips-give", "pretty-hotels-drop", "quick-numbers-flash", + "quiet-dancers-prove", "quiet-squids-share", "rare-planes-draw", "rare-trainers-fry", @@ -107,8 +109,10 @@ "strange-candles-shout", "strange-ducks-float", "strong-geckos-shake", + "strong-months-push", "tame-lemons-play", "thin-buses-reply", + "tricky-beds-kiss", "tricky-carrots-talk", "tricky-comics-remain", "tricky-frogs-beam", diff --git a/CHANGELOG.md b/CHANGELOG.md index 59dcc2257f..6a486c8538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,71 @@ +## Version 2.0.0-next.9 + +### Major changes + +**[feat: replace Schema with FieldLayout for contract internals (#1336)](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e)** (@latticexyz/cli, @latticexyz/protocol-parser, @latticexyz/store, @latticexyz/world) + +- Add `FieldLayout`, which is a `bytes32` user-type similar to `Schema`. + + Both `FieldLayout` and `Schema` have the same kind of data in the first 4 bytes. + + - 2 bytes for total length of all static fields + - 1 byte for number of static size fields + - 1 byte for number of dynamic size fields + + But whereas `Schema` has `SchemaType` enum in each of the other 28 bytes, `FieldLayout` has static byte lengths in each of the other 28 bytes. + +- Replace `Schema valueSchema` with `FieldLayout fieldLayout` in Store and World contracts. + + `FieldLayout` is more gas-efficient because it already has lengths, and `Schema` has types which need to be converted to lengths. + +- Add `getFieldLayout` to `IStore` interface. + + There is no `FieldLayout` for keys, only for values, because key byte lengths aren't usually relevant on-chain. You can still use `getKeySchema` if you need key types. + +- Add `fieldLayoutToHex` utility to `protocol-parser` package. + +- Add `constants.sol` for constants shared between `FieldLayout`, `Schema` and `PackedCounter`. + +**[feat(world,store): add initialize method, initialize core tables in core module (#1472)](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)** (@latticexyz/store) + +- `StoreCore`'s `initialize` function is split into `initialize` (to set the `StoreSwitch`'s `storeAddress`) and `registerCoreTables` (to register the `Tables` and `StoreHooks` tables). + The purpose of this is to give consumers more granular control over the setup flow. + +- The `StoreRead` contract no longer calls `StoreCore.initialize` in its constructor. + `StoreCore` consumers are expected to call `StoreCore.initialize` and `StoreCore.registerCoreTable` in their own setup logic. + +### Minor changes + +**[feat(world,store): add initialize method, initialize core tables in core module (#1472)](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)** (@latticexyz/cli, @latticexyz/world) + +- The `World` contract now has an `initialize` function, which can be called once by the creator of the World to install the core module. + This change allows the registration of all core tables to happen in the `CoreModule`, so no table metadata has to be included in the `World`'s bytecode. + + ```solidity + interface IBaseWorld { + function initialize(IModule coreModule) public; + } + ``` + +- The `World` contract now stores the original creator of the `World` in an immutable state variable. + It is used internally to only allow the original creator to initialize the `World` in a separate transaction. + + ```solidity + interface IBaseWorld { + function creator() external view returns (address); + } + ``` + +- The deploy script is updated to use the `World`'s `initialize` function to install the `CoreModule` instead of `registerRootModule` as before. + +### Patch changes + +**[fix(world): register Delegations table in CoreModule (#1452)](https://github.com/latticexyz/mud/commit/f1cd43bf9264d5a23a3edf2a1ea4212361a72203)** (@latticexyz/world) + +Register `Delegations` table in the `CoreModule` + +--- + ## Version 2.0.0-next.8 ### Major changes diff --git a/docs/pages/changelog.mdx b/docs/pages/changelog.mdx index 59dcc2257f..6a486c8538 100644 --- a/docs/pages/changelog.mdx +++ b/docs/pages/changelog.mdx @@ -1,3 +1,71 @@ +## Version 2.0.0-next.9 + +### Major changes + +**[feat: replace Schema with FieldLayout for contract internals (#1336)](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e)** (@latticexyz/cli, @latticexyz/protocol-parser, @latticexyz/store, @latticexyz/world) + +- Add `FieldLayout`, which is a `bytes32` user-type similar to `Schema`. + + Both `FieldLayout` and `Schema` have the same kind of data in the first 4 bytes. + + - 2 bytes for total length of all static fields + - 1 byte for number of static size fields + - 1 byte for number of dynamic size fields + + But whereas `Schema` has `SchemaType` enum in each of the other 28 bytes, `FieldLayout` has static byte lengths in each of the other 28 bytes. + +- Replace `Schema valueSchema` with `FieldLayout fieldLayout` in Store and World contracts. + + `FieldLayout` is more gas-efficient because it already has lengths, and `Schema` has types which need to be converted to lengths. + +- Add `getFieldLayout` to `IStore` interface. + + There is no `FieldLayout` for keys, only for values, because key byte lengths aren't usually relevant on-chain. You can still use `getKeySchema` if you need key types. + +- Add `fieldLayoutToHex` utility to `protocol-parser` package. + +- Add `constants.sol` for constants shared between `FieldLayout`, `Schema` and `PackedCounter`. + +**[feat(world,store): add initialize method, initialize core tables in core module (#1472)](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)** (@latticexyz/store) + +- `StoreCore`'s `initialize` function is split into `initialize` (to set the `StoreSwitch`'s `storeAddress`) and `registerCoreTables` (to register the `Tables` and `StoreHooks` tables). + The purpose of this is to give consumers more granular control over the setup flow. + +- The `StoreRead` contract no longer calls `StoreCore.initialize` in its constructor. + `StoreCore` consumers are expected to call `StoreCore.initialize` and `StoreCore.registerCoreTable` in their own setup logic. + +### Minor changes + +**[feat(world,store): add initialize method, initialize core tables in core module (#1472)](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)** (@latticexyz/cli, @latticexyz/world) + +- The `World` contract now has an `initialize` function, which can be called once by the creator of the World to install the core module. + This change allows the registration of all core tables to happen in the `CoreModule`, so no table metadata has to be included in the `World`'s bytecode. + + ```solidity + interface IBaseWorld { + function initialize(IModule coreModule) public; + } + ``` + +- The `World` contract now stores the original creator of the `World` in an immutable state variable. + It is used internally to only allow the original creator to initialize the `World` in a separate transaction. + + ```solidity + interface IBaseWorld { + function creator() external view returns (address); + } + ``` + +- The deploy script is updated to use the `World`'s `initialize` function to install the `CoreModule` instead of `registerRootModule` as before. + +### Patch changes + +**[fix(world): register Delegations table in CoreModule (#1452)](https://github.com/latticexyz/mud/commit/f1cd43bf9264d5a23a3edf2a1ea4212361a72203)** (@latticexyz/world) + +Register `Delegations` table in the `CoreModule` + +--- + ## Version 2.0.0-next.8 ### Major changes diff --git a/packages/abi-ts/CHANGELOG.md b/packages/abi-ts/CHANGELOG.md index 4410450fd1..d5b73cd002 100644 --- a/packages/abi-ts/CHANGELOG.md +++ b/packages/abi-ts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/abi-ts +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/abi-ts/package.json b/packages/abi-ts/package.json index 6eb24d5d16..51b786922c 100644 --- a/packages/abi-ts/package.json +++ b/packages/abi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/abi-ts", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files.", "repository": { "type": "git", diff --git a/packages/block-logs-stream/CHANGELOG.md b/packages/block-logs-stream/CHANGELOG.md index dd9e7bd533..3714d9a873 100644 --- a/packages/block-logs-stream/CHANGELOG.md +++ b/packages/block-logs-stream/CHANGELOG.md @@ -1,5 +1,12 @@ # @latticexyz/block-logs-stream +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/common@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/block-logs-stream/package.json b/packages/block-logs-stream/package.json index 739cc8e433..7abd61c129 100644 --- a/packages/block-logs-stream/package.json +++ b/packages/block-logs-stream/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/block-logs-stream", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Create a stream of EVM block logs for events", "repository": { "type": "git", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 49f56d7598..763320a82f 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,65 @@ # Change Log +## 2.0.0-next.9 + +### Major Changes + +- [#1336](https://github.com/latticexyz/mud/pull/1336) [`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e) Thanks [@dk1a](https://github.com/dk1a)! - - Add `FieldLayout`, which is a `bytes32` user-type similar to `Schema`. + + Both `FieldLayout` and `Schema` have the same kind of data in the first 4 bytes. + + - 2 bytes for total length of all static fields + - 1 byte for number of static size fields + - 1 byte for number of dynamic size fields + + But whereas `Schema` has `SchemaType` enum in each of the other 28 bytes, `FieldLayout` has static byte lengths in each of the other 28 bytes. + + - Replace `Schema valueSchema` with `FieldLayout fieldLayout` in Store and World contracts. + + `FieldLayout` is more gas-efficient because it already has lengths, and `Schema` has types which need to be converted to lengths. + + - Add `getFieldLayout` to `IStore` interface. + + There is no `FieldLayout` for keys, only for values, because key byte lengths aren't usually relevant on-chain. You can still use `getKeySchema` if you need key types. + + - Add `fieldLayoutToHex` utility to `protocol-parser` package. + + - Add `constants.sol` for constants shared between `FieldLayout`, `Schema` and `PackedCounter`. + +### Patch Changes + +- [#1472](https://github.com/latticexyz/mud/pull/1472) [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf) Thanks [@alvrs](https://github.com/alvrs)! - - The `World` contract now has an `initialize` function, which can be called once by the creator of the World to install the core module. + This change allows the registration of all core tables to happen in the `CoreModule`, so no table metadata has to be included in the `World`'s bytecode. + + ```solidity + interface IBaseWorld { + function initialize(IModule coreModule) public; + } + ``` + + - The `World` contract now stores the original creator of the `World` in an immutable state variable. + It is used internally to only allow the original creator to initialize the `World` in a separate transaction. + + ```solidity + interface IBaseWorld { + function creator() external view returns (address); + } + ``` + + - The deploy script is updated to use the `World`'s `initialize` function to install the `CoreModule` instead of `registerRootModule` as before. + +- Updated dependencies [[`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`f1cd43bf`](https://github.com/latticexyz/mud/commit/f1cd43bf9264d5a23a3edf2a1ea4212361a72203), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)]: + - @latticexyz/protocol-parser@2.0.0-next.9 + - @latticexyz/store@2.0.0-next.9 + - @latticexyz/world@2.0.0-next.9 + - @latticexyz/abi-ts@2.0.0-next.9 + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/config@2.0.0-next.9 + - @latticexyz/gas-report@2.0.0-next.9 + - @latticexyz/schema-type@2.0.0-next.9 + - @latticexyz/services@2.0.0-next.9 + - @latticexyz/utils@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 667a7d7765..c3f1a43ee0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/cli", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Command line interface for mud", "repository": { "type": "git", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 521aefc567..4ad19ff496 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/schema-type@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/common/package.json b/packages/common/package.json index e269b73d8f..280a425bdf 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/common", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Common low level logic shared between packages", "repository": { "type": "git", diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index cd74617d7c..fa9222a3aa 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/schema-type@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index c40af6e11d..3b905a9372 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/config", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Config for Store and World", "repository": { "type": "git", diff --git a/packages/create-mud/CHANGELOG.md b/packages/create-mud/CHANGELOG.md index 2a64f39d79..d5a49774a8 100644 --- a/packages/create-mud/CHANGELOG.md +++ b/packages/create-mud/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/create-mud/package.json b/packages/create-mud/package.json index 0a7d9ce420..fbc0f232ab 100644 --- a/packages/create-mud/package.json +++ b/packages/create-mud/package.json @@ -1,6 +1,6 @@ { "name": "create-mud", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Create a new MUD project", "license": "MIT", "author": "Lattice ", diff --git a/packages/dev-tools/CHANGELOG.md b/packages/dev-tools/CHANGELOG.md index 10c12d7fa8..5f0018cbb5 100644 --- a/packages/dev-tools/CHANGELOG.md +++ b/packages/dev-tools/CHANGELOG.md @@ -1,5 +1,18 @@ # @latticexyz/dev-tools +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies [[`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`f1cd43bf`](https://github.com/latticexyz/mud/commit/f1cd43bf9264d5a23a3edf2a1ea4212361a72203), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)]: + - @latticexyz/store@2.0.0-next.9 + - @latticexyz/world@2.0.0-next.9 + - @latticexyz/store-sync@2.0.0-next.9 + - @latticexyz/react@2.0.0-next.9 + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/recs@2.0.0-next.9 + - @latticexyz/utils@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index c1af28ac22..929b785e94 100644 --- a/packages/dev-tools/package.json +++ b/packages/dev-tools/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/dev-tools", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "MUD developer tools", "repository": { "type": "git", @@ -51,12 +51,12 @@ "vitest": "0.31.4" }, "peerDependencies": { - "@latticexyz/common": "2.0.0-next.8", - "@latticexyz/recs": "2.0.0-next.8", - "@latticexyz/store": "2.0.0-next.8", - "@latticexyz/store-sync": "2.0.0-next.8", - "@latticexyz/utils": "2.0.0-next.8", - "@latticexyz/world": "2.0.0-next.8" + "@latticexyz/common": "2.0.0-next.9", + "@latticexyz/recs": "2.0.0-next.9", + "@latticexyz/store": "2.0.0-next.9", + "@latticexyz/store-sync": "2.0.0-next.9", + "@latticexyz/utils": "2.0.0-next.9", + "@latticexyz/world": "2.0.0-next.9" }, "publishConfig": { "access": "public" diff --git a/packages/ecs-browser/CHANGELOG.md b/packages/ecs-browser/CHANGELOG.md index 8544b652c7..697be0a67d 100644 --- a/packages/ecs-browser/CHANGELOG.md +++ b/packages/ecs-browser/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/ecs-browser +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/ecs-browser/package.json b/packages/ecs-browser/package.json index d9fe5088a7..a2a8a63dbb 100644 --- a/packages/ecs-browser/package.json +++ b/packages/ecs-browser/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/ecs-browser", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "private": true } diff --git a/packages/gas-report/CHANGELOG.md b/packages/gas-report/CHANGELOG.md index 5a6f1590d1..79e7ab89b6 100644 --- a/packages/gas-report/CHANGELOG.md +++ b/packages/gas-report/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/gas-report/package.json b/packages/gas-report/package.json index 5ad7eeeb7f..4c68268e80 100644 --- a/packages/gas-report/package.json +++ b/packages/gas-report/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/gas-report", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Gas reporter for specific lines within forge tests", "repository": { "type": "git", diff --git a/packages/network/CHANGELOG.md b/packages/network/CHANGELOG.md index f67d572e1b..40d6fc9e7f 100644 --- a/packages/network/CHANGELOG.md +++ b/packages/network/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/network +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/network/package.json b/packages/network/package.json index 9eb328626a..39c9eb3b18 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/network", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "private": true } diff --git a/packages/noise/CHANGELOG.md b/packages/noise/CHANGELOG.md index da095e5407..597032dd9d 100644 --- a/packages/noise/CHANGELOG.md +++ b/packages/noise/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/noise/package.json b/packages/noise/package.json index 34f8665f64..8b8f6a0fe4 100644 --- a/packages/noise/package.json +++ b/packages/noise/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/noise", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "license": "MIT", "type": "module", "exports": { diff --git a/packages/phaserx/CHANGELOG.md b/packages/phaserx/CHANGELOG.md index 9f9f0b4af8..e6cd3e208b 100644 --- a/packages/phaserx/CHANGELOG.md +++ b/packages/phaserx/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/utils@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/phaserx/package.json b/packages/phaserx/package.json index 718d1e459d..dee9bdad69 100644 --- a/packages/phaserx/package.json +++ b/packages/phaserx/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/phaserx", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/protocol-parser/CHANGELOG.md b/packages/protocol-parser/CHANGELOG.md index 4bf6a0b363..eb1031ad47 100644 --- a/packages/protocol-parser/CHANGELOG.md +++ b/packages/protocol-parser/CHANGELOG.md @@ -1,5 +1,37 @@ # @latticexyz/protocol-parser +## 2.0.0-next.9 + +### Minor Changes + +- [#1336](https://github.com/latticexyz/mud/pull/1336) [`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e) Thanks [@dk1a](https://github.com/dk1a)! - - Add `FieldLayout`, which is a `bytes32` user-type similar to `Schema`. + + Both `FieldLayout` and `Schema` have the same kind of data in the first 4 bytes. + + - 2 bytes for total length of all static fields + - 1 byte for number of static size fields + - 1 byte for number of dynamic size fields + + But whereas `Schema` has `SchemaType` enum in each of the other 28 bytes, `FieldLayout` has static byte lengths in each of the other 28 bytes. + + - Replace `Schema valueSchema` with `FieldLayout fieldLayout` in Store and World contracts. + + `FieldLayout` is more gas-efficient because it already has lengths, and `Schema` has types which need to be converted to lengths. + + - Add `getFieldLayout` to `IStore` interface. + + There is no `FieldLayout` for keys, only for values, because key byte lengths aren't usually relevant on-chain. You can still use `getKeySchema` if you need key types. + + - Add `fieldLayoutToHex` utility to `protocol-parser` package. + + - Add `constants.sol` for constants shared between `FieldLayout`, `Schema` and `PackedCounter`. + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/schema-type@2.0.0-next.9 + ## 2.0.0-next.8 ### Minor Changes diff --git a/packages/protocol-parser/package.json b/packages/protocol-parser/package.json index f7096b2e4e..689a751943 100644 --- a/packages/protocol-parser/package.json +++ b/packages/protocol-parser/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/protocol-parser", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Parser utilities for the MUD protocol", "repository": { "type": "git", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index b70a4c7665..60cb2ffaff 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies [[`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)]: + - @latticexyz/store@2.0.0-next.9 + - @latticexyz/recs@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 3fedb5d19b..12a4a7f604 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/react", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "React tools for MUD client.", "repository": { "type": "git", diff --git a/packages/recs/CHANGELOG.md b/packages/recs/CHANGELOG.md index 27d9823cc6..778809c9f7 100644 --- a/packages/recs/CHANGELOG.md +++ b/packages/recs/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/schema-type@2.0.0-next.9 + - @latticexyz/utils@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/recs/package.json b/packages/recs/package.json index 5d72ffd027..d4c5eed2e0 100644 --- a/packages/recs/package.json +++ b/packages/recs/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/recs", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/schema-type/CHANGELOG.md b/packages/schema-type/CHANGELOG.md index 98391dc303..b07141ab8d 100644 --- a/packages/schema-type/CHANGELOG.md +++ b/packages/schema-type/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/schema-type/package.json b/packages/schema-type/package.json index e0d57ed90b..68e8868010 100644 --- a/packages/schema-type/package.json +++ b/packages/schema-type/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/schema-type", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "SchemaType enum for various languages", "repository": { "type": "git", diff --git a/packages/services/CHANGELOG.md b/packages/services/CHANGELOG.md index 80ae076555..6818abbb9a 100644 --- a/packages/services/CHANGELOG.md +++ b/packages/services/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/services/package.json b/packages/services/package.json index 97904a6339..8dc5caa275 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/services", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "MUD services for enhanced interactions with on-chain ECS state", "repository": { "type": "git", diff --git a/packages/solecs/CHANGELOG.md b/packages/solecs/CHANGELOG.md index 71fcc584f1..0daa6a57c7 100644 --- a/packages/solecs/CHANGELOG.md +++ b/packages/solecs/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/solecs +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/solecs/package.json b/packages/solecs/package.json index 474ec9ccd2..f7120419b7 100644 --- a/packages/solecs/package.json +++ b/packages/solecs/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/solecs", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "private": true } diff --git a/packages/solhint-config-mud/CHANGELOG.md b/packages/solhint-config-mud/CHANGELOG.md index 6354ac1eda..8679e38c28 100644 --- a/packages/solhint-config-mud/CHANGELOG.md +++ b/packages/solhint-config-mud/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/solhint-config-mud/package.json b/packages/solhint-config-mud/package.json index 8850d0fb16..3477761019 100644 --- a/packages/solhint-config-mud/package.json +++ b/packages/solhint-config-mud/package.json @@ -1,6 +1,6 @@ { "name": "solhint-config-mud", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/solhint-plugin-mud/CHANGELOG.md b/packages/solhint-plugin-mud/CHANGELOG.md index 6354ac1eda..8679e38c28 100644 --- a/packages/solhint-plugin-mud/CHANGELOG.md +++ b/packages/solhint-plugin-mud/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/solhint-plugin-mud/package.json b/packages/solhint-plugin-mud/package.json index 391eb8b1da..d26ddfe5e2 100644 --- a/packages/solhint-plugin-mud/package.json +++ b/packages/solhint-plugin-mud/package.json @@ -1,6 +1,6 @@ { "name": "solhint-plugin-mud", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/std-client/CHANGELOG.md b/packages/std-client/CHANGELOG.md index ffdbe25dae..6edd94848c 100644 --- a/packages/std-client/CHANGELOG.md +++ b/packages/std-client/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-client +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/std-client/package.json b/packages/std-client/package.json index 4cc879fe7e..f246f9c92f 100644 --- a/packages/std-client/package.json +++ b/packages/std-client/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/std-client", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "private": true } diff --git a/packages/std-contracts/CHANGELOG.md b/packages/std-contracts/CHANGELOG.md index 7eb7942733..fce31caf71 100644 --- a/packages/std-contracts/CHANGELOG.md +++ b/packages/std-contracts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-contracts +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/std-contracts/package.json b/packages/std-contracts/package.json index b6fdb984bb..1a834ab966 100644 --- a/packages/std-contracts/package.json +++ b/packages/std-contracts/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/std-contracts", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "private": true } diff --git a/packages/store-cache/CHANGELOG.md b/packages/store-cache/CHANGELOG.md index 2c3e9dfea3..d9385b5dfc 100644 --- a/packages/store-cache/CHANGELOG.md +++ b/packages/store-cache/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/store-cache +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/store-cache/package.json b/packages/store-cache/package.json index b2054eeeb9..4dee6f6b6c 100644 --- a/packages/store-cache/package.json +++ b/packages/store-cache/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/store-cache", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "private": true } diff --git a/packages/store-indexer/CHANGELOG.md b/packages/store-indexer/CHANGELOG.md index ea15b88002..c1532b77d5 100644 --- a/packages/store-indexer/CHANGELOG.md +++ b/packages/store-indexer/CHANGELOG.md @@ -1,5 +1,15 @@ # @latticexyz/store-indexer +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies [[`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)]: + - @latticexyz/store@2.0.0-next.9 + - @latticexyz/store-sync@2.0.0-next.9 + - @latticexyz/block-logs-stream@2.0.0-next.9 + - @latticexyz/common@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/store-indexer/package.json b/packages/store-indexer/package.json index c17410cf6b..2ee274aaed 100644 --- a/packages/store-indexer/package.json +++ b/packages/store-indexer/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store-indexer", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Minimal Typescript indexer for Store", "repository": { "type": "git", diff --git a/packages/store-sync/CHANGELOG.md b/packages/store-sync/CHANGELOG.md index 6613bab9da..3fb1659449 100644 --- a/packages/store-sync/CHANGELOG.md +++ b/packages/store-sync/CHANGELOG.md @@ -1,5 +1,18 @@ # @latticexyz/store-sync +## 2.0.0-next.9 + +### Patch Changes + +- Updated dependencies [[`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`f1cd43bf`](https://github.com/latticexyz/mud/commit/f1cd43bf9264d5a23a3edf2a1ea4212361a72203), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)]: + - @latticexyz/protocol-parser@2.0.0-next.9 + - @latticexyz/store@2.0.0-next.9 + - @latticexyz/world@2.0.0-next.9 + - @latticexyz/block-logs-stream@2.0.0-next.9 + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/recs@2.0.0-next.9 + - @latticexyz/schema-type@2.0.0-next.9 + ## 2.0.0-next.8 ### Patch Changes diff --git a/packages/store-sync/package.json b/packages/store-sync/package.json index 74ac0cd678..e096359c1f 100644 --- a/packages/store-sync/package.json +++ b/packages/store-sync/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store-sync", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Utilities to sync MUD Store events with a client or cache", "repository": { "type": "git", diff --git a/packages/store/CHANGELOG.md b/packages/store/CHANGELOG.md index 12f7db7a53..a15ec4fc26 100644 --- a/packages/store/CHANGELOG.md +++ b/packages/store/CHANGELOG.md @@ -1,5 +1,44 @@ # Change Log +## 2.0.0-next.9 + +### Major Changes + +- [#1336](https://github.com/latticexyz/mud/pull/1336) [`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e) Thanks [@dk1a](https://github.com/dk1a)! - - Add `FieldLayout`, which is a `bytes32` user-type similar to `Schema`. + + Both `FieldLayout` and `Schema` have the same kind of data in the first 4 bytes. + + - 2 bytes for total length of all static fields + - 1 byte for number of static size fields + - 1 byte for number of dynamic size fields + + But whereas `Schema` has `SchemaType` enum in each of the other 28 bytes, `FieldLayout` has static byte lengths in each of the other 28 bytes. + + - Replace `Schema valueSchema` with `FieldLayout fieldLayout` in Store and World contracts. + + `FieldLayout` is more gas-efficient because it already has lengths, and `Schema` has types which need to be converted to lengths. + + - Add `getFieldLayout` to `IStore` interface. + + There is no `FieldLayout` for keys, only for values, because key byte lengths aren't usually relevant on-chain. You can still use `getKeySchema` if you need key types. + + - Add `fieldLayoutToHex` utility to `protocol-parser` package. + + - Add `constants.sol` for constants shared between `FieldLayout`, `Schema` and `PackedCounter`. + +- [#1472](https://github.com/latticexyz/mud/pull/1472) [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf) Thanks [@alvrs](https://github.com/alvrs)! - - `StoreCore`'s `initialize` function is split into `initialize` (to set the `StoreSwitch`'s `storeAddress`) and `registerCoreTables` (to register the `Tables` and `StoreHooks` tables). + The purpose of this is to give consumers more granular control over the setup flow. + + - The `StoreRead` contract no longer calls `StoreCore.initialize` in its constructor. + `StoreCore` consumers are expected to call `StoreCore.initialize` and `StoreCore.registerCoreTable` in their own setup logic. + +### Patch Changes + +- Updated dependencies []: + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/config@2.0.0-next.9 + - @latticexyz/schema-type@2.0.0-next.9 + ## 2.0.0-next.8 ### Major Changes diff --git a/packages/store/package.json b/packages/store/package.json index ee891b4889..db0e6e597f 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "Store", "repository": { "type": "git", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 5c02256dec..6c977d9df1 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.9 + ## 2.0.0-next.8 ## 2.0.0-next.7 diff --git a/packages/utils/package.json b/packages/utils/package.json index 7da0b51e49..9a6a28f922 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/utils", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/world/CHANGELOG.md b/packages/world/CHANGELOG.md index 6e78301e32..ce906731f6 100644 --- a/packages/world/CHANGELOG.md +++ b/packages/world/CHANGELOG.md @@ -1,5 +1,63 @@ # Change Log +## 2.0.0-next.9 + +### Major Changes + +- [#1336](https://github.com/latticexyz/mud/pull/1336) [`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e) Thanks [@dk1a](https://github.com/dk1a)! - - Add `FieldLayout`, which is a `bytes32` user-type similar to `Schema`. + + Both `FieldLayout` and `Schema` have the same kind of data in the first 4 bytes. + + - 2 bytes for total length of all static fields + - 1 byte for number of static size fields + - 1 byte for number of dynamic size fields + + But whereas `Schema` has `SchemaType` enum in each of the other 28 bytes, `FieldLayout` has static byte lengths in each of the other 28 bytes. + + - Replace `Schema valueSchema` with `FieldLayout fieldLayout` in Store and World contracts. + + `FieldLayout` is more gas-efficient because it already has lengths, and `Schema` has types which need to be converted to lengths. + + - Add `getFieldLayout` to `IStore` interface. + + There is no `FieldLayout` for keys, only for values, because key byte lengths aren't usually relevant on-chain. You can still use `getKeySchema` if you need key types. + + - Add `fieldLayoutToHex` utility to `protocol-parser` package. + + - Add `constants.sol` for constants shared between `FieldLayout`, `Schema` and `PackedCounter`. + +### Minor Changes + +- [#1472](https://github.com/latticexyz/mud/pull/1472) [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf) Thanks [@alvrs](https://github.com/alvrs)! - - The `World` contract now has an `initialize` function, which can be called once by the creator of the World to install the core module. + This change allows the registration of all core tables to happen in the `CoreModule`, so no table metadata has to be included in the `World`'s bytecode. + + ```solidity + interface IBaseWorld { + function initialize(IModule coreModule) public; + } + ``` + + - The `World` contract now stores the original creator of the `World` in an immutable state variable. + It is used internally to only allow the original creator to initialize the `World` in a separate transaction. + + ```solidity + interface IBaseWorld { + function creator() external view returns (address); + } + ``` + + - The deploy script is updated to use the `World`'s `initialize` function to install the `CoreModule` instead of `registerRootModule` as before. + +### Patch Changes + +- [#1452](https://github.com/latticexyz/mud/pull/1452) [`f1cd43bf`](https://github.com/latticexyz/mud/commit/f1cd43bf9264d5a23a3edf2a1ea4212361a72203) Thanks [@alvrs](https://github.com/alvrs)! - Register `Delegations` table in the `CoreModule` + +- Updated dependencies [[`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf)]: + - @latticexyz/store@2.0.0-next.9 + - @latticexyz/common@2.0.0-next.9 + - @latticexyz/config@2.0.0-next.9 + - @latticexyz/schema-type@2.0.0-next.9 + ## 2.0.0-next.8 ### Major Changes diff --git a/packages/world/package.json b/packages/world/package.json index e2c56ec3a1..7bc7567ee8 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/world", - "version": "2.0.0-next.8", + "version": "2.0.0-next.9", "description": "World framework", "repository": { "type": "git",