diff --git a/.changeset/pre.json b/.changeset/pre.json index 706fa14f17..88e04ea614 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -36,9 +36,13 @@ "changesets": [ "afraid-hotels-bathe", "angry-ladybugs-invent", + "angry-peas-heal", + "angry-pigs-compare", "beige-badgers-smile", "beige-radios-drop", + "beige-rockets-return", "big-goats-prove", + "blue-forks-move", "blue-seals-relate", "brave-islands-wash", "brave-needles-love", @@ -53,6 +57,7 @@ "chilled-cougars-smash", "chilled-kangaroos-dream", "chilly-kangaroos-clap", + "clean-bananas-hug", "clever-icons-cough", "clever-items-appear", "clever-rats-sip", @@ -64,6 +69,7 @@ "cyan-baboons-breathe", "cyan-hats-try", "cyan-timers-tan", + "cyan-vans-pay", "dirty-items-retire", "dry-chicken-love", "eight-deers-confess", @@ -71,9 +77,13 @@ "eighty-tigers-argue", "empty-planes-kiss", "empty-starfishes-lick", + "fair-baboons-compare", "fair-buckets-dress", + "fair-bulldogs-decide", + "fair-pillows-poke", "famous-carrots-marry", "fast-ears-hug", + "fast-pandas-explain", "fast-zebras-drum", "fast-zebras-promise", "few-brooms-accept", @@ -84,17 +94,23 @@ "fifty-suits-itch", "fifty-suits-shout", "flat-trainers-marry", + "fluffy-days-carry", "fluffy-moles-march", "four-coats-pull", + "four-hotels-serve", "fresh-scissors-unite", + "fresh-seals-compare", "funny-paws-admire", "fuzzy-cars-stare", + "fuzzy-chefs-wait", + "fuzzy-wombats-dream", "giant-masks-carry", "gold-rings-switch", "gorgeous-swans-hide", "great-cooks-dream", "grumpy-files-heal", "grumpy-geckos-raise", + "grumpy-icons-sleep", "happy-pants-try", "heavy-eyes-smile", "heavy-rings-punch", @@ -105,13 +121,17 @@ "hungry-rings-doubt", "itchy-kids-relax", "itchy-shoes-appear", + "khaki-cars-suffer", "khaki-doors-refuse", "khaki-houses-whisper", + "khaki-months-add", "large-drinks-sell", "large-hats-walk", "large-hounds-type", "large-nails-suffer", + "large-schools-grow", "large-sloths-camp", + "late-cobras-ring", "late-geese-guess", "late-spies-cover", "lazy-ladybugs-return", @@ -119,6 +139,7 @@ "light-bananas-deny", "little-ravens-yawn", "long-lizards-admire", + "long-tips-marry", "loud-mayflies-divide", "lovely-bobcats-joke", "lovely-buses-boil", @@ -134,6 +155,7 @@ "metal-pots-notice", "metal-wombats-judge", "mighty-eels-type", + "mighty-years-whisper", "modern-bikes-build", "modern-hornets-jam", "modern-stingrays-kneel", @@ -149,6 +171,8 @@ "nice-glasses-begin", "nice-moose-love", "nice-pandas-knock", + "ninety-lions-double", + "odd-bags-compete", "olive-foxes-shop", "olive-parrots-move", "olive-pigs-fold", @@ -160,6 +184,8 @@ "plenty-guests-hunt", "plenty-rules-pull", "poor-bags-stare", + "poor-beans-beg", + "poor-waves-occur", "popular-coins-invent", "pretty-hotels-drop", "proud-insects-perform", @@ -178,7 +204,10 @@ "red-falcons-do", "red-sheep-confess", "red-turkeys-develop", + "rich-carpets-remember", + "rich-experts-hope", "rich-rockets-jog", + "rich-worms-deliver", "rotten-beers-learn", "rotten-cats-lay", "rude-cycles-travel", @@ -188,6 +217,7 @@ "seven-flies-chew", "seven-mangos-roll", "seven-points-mate", + "seven-rice-dance", "sharp-falcons-tie", "sharp-worms-kneel", "short-ads-jog", @@ -201,22 +231,27 @@ "silver-dolls-shave", "silver-mangos-thank", "silver-nails-explain", + "silver-wasps-count", "six-cats-agree", "six-kangaroos-sneeze", "sixty-crabs-itch", "slimy-glasses-tickle", "small-boxes-rush", + "small-brooms-prove", "small-chicken-repair", "small-dots-poke", "small-pots-press", + "smart-fireants-play", "smooth-elephants-wave", "smooth-pots-nail", "soft-boxes-smile", "soft-dryers-invite", "soft-fans-wink", "sour-cycles-warn", + "sour-rivers-grow", "spicy-bees-teach", "spotty-cups-destroy", + "spotty-geese-yawn", "spotty-sheep-warn", "stale-cooks-reflect", "stale-schools-wait", @@ -229,6 +264,9 @@ "sweet-kiwis-unite", "tall-buses-kick", "tame-lemons-play", + "tasty-balloons-collect", + "tasty-cows-pay", + "thick-masks-wait", "thin-buses-reply", "thin-chairs-compare", "thin-rice-trade", @@ -236,11 +274,14 @@ "thirty-cups-provide", "three-lizards-shave", "three-scissors-smile", + "tiny-lions-listen", "tough-flowers-breathe", + "tough-moose-pay", "tricky-beds-kiss", "tricky-carrots-talk", "tricky-comics-remain", "tricky-frogs-beam", + "tricky-gifts-compare", "tricky-kangaroos-love", "tricky-olives-stare", "tricky-oranges-pump", @@ -252,16 +293,22 @@ "unlucky-guests-cover", "violet-insects-press", "weak-mails-cross", + "wet-crabs-punch", "wicked-cheetahs-cough", + "wicked-donuts-cheat", "wicked-pens-promise", "wicked-squids-do", "wicked-tigers-return", "wild-gorillas-care", + "wild-moose-smile", "wild-nails-wonder", "wild-squids-bathe", + "wild-years-search", "wise-cheetahs-add", "witty-jokes-serve", "witty-tigers-rest", - "young-crabs-rest" + "yellow-bags-learn", + "young-crabs-rest", + "young-pandas-explode" ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1474fc41e3..85c776c8f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,279 @@ +## Version 2.0.0-next.15 + +Release date: Wed Jan 03 2024 + +### Major changes + +**[fix(store-sync,store-indexer): make last updated block number not null (#1972)](https://github.com/latticexyz/mud/commit/504e25dc83a210a1ef3b66d8487d9e292470620c)** (@latticexyz/store-sync) + +`lastUpdatedBlockNumber` columns in Postgres storage adapters are no longer nullable + +**[feat(store-indexer): clean database if outdated (#1984)](https://github.com/latticexyz/mud/commit/e48fb3b037d2ee888a8c61a6fc51721c903559e3)** (@latticexyz/store-sync) + +Renamed singleton `chain` table to `config` table for clarity. + +**[feat(store-sync, store-indexer): order logs by logIndex (#2037)](https://github.com/latticexyz/mud/commit/85b94614b83cd0964a305d488c1efb247445b915)** (@latticexyz/store-indexer, @latticexyz/store-sync) + +The postgres indexer is now storing the `logIndex` of the last update of a record to be able to return the snapshot logs in the order they were emitted onchain. + +**[feat(store-sync): fetch and store logs (#2003)](https://github.com/latticexyz/mud/commit/a4aff73c538265ecfd2a17ecf98edcaa6a2ef935)** (@latticexyz/store-sync) + +Previously, all `store-sync` strategies were susceptible to a potential memory leak where the stream that fetches logs from the RPC would get ahead of the stream that stores the logs in the provided storage adapter. We saw this most often when syncing to remote Postgres servers, where inserting records was much slower than we retrieving them from the RPC. In these cases, the stream would build up a backlog of items until the machine ran out of memory. + +This is now fixed by waiting for logs to be stored before fetching the next batch of logs from the RPC. To make this strategy work, we no longer return `blockLogs$` (stream of logs fetched from RPC but before they're stored) and instead just return `storedBlockLogs$` (stream of logs fetched from RPC after they're stored). + +**[feat(store-sync,store-indexer): schemaless indexer (#1965)](https://github.com/latticexyz/mud/commit/1b5eb0d075579d2437b4329266ca37735e65ce41)** (@latticexyz/store-sync) + +`syncToPostgres` from `@latticexyz/store-sync/postgres` now uses a single table to store all records in their bytes form (`staticData`, `encodedLengths`, and `dynamicData`), more closely mirroring onchain state and enabling more scalability and stability for automatic indexing of many worlds. + +The previous behavior, where schemaful SQL tables are created and populated for each MUD table, has been moved to a separate `@latticexyz/store-sync/postgres-decoded` export bundle. This approach is considered less stable and is intended to be used for analytics purposes rather than hydrating clients. Some previous metadata columns on these tables have been removed in favor of the bytes records table as the source of truth for onchain state. + +This overhaul is considered breaking and we recommend starting a fresh database when syncing with either of these strategies. + +**[feat(store-sync): snake case postgres names in decoded tables (#1989)](https://github.com/latticexyz/mud/commit/7b73f44d98dd25483c037e76d174e30e99488bd3)** (@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-sync,store-indexer): sync from getLogs indexer endpoint (#1973)](https://github.com/latticexyz/mud/commit/5df1f31bc9d35969de6f03396905778748017f38)** (@latticexyz/store-sync) + +Refactored how we fetch snapshots from an indexer, preferring the new `getLogs` endpoint and falling back to the previous `findAll` if it isn't available. This refactor also prepares for an easier entry point for adding client caching of snapshots. + +The `initialState` option for various sync methods (`syncToPostgres`, `syncToRecs`, etc.) is now deprecated in favor of `initialBlockLogs`. For now, we'll automatically convert `initialState` into `initialBlockLogs`, but if you want to update your code, you can do: + +```ts +import { tablesWithRecordsToLogs } from "@latticexyz/store-sync"; + +const initialBlockLogs = { + blockNumber: initialState.blockNumber, + logs: tablesWithRecordsToLogs(initialState.tables), +}; +``` + +**[feat(create-mud): remove window global usage in vanilla template (#1774)](https://github.com/latticexyz/mud/commit/f6133591a86eb169a7b1b2b8d342733a887af610)** (create-mud) + +Replaced usage of `window` global in vanilla JS template with an event listener on the button. + +**[feat(cli): add build command (#1990)](https://github.com/latticexyz/mud/commit/59d78c93ba80d20e5d7c4f47b9fe24575bcdc8cd)** (@latticexyz/cli) + +Added a `mud build` command that generates table libraries, system interfaces, and typed ABIs. + +**[feat(store-sync,store-indexer): schemaless indexer (#1965)](https://github.com/latticexyz/mud/commit/1b5eb0d075579d2437b4329266ca37735e65ce41)** (@latticexyz/common) + +Added `unique` and `groupBy` array helpers to `@latticexyz/common/utils`. + +```ts +import { unique } from "@latticexyz/common/utils"; + +unique([1, 2, 1, 4, 3, 2]); +// [1, 2, 4, 3] +``` + +```ts +import { groupBy } from "@latticexyz/common/utils"; + +const records = [ + { type: "cat", name: "Bob" }, + { type: "cat", name: "Spot" }, + { type: "dog", name: "Rover" }, +]; +Object.fromEntries(groupBy(records, (record) => record.type)); +// { +// "cat": [{ type: "cat", name: "Bob" }, { type: "cat", name: "Spot" }], +// "dog: [{ type: "dog", name: "Rover" }] +// } +``` + +**[feat(store-sync,store-indexer): schemaless indexer (#1965)](https://github.com/latticexyz/mud/commit/1b5eb0d075579d2437b4329266ca37735e65ce41)** (@latticexyz/store-indexer) + +The `findAll` method is now considered deprecated in favor of a new `getLogs` method. This is only implemented in the Postgres indexer for now, with SQLite coming soon. The new `getLogs` method will be an easier and more robust data source to hydrate the client and other indexers and will allow us to add streaming updates from the indexer in the near future. + +For backwards compatibility, `findAll` is now implemented on top of `getLogs`, with record key/value decoding done in memory at request time. This may not scale for large databases, so use wisely. + +**[feat(store-indexer): clean database if outdated (#1984)](https://github.com/latticexyz/mud/commit/e48fb3b037d2ee888a8c61a6fc51721c903559e3)** (@latticexyz/store-indexer) + +When the Postgres indexer starts up, it will now attempt to detect if the database is outdated and, if so, cleans up all MUD-related schemas and tables before proceeding. + +**[feat(store-indexer, store-sync): improve query performance and enable compression, add new api (#2026)](https://github.com/latticexyz/mud/commit/4c1dcd81eae44c37f66bd80871daf02834c04fb5)** (@latticexyz/common) + +- Added a `Result` type for more explicit and typesafe error handling ([inspired by Rust](https://doc.rust-lang.org/std/result/)). + +- Added a `includes` util as typesafe alternative to [`Array.prototype.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes). + +**[docs: add changeset for zustand sync progress (#1931)](https://github.com/latticexyz/mud/commit/7eabd06f7af9748aba842d116f1dcd0ef5635999)** (@latticexyz/store-sync) + +Added and populated `syncProgress` key in Zustand store for sync progress, like we do for RECS sync. This will let apps using `syncToZustand` render a loading state while initial client hydration is in progress. + +```tsx +const syncProgress = useStore((state) => state.syncProgress); + +if (syncProgress.step !== SyncStep.LIVE) { + return <>Loading ({Math.floor(syncProgress.percentage)}%); +} +``` + +**[feat(store-sync,store-indexer): sync from getLogs indexer endpoint (#1973)](https://github.com/latticexyz/mud/commit/5df1f31bc9d35969de6f03396905778748017f38)** (@latticexyz/common) + +Updated `chunk` types to use readonly arrays + +**[feat(store-sync,store-indexer): sync from getLogs indexer endpoint (#1973)](https://github.com/latticexyz/mud/commit/5df1f31bc9d35969de6f03396905778748017f38)** (@latticexyz/store-indexer) + +Added `getLogs` query support to sqlite indexer + +**[feat(store-indexer, store-sync): improve query performance and enable compression, add new api (#2026)](https://github.com/latticexyz/mud/commit/4c1dcd81eae44c37f66bd80871daf02834c04fb5)** (@latticexyz/store-indexer, @latticexyz/store-sync) + +- Improved query performance by 10x by moving from drizzle ORM to handcrafted SQL. +- Moved away from `trpc` for more granular control over the transport layer. + Added an `/api/logs` endpoint using the new query and gzip compression for 40x less data transferred over the wire. + Deprecated the `/trpc/getLogs` and `/trpc/findAll` endpoints. +- Added a `createIndexerClient` client for the new `/api` indexer API exported from `@latticexyz/store-sync/indexer-client`. + The `createIndexerClient` export from `@latticexyz/store-sync/trpc-indexer` is deprecated. + +```diff +- import { createIndexerClient } from "@latticexyz/store-sync/trpc-indexer"; ++ import { createIndexerClient } from "@latticexyz/store-sync/indexer-client"; + +- const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz/trpc" }); ++ const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz" }); + +- const snapshot = indexer.getLogs.query(options); ++ const snapshot = indexer.getLogs(options); +``` + +**[feat(store-indexer): return a "not found" error when no snapshot is found for a `/api/logs` request (#2043)](https://github.com/latticexyz/mud/commit/f61b4bc0903d09c4c71f01270012953adee50701)** (@latticexyz/store-indexer) + +The `/api/logs` indexer endpoint is now returning a `404` snapshot not found error when no snapshot is found for the provided filter instead of an empty `200` response. + +**[fix(cli): add worldAddress to dev-contracts (#1892)](https://github.com/latticexyz/mud/commit/1feecf4955462554c650f56e4777aa330e31f667)** (@latticexyz/store-indexer) + +Added `STORE_ADDRESS` environment variable to index only a specific MUD Store. + +### Patch changes + +**[fix(store,world): exclude ERC165 interface ID from custom interface ID's [L-06] (#2014)](https://github.com/latticexyz/mud/commit/d8c8f66bfd403994216e856d5e92368f7a63be38)** (@latticexyz/store, @latticexyz/world) + +Exclude ERC165 interface ID from custom interface ID's. + +**[fix(store-sync,store-indexer): make last updated block number not null (#1972)](https://github.com/latticexyz/mud/commit/504e25dc83a210a1ef3b66d8487d9e292470620c)** (@latticexyz/store-indexer) + +Records are now ordered by `lastUpdatedBlockNumber` at the Postgres SQL query level + +**[fix(store): slice4 output should be bytes4 [M-03] (#2031)](https://github.com/latticexyz/mud/commit/1b86eac0530d069ff267f6fee8d6a71d6bbb365b)** (@latticexyz/store) + +Changed the type of the output variable in the `slice4` function to `bytes4`. + +**[fix(cli): mud set-version --link shouldn't fetch versions (#2000)](https://github.com/latticexyz/mud/commit/854de0761fd3744c2076a2b995f0f9274a8ef971)** (@latticexyz/cli) + +Using `mud set-version --link` will no longer attempt to fetch the latest version from npm. + +**[fix(store,world): fix mud config TS errors (#1974)](https://github.com/latticexyz/mud/commit/1077c7f53b6c0d6ea7663fe2722b0e768d407741)** (@latticexyz/store, @latticexyz/world) + +Fixed an issue where `mud.config.ts` source file was not included in the package, causing TS errors downstream. + +**[feat(store-indexer): command to run decoded indexer (#2001)](https://github.com/latticexyz/mud/commit/b00550cef2a3824dd38122a16b6e768bd88f9357)** (@latticexyz/store-indexer) + +Added a script to run the decoded postgres indexer. + +**[chore(store-indexer, store-sync): add explicit error logs (#2045)](https://github.com/latticexyz/mud/commit/0a3b9b1c9c821b153cb07281b585feb006ec621e)** (@latticexyz/store-indexer, @latticexyz/store-sync) + +Added explicit error logs for unexpected situations. +Previously all `debug` logs were going to `stderr`, which made it hard to find the unexpected errors. +Now `debug` logs go to `stdout` and we can add explicit `stderr` logs. + +**[chore(common): log benchmark to stderr (#2047)](https://github.com/latticexyz/mud/commit/933b54b5fcdd9400e21e8e0114bb4c691e830fec)** (@latticexyz/common) + +The benchmark util now logs to `stdout` instead of `stderr`. + +**[chore(world): add explicit visibility to coreSystem [N-07] (#2029)](https://github.com/latticexyz/mud/commit/f8dab7334d41d1a53dfad0bbd13a1bbe6fc0cbf8)** (@latticexyz/world) + +Added explicit `internal` visibility to the `coreSystem` variable in `CoreModule`. + +**[fix(world,world-modules): requireInterface correctly specifies ERC165 [M-02] (#2016)](https://github.com/latticexyz/mud/commit/1a0fa7974b493258c7fc8f0708c442ed548e227e)** (@latticexyz/world) + +Fixed `requireInterface` to correctly specify ERC165. + +**[feat(world): add isInstalled to Module (#2056)](https://github.com/latticexyz/mud/commit/eb384bb0e073b1261b8ab92bc74c32ec4956c886)** (@latticexyz/world-modules, @latticexyz/world) + +Added `isInstalled` and `requireNotInstalled` helpers to `Module` base contract. + +**[fix(store-sync): create table registration logs from indexer records (#1919)](https://github.com/latticexyz/mud/commit/712866f5fb392a4e39b59cd4565da61adc3c005f)** (@latticexyz/store-sync) + +`createStoreSync` now correctly creates table registration logs from indexer records. + +**[chore(store-indexer): setup Sentry middleware in indexer (#2054)](https://github.com/latticexyz/mud/commit/85d16e48b6b3d15fe895dba550fb8d176481e1cd)** (@latticexyz/store-indexer) + +Added a Sentry middleware and `SENTRY_DNS` environment variable to the postgres indexer. + +**[fix(world): register FunctionSignatures table [L-01] (#1841)](https://github.com/latticexyz/mud/commit/e5a962bc31086fc4c13bbb4aa049b7a14599b11d)** (@latticexyz/world) + +`World` now correctly registers the `FunctionSignatures` table. + +**[feat(store-indexer): replace fastify with koa (#2006)](https://github.com/latticexyz/mud/commit/c314badd13412a7a96692046b0402a00988994f1)** (@latticexyz/store-indexer) + +Replaced Fastify with Koa for store-indexer frontends + +**[fix(create-mud): include `.gitignore` files in created projects (#1945)](https://github.com/latticexyz/mud/commit/6963a9e85ea97b47be2edd199afa98100f728cf1)** (create-mud) + +Templates now correctly include their respective `.gitignore` files + +**[fix(cli): always rebuild IWorld ABI (#1929)](https://github.com/latticexyz/mud/commit/2699630c0e0c2027f331a9defe7f90a8968f7b3d)** (@latticexyz/cli) + +Deploys will now always rebuild `IWorld.sol` interface (a workaround for https://github.com/foundry-rs/foundry/issues/6241) + +**[build: allow use by TypeScript projects with `bundler`/`node16` config (#2084)](https://github.com/latticexyz/mud/commit/590542030e7500f8d3cce6e54e4961d9f8a1a6d5)** (@latticexyz/abi-ts, @latticexyz/block-logs-stream, @latticexyz/common, @latticexyz/config, @latticexyz/dev-tools, @latticexyz/faucet, @latticexyz/gas-report, @latticexyz/noise, @latticexyz/phaserx, @latticexyz/protocol-parser, @latticexyz/react, @latticexyz/recs, @latticexyz/schema-type, @latticexyz/services, @latticexyz/store-sync, @latticexyz/store, @latticexyz/utils, @latticexyz/world-modules, @latticexyz/world) + +TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + +**[fix(store): onBeforeSpliceDynamicData receives the previous encoded lengths [M-01] (#2020)](https://github.com/latticexyz/mud/commit/6db95ce15e1c51422ca0494883210105c3e742ba)** (@latticexyz/store) + +Fixed `StoreCore` to pass `previousEncodedLengths` into `onBeforeSpliceDynamicData`. + +**[fix(store-indexer): disable prepared statements (#2058)](https://github.com/latticexyz/mud/commit/392c4b88d033d2d175541b974189a3f4da49e335)** (@latticexyz/store-indexer) + +Disabled prepared statements for the postgres indexer, which led to issues in combination with `pgBouncer`. + +**[chore: pipe debug logs to stdout, add separate util to pipe to stderr (#2044)](https://github.com/latticexyz/mud/commit/5d737cf2e7a1a305d7ef0bee99c07c17d80233c8)** (@latticexyz/abi-ts, @latticexyz/block-logs-stream, @latticexyz/cli, @latticexyz/common, @latticexyz/faucet, @latticexyz/store-indexer, @latticexyz/store-sync, @latticexyz/store) + +Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. + +**[chore(store-indexer): stringify filter in error log (#2048)](https://github.com/latticexyz/mud/commit/5ab67e3350bd08d15fbbe28c498cec62d2aaa116)** (@latticexyz/store-indexer) + +The error log if no data is found in `/api/logs` is now stringifying the filter instead of logging `[object Object]`. + +**[fix(store): fix potential memory corruption [M-04] (#1978)](https://github.com/latticexyz/mud/commit/5ac4c97f43756e3fca4ab01f6c881822100fa56d)** (@latticexyz/store) + +Fixed M-04 Memory Corruption on Load From Storage +It only affected external use of `Storage.load` with a `memoryPointer` argument + +**[chore(store,world): remove unused imports [N-05] (#2028)](https://github.com/latticexyz/mud/commit/e481717413a280e830b33b44a16c8c2475452b07)** (@latticexyz/store, @latticexyz/world) + +Removed unused imports from various files in the `store` and `world` packages. + +**[fix(store-indexer): add postgres-decoded-indexer binary (#2062)](https://github.com/latticexyz/mud/commit/735d957c6906e896e3e496158b9afd35da4688d4)** (@latticexyz/store-indexer) + +Added a binary for the `postgres-decoded` indexer. + +**[fix(world-modules): rename token address fields (#1986)](https://github.com/latticexyz/mud/commit/747d8d1b819882c1f84b8029fd4ade669f772322)** (@latticexyz/world-modules) + +Renamed token address fields in ERC20 and ERC721 modules to `tokenAddress` + +**[fix(react): trigger useComponentValue on deleted records (#1959)](https://github.com/latticexyz/mud/commit/9ef3f9a7c2ea52778027fb61988f876b590b22b0)** (@latticexyz/react) + +Fixed an issue where `useComponentValue` would not detect a change and re-render if the component value was immediately removed. + +**[fix(store-sync): use dynamic data in postgres decoded indexer (#1983)](https://github.com/latticexyz/mud/commit/34203e4ed88c2aa79f994b99a96be4fcff21ca06)** (@latticexyz/store-sync) + +Fixed invalid value when decoding records in `postgres-decoded` storage adapter + +**[fix(faucet): use MUD's sendTransaction for better nonce handling (#2080)](https://github.com/latticexyz/mud/commit/9082c179c5a1907cc79ec95543664e63fc327bb4)** (@latticexyz/faucet) + +Updated to use MUD's `sendTransaction`, which does a better of managing nonces for higher volumes of transactions. + +--- + ## Version 2.0.0-next.14 Release date: Fri Nov 10 2023 diff --git a/docs/pages/changelog.mdx b/docs/pages/changelog.mdx index 1474fc41e3..85c776c8f9 100644 --- a/docs/pages/changelog.mdx +++ b/docs/pages/changelog.mdx @@ -1,3 +1,279 @@ +## Version 2.0.0-next.15 + +Release date: Wed Jan 03 2024 + +### Major changes + +**[fix(store-sync,store-indexer): make last updated block number not null (#1972)](https://github.com/latticexyz/mud/commit/504e25dc83a210a1ef3b66d8487d9e292470620c)** (@latticexyz/store-sync) + +`lastUpdatedBlockNumber` columns in Postgres storage adapters are no longer nullable + +**[feat(store-indexer): clean database if outdated (#1984)](https://github.com/latticexyz/mud/commit/e48fb3b037d2ee888a8c61a6fc51721c903559e3)** (@latticexyz/store-sync) + +Renamed singleton `chain` table to `config` table for clarity. + +**[feat(store-sync, store-indexer): order logs by logIndex (#2037)](https://github.com/latticexyz/mud/commit/85b94614b83cd0964a305d488c1efb247445b915)** (@latticexyz/store-indexer, @latticexyz/store-sync) + +The postgres indexer is now storing the `logIndex` of the last update of a record to be able to return the snapshot logs in the order they were emitted onchain. + +**[feat(store-sync): fetch and store logs (#2003)](https://github.com/latticexyz/mud/commit/a4aff73c538265ecfd2a17ecf98edcaa6a2ef935)** (@latticexyz/store-sync) + +Previously, all `store-sync` strategies were susceptible to a potential memory leak where the stream that fetches logs from the RPC would get ahead of the stream that stores the logs in the provided storage adapter. We saw this most often when syncing to remote Postgres servers, where inserting records was much slower than we retrieving them from the RPC. In these cases, the stream would build up a backlog of items until the machine ran out of memory. + +This is now fixed by waiting for logs to be stored before fetching the next batch of logs from the RPC. To make this strategy work, we no longer return `blockLogs$` (stream of logs fetched from RPC but before they're stored) and instead just return `storedBlockLogs$` (stream of logs fetched from RPC after they're stored). + +**[feat(store-sync,store-indexer): schemaless indexer (#1965)](https://github.com/latticexyz/mud/commit/1b5eb0d075579d2437b4329266ca37735e65ce41)** (@latticexyz/store-sync) + +`syncToPostgres` from `@latticexyz/store-sync/postgres` now uses a single table to store all records in their bytes form (`staticData`, `encodedLengths`, and `dynamicData`), more closely mirroring onchain state and enabling more scalability and stability for automatic indexing of many worlds. + +The previous behavior, where schemaful SQL tables are created and populated for each MUD table, has been moved to a separate `@latticexyz/store-sync/postgres-decoded` export bundle. This approach is considered less stable and is intended to be used for analytics purposes rather than hydrating clients. Some previous metadata columns on these tables have been removed in favor of the bytes records table as the source of truth for onchain state. + +This overhaul is considered breaking and we recommend starting a fresh database when syncing with either of these strategies. + +**[feat(store-sync): snake case postgres names in decoded tables (#1989)](https://github.com/latticexyz/mud/commit/7b73f44d98dd25483c037e76d174e30e99488bd3)** (@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-sync,store-indexer): sync from getLogs indexer endpoint (#1973)](https://github.com/latticexyz/mud/commit/5df1f31bc9d35969de6f03396905778748017f38)** (@latticexyz/store-sync) + +Refactored how we fetch snapshots from an indexer, preferring the new `getLogs` endpoint and falling back to the previous `findAll` if it isn't available. This refactor also prepares for an easier entry point for adding client caching of snapshots. + +The `initialState` option for various sync methods (`syncToPostgres`, `syncToRecs`, etc.) is now deprecated in favor of `initialBlockLogs`. For now, we'll automatically convert `initialState` into `initialBlockLogs`, but if you want to update your code, you can do: + +```ts +import { tablesWithRecordsToLogs } from "@latticexyz/store-sync"; + +const initialBlockLogs = { + blockNumber: initialState.blockNumber, + logs: tablesWithRecordsToLogs(initialState.tables), +}; +``` + +**[feat(create-mud): remove window global usage in vanilla template (#1774)](https://github.com/latticexyz/mud/commit/f6133591a86eb169a7b1b2b8d342733a887af610)** (create-mud) + +Replaced usage of `window` global in vanilla JS template with an event listener on the button. + +**[feat(cli): add build command (#1990)](https://github.com/latticexyz/mud/commit/59d78c93ba80d20e5d7c4f47b9fe24575bcdc8cd)** (@latticexyz/cli) + +Added a `mud build` command that generates table libraries, system interfaces, and typed ABIs. + +**[feat(store-sync,store-indexer): schemaless indexer (#1965)](https://github.com/latticexyz/mud/commit/1b5eb0d075579d2437b4329266ca37735e65ce41)** (@latticexyz/common) + +Added `unique` and `groupBy` array helpers to `@latticexyz/common/utils`. + +```ts +import { unique } from "@latticexyz/common/utils"; + +unique([1, 2, 1, 4, 3, 2]); +// [1, 2, 4, 3] +``` + +```ts +import { groupBy } from "@latticexyz/common/utils"; + +const records = [ + { type: "cat", name: "Bob" }, + { type: "cat", name: "Spot" }, + { type: "dog", name: "Rover" }, +]; +Object.fromEntries(groupBy(records, (record) => record.type)); +// { +// "cat": [{ type: "cat", name: "Bob" }, { type: "cat", name: "Spot" }], +// "dog: [{ type: "dog", name: "Rover" }] +// } +``` + +**[feat(store-sync,store-indexer): schemaless indexer (#1965)](https://github.com/latticexyz/mud/commit/1b5eb0d075579d2437b4329266ca37735e65ce41)** (@latticexyz/store-indexer) + +The `findAll` method is now considered deprecated in favor of a new `getLogs` method. This is only implemented in the Postgres indexer for now, with SQLite coming soon. The new `getLogs` method will be an easier and more robust data source to hydrate the client and other indexers and will allow us to add streaming updates from the indexer in the near future. + +For backwards compatibility, `findAll` is now implemented on top of `getLogs`, with record key/value decoding done in memory at request time. This may not scale for large databases, so use wisely. + +**[feat(store-indexer): clean database if outdated (#1984)](https://github.com/latticexyz/mud/commit/e48fb3b037d2ee888a8c61a6fc51721c903559e3)** (@latticexyz/store-indexer) + +When the Postgres indexer starts up, it will now attempt to detect if the database is outdated and, if so, cleans up all MUD-related schemas and tables before proceeding. + +**[feat(store-indexer, store-sync): improve query performance and enable compression, add new api (#2026)](https://github.com/latticexyz/mud/commit/4c1dcd81eae44c37f66bd80871daf02834c04fb5)** (@latticexyz/common) + +- Added a `Result` type for more explicit and typesafe error handling ([inspired by Rust](https://doc.rust-lang.org/std/result/)). + +- Added a `includes` util as typesafe alternative to [`Array.prototype.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes). + +**[docs: add changeset for zustand sync progress (#1931)](https://github.com/latticexyz/mud/commit/7eabd06f7af9748aba842d116f1dcd0ef5635999)** (@latticexyz/store-sync) + +Added and populated `syncProgress` key in Zustand store for sync progress, like we do for RECS sync. This will let apps using `syncToZustand` render a loading state while initial client hydration is in progress. + +```tsx +const syncProgress = useStore((state) => state.syncProgress); + +if (syncProgress.step !== SyncStep.LIVE) { + return <>Loading ({Math.floor(syncProgress.percentage)}%); +} +``` + +**[feat(store-sync,store-indexer): sync from getLogs indexer endpoint (#1973)](https://github.com/latticexyz/mud/commit/5df1f31bc9d35969de6f03396905778748017f38)** (@latticexyz/common) + +Updated `chunk` types to use readonly arrays + +**[feat(store-sync,store-indexer): sync from getLogs indexer endpoint (#1973)](https://github.com/latticexyz/mud/commit/5df1f31bc9d35969de6f03396905778748017f38)** (@latticexyz/store-indexer) + +Added `getLogs` query support to sqlite indexer + +**[feat(store-indexer, store-sync): improve query performance and enable compression, add new api (#2026)](https://github.com/latticexyz/mud/commit/4c1dcd81eae44c37f66bd80871daf02834c04fb5)** (@latticexyz/store-indexer, @latticexyz/store-sync) + +- Improved query performance by 10x by moving from drizzle ORM to handcrafted SQL. +- Moved away from `trpc` for more granular control over the transport layer. + Added an `/api/logs` endpoint using the new query and gzip compression for 40x less data transferred over the wire. + Deprecated the `/trpc/getLogs` and `/trpc/findAll` endpoints. +- Added a `createIndexerClient` client for the new `/api` indexer API exported from `@latticexyz/store-sync/indexer-client`. + The `createIndexerClient` export from `@latticexyz/store-sync/trpc-indexer` is deprecated. + +```diff +- import { createIndexerClient } from "@latticexyz/store-sync/trpc-indexer"; ++ import { createIndexerClient } from "@latticexyz/store-sync/indexer-client"; + +- const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz/trpc" }); ++ const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz" }); + +- const snapshot = indexer.getLogs.query(options); ++ const snapshot = indexer.getLogs(options); +``` + +**[feat(store-indexer): return a "not found" error when no snapshot is found for a `/api/logs` request (#2043)](https://github.com/latticexyz/mud/commit/f61b4bc0903d09c4c71f01270012953adee50701)** (@latticexyz/store-indexer) + +The `/api/logs` indexer endpoint is now returning a `404` snapshot not found error when no snapshot is found for the provided filter instead of an empty `200` response. + +**[fix(cli): add worldAddress to dev-contracts (#1892)](https://github.com/latticexyz/mud/commit/1feecf4955462554c650f56e4777aa330e31f667)** (@latticexyz/store-indexer) + +Added `STORE_ADDRESS` environment variable to index only a specific MUD Store. + +### Patch changes + +**[fix(store,world): exclude ERC165 interface ID from custom interface ID's [L-06] (#2014)](https://github.com/latticexyz/mud/commit/d8c8f66bfd403994216e856d5e92368f7a63be38)** (@latticexyz/store, @latticexyz/world) + +Exclude ERC165 interface ID from custom interface ID's. + +**[fix(store-sync,store-indexer): make last updated block number not null (#1972)](https://github.com/latticexyz/mud/commit/504e25dc83a210a1ef3b66d8487d9e292470620c)** (@latticexyz/store-indexer) + +Records are now ordered by `lastUpdatedBlockNumber` at the Postgres SQL query level + +**[fix(store): slice4 output should be bytes4 [M-03] (#2031)](https://github.com/latticexyz/mud/commit/1b86eac0530d069ff267f6fee8d6a71d6bbb365b)** (@latticexyz/store) + +Changed the type of the output variable in the `slice4` function to `bytes4`. + +**[fix(cli): mud set-version --link shouldn't fetch versions (#2000)](https://github.com/latticexyz/mud/commit/854de0761fd3744c2076a2b995f0f9274a8ef971)** (@latticexyz/cli) + +Using `mud set-version --link` will no longer attempt to fetch the latest version from npm. + +**[fix(store,world): fix mud config TS errors (#1974)](https://github.com/latticexyz/mud/commit/1077c7f53b6c0d6ea7663fe2722b0e768d407741)** (@latticexyz/store, @latticexyz/world) + +Fixed an issue where `mud.config.ts` source file was not included in the package, causing TS errors downstream. + +**[feat(store-indexer): command to run decoded indexer (#2001)](https://github.com/latticexyz/mud/commit/b00550cef2a3824dd38122a16b6e768bd88f9357)** (@latticexyz/store-indexer) + +Added a script to run the decoded postgres indexer. + +**[chore(store-indexer, store-sync): add explicit error logs (#2045)](https://github.com/latticexyz/mud/commit/0a3b9b1c9c821b153cb07281b585feb006ec621e)** (@latticexyz/store-indexer, @latticexyz/store-sync) + +Added explicit error logs for unexpected situations. +Previously all `debug` logs were going to `stderr`, which made it hard to find the unexpected errors. +Now `debug` logs go to `stdout` and we can add explicit `stderr` logs. + +**[chore(common): log benchmark to stderr (#2047)](https://github.com/latticexyz/mud/commit/933b54b5fcdd9400e21e8e0114bb4c691e830fec)** (@latticexyz/common) + +The benchmark util now logs to `stdout` instead of `stderr`. + +**[chore(world): add explicit visibility to coreSystem [N-07] (#2029)](https://github.com/latticexyz/mud/commit/f8dab7334d41d1a53dfad0bbd13a1bbe6fc0cbf8)** (@latticexyz/world) + +Added explicit `internal` visibility to the `coreSystem` variable in `CoreModule`. + +**[fix(world,world-modules): requireInterface correctly specifies ERC165 [M-02] (#2016)](https://github.com/latticexyz/mud/commit/1a0fa7974b493258c7fc8f0708c442ed548e227e)** (@latticexyz/world) + +Fixed `requireInterface` to correctly specify ERC165. + +**[feat(world): add isInstalled to Module (#2056)](https://github.com/latticexyz/mud/commit/eb384bb0e073b1261b8ab92bc74c32ec4956c886)** (@latticexyz/world-modules, @latticexyz/world) + +Added `isInstalled` and `requireNotInstalled` helpers to `Module` base contract. + +**[fix(store-sync): create table registration logs from indexer records (#1919)](https://github.com/latticexyz/mud/commit/712866f5fb392a4e39b59cd4565da61adc3c005f)** (@latticexyz/store-sync) + +`createStoreSync` now correctly creates table registration logs from indexer records. + +**[chore(store-indexer): setup Sentry middleware in indexer (#2054)](https://github.com/latticexyz/mud/commit/85d16e48b6b3d15fe895dba550fb8d176481e1cd)** (@latticexyz/store-indexer) + +Added a Sentry middleware and `SENTRY_DNS` environment variable to the postgres indexer. + +**[fix(world): register FunctionSignatures table [L-01] (#1841)](https://github.com/latticexyz/mud/commit/e5a962bc31086fc4c13bbb4aa049b7a14599b11d)** (@latticexyz/world) + +`World` now correctly registers the `FunctionSignatures` table. + +**[feat(store-indexer): replace fastify with koa (#2006)](https://github.com/latticexyz/mud/commit/c314badd13412a7a96692046b0402a00988994f1)** (@latticexyz/store-indexer) + +Replaced Fastify with Koa for store-indexer frontends + +**[fix(create-mud): include `.gitignore` files in created projects (#1945)](https://github.com/latticexyz/mud/commit/6963a9e85ea97b47be2edd199afa98100f728cf1)** (create-mud) + +Templates now correctly include their respective `.gitignore` files + +**[fix(cli): always rebuild IWorld ABI (#1929)](https://github.com/latticexyz/mud/commit/2699630c0e0c2027f331a9defe7f90a8968f7b3d)** (@latticexyz/cli) + +Deploys will now always rebuild `IWorld.sol` interface (a workaround for https://github.com/foundry-rs/foundry/issues/6241) + +**[build: allow use by TypeScript projects with `bundler`/`node16` config (#2084)](https://github.com/latticexyz/mud/commit/590542030e7500f8d3cce6e54e4961d9f8a1a6d5)** (@latticexyz/abi-ts, @latticexyz/block-logs-stream, @latticexyz/common, @latticexyz/config, @latticexyz/dev-tools, @latticexyz/faucet, @latticexyz/gas-report, @latticexyz/noise, @latticexyz/phaserx, @latticexyz/protocol-parser, @latticexyz/react, @latticexyz/recs, @latticexyz/schema-type, @latticexyz/services, @latticexyz/store-sync, @latticexyz/store, @latticexyz/utils, @latticexyz/world-modules, @latticexyz/world) + +TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + +**[fix(store): onBeforeSpliceDynamicData receives the previous encoded lengths [M-01] (#2020)](https://github.com/latticexyz/mud/commit/6db95ce15e1c51422ca0494883210105c3e742ba)** (@latticexyz/store) + +Fixed `StoreCore` to pass `previousEncodedLengths` into `onBeforeSpliceDynamicData`. + +**[fix(store-indexer): disable prepared statements (#2058)](https://github.com/latticexyz/mud/commit/392c4b88d033d2d175541b974189a3f4da49e335)** (@latticexyz/store-indexer) + +Disabled prepared statements for the postgres indexer, which led to issues in combination with `pgBouncer`. + +**[chore: pipe debug logs to stdout, add separate util to pipe to stderr (#2044)](https://github.com/latticexyz/mud/commit/5d737cf2e7a1a305d7ef0bee99c07c17d80233c8)** (@latticexyz/abi-ts, @latticexyz/block-logs-stream, @latticexyz/cli, @latticexyz/common, @latticexyz/faucet, @latticexyz/store-indexer, @latticexyz/store-sync, @latticexyz/store) + +Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. + +**[chore(store-indexer): stringify filter in error log (#2048)](https://github.com/latticexyz/mud/commit/5ab67e3350bd08d15fbbe28c498cec62d2aaa116)** (@latticexyz/store-indexer) + +The error log if no data is found in `/api/logs` is now stringifying the filter instead of logging `[object Object]`. + +**[fix(store): fix potential memory corruption [M-04] (#1978)](https://github.com/latticexyz/mud/commit/5ac4c97f43756e3fca4ab01f6c881822100fa56d)** (@latticexyz/store) + +Fixed M-04 Memory Corruption on Load From Storage +It only affected external use of `Storage.load` with a `memoryPointer` argument + +**[chore(store,world): remove unused imports [N-05] (#2028)](https://github.com/latticexyz/mud/commit/e481717413a280e830b33b44a16c8c2475452b07)** (@latticexyz/store, @latticexyz/world) + +Removed unused imports from various files in the `store` and `world` packages. + +**[fix(store-indexer): add postgres-decoded-indexer binary (#2062)](https://github.com/latticexyz/mud/commit/735d957c6906e896e3e496158b9afd35da4688d4)** (@latticexyz/store-indexer) + +Added a binary for the `postgres-decoded` indexer. + +**[fix(world-modules): rename token address fields (#1986)](https://github.com/latticexyz/mud/commit/747d8d1b819882c1f84b8029fd4ade669f772322)** (@latticexyz/world-modules) + +Renamed token address fields in ERC20 and ERC721 modules to `tokenAddress` + +**[fix(react): trigger useComponentValue on deleted records (#1959)](https://github.com/latticexyz/mud/commit/9ef3f9a7c2ea52778027fb61988f876b590b22b0)** (@latticexyz/react) + +Fixed an issue where `useComponentValue` would not detect a change and re-render if the component value was immediately removed. + +**[fix(store-sync): use dynamic data in postgres decoded indexer (#1983)](https://github.com/latticexyz/mud/commit/34203e4ed88c2aa79f994b99a96be4fcff21ca06)** (@latticexyz/store-sync) + +Fixed invalid value when decoding records in `postgres-decoded` storage adapter + +**[fix(faucet): use MUD's sendTransaction for better nonce handling (#2080)](https://github.com/latticexyz/mud/commit/9082c179c5a1907cc79ec95543664e63fc327bb4)** (@latticexyz/faucet) + +Updated to use MUD's `sendTransaction`, which does a better of managing nonces for higher volumes of transactions. + +--- + ## Version 2.0.0-next.14 Release date: Fri Nov 10 2023 diff --git a/packages/abi-ts/CHANGELOG.md b/packages/abi-ts/CHANGELOG.md index e0fa76f9f8..2d7c62a3b7 100644 --- a/packages/abi-ts/CHANGELOG.md +++ b/packages/abi-ts/CHANGELOG.md @@ -1,5 +1,12 @@ # @latticexyz/abi-ts +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/abi-ts/package.json b/packages/abi-ts/package.json index 902bcf5cc1..af7a5bdbe8 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.14", + "version": "2.0.0-next.15", "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 0125cff561..d569e4b1f8 100644 --- a/packages/block-logs-stream/CHANGELOG.md +++ b/packages/block-logs-stream/CHANGELOG.md @@ -1,5 +1,19 @@ # @latticexyz/block-logs-stream +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- Updated dependencies [933b54b5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [5d737cf2] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/common@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/block-logs-stream/package.json b/packages/block-logs-stream/package.json index fab324c59a..7bf1c53a90 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.14", + "version": "2.0.0-next.15", "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 e948949288..5d7467f4c7 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,45 @@ # Change Log +## 2.0.0-next.15 + +### Minor Changes + +- 59d78c93: Added a `mud build` command that generates table libraries, system interfaces, and typed ABIs. + +### Patch Changes + +- 854de076: Using `mud set-version --link` will no longer attempt to fetch the latest version from npm. +- 2699630c: Deploys will now always rebuild `IWorld.sol` interface (a workaround for https://github.com/foundry-rs/foundry/issues/6241) +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [1077c7f5] +- Updated dependencies [933b54b5] +- Updated dependencies [f8dab733] +- Updated dependencies [1a0fa797] +- Updated dependencies [eb384bb0] +- Updated dependencies [e5a962bc] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] +- Updated dependencies [747d8d1b] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/world@2.0.0-next.15 + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/world-modules@2.0.0-next.15 + - @latticexyz/abi-ts@2.0.0-next.15 + - @latticexyz/config@2.0.0-next.15 + - @latticexyz/gas-report@2.0.0-next.15 + - @latticexyz/protocol-parser@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + - @latticexyz/services@2.0.0-next.15 + - @latticexyz/utils@2.0.0-next.15 + ## 2.0.0-next.14 ### Minor Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 33eb78f560..00d29ef8ab 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/cli", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "Command line interface for mud", "repository": { "type": "git", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 1a2e7800cb..7e9b5a1ddf 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,47 @@ # Change Log +## 2.0.0-next.15 + +### Minor Changes + +- 1b5eb0d0: Added `unique` and `groupBy` array helpers to `@latticexyz/common/utils`. + + ```ts + import { unique } from "@latticexyz/common/utils"; + + unique([1, 2, 1, 4, 3, 2]); + // [1, 2, 4, 3] + ``` + + ```ts + import { groupBy } from "@latticexyz/common/utils"; + + const records = [ + { type: "cat", name: "Bob" }, + { type: "cat", name: "Spot" }, + { type: "dog", name: "Rover" }, + ]; + Object.fromEntries(groupBy(records, (record) => record.type)); + // { + // "cat": [{ type: "cat", name: "Bob" }, { type: "cat", name: "Spot" }], + // "dog: [{ type: "dog", name: "Rover" }] + // } + ``` + +- 4c1dcd81: - Added a `Result` type for more explicit and typesafe error handling ([inspired by Rust](https://doc.rust-lang.org/std/result/)). + + - Added a `includes` util as typesafe alternative to [`Array.prototype.includes()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes). + +- 5df1f31b: Updated `chunk` types to use readonly arrays + +### Patch Changes + +- 933b54b5: The benchmark util now logs to `stdout` instead of `stderr`. +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- Updated dependencies [59054203] + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/common/package.json b/packages/common/package.json index 91dd3fcbc5..d1210cab66 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/common", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "Common low level logic shared between packages", "repository": { "type": "git", diff --git a/packages/config/CHANGELOG.md b/packages/config/CHANGELOG.md index 8812bf1b3f..e56ccb1e9a 100644 --- a/packages/config/CHANGELOG.md +++ b/packages/config/CHANGELOG.md @@ -1,5 +1,19 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- Updated dependencies [933b54b5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [5d737cf2] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/config/package.json b/packages/config/package.json index b2a3c1b651..09d81ca858 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/config", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "Config for Store and World", "repository": { "type": "git", diff --git a/packages/create-mud/CHANGELOG.md b/packages/create-mud/CHANGELOG.md index a397f8d52a..05c0ad0903 100644 --- a/packages/create-mud/CHANGELOG.md +++ b/packages/create-mud/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## 2.0.0-next.15 + +### Minor Changes + +- f6133591: Replaced usage of `window` global in vanilla JS template with an event listener on the button. + +### Patch Changes + +- 6963a9e8: Templates now correctly include their respective `.gitignore` files + ## 2.0.0-next.14 ### Minor Changes diff --git a/packages/create-mud/package.json b/packages/create-mud/package.json index 7817a919c5..fd8231abea 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.14", + "version": "2.0.0-next.15", "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 d4571554b5..349a38a7f9 100644 --- a/packages/dev-tools/CHANGELOG.md +++ b/packages/dev-tools/CHANGELOG.md @@ -1,5 +1,48 @@ # @latticexyz/dev-tools +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- Updated dependencies [5df1f31b] +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [504e25dc] +- Updated dependencies [1077c7f5] +- Updated dependencies [e48fb3b0] +- Updated dependencies [0a3b9b1c] +- Updated dependencies [85b94614] +- Updated dependencies [a4aff73c] +- Updated dependencies [933b54b5] +- Updated dependencies [f8dab733] +- Updated dependencies [1a0fa797] +- Updated dependencies [eb384bb0] +- Updated dependencies [712866f5] +- Updated dependencies [e5a962bc] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] +- Updated dependencies [9ef3f9a7] +- Updated dependencies [34203e4e] +- Updated dependencies [4c1dcd81] +- Updated dependencies [7eabd06f] +- Updated dependencies [5df1f31b] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [4c1dcd81] +- Updated dependencies [7b73f44d] + - @latticexyz/store-sync@2.0.0-next.15 + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/world@2.0.0-next.15 + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/react@2.0.0-next.15 + - @latticexyz/recs@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + - @latticexyz/utils@2.0.0-next.15 + ## 2.0.0-next.14 ### Minor Changes diff --git a/packages/dev-tools/package.json b/packages/dev-tools/package.json index 78749fd40b..f344d49660 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.14", + "version": "2.0.0-next.15", "description": "MUD developer tools", "repository": { "type": "git", @@ -51,12 +51,12 @@ "vitest": "0.31.4" }, "peerDependencies": { - "@latticexyz/common": "2.0.0-next.14", - "@latticexyz/recs": "2.0.0-next.14", - "@latticexyz/store": "2.0.0-next.14", - "@latticexyz/store-sync": "2.0.0-next.14", - "@latticexyz/utils": "2.0.0-next.14", - "@latticexyz/world": "2.0.0-next.14" + "@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" }, "publishConfig": { "access": "public" diff --git a/packages/ecs-browser/CHANGELOG.md b/packages/ecs-browser/CHANGELOG.md index 3233a3da4e..af0e916506 100644 --- a/packages/ecs-browser/CHANGELOG.md +++ b/packages/ecs-browser/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/ecs-browser +## 2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/ecs-browser/package.json b/packages/ecs-browser/package.json index 97ee33f5da..04e8d5ddfc 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.14", + "version": "2.0.0-next.15", "private": true } diff --git a/packages/faucet/CHANGELOG.md b/packages/faucet/CHANGELOG.md index f730878295..ef8fdb4e53 100644 --- a/packages/faucet/CHANGELOG.md +++ b/packages/faucet/CHANGELOG.md @@ -1,5 +1,20 @@ # @latticexyz/faucet +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- 9082c179: Updated to use MUD's `sendTransaction`, which does a better of managing nonces for higher volumes of transactions. +- Updated dependencies [933b54b5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [5d737cf2] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/common@2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/faucet/package.json b/packages/faucet/package.json index f13a862f06..c8d7f1d2f4 100644 --- a/packages/faucet/package.json +++ b/packages/faucet/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/faucet", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "Faucet API for Lattice testnet", "repository": { "type": "git", diff --git a/packages/gas-report/CHANGELOG.md b/packages/gas-report/CHANGELOG.md index d615a8bc7c..ae4fe7e56f 100644 --- a/packages/gas-report/CHANGELOG.md +++ b/packages/gas-report/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/gas-report/package.json b/packages/gas-report/package.json index 0e5c335981..15bd01c24e 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.14", + "version": "2.0.0-next.15", "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 a37ae01bab..7cb74ca85d 100644 --- a/packages/network/CHANGELOG.md +++ b/packages/network/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/network +## 2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/network/package.json b/packages/network/package.json index dcb821251e..83d0f3cb12 100644 --- a/packages/network/package.json +++ b/packages/network/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/network", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "private": true } diff --git a/packages/noise/CHANGELOG.md b/packages/noise/CHANGELOG.md index e61e98e873..819bf65e11 100644 --- a/packages/noise/CHANGELOG.md +++ b/packages/noise/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/noise/package.json b/packages/noise/package.json index 4ace20290c..271fc3d5cf 100644 --- a/packages/noise/package.json +++ b/packages/noise/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/noise", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "license": "MIT", "type": "module", "exports": { diff --git a/packages/phaserx/CHANGELOG.md b/packages/phaserx/CHANGELOG.md index 4049a5e0fd..1f0941a1e4 100644 --- a/packages/phaserx/CHANGELOG.md +++ b/packages/phaserx/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- Updated dependencies [59054203] + - @latticexyz/utils@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/phaserx/package.json b/packages/phaserx/package.json index 7f0b719ea2..d542a65479 100644 --- a/packages/phaserx/package.json +++ b/packages/phaserx/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/phaserx", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "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 c25fce3ccb..41d4cbeec1 100644 --- a/packages/protocol-parser/CHANGELOG.md +++ b/packages/protocol-parser/CHANGELOG.md @@ -1,5 +1,19 @@ # @latticexyz/protocol-parser +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- Updated dependencies [933b54b5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [5d737cf2] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/protocol-parser/package.json b/packages/protocol-parser/package.json index 6ba2312448..5998ab0796 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.14", + "version": "2.0.0-next.15", "description": "Parser utilities for the MUD protocol", "repository": { "type": "git", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 38a53781b6..f9f54d0d45 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,22 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 9ef3f9a7: Fixed an issue where `useComponentValue` would not detect a change and re-render if the component value was immediately removed. +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [1077c7f5] +- Updated dependencies [59054203] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/recs@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 509ee260c6..1e10e97e20 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/react", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "React tools for MUD client.", "repository": { "type": "git", diff --git a/packages/recs/CHANGELOG.md b/packages/recs/CHANGELOG.md index d65cfcb2c4..5a804cfe50 100644 --- a/packages/recs/CHANGELOG.md +++ b/packages/recs/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- Updated dependencies [59054203] + - @latticexyz/schema-type@2.0.0-next.15 + - @latticexyz/utils@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/recs/package.json b/packages/recs/package.json index c3ec1dd76c..5bbf1f2dbe 100644 --- a/packages/recs/package.json +++ b/packages/recs/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/recs", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "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 aec24eb880..fc71a534b2 100644 --- a/packages/schema-type/CHANGELOG.md +++ b/packages/schema-type/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + ## 2.0.0-next.14 ### Minor Changes diff --git a/packages/schema-type/package.json b/packages/schema-type/package.json index e874836a54..1cd8e70608 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.14", + "version": "2.0.0-next.15", "description": "SchemaType enum for various languages", "repository": { "type": "git", diff --git a/packages/services/CHANGELOG.md b/packages/services/CHANGELOG.md index e8f01229f2..7231f25b1c 100644 --- a/packages/services/CHANGELOG.md +++ b/packages/services/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/services/package.json b/packages/services/package.json index df61b8bd04..b6a161967c 100644 --- a/packages/services/package.json +++ b/packages/services/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/services", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "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 6ca5ce78bd..5305ff9ccd 100644 --- a/packages/solecs/CHANGELOG.md +++ b/packages/solecs/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/solecs +## 2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/solecs/package.json b/packages/solecs/package.json index e277f882a4..2765d4a0b9 100644 --- a/packages/solecs/package.json +++ b/packages/solecs/package.json @@ -1,5 +1,5 @@ { "name": "@latticexyz/solecs", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "private": true } diff --git a/packages/solhint-config-mud/CHANGELOG.md b/packages/solhint-config-mud/CHANGELOG.md index 0c59a32d35..a3e220abf6 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.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/solhint-config-mud/package.json b/packages/solhint-config-mud/package.json index b64b4a7e03..f1e4414595 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.14", + "version": "2.0.0-next.15", "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 0c59a32d35..a3e220abf6 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.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/solhint-plugin-mud/package.json b/packages/solhint-plugin-mud/package.json index 335ba47b7f..cd0068329f 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.14", + "version": "2.0.0-next.15", "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 03a40662dd..eb9510f9bb 100644 --- a/packages/std-client/CHANGELOG.md +++ b/packages/std-client/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-client +## 2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/std-client/package.json b/packages/std-client/package.json index 1c21fc3867..21e5ce2973 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.14", + "version": "2.0.0-next.15", "private": true } diff --git a/packages/std-contracts/CHANGELOG.md b/packages/std-contracts/CHANGELOG.md index 3627957a09..583bc95046 100644 --- a/packages/std-contracts/CHANGELOG.md +++ b/packages/std-contracts/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/std-contracts +## 2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/std-contracts/package.json b/packages/std-contracts/package.json index 1c36bfa053..e7438be91a 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.14", + "version": "2.0.0-next.15", "private": true } diff --git a/packages/store-cache/CHANGELOG.md b/packages/store-cache/CHANGELOG.md index 71919d52f6..19b68e7882 100644 --- a/packages/store-cache/CHANGELOG.md +++ b/packages/store-cache/CHANGELOG.md @@ -1,5 +1,7 @@ # @latticexyz/store-cache +## 2.0.0-next.15 + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/store-cache/package.json b/packages/store-cache/package.json index ec2b8ac856..e6f6092e84 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.14", + "version": "2.0.0-next.15", "private": true } diff --git a/packages/store-indexer/CHANGELOG.md b/packages/store-indexer/CHANGELOG.md index 809013bdbd..b2caa28e7b 100644 --- a/packages/store-indexer/CHANGELOG.md +++ b/packages/store-indexer/CHANGELOG.md @@ -1,5 +1,83 @@ # @latticexyz/store-indexer +## 2.0.0-next.15 + +### Major Changes + +- 85b94614: The postgres indexer is now storing the `logIndex` of the last update of a record to be able to return the snapshot logs in the order they were emitted onchain. + +### Minor Changes + +- 1b5eb0d0: The `findAll` method is now considered deprecated in favor of a new `getLogs` method. This is only implemented in the Postgres indexer for now, with SQLite coming soon. The new `getLogs` method will be an easier and more robust data source to hydrate the client and other indexers and will allow us to add streaming updates from the indexer in the near future. + + For backwards compatibility, `findAll` is now implemented on top of `getLogs`, with record key/value decoding done in memory at request time. This may not scale for large databases, so use wisely. + +- e48fb3b0: When the Postgres indexer starts up, it will now attempt to detect if the database is outdated and, if so, cleans up all MUD-related schemas and tables before proceeding. +- 5df1f31b: Added `getLogs` query support to sqlite indexer +- 4c1dcd81: - Improved query performance by 10x by moving from drizzle ORM to handcrafted SQL. + + - Moved away from `trpc` for more granular control over the transport layer. + Added an `/api/logs` endpoint using the new query and gzip compression for 40x less data transferred over the wire. + Deprecated the `/trpc/getLogs` and `/trpc/findAll` endpoints. + - Added a `createIndexerClient` client for the new `/api` indexer API exported from `@latticexyz/store-sync/indexer-client`. + The `createIndexerClient` export from `@latticexyz/store-sync/trpc-indexer` is deprecated. + + ```diff + - import { createIndexerClient } from "@latticexyz/store-sync/trpc-indexer"; + + import { createIndexerClient } from "@latticexyz/store-sync/indexer-client"; + + - const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz/trpc" }); + + const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz" }); + + - const snapshot = indexer.getLogs.query(options); + + const snapshot = indexer.getLogs(options); + ``` + +- f61b4bc0: The `/api/logs` indexer endpoint is now returning a `404` snapshot not found error when no snapshot is found for the provided filter instead of an empty `200` response. + +### Patch Changes + +- 504e25dc: Records are now ordered by `lastUpdatedBlockNumber` at the Postgres SQL query level +- b00550ce: Added a script to run the decoded postgres indexer. +- 0a3b9b1c: Added explicit error logs for unexpected situations. + Previously all `debug` logs were going to `stderr`, which made it hard to find the unexpected errors. + Now `debug` logs go to `stdout` and we can add explicit `stderr` logs. +- 85d16e48: Added a Sentry middleware and `SENTRY_DNS` environment variable to the postgres indexer. +- c314badd: Replaced Fastify with Koa for store-indexer frontends +- 392c4b88: Disabled prepared statements for the postgres indexer, which led to issues in combination with `pgBouncer`. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- 5ab67e33: The error log if no data is found in `/api/logs` is now stringifying the filter instead of logging `[object Object]`. +- 735d957c: Added a binary for the `postgres-decoded` indexer. +- Updated dependencies [5df1f31b] +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [504e25dc] +- Updated dependencies [1077c7f5] +- Updated dependencies [e48fb3b0] +- Updated dependencies [0a3b9b1c] +- Updated dependencies [85b94614] +- Updated dependencies [a4aff73c] +- Updated dependencies [933b54b5] +- Updated dependencies [712866f5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] +- Updated dependencies [34203e4e] +- Updated dependencies [4c1dcd81] +- Updated dependencies [7eabd06f] +- Updated dependencies [5df1f31b] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [4c1dcd81] +- Updated dependencies [7b73f44d] + - @latticexyz/store-sync@2.0.0-next.15 + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/block-logs-stream@2.0.0-next.15 + - @latticexyz/protocol-parser@2.0.0-next.15 + ## 2.0.0-next.14 ### Major Changes diff --git a/packages/store-indexer/package.json b/packages/store-indexer/package.json index 69f00d8c3a..112a5739b6 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.14", + "version": "2.0.0-next.15", "description": "Minimal Typescript indexer for Store", "repository": { "type": "git", diff --git a/packages/store-sync/CHANGELOG.md b/packages/store-sync/CHANGELOG.md index c57613f13c..1874ad6d4e 100644 --- a/packages/store-sync/CHANGELOG.md +++ b/packages/store-sync/CHANGELOG.md @@ -1,5 +1,103 @@ # @latticexyz/store-sync +## 2.0.0-next.15 + +### Major Changes + +- 504e25dc: `lastUpdatedBlockNumber` columns in Postgres storage adapters are no longer nullable +- e48fb3b0: Renamed singleton `chain` table to `config` table for clarity. +- 85b94614: The postgres indexer is now storing the `logIndex` of the last update of a record to be able to return the snapshot logs in the order they were emitted onchain. +- a4aff73c: Previously, all `store-sync` strategies were susceptible to a potential memory leak where the stream that fetches logs from the RPC would get ahead of the stream that stores the logs in the provided storage adapter. We saw this most often when syncing to remote Postgres servers, where inserting records was much slower than we retrieving them from the RPC. In these cases, the stream would build up a backlog of items until the machine ran out of memory. + + This is now fixed by waiting for logs to be stored before fetching the next batch of logs from the RPC. To make this strategy work, we no longer return `blockLogs# @latticexyz/store-sync (stream of logs fetched from RPC but before they're stored) and instead just return `storedBlockLogs# @latticexyz/store-sync (stream of logs fetched from RPC after they're stored). + +- 1b5eb0d0: `syncToPostgres` from `@latticexyz/store-sync/postgres` now uses a single table to store all records in their bytes form (`staticData`, `encodedLengths`, and `dynamicData`), more closely mirroring onchain state and enabling more scalability and stability for automatic indexing of many worlds. + + The previous behavior, where schemaful SQL tables are created and populated for each MUD table, has been moved to a separate `@latticexyz/store-sync/postgres-decoded` export bundle. This approach is considered less stable and is intended to be used for analytics purposes rather than hydrating clients. Some previous metadata columns on these tables have been removed in favor of the bytes records table as the source of truth for onchain state. + + This overhaul is considered breaking and we recommend starting a fresh database when syncing with either of these strategies. + +- 7b73f44d: 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 + +- 5df1f31b: Refactored how we fetch snapshots from an indexer, preferring the new `getLogs` endpoint and falling back to the previous `findAll` if it isn't available. This refactor also prepares for an easier entry point for adding client caching of snapshots. + + The `initialState` option for various sync methods (`syncToPostgres`, `syncToRecs`, etc.) is now deprecated in favor of `initialBlockLogs`. For now, we'll automatically convert `initialState` into `initialBlockLogs`, but if you want to update your code, you can do: + + ```ts + import { tablesWithRecordsToLogs } from "@latticexyz/store-sync"; + + const initialBlockLogs = { + blockNumber: initialState.blockNumber, + logs: tablesWithRecordsToLogs(initialState.tables), + }; + ``` + +- 7eabd06f: Added and populated `syncProgress` key in Zustand store for sync progress, like we do for RECS sync. This will let apps using `syncToZustand` render a loading state while initial client hydration is in progress. + + ```tsx + const syncProgress = useStore((state) => state.syncProgress); + + if (syncProgress.step !== SyncStep.LIVE) { + return <>Loading ({Math.floor(syncProgress.percentage)}%); + } + ``` + +- 4c1dcd81: - Improved query performance by 10x by moving from drizzle ORM to handcrafted SQL. + + - Moved away from `trpc` for more granular control over the transport layer. + Added an `/api/logs` endpoint using the new query and gzip compression for 40x less data transferred over the wire. + Deprecated the `/trpc/getLogs` and `/trpc/findAll` endpoints. + - Added a `createIndexerClient` client for the new `/api` indexer API exported from `@latticexyz/store-sync/indexer-client`. + The `createIndexerClient` export from `@latticexyz/store-sync/trpc-indexer` is deprecated. + + ```diff + - import { createIndexerClient } from "@latticexyz/store-sync/trpc-indexer"; + + import { createIndexerClient } from "@latticexyz/store-sync/indexer-client"; + + - const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz/trpc" }); + + const indexer = createIndexerClient({ url: "https://indexer.holesky.redstone.xyz" }); + + - const snapshot = indexer.getLogs.query(options); + + const snapshot = indexer.getLogs(options); + ``` + +### Patch Changes + +- 0a3b9b1c: Added explicit error logs for unexpected situations. + Previously all `debug` logs were going to `stderr`, which made it hard to find the unexpected errors. + Now `debug` logs go to `stdout` and we can add explicit `stderr` logs. +- 712866f5: `createStoreSync` now correctly creates table registration logs from indexer records. +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- 34203e4e: Fixed invalid value when decoding records in `postgres-decoded` storage adapter +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [1077c7f5] +- Updated dependencies [933b54b5] +- Updated dependencies [f8dab733] +- Updated dependencies [1a0fa797] +- Updated dependencies [eb384bb0] +- Updated dependencies [e5a962bc] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/world@2.0.0-next.15 + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/block-logs-stream@2.0.0-next.15 + - @latticexyz/protocol-parser@2.0.0-next.15 + - @latticexyz/recs@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Major Changes diff --git a/packages/store-sync/package.json b/packages/store-sync/package.json index d7fc0c3ce6..e8600fce4d 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.14", + "version": "2.0.0-next.15", "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 93a2e0a85e..6d3a3500c0 100644 --- a/packages/store/CHANGELOG.md +++ b/packages/store/CHANGELOG.md @@ -1,5 +1,28 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- d8c8f66b: Exclude ERC165 interface ID from custom interface ID's. +- 1b86eac0: Changed the type of the output variable in the `slice4` function to `bytes4`. +- 1077c7f5: Fixed an issue where `mud.config.ts` source file was not included in the package, causing TS errors downstream. +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 6db95ce1: Fixed `StoreCore` to pass `previousEncodedLengths` into `onBeforeSpliceDynamicData`. +- 5d737cf2: Updated the `debug` util to pipe to `stdout` and added an additional util to explicitly pipe to `stderr` when needed. +- 5ac4c97f: Fixed M-04 Memory Corruption on Load From Storage + It only affected external use of `Storage.load` with a `memoryPointer` argument +- e4817174: Removed unused imports from various files in the `store` and `world` packages. +- Updated dependencies [933b54b5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [5d737cf2] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/config@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/store/package.json b/packages/store/package.json index 51c3bc9994..6f134c6652 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/store", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "Store", "repository": { "type": "git", diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 2993c27562..9012d6e6d0 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. + ## 2.0.0-next.14 ## 2.0.0-next.13 diff --git a/packages/utils/package.json b/packages/utils/package.json index 107db55b93..e699030564 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/utils", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "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 38d87a1bfb..a74ad2b6f7 100644 --- a/packages/world-modules/CHANGELOG.md +++ b/packages/world-modules/CHANGELOG.md @@ -1,5 +1,34 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- eb384bb0: Added `isInstalled` and `requireNotInstalled` helpers to `Module` base contract. +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- 747d8d1b: Renamed token address fields in ERC20 and ERC721 modules to `tokenAddress` +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [1077c7f5] +- Updated dependencies [933b54b5] +- Updated dependencies [f8dab733] +- Updated dependencies [1a0fa797] +- Updated dependencies [eb384bb0] +- Updated dependencies [e5a962bc] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/world@2.0.0-next.15 + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/config@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Minor Changes diff --git a/packages/world-modules/package.json b/packages/world-modules/package.json index 6d59d6adcf..df07b475d6 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.14", + "version": "2.0.0-next.15", "description": "World modules", "repository": { "type": "git", diff --git a/packages/world/CHANGELOG.md b/packages/world/CHANGELOG.md index ff6f795a83..9c48d58f6a 100644 --- a/packages/world/CHANGELOG.md +++ b/packages/world/CHANGELOG.md @@ -1,5 +1,34 @@ # Change Log +## 2.0.0-next.15 + +### Patch Changes + +- d8c8f66b: Exclude ERC165 interface ID from custom interface ID's. +- 1077c7f5: Fixed an issue where `mud.config.ts` source file was not included in the package, causing TS errors downstream. +- f8dab733: Added explicit `internal` visibility to the `coreSystem` variable in `CoreModule`. +- 1a0fa797: Fixed `requireInterface` to correctly specify ERC165. +- eb384bb0: Added `isInstalled` and `requireNotInstalled` helpers to `Module` base contract. +- e5a962bc: `World` now correctly registers the `FunctionSignatures` table. +- 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages. +- e4817174: Removed unused imports from various files in the `store` and `world` packages. +- Updated dependencies [d8c8f66b] +- Updated dependencies [1b86eac0] +- Updated dependencies [1077c7f5] +- Updated dependencies [933b54b5] +- Updated dependencies [59054203] +- Updated dependencies [1b5eb0d0] +- Updated dependencies [6db95ce1] +- Updated dependencies [5d737cf2] +- Updated dependencies [5ac4c97f] +- Updated dependencies [e4817174] +- Updated dependencies [4c1dcd81] +- Updated dependencies [5df1f31b] + - @latticexyz/store@2.0.0-next.15 + - @latticexyz/common@2.0.0-next.15 + - @latticexyz/config@2.0.0-next.15 + - @latticexyz/schema-type@2.0.0-next.15 + ## 2.0.0-next.14 ### Patch Changes diff --git a/packages/world/package.json b/packages/world/package.json index 4a4d027067..d19d01d1d6 100644 --- a/packages/world/package.json +++ b/packages/world/package.json @@ -1,6 +1,6 @@ { "name": "@latticexyz/world", - "version": "2.0.0-next.14", + "version": "2.0.0-next.15", "description": "World framework", "repository": { "type": "git",