Skip to content

Commit

Permalink
Merge branch 'main' into stash
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Sep 17, 2024
2 parents 5a78e69 + be0860f commit f655881
Show file tree
Hide file tree
Showing 218 changed files with 3,405 additions and 1,762 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-bats-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/explorer": patch
---

World Explorer now supports connecting external wallets.
13 changes: 13 additions & 0 deletions .changeset/bright-rabbits-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@latticexyz/common": patch
---

To reset an account's nonce, the nonce manager uses the [`eth_getTransactionCount`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactioncount) RPC method,
which returns the number of transactions sent from the account.
When using the `pending` block tag, this includes transactions in the mempool that have not been included in a block yet.
If an account submits a transaction with a nonce higher than the next valid nonce, this transaction will stay in the mempool until the nonce gap is closed and the transactions nonce is the next valid nonce.
This means if an account has gapped transactions "stuck in the mempool", the `eth_getTransactionCount` method with `pending` block tag can't be used to get the next valid nonce
(since it includes the number of transactions stuck in the mempool).
Since the nonce manager only resets the nonce on reload or in case of a nonce error, using the `latest` block tag by default is the safer choice to be able to recover from nonce gaps.

Note that this change may reveal more "transaction underpriced" errors than before. These errors will now be retried automatically and should go through after the next block is mined.
25 changes: 25 additions & 0 deletions .changeset/itchy-insects-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"@latticexyz/block-logs-stream": patch
"@latticexyz/cli": patch
"@latticexyz/common": patch
"@latticexyz/config": patch
"@latticexyz/dev-tools": patch
"@latticexyz/explorer": patch
"@latticexyz/faucet": patch
"@latticexyz/protocol-parser": patch
"@latticexyz/schema-type": patch
"@latticexyz/stash": patch
"@latticexyz/store-indexer": patch
"@latticexyz/store-sync": patch
"@latticexyz/store": patch
"@latticexyz/world": patch
"create-mud": patch
---

Bumped viem, wagmi, and abitype packages to their latest release.

MUD projects using these packages should do the same to ensure no type errors due to mismatched versions:

```
pnpm recursive up [email protected] [email protected] @wagmi/[email protected] [email protected]
```
5 changes: 5 additions & 0 deletions .changeset/metal-brooms-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/cli": patch
---

Along with table and system labels, the MUD deployer now registers namespace labels. Additionally, labels will only be registered if they differ from the underlying resource name.
33 changes: 33 additions & 0 deletions .changeset/smart-parents-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
"@latticexyz/explorer": patch
---

World Explorer package now exports an `observer` Viem decorator that can be used to get visibility into contract writes initiated from your app. You can watch these writes stream in on the new "Observe" tab of the World Explorer.

```ts
import { createClient, publicActions, walletActions } from "viem";
import { observer } from "@latticexyz/explorer/observer";

const client = createClient({ ... })
.extend(publicActions)
.extend(walletActions)
.extend(observer());
```

By default, the `observer` action assumes the World Explorer is running at `http://localhost:13690`, but this can be customized with the `explorerUrl` option.

```ts
observer({
explorerUrl: "http://localhost:4444",
});
```

