From 54f518b8e850437a3c26f01280070211a43fc8c4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 22 Jan 2024 21:11:38 +0000 Subject: [PATCH] Version Packages (next) --- .changeset/pre.json | 34 +++- CHANGELOG.md | 192 +++++++++++++++++++++++ docs/pages/changelog.mdx | 192 +++++++++++++++++++++++ packages/abi-ts/CHANGELOG.md | 2 + packages/abi-ts/package.json | 2 +- packages/block-logs-stream/CHANGELOG.md | 6 + packages/block-logs-stream/package.json | 2 +- packages/cli/CHANGELOG.md | 70 +++++++++ packages/cli/package.json | 2 +- packages/common/CHANGELOG.md | 6 + packages/common/package.json | 2 +- packages/config/CHANGELOG.md | 7 + packages/config/package.json | 2 +- packages/create-mud/CHANGELOG.md | 2 + packages/create-mud/package.json | 2 +- packages/dev-tools/CHANGELOG.md | 43 +++++ packages/dev-tools/package.json | 14 +- packages/ecs-browser/CHANGELOG.md | 2 + packages/ecs-browser/package.json | 2 +- packages/faucet/CHANGELOG.md | 6 + packages/faucet/package.json | 2 +- packages/gas-report/CHANGELOG.md | 2 + packages/gas-report/package.json | 2 +- packages/network/CHANGELOG.md | 2 + packages/network/package.json | 2 +- packages/noise/CHANGELOG.md | 2 + packages/noise/package.json | 2 +- packages/phaserx/CHANGELOG.md | 6 + packages/phaserx/package.json | 2 +- packages/protocol-parser/CHANGELOG.md | 7 + packages/protocol-parser/package.json | 2 +- packages/react/CHANGELOG.md | 21 +++ packages/react/package.json | 2 +- packages/recs/CHANGELOG.md | 7 + packages/recs/package.json | 2 +- packages/schema-type/CHANGELOG.md | 2 + packages/schema-type/package.json | 2 +- packages/services/CHANGELOG.md | 2 + packages/services/package.json | 2 +- packages/solecs/CHANGELOG.md | 2 + packages/solecs/package.json | 2 +- packages/solhint-config-mud/CHANGELOG.md | 2 + packages/solhint-config-mud/package.json | 2 +- packages/solhint-plugin-mud/CHANGELOG.md | 2 + packages/solhint-plugin-mud/package.json | 2 +- packages/std-client/CHANGELOG.md | 2 + packages/std-client/package.json | 2 +- packages/std-contracts/CHANGELOG.md | 2 + packages/std-contracts/package.json | 2 +- packages/store-cache/CHANGELOG.md | 2 + packages/store-cache/package.json | 2 +- packages/store-indexer/CHANGELOG.md | 25 +++ packages/store-indexer/package.json | 2 +- packages/store-sync/CHANGELOG.md | 42 +++++ packages/store-sync/package.json | 2 +- packages/store/CHANGELOG.md | 40 +++++ packages/store/package.json | 2 +- packages/utils/CHANGELOG.md | 2 + packages/utils/package.json | 2 +- packages/world-modules/CHANGELOG.md | 71 +++++++++ packages/world-modules/package.json | 2 +- packages/world/CHANGELOG.md | 82 ++++++++++ packages/world/package.json | 2 +- 63 files changed, 922 insertions(+), 37 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 88e04ea6148..876dec76074 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -38,6 +38,7 @@ "angry-ladybugs-invent", "angry-peas-heal", "angry-pigs-compare", + "beige-ads-melt", "beige-badgers-smile", "beige-radios-drop", "beige-rockets-return", @@ -48,10 +49,13 @@ "brave-needles-love", "brave-rings-tickle", "breezy-cameras-switch", + "breezy-garlics-decide", "breezy-seahorses-prove", "bright-flies-hug", + "bright-kangaroos-battle", "brown-garlics-lie", "brown-icons-burn", + "calm-clocks-add", "chatty-planets-heal", "chilled-chicken-repair", "chilled-cougars-smash", @@ -75,6 +79,7 @@ "eight-deers-confess", "eighty-pots-report", "eighty-tigers-argue", + "eleven-zebras-travel", "empty-planes-kiss", "empty-starfishes-lick", "fair-baboons-compare", @@ -93,6 +98,7 @@ "fifty-squids-eat", "fifty-suits-itch", "fifty-suits-shout", + "five-emus-battle", "flat-trainers-marry", "fluffy-days-carry", "fluffy-moles-march", @@ -106,11 +112,13 @@ "fuzzy-wombats-dream", "giant-masks-carry", "gold-rings-switch", + "gold-wombats-add", "gorgeous-swans-hide", "great-cooks-dream", "grumpy-files-heal", "grumpy-geckos-raise", "grumpy-icons-sleep", + "happy-ants-lay", "happy-pants-try", "heavy-eyes-smile", "heavy-rings-punch", @@ -133,10 +141,14 @@ "large-sloths-camp", "late-cobras-ring", "late-geese-guess", + "late-rats-hide", "late-spies-cover", + "lazy-foxes-applaud", "lazy-ladybugs-return", "lemon-zoos-mate", "light-bananas-deny", + "little-cherries-rule", + "little-cobras-yell", "little-ravens-yawn", "long-lizards-admire", "long-tips-marry", @@ -157,12 +169,16 @@ "mighty-eels-type", "mighty-years-whisper", "modern-bikes-build", + "modern-brooms-rule", "modern-hornets-jam", + "modern-impalas-stare", "modern-stingrays-kneel", "modern-trains-remain", "nasty-crabs-explode", + "nasty-owls-sneeze", "nasty-trains-drop", "nasty-waves-divide", + "neat-tools-check", "nervous-walls-knock", "new-falcons-fail", "nice-avocados-poke", @@ -173,10 +189,12 @@ "nice-pandas-knock", "ninety-lions-double", "odd-bags-compete", + "olive-bugs-add", "olive-foxes-shop", "olive-parrots-move", "olive-pigs-fold", "perfect-mangos-cry", + "perfect-windows-reply", "pink-buses-look", "pink-fans-nail", "pink-horses-deny", @@ -188,12 +206,14 @@ "poor-waves-occur", "popular-coins-invent", "pretty-hotels-drop", + "pretty-toys-rescue", "proud-insects-perform", "proud-turkeys-compete", "purple-ghosts-hear", "quick-numbers-flash", "quick-years-juggle", "quiet-dancers-prove", + "quiet-guests-approve", "quiet-squids-share", "rare-lizards-sleep", "rare-planes-draw", @@ -214,10 +234,12 @@ "selfish-cycles-retire", "serious-ads-trade", "serious-plants-itch", + "seven-carpets-develop", "seven-flies-chew", "seven-mangos-roll", "seven-points-mate", "seven-rice-dance", + "shaggy-pianos-fetch", "sharp-falcons-tie", "sharp-worms-kneel", "short-ads-jog", @@ -229,6 +251,7 @@ "silent-rice-argue", "silly-snakes-fold", "silver-dolls-shave", + "silver-ligers-grin", "silver-mangos-thank", "silver-nails-explain", "silver-wasps-count", @@ -242,14 +265,17 @@ "small-dots-poke", "small-pots-press", "smart-fireants-play", + "smart-games-taste", "smooth-elephants-wave", "smooth-pots-nail", "soft-boxes-smile", "soft-dryers-invite", "soft-fans-wink", + "soft-panthers-develop", "sour-cycles-warn", "sour-rivers-grow", "spicy-bees-teach", + "spotty-balloons-itch", "spotty-cups-destroy", "spotty-geese-yawn", "spotty-sheep-warn", @@ -269,11 +295,15 @@ "thick-masks-wait", "thin-buses-reply", "thin-chairs-compare", + "thin-days-sparkle", "thin-rice-trade", "thin-terms-lay", "thirty-cups-provide", "three-lizards-shave", + "three-llamas-sin", "three-scissors-smile", + "tidy-ants-ring", + "tidy-stingrays-think", "tiny-lions-listen", "tough-flowers-breathe", "tough-moose-pay", @@ -293,6 +323,7 @@ "unlucky-guests-cover", "violet-insects-press", "weak-mails-cross", + "weak-otters-turn", "wet-crabs-punch", "wicked-cheetahs-cough", "wicked-donuts-cheat", @@ -309,6 +340,7 @@ "witty-tigers-rest", "yellow-bags-learn", "young-crabs-rest", - "young-pandas-explode" + "young-pandas-explode", + "young-poets-beam" ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 85c776c8f98..28c6045cd21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,195 @@ +## Version 2.0.0-next.16 + +Release date: Mon Jan 22 2024 + +### Major changes + +**[feat(world): remove system name from function signatures/selectors [M-05] (#2160)](https://github.com/latticexyz/mud/commit/0f27afddb73d855d119ea432d7943cd96952e4da)** (@latticexyz/world-modules, @latticexyz/world) + +World function signatures for namespaced systems have changed from `{namespace}_{systemName}_{functionName}` to `{namespace}__{functionName}` (double underscore, no system name). This is more ergonomic and is more consistent with namespaced resources in other parts of the codebase (e.g. MUD config types, table names in the schemaful indexer). + +If you have a project using the `namespace` key in your `mud.config.ts` or are manually registering systems and function selectors on a namespace, you will likely need to codegen your system interfaces (`pnpm build`) and update any calls to these systems through the world's namespaced function signatures. + +**[chore: add module addresses changeset (#2172)](https://github.com/latticexyz/mud/commit/865253dba0aeccf30615e446c8946583ee6b1068)** (@latticexyz/world, @latticexyz/world-modules) + +Refactored `InstalledModules` to key modules by addresses instead of pre-defined names. Previously, modules could report arbitrary names, meaning misconfigured modules could be installed under a name intended for another module. + +**[feat(world): require namespace to exist before registering systems/tables in it [C-01] (#2007)](https://github.com/latticexyz/mud/commit/063daf80ef9aa9151903061fc7d80c170a96cb07)** (@latticexyz/cli, @latticexyz/world-modules, @latticexyz/world) + +Previously `registerSystem` and `registerTable` had a side effect of registering namespaces if the system or table's namespace didn't exist yet. +This caused a possible frontrunning issue, where an attacker could detect a `registerSystem`/`registerTable` transaction in the mempool, +insert a `registerNamespace` transaction before it, grant themselves access to the namespace, transfer ownership of the namespace to the victim, +so that the `registerSystem`/`registerTable` transactions still went through successfully. +To mitigate this issue, the side effect of registering a namespace in `registerSystem` and `registerTable` has been removed. +Calls to these functions now expect the respective namespace to exist and the caller to own the namespace, otherwise they revert. + +Changes in consuming projects are only necessary if tables or systems are registered manually. +If only the MUD deployer is used to register tables and systems, no changes are necessary, as the MUD deployer has been updated accordingly. + +```diff ++ world.registerNamespace(namespaceId); + world.registerSystem(systemId, system, true); +``` + +```diff ++ world.registerNamespace(namespaceId); + MyTable.register(); +``` + +**[refactor(cli,world,world-modules): split and separately deploy core systems (#2128)](https://github.com/latticexyz/mud/commit/57d8965dfaa5275bd803a48c22d42b50b83c23ed)** (@latticexyz/cli) + +Separated core systems deployment from `CoreModule`, and added the systems as arguments to `CoreModule` + +**[refactor(cli,world,world-modules): split and separately deploy core systems (#2128)](https://github.com/latticexyz/mud/commit/57d8965dfaa5275bd803a48c22d42b50b83c23ed)** (@latticexyz/world) + +- Split `CoreSystem` into `AccessManagementSystem`, `BalanceTransferSystem`, `BatchCallSystem`, `CoreRegistrationSystem` +- Changed `CoreModule` to receive the addresses of these systems as arguments, instead of deploying them +- Replaced `CORE_SYSTEM_ID` constant with `ACCESS_MANAGEMENT_SYSTEM_ID`, `BALANCE_TRANSFER_SYSTEM_ID`, `BATCH_CALL_SYSTEM_ID`, `CORE_REGISTRATION_SYSTEM_ID`, for each respective system + +These changes separate the initcode of `CoreModule` from the bytecode of core systems, which effectively removes a limit on the total bytecode of all core systems. + +**[feat(world): prevent invalid namespace strings [M-05] (#2169)](https://github.com/latticexyz/mud/commit/c642ff3a0ad0d6f47d53d7c381ad6d3fffe52bbf)** (@latticexyz/world) + +Namespaces are not allowed to contain double underscores ("\_\_") anymore, as this sequence of characters is used to [separate the namespace and function selector](https://github.com/latticexyz/mud/pull/2168) in namespaced systems. +This is to prevent signature clashes of functions in different namespaces. + +(Example: If namespaces were allowed to contain this separator string, a function "function" in namespace "namespace\_\_my" would result in the namespaced function selector "namespace\_\_my\_\_function", +and would clash with a function "my\_\_function" in namespace "namespace".) + +**[docs(faucet): the faucet service (#1975)](https://github.com/latticexyz/mud/commit/809905d793c3011b042bbfa3943225601e273c68)** (@latticexyz/store-sync) + +Postgres storage adapter now uses snake case for decoded table names and column names. This allows for better SQL ergonomics when querying these tables. + +To avoid naming conflicts for now, schemas are still case-sensitive and need to be queried with double quotes. We may change this in the future with [namespace validation](https://github.com/latticexyz/mud/issues/1991). + +### Minor changes + +**[feat(store): never allow empty FieldLayout (#2122)](https://github.com/latticexyz/mud/commit/3ac68ade6e60dae2caad9f12ca146b1d461cb1c4)** (@latticexyz/store) + +Removed `allowEmpty` option from `FieldLayout.validate()` as field layouts should never be empty. + +**[feat(store): improve FieldLayout errors [N-03] (#2114)](https://github.com/latticexyz/mud/commit/103f635ebc20ac1aecc5c526c4bcb928e860a7ed)** (@latticexyz/store) + +Improved error messages for invalid `FieldLayout`s + +```diff +-error FieldLayoutLib_InvalidLength(uint256 length); ++error FieldLayoutLib_TooManyFields(uint256 numFields, uint256 maxFields); ++error FieldLayoutLib_TooManyDynamicFields(uint256 numFields, uint256 maxFields); ++error FieldLayoutLib_Empty(); +``` + +### Patch changes + +**[fix(store): emit event after calling beforeSetRecord hook [L-02] (#2017)](https://github.com/latticexyz/mud/commit/c6c13f2ea7e405cac2bc9cf77659d2d66bfdc0d2)** (@latticexyz/store) + +Storage events are now emitted after "before" hooks, so that the resulting logs are now correctly ordered and reflect onchain logic. This resolves issues with store writes and event emissions happening in "before" hooks. + +**[refactor(world-modules): simplify getUniqueEntity call (#2161)](https://github.com/latticexyz/mud/commit/eaa766ef7d68b76bb783531a1a2691abdaa27df5)** (@latticexyz/world-modules) + +Removed `IUniqueEntitySystem` in favor of calling `getUniqueEntity` via `world.call` instead of the world function selector. This had a small gas improvement. + +**[refactor(store,world): rename ambiguous elements [N-03] (#2091)](https://github.com/latticexyz/mud/commit/e6c03a87a5c80b5ed9ddc1aaf6ad73f544c03648)** (@latticexyz/store, @latticexyz/world) + +Renamed the `requireNoCallback` modifier to `prohibitDirectCallback`. + +**[refactor(world): use \_getSystem when fetching system addresses [N-11] (#2022)](https://github.com/latticexyz/mud/commit/c207d35e822afe5f04225d6854fb039116cc7840)** (@latticexyz/world) + +Optimised `StoreRegistrationSystem` and `WorldRegistrationSystem` by fetching individual fields instead of entire records where possible. + +**[fix(world): inline debug constants [L-11] (#1976)](https://github.com/latticexyz/mud/commit/d00c4a9af5fe54b1d21caa9f5cd525e48b3960f5)** (@latticexyz/world) + +Removed `ROOT_NAMESPACE_STRING` and `ROOT_NAME_STRING` exports in favor of inlining these constants, to avoid reuse as they're meant for internal error messages and debugging. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store, @latticexyz/world) + +Refactored various files to specify integers in a hex base instead of decimals. + +**[fix(world): module supports world context consumer id [L-12] (#2032)](https://github.com/latticexyz/mud/commit/f6f402896d8256da3b868f865a960db68393caf4)** (@latticexyz/world) + +Added the WorldContextConsumer interface ID to `supportsInterface` in the Module contract. + +**[fix(world): limit call context of `CoreSystem` to delegatecall [C-02] (#2111)](https://github.com/latticexyz/mud/commit/08b4221712cb004867e5c43b4b408aa45d9e3355)** (@latticexyz/world) + +Systems are expected to be always called via the central World contract. +Depending on whether it is a root or non-root system, the call is performed via `delegatecall` or `call`. +Since Systems are expected to be stateless and only interact with the World state, it is not necessary to prevent direct calls to the systems. +However, since the `CoreSystem` is known to always be registered as a root system in the World, it is always expected to be delegatecalled, +so we made this expectation explicit by reverting if it is not delegatecalled. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world) + +Made the `coreModule` variable in `WorldFactory` immutable. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world) + +Removed the unnecessary `extcodesize` check from the `Create2` library. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world-modules, @latticexyz/store, @latticexyz/world) + +Refactored `ResourceId` to use a global Solidity `using` statement. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world-modules, @latticexyz/store, @latticexyz/world) + +Refactored EIP165 usages to use the built-in interfaceId property instead of pre-defined constants. + +**[fix(world): prevent initialising the world multiple times [L-05] (#2170)](https://github.com/latticexyz/mud/commit/2bfee9217c0b08b2cca5b4a5aef6f4c2f0e7d2f2)** (@latticexyz/world) + +Added a table to track the `CoreModule` address the world was initialised with. + +**[fix(store-sync): improve syncToZustand hydration speed (#2145)](https://github.com/latticexyz/mud/commit/a735e14b44f7bd0ed72745610d49b55a181f5401)** (@latticexyz/store-sync) + +Improved `syncToZustand` speed of hydrating from snapshot by only applying block logs once per block instead of once per log. + +**[fix(store): revert if slice bound is invalid [L-10] (#2034)](https://github.com/latticexyz/mud/commit/7b28d32e579a0ed09122982617bb938b3e2b5a98)** (@latticexyz/store) + +Added a custom error `Store_InvalidBounds` for when the `start:end` slice in `getDynamicFieldSlice` is invalid (it used to revert with the default overflow error) + +**[refactor(store): order load function arguments [N-02] (#2033)](https://github.com/latticexyz/mud/commit/9f8b84e733412323103fdd81067f8edc9d681a17)** (@latticexyz/store) + +Aligned the order of function arguments in the `Storage` library. + +```solidity +store(uint256 storagePointer, uint256 offset, bytes memory data) +store(uint256 storagePointer, uint256 offset, uint256 length, uint256 memoryPointer) +load(uint256 storagePointer, uint256 offset, uint256 length) +load(uint256 storagePointer, uint256 offset, uint256 length, uint256 memoryPointer) +``` + +**[fix(world): check namespace exists before balance transfer [L-03] (#2095)](https://github.com/latticexyz/mud/commit/aee8020a65ca5cfebb2ca479357a535bbf07269b)** (@latticexyz/world) + +Namespace balances can no longer be transferred to non-existent namespaces. + +**[fix(store): add missing FieldLayout and Schema validations [L-07] (#2046)](https://github.com/latticexyz/mud/commit/ad4ac44594f222fdfeca77e4d262eb47ef735836)** (@latticexyz/store) + +Added more validation checks for `FieldLayout` and `Schema`. + +**[fix(world): prevent misconfigured delegations, allow unregistering [L-04] (#2096)](https://github.com/latticexyz/mud/commit/e4a6189df7b2bbf5c88cc050c529d8f0ee49bc5a)** (@latticexyz/world) + +Prevented invalid delegations by performing full validation regardless of whether `initCallData` is empty. Added an `unregisterDelegation` function which allows explicit unregistration, as opposed of passing in zero bytes into `registerDelegation`. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world-modules, @latticexyz/store, @latticexyz/world) + +Refactored various Solidity files to not explicitly initialise variables to zero. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store) + +Refactored some Store functions to use a right bit mask instead of left. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store) + +Simplified a check in `Slice.getSubslice`. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world) + +Refactored `WorldContext` to get the world address from `WorldContextConsumerLib` instead of `StoreSwitch`. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store) + +Optimised the `Schema.validate` function to decrease gas use. + +--- + ## Version 2.0.0-next.15 Release date: Wed Jan 03 2024 diff --git a/docs/pages/changelog.mdx b/docs/pages/changelog.mdx index 85c776c8f98..28c6045cd21 100644 --- a/docs/pages/changelog.mdx +++ b/docs/pages/changelog.mdx @@ -1,3 +1,195 @@ +## Version 2.0.0-next.16 + +Release date: Mon Jan 22 2024 + +### Major changes + +**[feat(world): remove system name from function signatures/selectors [M-05] (#2160)](https://github.com/latticexyz/mud/commit/0f27afddb73d855d119ea432d7943cd96952e4da)** (@latticexyz/world-modules, @latticexyz/world) + +World function signatures for namespaced systems have changed from `{namespace}_{systemName}_{functionName}` to `{namespace}__{functionName}` (double underscore, no system name). This is more ergonomic and is more consistent with namespaced resources in other parts of the codebase (e.g. MUD config types, table names in the schemaful indexer). + +If you have a project using the `namespace` key in your `mud.config.ts` or are manually registering systems and function selectors on a namespace, you will likely need to codegen your system interfaces (`pnpm build`) and update any calls to these systems through the world's namespaced function signatures. + +**[chore: add module addresses changeset (#2172)](https://github.com/latticexyz/mud/commit/865253dba0aeccf30615e446c8946583ee6b1068)** (@latticexyz/world, @latticexyz/world-modules) + +Refactored `InstalledModules` to key modules by addresses instead of pre-defined names. Previously, modules could report arbitrary names, meaning misconfigured modules could be installed under a name intended for another module. + +**[feat(world): require namespace to exist before registering systems/tables in it [C-01] (#2007)](https://github.com/latticexyz/mud/commit/063daf80ef9aa9151903061fc7d80c170a96cb07)** (@latticexyz/cli, @latticexyz/world-modules, @latticexyz/world) + +Previously `registerSystem` and `registerTable` had a side effect of registering namespaces if the system or table's namespace didn't exist yet. +This caused a possible frontrunning issue, where an attacker could detect a `registerSystem`/`registerTable` transaction in the mempool, +insert a `registerNamespace` transaction before it, grant themselves access to the namespace, transfer ownership of the namespace to the victim, +so that the `registerSystem`/`registerTable` transactions still went through successfully. +To mitigate this issue, the side effect of registering a namespace in `registerSystem` and `registerTable` has been removed. +Calls to these functions now expect the respective namespace to exist and the caller to own the namespace, otherwise they revert. + +Changes in consuming projects are only necessary if tables or systems are registered manually. +If only the MUD deployer is used to register tables and systems, no changes are necessary, as the MUD deployer has been updated accordingly. + +```diff ++ world.registerNamespace(namespaceId); + world.registerSystem(systemId, system, true); +``` + +```diff ++ world.registerNamespace(namespaceId); + MyTable.register(); +``` + +**[refactor(cli,world,world-modules): split and separately deploy core systems (#2128)](https://github.com/latticexyz/mud/commit/57d8965dfaa5275bd803a48c22d42b50b83c23ed)** (@latticexyz/cli) + +Separated core systems deployment from `CoreModule`, and added the systems as arguments to `CoreModule` + +**[refactor(cli,world,world-modules): split and separately deploy core systems (#2128)](https://github.com/latticexyz/mud/commit/57d8965dfaa5275bd803a48c22d42b50b83c23ed)** (@latticexyz/world) + +- Split `CoreSystem` into `AccessManagementSystem`, `BalanceTransferSystem`, `BatchCallSystem`, `CoreRegistrationSystem` +- Changed `CoreModule` to receive the addresses of these systems as arguments, instead of deploying them +- Replaced `CORE_SYSTEM_ID` constant with `ACCESS_MANAGEMENT_SYSTEM_ID`, `BALANCE_TRANSFER_SYSTEM_ID`, `BATCH_CALL_SYSTEM_ID`, `CORE_REGISTRATION_SYSTEM_ID`, for each respective system + +These changes separate the initcode of `CoreModule` from the bytecode of core systems, which effectively removes a limit on the total bytecode of all core systems. + +**[feat(world): prevent invalid namespace strings [M-05] (#2169)](https://github.com/latticexyz/mud/commit/c642ff3a0ad0d6f47d53d7c381ad6d3fffe52bbf)** (@latticexyz/world) + +Namespaces are not allowed to contain double underscores ("\_\_") anymore, as this sequence of characters is used to [separate the namespace and function selector](https://github.com/latticexyz/mud/pull/2168) in namespaced systems. +This is to prevent signature clashes of functions in different namespaces. + +(Example: If namespaces were allowed to contain this separator string, a function "function" in namespace "namespace\_\_my" would result in the namespaced function selector "namespace\_\_my\_\_function", +and would clash with a function "my\_\_function" in namespace "namespace".) + +**[docs(faucet): the faucet service (#1975)](https://github.com/latticexyz/mud/commit/809905d793c3011b042bbfa3943225601e273c68)** (@latticexyz/store-sync) + +Postgres storage adapter now uses snake case for decoded table names and column names. This allows for better SQL ergonomics when querying these tables. + +To avoid naming conflicts for now, schemas are still case-sensitive and need to be queried with double quotes. We may change this in the future with [namespace validation](https://github.com/latticexyz/mud/issues/1991). + +### Minor changes + +**[feat(store): never allow empty FieldLayout (#2122)](https://github.com/latticexyz/mud/commit/3ac68ade6e60dae2caad9f12ca146b1d461cb1c4)** (@latticexyz/store) + +Removed `allowEmpty` option from `FieldLayout.validate()` as field layouts should never be empty. + +**[feat(store): improve FieldLayout errors [N-03] (#2114)](https://github.com/latticexyz/mud/commit/103f635ebc20ac1aecc5c526c4bcb928e860a7ed)** (@latticexyz/store) + +Improved error messages for invalid `FieldLayout`s + +```diff +-error FieldLayoutLib_InvalidLength(uint256 length); ++error FieldLayoutLib_TooManyFields(uint256 numFields, uint256 maxFields); ++error FieldLayoutLib_TooManyDynamicFields(uint256 numFields, uint256 maxFields); ++error FieldLayoutLib_Empty(); +``` + +### Patch changes + +**[fix(store): emit event after calling beforeSetRecord hook [L-02] (#2017)](https://github.com/latticexyz/mud/commit/c6c13f2ea7e405cac2bc9cf77659d2d66bfdc0d2)** (@latticexyz/store) + +Storage events are now emitted after "before" hooks, so that the resulting logs are now correctly ordered and reflect onchain logic. This resolves issues with store writes and event emissions happening in "before" hooks. + +**[refactor(world-modules): simplify getUniqueEntity call (#2161)](https://github.com/latticexyz/mud/commit/eaa766ef7d68b76bb783531a1a2691abdaa27df5)** (@latticexyz/world-modules) + +Removed `IUniqueEntitySystem` in favor of calling `getUniqueEntity` via `world.call` instead of the world function selector. This had a small gas improvement. + +**[refactor(store,world): rename ambiguous elements [N-03] (#2091)](https://github.com/latticexyz/mud/commit/e6c03a87a5c80b5ed9ddc1aaf6ad73f544c03648)** (@latticexyz/store, @latticexyz/world) + +Renamed the `requireNoCallback` modifier to `prohibitDirectCallback`. + +**[refactor(world): use \_getSystem when fetching system addresses [N-11] (#2022)](https://github.com/latticexyz/mud/commit/c207d35e822afe5f04225d6854fb039116cc7840)** (@latticexyz/world) + +Optimised `StoreRegistrationSystem` and `WorldRegistrationSystem` by fetching individual fields instead of entire records where possible. + +**[fix(world): inline debug constants [L-11] (#1976)](https://github.com/latticexyz/mud/commit/d00c4a9af5fe54b1d21caa9f5cd525e48b3960f5)** (@latticexyz/world) + +Removed `ROOT_NAMESPACE_STRING` and `ROOT_NAME_STRING` exports in favor of inlining these constants, to avoid reuse as they're meant for internal error messages and debugging. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store, @latticexyz/world) + +Refactored various files to specify integers in a hex base instead of decimals. + +**[fix(world): module supports world context consumer id [L-12] (#2032)](https://github.com/latticexyz/mud/commit/f6f402896d8256da3b868f865a960db68393caf4)** (@latticexyz/world) + +Added the WorldContextConsumer interface ID to `supportsInterface` in the Module contract. + +**[fix(world): limit call context of `CoreSystem` to delegatecall [C-02] (#2111)](https://github.com/latticexyz/mud/commit/08b4221712cb004867e5c43b4b408aa45d9e3355)** (@latticexyz/world) + +Systems are expected to be always called via the central World contract. +Depending on whether it is a root or non-root system, the call is performed via `delegatecall` or `call`. +Since Systems are expected to be stateless and only interact with the World state, it is not necessary to prevent direct calls to the systems. +However, since the `CoreSystem` is known to always be registered as a root system in the World, it is always expected to be delegatecalled, +so we made this expectation explicit by reverting if it is not delegatecalled. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world) + +Made the `coreModule` variable in `WorldFactory` immutable. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world) + +Removed the unnecessary `extcodesize` check from the `Create2` library. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world-modules, @latticexyz/store, @latticexyz/world) + +Refactored `ResourceId` to use a global Solidity `using` statement. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world-modules, @latticexyz/store, @latticexyz/world) + +Refactored EIP165 usages to use the built-in interfaceId property instead of pre-defined constants. + +**[fix(world): prevent initialising the world multiple times [L-05] (#2170)](https://github.com/latticexyz/mud/commit/2bfee9217c0b08b2cca5b4a5aef6f4c2f0e7d2f2)** (@latticexyz/world) + +Added a table to track the `CoreModule` address the world was initialised with. + +**[fix(store-sync): improve syncToZustand hydration speed (#2145)](https://github.com/latticexyz/mud/commit/a735e14b44f7bd0ed72745610d49b55a181f5401)** (@latticexyz/store-sync) + +Improved `syncToZustand` speed of hydrating from snapshot by only applying block logs once per block instead of once per log. + +**[fix(store): revert if slice bound is invalid [L-10] (#2034)](https://github.com/latticexyz/mud/commit/7b28d32e579a0ed09122982617bb938b3e2b5a98)** (@latticexyz/store) + +Added a custom error `Store_InvalidBounds` for when the `start:end` slice in `getDynamicFieldSlice` is invalid (it used to revert with the default overflow error) + +**[refactor(store): order load function arguments [N-02] (#2033)](https://github.com/latticexyz/mud/commit/9f8b84e733412323103fdd81067f8edc9d681a17)** (@latticexyz/store) + +Aligned the order of function arguments in the `Storage` library. + +```solidity +store(uint256 storagePointer, uint256 offset, bytes memory data) +store(uint256 storagePointer, uint256 offset, uint256 length, uint256 memoryPointer) +load(uint256 storagePointer, uint256 offset, uint256 length) +load(uint256 storagePointer, uint256 offset, uint256 length, uint256 memoryPointer) +``` + +**[fix(world): check namespace exists before balance transfer [L-03] (#2095)](https://github.com/latticexyz/mud/commit/aee8020a65ca5cfebb2ca479357a535bbf07269b)** (@latticexyz/world) + +Namespace balances can no longer be transferred to non-existent namespaces. + +**[fix(store): add missing FieldLayout and Schema validations [L-07] (#2046)](https://github.com/latticexyz/mud/commit/ad4ac44594f222fdfeca77e4d262eb47ef735836)** (@latticexyz/store) + +Added more validation checks for `FieldLayout` and `Schema`. + +**[fix(world): prevent misconfigured delegations, allow unregistering [L-04] (#2096)](https://github.com/latticexyz/mud/commit/e4a6189df7b2bbf5c88cc050c529d8f0ee49bc5a)** (@latticexyz/world) + +Prevented invalid delegations by performing full validation regardless of whether `initCallData` is empty. Added an `unregisterDelegation` function which allows explicit unregistration, as opposed of passing in zero bytes into `registerDelegation`. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world-modules, @latticexyz/store, @latticexyz/world) + +Refactored various Solidity files to not explicitly initialise variables to zero. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store) + +Refactored some Store functions to use a right bit mask instead of left. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store) + +Simplified a check in `Slice.getSubslice`. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/world) + +Refactored `WorldContext` to get the world address from `WorldContextConsumerLib` instead of `StoreSwitch`. + +**[refactor(store,world,world-modules): code suggestions [N-08] (#2140)](https://github.com/latticexyz/mud/commit/37c228c63235e184a40623d9bb1f6494abdf25e4)** (@latticexyz/store) + +Optimised the `Schema.validate` function to decrease gas use. + +--- + ## Version 2.0.0-next.15 Release date: Wed Jan 03 2024 diff --git a/packages/abi-ts/CHANGELOG.md b/packages/abi-ts/CHANGELOG.md index 2d7c62a3b71..7ef1deccbcc 100644 --- a/packages/abi-ts/CHANGELOG.md +++ b/packages/abi-ts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/abi-ts +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/abi-ts/package.json b/packages/abi-ts/package.json index af7a5bdbe84..25c70bc8dc7 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.15", + "version": "2.0.0-next.16", "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 d569e4b1f8a..a486f7b3159 100644 --- a/packages/block-logs-stream/CHANGELOG.md +++ b/packages/block-logs-stream/CHANGELOG.md @@ -1,5 +1,11 @@ # @latticexyz/block-logs-stream +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/common@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/block-logs-stream/package.json b/packages/block-logs-stream/package.json index 7bf1c53a90b..3361b4987ce 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.15", + "version": "2.0.0-next.16", "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 5d7467f4c71..15462c82ced 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,75 @@ # Change Log +## 2.0.0-next.16 + +### Major Changes + +- 57d8965d: Separated core systems deployment from `CoreModule`, and added the systems as arguments to `CoreModule` + +### Patch Changes + +- 063daf80: Previously `registerSystem` and `registerTable` had a side effect of registering namespaces if the system or table's namespace didn't exist yet. + This caused a possible frontrunning issue, where an attacker could detect a `registerSystem`/`registerTable` transaction in the mempool, + insert a `registerNamespace` transaction before it, grant themselves access to the namespace, transfer ownership of the namespace to the victim, + so that the `registerSystem`/`registerTable` transactions still went through successfully. + To mitigate this issue, the side effect of registering a namespace in `registerSystem` and `registerTable` has been removed. + Calls to these functions now expect the respective namespace to exist and the caller to own the namespace, otherwise they revert. + + Changes in consuming projects are only necessary if tables or systems are registered manually. + If only the MUD deployer is used to register tables and systems, no changes are necessary, as the MUD deployer has been updated accordingly. + + ```diff + + world.registerNamespace(namespaceId); + world.registerSystem(systemId, system, true); + ``` + + ```diff + + world.registerNamespace(namespaceId); + MyTable.register(); + ``` + +- Updated dependencies [c6c13f2e] +- Updated dependencies [eaa766ef] +- Updated dependencies [0f27afdd] +- Updated dependencies [865253db] +- Updated dependencies [e6c03a87] +- Updated dependencies [c207d35e] +- Updated dependencies [d00c4a9a] +- Updated dependencies [37c228c6] +- Updated dependencies [f6f40289] +- Updated dependencies [08b42217] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [063daf80] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [2bfee921] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [aee8020a] +- Updated dependencies [ad4ac445] +- Updated dependencies [57d8965d] +- Updated dependencies [e4a6189d] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [c642ff3a] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/world-modules@2.0.0-next.16 + - @latticexyz/world@2.0.0-next.16 + - @latticexyz/abi-ts@2.0.0-next.16 + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/config@2.0.0-next.16 + - @latticexyz/gas-report@2.0.0-next.16 + - @latticexyz/protocol-parser@2.0.0-next.16 + - @latticexyz/schema-type@2.0.0-next.16 + - @latticexyz/services@2.0.0-next.16 + - @latticexyz/utils@2.0.0-next.16 + ## 2.0.0-next.15 ### Minor Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 00d29ef8ab5..3867c1bcdca 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/cli", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "Command line interface for mud", "repository": { "type": "git", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 7e9b5a1ddf2..ef40e2b7938 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Minor Changes diff --git a/packages/common/package.json b/packages/common/package.json index d1210cab66f..12cc8d3f4f5 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/common", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "Common low level logic shared between packages", "repository": { "type": "git", diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index e56ccb1e9a6..8b2ca78ebdb 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/common@2.0.0-next.16 +- @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index 09d81ca8584..5a6bb45837c 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/config", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "Config for Store and World", "repository": { "type": "git", diff --git a/packages/create-mud/CHANGELOG.md b/packages/create-mud/CHANGELOG.md index 05c0ad0903f..1ac2caf09ba 100644 --- a/packages/create-mud/CHANGELOG.md +++ b/packages/create-mud/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Minor Changes diff --git a/packages/create-mud/package.json b/packages/create-mud/package.json index fd8231abea2..d0eefb5833d 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.15", + "version": "2.0.0-next.16", "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 349a38a7f9a..798322f5d56 100644 --- a/packages/dev-tools/CHANGELOG.md +++ b/packages/dev-tools/CHANGELOG.md @@ -1,5 +1,48 @@ # @latticexyz/dev-tools +## 2.0.0-next.16 + +### Patch Changes + +- Updated dependencies [c6c13f2e] +- Updated dependencies [0f27afdd] +- Updated dependencies [865253db] +- Updated dependencies [e6c03a87] +- Updated dependencies [c207d35e] +- Updated dependencies [d00c4a9a] +- Updated dependencies [37c228c6] +- Updated dependencies [f6f40289] +- Updated dependencies [08b42217] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [063daf80] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [2bfee921] +- Updated dependencies [a735e14b] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [aee8020a] +- Updated dependencies [ad4ac445] +- Updated dependencies [57d8965d] +- Updated dependencies [e4a6189d] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [c642ff3a] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/world@2.0.0-next.16 + - @latticexyz/store-sync@2.0.0-next.16 + - @latticexyz/react@2.0.0-next.16 + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/recs@2.0.0-next.16 + - @latticexyz/schema-type@2.0.0-next.16 + - @latticexyz/utils@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index f344d496608..9bd7f657bce 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.15", + "version": "2.0.0-next.16", "description": "MUD developer tools", "repository": { "type": "git", @@ -51,12 +51,12 @@ "vitest": "0.31.4" }, "peerDependencies": { - "@latticexyz/common": "2.0.0-next.15", - "@latticexyz/recs": "2.0.0-next.15", - "@latticexyz/store": "2.0.0-next.15", - "@latticexyz/store-sync": "2.0.0-next.15", - "@latticexyz/utils": "2.0.0-next.15", - "@latticexyz/world": "2.0.0-next.15" + "@latticexyz/common": "2.0.0-next.16", + "@latticexyz/recs": "2.0.0-next.16", + "@latticexyz/store": "2.0.0-next.16", + "@latticexyz/store-sync": "2.0.0-next.16", + "@latticexyz/utils": "2.0.0-next.16", + "@latticexyz/world": "2.0.0-next.16" }, "publishConfig": { "access": "public" diff --git a/packages/ecs-browser/CHANGELOG.md b/packages/ecs-browser/CHANGELOG.md index af0e9165062..e352e37742b 100644 --- a/packages/ecs-browser/CHANGELOG.md +++ b/packages/ecs-browser/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/ecs-browser +## 2.0.0-next.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/ecs-browser/package.json b/packages/ecs-browser/package.json index 04e8d5ddfcc..d8b1a380794 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.15", + "version": "2.0.0-next.16", "private": true } diff --git a/packages/faucet/CHANGELOG.md b/packages/faucet/CHANGELOG.md index ef8fdb4e53d..cbccac65c12 100644 --- a/packages/faucet/CHANGELOG.md +++ b/packages/faucet/CHANGELOG.md @@ -1,5 +1,11 @@ # @latticexyz/faucet +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/common@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/faucet/package.json b/packages/faucet/package.json index c8d7f1d2f43..095228f3d04 100644 --- a/packages/faucet/package.json +++ b/packages/faucet/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/faucet", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "Faucet API for Lattice testnet", "repository": { "type": "git", diff --git a/packages/gas-report/CHANGELOG.md b/packages/gas-report/CHANGELOG.md index ae4fe7e56f3..b2e74e5bc84 100644 --- a/packages/gas-report/CHANGELOG.md +++ b/packages/gas-report/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/gas-report/package.json b/packages/gas-report/package.json index 15bd01c24eb..1a907d65bfd 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.15", + "version": "2.0.0-next.16", "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 7cb74ca85d7..7e26a657e28 100644 --- a/packages/network/CHANGELOG.md +++ b/packages/network/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/network +## 2.0.0-next.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/network/package.json b/packages/network/package.json index 83d0f3cb120..80e98015fd7 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/network", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "private": true } diff --git a/packages/noise/CHANGELOG.md b/packages/noise/CHANGELOG.md index 819bf65e113..790b66408c2 100644 --- a/packages/noise/CHANGELOG.md +++ b/packages/noise/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/noise/package.json b/packages/noise/package.json index 271fc3d5cf5..bf7ef3696a6 100644 --- a/packages/noise/package.json +++ b/packages/noise/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/noise", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "license": "MIT", "type": "module", "exports": { diff --git a/packages/phaserx/CHANGELOG.md b/packages/phaserx/CHANGELOG.md index 1f0941a1e45..b951e18cbde 100644 --- a/packages/phaserx/CHANGELOG.md +++ b/packages/phaserx/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/utils@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/phaserx/package.json b/packages/phaserx/package.json index d542a654797..d3719f652eb 100644 --- a/packages/phaserx/package.json +++ b/packages/phaserx/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/phaserx", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "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 41d4cbeec1e..59ce694b377 100644 --- a/packages/protocol-parser/CHANGELOG.md +++ b/packages/protocol-parser/CHANGELOG.md @@ -1,5 +1,12 @@ # @latticexyz/protocol-parser +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/common@2.0.0-next.16 +- @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/protocol-parser/package.json b/packages/protocol-parser/package.json index 5998ab0796a..8c6e45c8927 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.15", + "version": "2.0.0-next.16", "description": "Parser utilities for the MUD protocol", "repository": { "type": "git", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index f9f54d0d45f..60ea9423b59 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,26 @@ # Change Log +## 2.0.0-next.16 + +### Patch Changes + +- Updated dependencies [c6c13f2e] +- Updated dependencies [e6c03a87] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [ad4ac445] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/recs@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 1e10e97e20c..fdf802cf972 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/react", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "React tools for MUD client.", "repository": { "type": "git", diff --git a/packages/recs/CHANGELOG.md b/packages/recs/CHANGELOG.md index 5a804cfe50f..e055f7e24cd 100644 --- a/packages/recs/CHANGELOG.md +++ b/packages/recs/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## 2.0.0-next.16 + +### Patch Changes + +- @latticexyz/schema-type@2.0.0-next.16 +- @latticexyz/utils@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/recs/package.json b/packages/recs/package.json index 5bbf1f2dbef..3399f2ea5ed 100644 --- a/packages/recs/package.json +++ b/packages/recs/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/recs", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "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 fc71a534b27..46c5d522cc1 100644 --- a/packages/schema-type/CHANGELOG.md +++ b/packages/schema-type/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/schema-type/package.json b/packages/schema-type/package.json index 1cd8e706089..c5ab1fa7465 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.15", + "version": "2.0.0-next.16", "description": "SchemaType enum for various languages", "repository": { "type": "git", diff --git a/packages/services/CHANGELOG.md b/packages/services/CHANGELOG.md index 7231f25b1c4..7edb1b1d505 100644 --- a/packages/services/CHANGELOG.md +++ b/packages/services/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/services/package.json b/packages/services/package.json index b6a161967c5..30bfa5a3470 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/services", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "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 5305ff9ccd2..b669f5248fe 100644 --- a/packages/solecs/CHANGELOG.md +++ b/packages/solecs/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/solecs +## 2.0.0-next.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/solecs/package.json b/packages/solecs/package.json index 2765d4a0b95..5a71b5d7599 100644 --- a/packages/solecs/package.json +++ b/packages/solecs/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/solecs", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "private": true } diff --git a/packages/solhint-config-mud/CHANGELOG.md b/packages/solhint-config-mud/CHANGELOG.md index a3e220abf6a..048b83363b8 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.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/solhint-config-mud/package.json b/packages/solhint-config-mud/package.json index f1e44145950..07f238e97eb 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.15", + "version": "2.0.0-next.16", "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 a3e220abf6a..048b83363b8 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.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/solhint-plugin-mud/package.json b/packages/solhint-plugin-mud/package.json index cd0068329f9..131ae4263ca 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.15", + "version": "2.0.0-next.16", "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 eb9510f9bba..30f9cae59e5 100644 --- a/packages/std-client/CHANGELOG.md +++ b/packages/std-client/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-client +## 2.0.0-next.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/std-client/package.json b/packages/std-client/package.json index 21e5ce29733..b5bc8434261 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.15", + "version": "2.0.0-next.16", "private": true } diff --git a/packages/std-contracts/CHANGELOG.md b/packages/std-contracts/CHANGELOG.md index 583bc950469..dabff6b2854 100644 --- a/packages/std-contracts/CHANGELOG.md +++ b/packages/std-contracts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-contracts +## 2.0.0-next.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/std-contracts/package.json b/packages/std-contracts/package.json index e7438be91a7..3f2f6d14132 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.15", + "version": "2.0.0-next.16", "private": true } diff --git a/packages/store-cache/CHANGELOG.md b/packages/store-cache/CHANGELOG.md index 19b68e78827..bb8e6469818 100644 --- a/packages/store-cache/CHANGELOG.md +++ b/packages/store-cache/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/store-cache +## 2.0.0-next.16 + ## 2.0.0-next.15 ## 2.0.0-next.14 diff --git a/packages/store-cache/package.json b/packages/store-cache/package.json index e6f6092e84f..247d1aaa196 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.15", + "version": "2.0.0-next.16", "private": true } diff --git a/packages/store-indexer/CHANGELOG.md b/packages/store-indexer/CHANGELOG.md index b2caa28e7b6..2aeab29ad15 100644 --- a/packages/store-indexer/CHANGELOG.md +++ b/packages/store-indexer/CHANGELOG.md @@ -1,5 +1,30 @@ # @latticexyz/store-indexer +## 2.0.0-next.16 + +### Patch Changes + +- Updated dependencies [c6c13f2e] +- Updated dependencies [e6c03a87] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [a735e14b] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [ad4ac445] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/store-sync@2.0.0-next.16 + - @latticexyz/block-logs-stream@2.0.0-next.16 + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/protocol-parser@2.0.0-next.16 + ## 2.0.0-next.15 ### Major Changes diff --git a/packages/store-indexer/package.json b/packages/store-indexer/package.json index fa70a07b353..62433bbe04f 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.15", + "version": "2.0.0-next.16", "description": "Minimal Typescript indexer for Store", "repository": { "type": "git", diff --git a/packages/store-sync/CHANGELOG.md b/packages/store-sync/CHANGELOG.md index 1874ad6d4e8..8a34a7b174e 100644 --- a/packages/store-sync/CHANGELOG.md +++ b/packages/store-sync/CHANGELOG.md @@ -1,5 +1,47 @@ # @latticexyz/store-sync +## 2.0.0-next.16 + +### Patch Changes + +- a735e14b: Improved `syncToZustand` speed of hydrating from snapshot by only applying block logs once per block instead of once per log. +- Updated dependencies [c6c13f2e] +- Updated dependencies [0f27afdd] +- Updated dependencies [865253db] +- Updated dependencies [e6c03a87] +- Updated dependencies [c207d35e] +- Updated dependencies [d00c4a9a] +- Updated dependencies [37c228c6] +- Updated dependencies [f6f40289] +- Updated dependencies [08b42217] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [063daf80] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [2bfee921] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [aee8020a] +- Updated dependencies [ad4ac445] +- Updated dependencies [57d8965d] +- Updated dependencies [e4a6189d] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [c642ff3a] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/world@2.0.0-next.16 + - @latticexyz/block-logs-stream@2.0.0-next.16 + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/protocol-parser@2.0.0-next.16 + - @latticexyz/recs@2.0.0-next.16 + - @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Major Changes diff --git a/packages/store-sync/package.json b/packages/store-sync/package.json index e8600fce4d2..75a392793f6 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.15", + "version": "2.0.0-next.16", "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 6d3a3500c06..a072fca9f0e 100644 --- a/packages/store/CHANGELOG.md +++ b/packages/store/CHANGELOG.md @@ -1,5 +1,45 @@ # Change Log +## 2.0.0-next.16 + +### Minor Changes + +- 3ac68ade: Removed `allowEmpty` option from `FieldLayout.validate()` as field layouts should never be empty. +- 103f635e: Improved error messages for invalid `FieldLayout`s + + ```diff + -error FieldLayoutLib_InvalidLength(uint256 length); + +error FieldLayoutLib_TooManyFields(uint256 numFields, uint256 maxFields); + +error FieldLayoutLib_TooManyDynamicFields(uint256 numFields, uint256 maxFields); + +error FieldLayoutLib_Empty(); + ``` + +### Patch Changes + +- c6c13f2e: Storage events are now emitted after "before" hooks, so that the resulting logs are now correctly ordered and reflect onchain logic. This resolves issues with store writes and event emissions happening in "before" hooks. +- e6c03a87: Renamed the `requireNoCallback` modifier to `prohibitDirectCallback`. +- 37c228c6: Refactored various files to specify integers in a hex base instead of decimals. +- 37c228c6: Refactored `ResourceId` to use a global Solidity `using` statement. +- 37c228c6: Refactored EIP165 usages to use the built-in interfaceId property instead of pre-defined constants. +- 7b28d32e: Added a custom error `Store_InvalidBounds` for when the `start:end` slice in `getDynamicFieldSlice` is invalid (it used to revert with the default overflow error) +- 9f8b84e7: Aligned the order of function arguments in the `Storage` library. + + ```solidity + store(uint256 storagePointer, uint256 offset, bytes memory data) + store(uint256 storagePointer, uint256 offset, uint256 length, uint256 memoryPointer) + load(uint256 storagePointer, uint256 offset, uint256 length) + load(uint256 storagePointer, uint256 offset, uint256 length, uint256 memoryPointer) + ``` + +- ad4ac445: Added more validation checks for `FieldLayout` and `Schema`. +- 37c228c6: Refactored various Solidity files to not explicitly initialise variables to zero. +- 37c228c6: Refactored some Store functions to use a right bit mask instead of left. +- 37c228c6: Simplified a check in `Slice.getSubslice`. +- 37c228c6: Optimised the `Schema.validate` function to decrease gas use. + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/config@2.0.0-next.16 + - @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/store/package.json b/packages/store/package.json index 6f134c66529..5801260085c 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "Store", "repository": { "type": "git", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 9012d6e6d09..06eaef412c4 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +## 2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/utils/package.json b/packages/utils/package.json index e6990305642..b6add7f37e9 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/utils", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "repository": { "type": "git", "url": "https://github.com/latticexyz/mud.git", diff --git a/packages/world-modules/CHANGELOG.md b/packages/world-modules/CHANGELOG.md index a74ad2b6f7b..09b31ac696f 100644 --- a/packages/world-modules/CHANGELOG.md +++ b/packages/world-modules/CHANGELOG.md @@ -1,5 +1,76 @@ # Change Log +## 2.0.0-next.16 + +### Major Changes + +- 865253db: Refactored `InstalledModules` to key modules by addresses instead of pre-defined names. Previously, modules could report arbitrary names, meaning misconfigured modules could be installed under a name intended for another module. + +### Patch Changes + +- eaa766ef: Removed `IUniqueEntitySystem` in favor of calling `getUniqueEntity` via `world.call` instead of the world function selector. This had a small gas improvement. +- 0f27afdd: World function signatures for namespaced systems have changed from `{namespace}_{systemName}_{functionName}` to `{namespace}__{functionName}` (double underscore, no system name). This is more ergonomic and is more consistent with namespaced resources in other parts of the codebase (e.g. MUD config types, table names in the schemaful indexer). + + If you have a project using the `namespace` key in your `mud.config.ts` or are manually registering systems and function selectors on a namespace, you will likely need to codegen your system interfaces (`pnpm build`) and update any calls to these systems through the world's namespaced function signatures. + +- 063daf80: Previously `registerSystem` and `registerTable` had a side effect of registering namespaces if the system or table's namespace didn't exist yet. + This caused a possible frontrunning issue, where an attacker could detect a `registerSystem`/`registerTable` transaction in the mempool, + insert a `registerNamespace` transaction before it, grant themselves access to the namespace, transfer ownership of the namespace to the victim, + so that the `registerSystem`/`registerTable` transactions still went through successfully. + To mitigate this issue, the side effect of registering a namespace in `registerSystem` and `registerTable` has been removed. + Calls to these functions now expect the respective namespace to exist and the caller to own the namespace, otherwise they revert. + + Changes in consuming projects are only necessary if tables or systems are registered manually. + If only the MUD deployer is used to register tables and systems, no changes are necessary, as the MUD deployer has been updated accordingly. + + ```diff + + world.registerNamespace(namespaceId); + world.registerSystem(systemId, system, true); + ``` + + ```diff + + world.registerNamespace(namespaceId); + MyTable.register(); + ``` + +- 37c228c6: Refactored `ResourceId` to use a global Solidity `using` statement. +- 37c228c6: Refactored EIP165 usages to use the built-in interfaceId property instead of pre-defined constants. +- 37c228c6: Refactored various Solidity files to not explicitly initialise variables to zero. +- Updated dependencies [c6c13f2e] +- Updated dependencies [0f27afdd] +- Updated dependencies [865253db] +- Updated dependencies [e6c03a87] +- Updated dependencies [c207d35e] +- Updated dependencies [d00c4a9a] +- Updated dependencies [37c228c6] +- Updated dependencies [f6f40289] +- Updated dependencies [08b42217] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [063daf80] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [2bfee921] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [aee8020a] +- Updated dependencies [ad4ac445] +- Updated dependencies [57d8965d] +- Updated dependencies [e4a6189d] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [c642ff3a] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/world@2.0.0-next.16 + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/config@2.0.0-next.16 + - @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/world-modules/package.json b/packages/world-modules/package.json index df07b475d62..45505f1312d 100644 --- a/packages/world-modules/package.json +++ b/packages/world-modules/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/world-modules", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "World modules", "repository": { "type": "git", diff --git a/packages/world/CHANGELOG.md b/packages/world/CHANGELOG.md index 9c48d58f6a5..0c003715c3a 100644 --- a/packages/world/CHANGELOG.md +++ b/packages/world/CHANGELOG.md @@ -1,5 +1,87 @@ # Change Log +## 2.0.0-next.16 + +### Major Changes + +- 0f27afdd: World function signatures for namespaced systems have changed from `{namespace}_{systemName}_{functionName}` to `{namespace}__{functionName}` (double underscore, no system name). This is more ergonomic and is more consistent with namespaced resources in other parts of the codebase (e.g. MUD config types, table names in the schemaful indexer). + + If you have a project using the `namespace` key in your `mud.config.ts` or are manually registering systems and function selectors on a namespace, you will likely need to codegen your system interfaces (`pnpm build`) and update any calls to these systems through the world's namespaced function signatures. + +- 865253db: Refactored `InstalledModules` to key modules by addresses instead of pre-defined names. Previously, modules could report arbitrary names, meaning misconfigured modules could be installed under a name intended for another module. +- 063daf80: Previously `registerSystem` and `registerTable` had a side effect of registering namespaces if the system or table's namespace didn't exist yet. + This caused a possible frontrunning issue, where an attacker could detect a `registerSystem`/`registerTable` transaction in the mempool, + insert a `registerNamespace` transaction before it, grant themselves access to the namespace, transfer ownership of the namespace to the victim, + so that the `registerSystem`/`registerTable` transactions still went through successfully. + To mitigate this issue, the side effect of registering a namespace in `registerSystem` and `registerTable` has been removed. + Calls to these functions now expect the respective namespace to exist and the caller to own the namespace, otherwise they revert. + + Changes in consuming projects are only necessary if tables or systems are registered manually. + If only the MUD deployer is used to register tables and systems, no changes are necessary, as the MUD deployer has been updated accordingly. + + ```diff + + world.registerNamespace(namespaceId); + world.registerSystem(systemId, system, true); + ``` + + ```diff + + world.registerNamespace(namespaceId); + MyTable.register(); + ``` + +- 57d8965d: - Split `CoreSystem` into `AccessManagementSystem`, `BalanceTransferSystem`, `BatchCallSystem`, `CoreRegistrationSystem` + + - Changed `CoreModule` to receive the addresses of these systems as arguments, instead of deploying them + - Replaced `CORE_SYSTEM_ID` constant with `ACCESS_MANAGEMENT_SYSTEM_ID`, `BALANCE_TRANSFER_SYSTEM_ID`, `BATCH_CALL_SYSTEM_ID`, `CORE_REGISTRATION_SYSTEM_ID`, for each respective system + + These changes separate the initcode of `CoreModule` from the bytecode of core systems, which effectively removes a limit on the total bytecode of all core systems. + +- c642ff3a: Namespaces are not allowed to contain double underscores ("\_\_") anymore, as this sequence of characters is used to [separate the namespace and function selector](https://github.com/latticexyz/mud/pull/2168) in namespaced systems. + This is to prevent signature clashes of functions in different namespaces. + + (Example: If namespaces were allowed to contain this separator string, a function "function" in namespace "namespace\_\_my" would result in the namespaced function selector "namespace\_\_my\_\_function", + and would clash with a function "my\_\_function" in namespace "namespace".) + +### Patch Changes + +- e6c03a87: Renamed the `requireNoCallback` modifier to `prohibitDirectCallback`. +- c207d35e: Optimised `StoreRegistrationSystem` and `WorldRegistrationSystem` by fetching individual fields instead of entire records where possible. +- d00c4a9a: Removed `ROOT_NAMESPACE_STRING` and `ROOT_NAME_STRING` exports in favor of inlining these constants, to avoid reuse as they're meant for internal error messages and debugging. +- 37c228c6: Refactored various files to specify integers in a hex base instead of decimals. +- f6f40289: Added the WorldContextConsumer interface ID to `supportsInterface` in the Module contract. +- 08b42217: Systems are expected to be always called via the central World contract. + Depending on whether it is a root or non-root system, the call is performed via `delegatecall` or `call`. + Since Systems are expected to be stateless and only interact with the World state, it is not necessary to prevent direct calls to the systems. + However, since the `CoreSystem` is known to always be registered as a root system in the World, it is always expected to be delegatecalled, + so we made this expectation explicit by reverting if it is not delegatecalled. +- 37c228c6: Made the `coreModule` variable in `WorldFactory` immutable. +- 37c228c6: Removed the unnecessary `extcodesize` check from the `Create2` library. +- 37c228c6: Refactored `ResourceId` to use a global Solidity `using` statement. +- 37c228c6: Refactored EIP165 usages to use the built-in interfaceId property instead of pre-defined constants. +- 2bfee921: Added a table to track the `CoreModule` address the world was initialised with. +- aee8020a: Namespace balances can no longer be transferred to non-existent namespaces. +- e4a6189d: Prevented invalid delegations by performing full validation regardless of whether `initCallData` is empty. Added an `unregisterDelegation` function which allows explicit unregistration, as opposed of passing in zero bytes into `registerDelegation`. +- 37c228c6: Refactored various Solidity files to not explicitly initialise variables to zero. +- 37c228c6: Refactored `WorldContext` to get the world address from `WorldContextConsumerLib` instead of `StoreSwitch`. +- Updated dependencies [c6c13f2e] +- Updated dependencies [e6c03a87] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [7b28d32e] +- Updated dependencies [9f8b84e7] +- Updated dependencies [ad4ac445] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [37c228c6] +- Updated dependencies [3ac68ade] +- Updated dependencies [37c228c6] +- Updated dependencies [103f635e] + - @latticexyz/store@2.0.0-next.16 + - @latticexyz/common@2.0.0-next.16 + - @latticexyz/config@2.0.0-next.16 + - @latticexyz/schema-type@2.0.0-next.16 + ## 2.0.0-next.15 ### Patch Changes diff --git a/packages/world/package.json b/packages/world/package.json index d19d01d1d6a..65cd8e2ac7f 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/world", - "version": "2.0.0-next.15", + "version": "2.0.0-next.16", "description": "World framework", "repository": { "type": "git",