-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into holic/bump-solc
- Loading branch information
Showing
695 changed files
with
14,650 additions
and
50,606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"@latticexyz/faucet": minor | ||
--- | ||
|
||
New package to run your own faucet service. We'll use this soon for our testnet in place of `@latticexyz/services`. | ||
|
||
To run the faucet server: | ||
|
||
- Add the package with `pnpm add @latticexyz/faucet` | ||
- Add a `.env` file that has a `RPC_HTTP_URL` and `FAUCET_PRIVATE_KEY` (or pass the environment variables into the next command) | ||
- Run `pnpm faucet-server` to start the server | ||
|
||
You can also adjust the server's `HOST` (defaults to `0.0.0.0`) and `PORT` (defaults to `3002`). The tRPC routes are accessible under `/trpc`. | ||
|
||
To connect a tRPC client, add the package with `pnpm add @latticexyz/faucet` and then use `createClient`: | ||
|
||
```ts | ||
import { createClient } from "@latticexyz/faucet"; | ||
|
||
const faucet = createClient({ url: "http://localhost:3002/trpc" }); | ||
|
||
await faucet.mutate.drip({ address: burnerAccount.address }); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/store-indexer": patch | ||
--- | ||
|
||
Fixes postgres indexer stopping sync after it catches up to the latest block. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@latticexyz/cli": patch | ||
"@latticexyz/store": patch | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
Include bytecode for `World` and `Store` in npm packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
"@latticexyz/cli": major | ||
"@latticexyz/protocol-parser": major | ||
"@latticexyz/store-sync": major | ||
"@latticexyz/store": major | ||
"create-mud": minor | ||
--- | ||
|
||
Renamed all occurrences of `schema` where it is used as "value schema" to `valueSchema` to clearly distinguish it from "key schema". | ||
The only breaking change for users is the change from `schema` to `valueSchema` in `mud.config.ts`. | ||
|
||
```diff | ||
// mud.config.ts | ||
export default mudConfig({ | ||
tables: { | ||
CounterTable: { | ||
keySchema: {}, | ||
- schema: { | ||
+ valueSchema: { | ||
value: "uint32", | ||
}, | ||
}, | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
"@latticexyz/store": major | ||
"@latticexyz/world": major | ||
--- | ||
|
||
We've updated Store events to be "schemaless", meaning there is enough information in each event to only need to operate on the bytes of each record to make an update to that record without having to first decode the record by its schema. This enables new kinds of indexers and sync strategies. | ||
|
||
If you've written your own sync logic or are interacting with Store calls directly, this is a breaking change. We have a few more breaking protocol changes upcoming, so you may hold off on upgrading until those land. | ||
|
||
If you are using MUD's built-in tooling (table codegen, indexer, store sync, etc.), you don't have to make any changes except upgrading to the latest versions and deploying a fresh World. | ||
|
||
- The `data` field in each `StoreSetRecord` and `StoreEphemeralRecord` has been replaced with three new fields: `staticData`, `encodedLengths`, and `dynamicData`. This better reflects the on-chain state and makes it easier to perform modifications to the raw bytes. We recommend storing each of these fields individually in your off-chain storage of choice (indexer, client, etc.). | ||
|
||
```diff | ||
- event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); | ||
+ event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData); | ||
|
||
- event StoreEphemeralRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); | ||
+ event StoreEphemeralRecord(bytes32 tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData); | ||
``` | ||
|
||
- The `StoreSetField` event is now replaced by two new events: `StoreSpliceStaticData` and `StoreSpliceDynamicData`. Splicing allows us to perform efficient operations like push and pop, in addition to replacing a field value. We use two events because updating a dynamic-length field also requires updating the record's `encodedLengths` (aka PackedCounter). | ||
|
||
```diff | ||
- event StoreSetField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes data); | ||
+ event StoreSpliceStaticData(bytes32 tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data); | ||
+ event StoreSpliceDynamicData(bytes32 tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data, bytes32 encodedLengths); | ||
``` | ||
|
||
Similarly, Store setter methods (e.g. `setRecord`) have been updated to reflect the `data` to `staticData`, `encodedLengths`, and `dynamicData` changes. We'll be following up shortly with Store getter method changes for more gas efficient storage reads. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@latticexyz/common": minor | ||
"@latticexyz/protocol-parser": major | ||
--- | ||
|
||
`readHex` was moved from `@latticexyz/protocol-parser` to `@latticexyz/common` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
"@latticexyz/store": major | ||
"@latticexyz/world": major | ||
--- | ||
|
||
Moved the registration of store hooks and systems hooks to bitmaps with bitwise operator instead of a struct. | ||
|
||
```diff | ||
- import { StoreHookLib } from "@latticexyz/src/StoreHook.sol"; | ||
+ import { | ||
+ BEFORE_SET_RECORD, | ||
+ BEFORE_SET_FIELD, | ||
+ BEFORE_DELETE_RECORD | ||
+ } from "@latticexyz/store/storeHookTypes.sol"; | ||
|
||
StoreCore.registerStoreHook( | ||
tableId, | ||
subscriber, | ||
- StoreHookLib.encodeBitmap({ | ||
- onBeforeSetRecord: true, | ||
- onAfterSetRecord: false, | ||
- onBeforeSetField: true, | ||
- onAfterSetField: false, | ||
- onBeforeDeleteRecord: true, | ||
- onAfterDeleteRecord: false | ||
- }) | ||
+ BEFORE_SET_RECORD | BEFORE_SET_FIELD | BEFORE_DELETE_RECORD | ||
); | ||
``` | ||
|
||
```diff | ||
- import { SystemHookLib } from "../src/SystemHook.sol"; | ||
+ import { BEFORE_CALL_SYSTEM, AFTER_CALL_SYSTEM } from "../src/systemHookTypes.sol"; | ||
|
||
world.registerSystemHook( | ||
systemId, | ||
subscriber, | ||
- SystemHookLib.encodeBitmap({ onBeforeCallSystem: true, onAfterCallSystem: true }) | ||
+ BEFORE_CALL_SYSTEM | AFTER_CALL_SYSTEM | ||
); | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@latticexyz/cli": patch | ||
"@latticexyz/store": patch | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
The `FieldLayout` in table libraries is now generated at compile time instead of dynamically in a table library function. | ||
This significantly reduces gas cost in all table library functions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/store": patch | ||
--- | ||
|
||
Added `Storage.loadField` to optimize loading 32 bytes or less from storage (which is always the case when loading data for static fields). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
Remove a workaround for the internal `InstalledModules` table that is not needed anymore. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
Renamed all `funcSelectorAndArgs` arguments to `callData` for clarity. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
"@latticexyz/store": major | ||
"@latticexyz/world": major | ||
--- | ||
|
||
Store and World contract ABIs are now exported from the `out` directory. You'll need to update your imports like: | ||
|
||
```diff | ||
- import IBaseWorldAbi from "@latticexyz/world/abi/IBaseWorld.sol/IBaseWorldAbi.json"; | ||
+ import IBaseWorldAbi from "@latticexyz/world/out/IBaseWorld.sol/IBaseWorldAbi.json"; | ||
``` | ||
|
||
`MudTest.sol` was also moved to the World package. You can update your import like: | ||
|
||
```diff | ||
- import { MudTest } from "@latticexyz/store/src/MudTest.sol"; | ||
+ import { MudTest } from "@latticexyz/world/test/MudTest.t.sol"; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
"@latticexyz/block-logs-stream": patch | ||
"@latticexyz/store-sync": patch | ||
"@latticexyz/store": patch | ||
--- | ||
|
||
Renamed all occurrences of `table` where it is used as "table ID" to `tableId`. | ||
This is only a breaking change for consumers who manually decode `Store` events, but not for consumers who use the MUD libraries. | ||
|
||
```diff | ||
event StoreSetRecord( | ||
- bytes32 table, | ||
+ bytes32 tableId, | ||
bytes32[] key, | ||
bytes data | ||
); | ||
|
||
event StoreSetField( | ||
- bytes32 table, | ||
+ bytes32 tableId, | ||
bytes32[] key, | ||
uint8 fieldIndex, | ||
bytes data | ||
); | ||
|
||
event StoreDeleteRecord( | ||
- bytes32 table, | ||
+ bytes32 tableId, | ||
bytes32[] key | ||
); | ||
|
||
event StoreEphemeralRecord( | ||
- bytes32 table, | ||
+ bytes32 tableId, | ||
bytes32[] key, | ||
bytes data | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
"create-mud": minor | ||
--- | ||
|
||
Templates now use `out` for their `forge build` artifacts, including ABIs. If you have a project created from a previous template, you can update your `packages/contracts/package.json` with: | ||
|
||
```diff | ||
- "build:abi": "rimraf abi && forge build --extra-output-files abi --out abi --skip test script MudTest.sol", | ||
- "build:abi-ts": "mud abi-ts --input 'abi/IWorld.sol/IWorld.abi.json' && prettier --write '**/*.abi.json.d.ts'", | ||
+ "build:abi": "forge clean && forge build --skip test script", | ||
+ "build:abi-ts": "mud abi-ts && prettier --write '**/*.abi.json.d.ts'", | ||
``` | ||
|
||
And your `packages/client/src/mud/setupNetwork` with: | ||
|
||
```diff | ||
- import IWorldAbi from "contracts/abi/IWorld.sol/IWorld.abi.json"; | ||
+ import IWorldAbi from "contracts/out/IWorld.sol/IWorld.abi.json"; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/cli": patch | ||
--- | ||
|
||
Refactor `deploy` command to break up logic into modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
"@latticexyz/block-logs-stream": patch | ||
"@latticexyz/store-sync": patch | ||
"@latticexyz/store": patch | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
Renamed all occurrences of `key` where it is used as "key tuple" to `keyTuple`. | ||
This is only a breaking change for consumers who manually decode `Store` events, but not for consumers who use the MUD libraries. | ||
|
||
```diff | ||
event StoreSetRecord( | ||
bytes32 tableId, | ||
- bytes32[] key, | ||
+ bytes32[] keyTuple, | ||
bytes data | ||
); | ||
|
||
event StoreSetField( | ||
bytes32 tableId, | ||
- bytes32[] key, | ||
+ bytes32[] keyTuple, | ||
uint8 fieldIndex, | ||
bytes data | ||
); | ||
|
||
event StoreDeleteRecord( | ||
bytes32 tableId, | ||
- bytes32[] key, | ||
+ bytes32[] keyTuple, | ||
); | ||
|
||
event StoreEphemeralRecord( | ||
bytes32 tableId, | ||
- bytes32[] key, | ||
+ bytes32[] keyTuple, | ||
bytes data | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/protocol-parser": patch | ||
--- | ||
|
||
Export `valueSchemaToFieldLayoutHex` helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
"@latticexyz/store-indexer": minor | ||
--- | ||
|
||
You can now install and run `@latticexyz/store-indexer` from the npm package itself, without having to clone/build the MUD repo: | ||
|
||
```sh | ||
npm install @latticexyz/store-indexer | ||
|
||
npm sqlite-indexer | ||
# or | ||
npm postgres-indexer | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
npx -p @latticexyz/store-indexer sqlite-indexer | ||
# or | ||
npx -p @latticexyz/store-indexer postgres-indexer | ||
``` | ||
|
||
The binary will also load the nearby `.env` file for easier local configuration. | ||
|
||
We've removed the `CHAIN_ID` requirement and instead require just a `RPC_HTTP_URL` or `RPC_WS_URL` or both. You can now also adjust the polling interval with `POLLING_INTERVAL` (defaults to 1000ms, which corresponds to MUD's default block time). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/store-sync": patch | ||
--- | ||
|
||
Catch errors when parsing logs to tables and storage operations, log and skip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@latticexyz/common": minor | ||
--- | ||
|
||
`spliceHex` was added, which has a similar API as JavaScript's [`Array.prototype.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice), but for `Hex` strings. | ||
|
||
```ts | ||
spliceHex("0x123456", 1, 1, "0x0000"); // "0x12000056" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@latticexyz/store": patch | ||
"@latticexyz/world": patch | ||
--- | ||
|
||
Optimized the `StoreCore` hash function determining the data location to use less gas. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
"@latticexyz/cli": major | ||
"@latticexyz/store": major | ||
"create-mud": patch | ||
--- | ||
|
||
Renamed the default filename of generated user types from `Types.sol` to `common.sol` and the default filename of the generated table index file from `Tables.sol` to `index.sol`. | ||
|
||
Both can be overridden via the MUD config: | ||
|
||
```ts | ||
export default mudConfig({ | ||
/** Filename where common user types will be generated and imported from. */ | ||
userTypesFilename: "common.sol", | ||
/** Filename where codegen index will be generated. */ | ||
codegenIndexFilename: "index.sol", | ||
}); | ||
``` | ||
|
||
Note: `userTypesFilename` was renamed from `userTypesPath` and `.sol` is not appended automatically anymore but needs to be part of the provided filename. | ||
|
||
To update your existing project, update all imports from `Tables.sol` to `index.sol` and all imports from `Types.sol` to `common.sol`, or override the defaults in your MUD config to the previous values. | ||
|
||
```diff | ||
- import { Counter } from "../src/codegen/Tables.sol"; | ||
+ import { Counter } from "../src/codegen/index.sol"; | ||
- import { ExampleEnum } from "../src/codegen/Types.sol"; | ||
+ import { ExampleEnum } from "../src/codegen/common.sol"; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@latticexyz/dev-tools": major | ||
"@latticexyz/store-sync": major | ||
"create-mud": minor | ||
--- | ||
|
||
We've updated Store events to be "schemaless", meaning there is enough information in each event to only need to operate on the bytes of each record to make an update to that record without having to first decode the record by its schema. This enables new kinds of indexers and sync strategies. | ||
|
||
As such, we've replaced `blockStorageOperations$` with `storedBlockLogs$`, a stream of simplified Store event logs after they've been synced to the configured storage adapter. These logs may not reflect exactly the events that are on chain when e.g. hydrating from an indexer, but they will still allow the client to "catch up" to the on-chain state of your tables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@latticexyz/protocol-parser": minor | ||
--- | ||
|
||
Adds `valueSchemaToFieldLayoutHex` helper |
Oops, something went wrong.