If you want to measure the timing of transaction-to-state-change, you can also pass in a `waitForStateChange` function that takes a transaction hash and returns a partial [`TransactionReceipt`](https://viem.sh/docs/glossary/types#transactionreceipt) with `blockNumber`, `status`, and `transactionHash`. This mirrors the `waitForTransaction` function signature returned by `syncTo...` helper in `@latticexyz/store-sync`.

```ts
observer({
async waitForStateChange(hash) {
return await waitForTransaction(hash);
},
});
```
6 changes: 5 additions & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
example: [minimal, multiple-namespaces]
example: [minimal, multiple-namespaces, custom-world]
env:
DEBUG: mud:*
# anvil default, prefunded account
PRIVATE_KEY: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

steps:
- name: Checkout
Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
## Version 2.2.3

Release date: Tue Sep 10 2024

### Patch changes

**[feat(cli): deploy custom world (#3131)](https://github.com/latticexyz/mud/commit/854645260c41eaa89cdadad30bf8e70d5d2fd109)** (@latticexyz/cli, @latticexyz/world)

MUD config now supports a `deploy.customWorld` option that, when used with the CLI, will deploy the specified custom World implementation.
Custom implementations must still follow [the World protocol](https://github.com/latticexyz/mud/tree/main/packages/world/ts/protocol-snapshots).

If you want to extend the world with new functions or override existing registered functions, we recommend using [root systems](https://mud.dev/world/systems#root-systems).
However, there are rare cases where this may not be enough to modify the native/internal World behavior.
Note that deploying a custom World opts out of the world factory, deterministic world deploys, and upgradeable implementation proxy.

```ts
import { defineWorld } from "@latticexyz/world";

export default defineWorld({
customWorld: {
// path to custom world source from project root
sourcePath: "src/CustomWorld.sol",
// custom world contract name
name: "CustomWorld",
},
});
```

**[fix(explorer): world address cli option as hex (#3155)](https://github.com/latticexyz/mud/commit/b9c61a96082e62c4f1bec3a8ebb358ea30c315f0)** (@latticexyz/explorer)

Fixed an issue with `--worldAddress` CLI flag being incorrectly interpreted as a number rather a hex string. Additionally, added `--hostname` option for specifying the hostname on which to start the application.

**[feat(cli): speed up dev deploy with temporary automine during deploy (#3130)](https://github.com/latticexyz/mud/commit/d3ab5c3783265b3e82b76157bccedeae6b0445e1)** (@latticexyz/cli)

Speed up deployment in development by temporarily enabling automine mode for the duration of the deployment.

---

## Version 2.2.2

Release date: Tue Sep 03 2024
Expand Down
45 changes: 40 additions & 5 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ export default withNextra({
destination: "/state-query/typescript/recs",
permanent: false,
},
{
source: "/indexer",
destination: "/services/indexer",
permanent: false,
},
{
source: "/cli",
destination: "/cli/tablegen",
Expand Down Expand Up @@ -256,6 +251,46 @@ export default withNextra({
destination: "/store/store-hooks",
permanent: false,
},
{
source: "/guides/best-practices/dividing-into-systems",
destination: "/best-practices/dividing-into-systems",
permanent: false,
},
{
source: "/guides/best-practices/system-best-practices",
destination: "/best-practices/system",
permanent: false,
},
{
source: "/guides/best-practices/deployment-settings",
destination: "/best-practices/deployment-settings",
permanent: false,
},
{
source: "/guides/best-practices/kms",
destination: "/best-practices/aws-kms",
permanent: false,
},
{
source: "/services/indexer/postgres-decoded",
destination: "/indexer/postgres-decoded",
permanent: false,
},
{
source: "/services/indexer/postgres-event-only",
destination: "/indexer/postgres-event-only",
permanent: false,
},
{
source: "/services/indexer/sqlite-indexer",
destination: "/indexer/sqlite",
permanent: false,
},
{
source: "/services/indexer/using-indexer",
destination: "/indexer/using",
permanent: false,
},
];
},
});
9 changes: 2 additions & 7 deletions docs/pages/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
config: "Config",
cli: "CLI",
"state-query": "State Query",
services: "Services",
indexer: "Indexer",
"world-explorer": {
title: "World Explorer",
theme: { breadcrumb: false },
Expand All @@ -33,6 +33,7 @@ export default {
},
guides: "Guides",
templates: "Templates",
"best-practices": "Best Practices",
contribute: {
title: "Contribute",
theme: { breadcrumb: false },
Expand All @@ -55,12 +56,6 @@ export default {
},
},
},
status: {
title: "Status",
type: "page",
href: "https://status.mud.dev",
newWindow: true,
},
community: {
title: "Community",
type: "page",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
"dividing-into-systems": "Dividing Code into Systems",
"system-best-practices": "System Best Practices",
"system": "System Best Practices",
"deployment-settings": "Recommended Deployment Settings",
"kms": "Deploy production worlds using AWS KMS"
"aws-kms": "Deploy production worlds using AWS KMS"
};

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Callout } from "nextra/components";

# Deploy production worlds using AWS KMS

The MUD equivalent of [root](https://en.wikipedia.org/wiki/Superuser) is the owner of the root namespace, by default this is the address that deployed the `World`.
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
38 changes: 38 additions & 0 deletions docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
## Version 2.2.3

Release date: Tue Sep 10 2024

### Patch changes

**[feat(cli): deploy custom world (#3131)](https://github.com/latticexyz/mud/commit/854645260c41eaa89cdadad30bf8e70d5d2fd109)** (@latticexyz/cli, @latticexyz/world)

MUD config now supports a `deploy.customWorld` option that, when used with the CLI, will deploy the specified custom World implementation.
Custom implementations must still follow [the World protocol](https://github.com/latticexyz/mud/tree/main/packages/world/ts/protocol-snapshots).

If you want to extend the world with new functions or override existing registered functions, we recommend using [root systems](https://mud.dev/world/systems#root-systems).
However, there are rare cases where this may not be enough to modify the native/internal World behavior.
Note that deploying a custom World opts out of the world factory, deterministic world deploys, and upgradeable implementation proxy.

```ts
import { defineWorld } from "@latticexyz/world";

export default defineWorld({
customWorld: {
// path to custom world source from project root
sourcePath: "src/CustomWorld.sol",
// custom world contract name
name: "CustomWorld",
},
});
```

**[fix(explorer): world address cli option as hex (#3155)](https://github.com/latticexyz/mud/commit/b9c61a96082e62c4f1bec3a8ebb358ea30c315f0)** (@latticexyz/explorer)

Fixed an issue with `--worldAddress` CLI flag being incorrectly interpreted as a number rather a hex string. Additionally, added `--hostname` option for specifying the hostname on which to start the application.

**[feat(cli): speed up dev deploy with temporary automine during deploy (#3130)](https://github.com/latticexyz/mud/commit/d3ab5c3783265b3e82b76157bccedeae6b0445e1)** (@latticexyz/cli)

Speed up deployment in development by temporarily enabling automine mode for the duration of the deployment.

---

## Version 2.2.2

Release date: Tue Sep 03 2024
Expand Down
21 changes: 17 additions & 4 deletions docs/pages/config/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ The following options are available in both single- and multiple-namespace modes

<Params title="Module config options">
<Param name="artifactPath">Relative path to the module's compiled JSON artifact (usually in `out`) or an import path if using a module from an npm package. This path is resolved using [Node's module `require` API](https://nodejs.org/api/modules.html#modulerequireid).</Param>

<Param name="root">Whether or not to install this as a root module. Defaults to `false`.</Param>

<Param name="args">
A list of arguments used to call the module's install function. Each argument is a structure with two fields:
<Params title="Structure in each argument">

<Params>
<Param name="type">Solidity data type.</Param>
<Param name="value">
The value.
To encode a complex data type, such as a structure or an array, you can use Viem's [`encodeAbiParameters`](https://viem.sh/docs/abi/encodeAbiParameters.html).
</Param>
</Params>

</Param>
</Params>

Expand All @@ -154,6 +154,7 @@ The following options are available in both single- and multiple-namespace modes
<Param name="userTypesFilename">Filename relative to `outputDirectory` to codegen enums into. Defaults to `"common.sol"`.</Param>
<Param name="worldgenDirectory">Output directory of world interfaces relative to `outputDirectory`. Defaults to `"world"`.</Param>
</Params>

</Param>
<Param name="deploy">
Customize how to deploy the world.
Expand All @@ -162,7 +163,19 @@ The following options are available in both single- and multiple-namespace modes
<Param name="deploysDirectory">Directory, relative to project root, to write the deployment artifacts to. Defaults to `"deploys"`.</Param>
<Param name="postDeployScript">Script name to execute after the deployment is complete. Defaults to `"PostDeploy"`.</Param>
<Param name="worldsFile">JSON filename, relative to project root, to write per-chain world deployment addresses. Defaults to `"worlds.json"`.</Param>
<Param name="upgradeableWorldImplementation">Wheter or not to deploy the world with an upgradeable proxy, allowing for the core implementation to be upgraded. Defaults to `false`, but [we recommend `true`](/guides/best-practices/deployment-settings).</Param>
<Param name="upgradeableWorldImplementation">Whether or not to deploy the world with an upgradeable proxy, allowing for the core implementation to be upgraded. Defaults to `false`, but [we recommend `true`](/guides/best-practices/deployment-settings).</Param>
<Param name="customWorld">
Deploy the World using a custom implementation. This world must implement the same interface as `World.sol` so that it can initialize core modules, etc.
If you want to extend the world with new functions or override existing registered functions, we recommend using [root systems](/world/systems#root-systems).
However, there are rare cases where this may not be enough to modify the native/internal World behavior.
Note that deploying a custom World opts out of the world factory, deterministic world deploys, and upgradeable implementation proxy.

<Params>
<Param name="sourcePath">Path to custom world source file relative to project root dir.</Param>
<Param name="name">Contract name in custom world source file.</Param>
</Params>

</Param>
</Params>

</Param>
Expand Down
3 changes: 1 addition & 2 deletions docs/pages/guides/_meta.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
export default {
"replicating-onchain-state": "Replicating onchain state",
"hello-world": "Hello World",
"extending-a-world": "Extending a World",
"adding-delegation": "Adding Delegation",
"modules": "Writing MUD Modules",
emojimon: "Emojimon",
testing: "Testing",
"best-practices": "Best Practices",
"replicating-onchain-state": "Replicating onchain state",
};
2 changes: 1 addition & 1 deletion docs/pages/guides/hello-world.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ The exception is filtering data synchronization, because it needs a table that i
- [Add a table](hello-world/add-table)
- [Filter data synchronization](hello-world/filter-sync)
- [Add a system](hello-world/add-system)
- [Deploy to a blockchain](../cli/deploy)
- [Deploy to a blockchain](hello-world/deploy)
5 changes: 1 addition & 4 deletions docs/pages/guides/hello-world/_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ export default {
"add-table": "Add a table",
"filter-sync": "Filter data synchronization",
"add-system": "Add a system",
"deploy": {
"title": "Deploy to a blockchain",
"href": "/cli/deploy"
},
"deploy": "Deploy to a blockchain",
"add-chain-client": "Add chains to the client",
};
Loading

0 comments on commit f655881

Please sign in to comment.