Skip to content

Commit

Permalink
Merge branch 'main' into optimistic-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
holic authored Sep 23, 2024
2 parents ad4eb36 + 9d990b5 commit 7d685e5
Show file tree
Hide file tree
Showing 62 changed files with 345 additions and 100 deletions.
6 changes: 0 additions & 6 deletions .changeset/early-poems-heal.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/good-crabs-trade.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/large-windows-sort.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/tricky-chefs-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/cli": patch
---

Adjusted deploy order so that the world deploy happens before everything else to avoid spending gas on system contract deploys, etc. if a world cannot be created first.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## Version 2.2.8

Release date: Mon Sep 23 2024

### Patch changes

**[feat(store-sync): remove unused generics (#3218)](https://github.com/latticexyz/mud/commit/7c7bdb26d0f87e2a5fc20c4eb34abb5167000ab9)** (@latticexyz/common, @latticexyz/store-sync)

Removed unused generics and ensure that we're only passing around the generics we need, when we need them. Hopefully this improves TS performance in MUD projects.

**[fix(create-mud): add missing three deps, fix types (#3221)](https://github.com/latticexyz/mud/commit/4fffb79d433d1052e4b3c9cce0215cf81eba9b11)** (create-mud)

Fixed types in threejs template after dependency bump.

**[feat(cli): paginate world deploy logs (#3217)](https://github.com/latticexyz/mud/commit/0f5b2916edfa24b9d0ad1b82df56aed57f7e657d)** (@latticexyz/cli)

When deploying to an existing world, the deployer now paginates with [`fetchLogs`](https://github.com/latticexyz/mud/blob/main/packages/block-logs-stream/src/fetchLogs.ts) to find the world deployment.

**[feat(cli): paginate world deploy logs (#3217)](https://github.com/latticexyz/mud/commit/0f5b2916edfa24b9d0ad1b82df56aed57f7e657d)** (@latticexyz/block-logs-stream)

- For block range size errors, `fetchLogs` now reduces the max block range for subsequent requests in its loop. For block out of range or response size errors, only the current request's block range is reduced until the request succeeds, then it resets to the max block range.
- Added `fetchBlockLogs` to find all matching logs of the given block range, grouped by block number, in a single async call.
- Loosened the `publicClient` type and switched to tree shakable actions.

**[fix(cli): wait for world init before transferring ownership (#3220)](https://github.com/latticexyz/mud/commit/b0711983a5f72f9b3236e6cbcef3dae7a424a09c)** (@latticexyz/cli)

If the project is using a custom world, the deployer now waits for the init transaction to be confirmed before transferring ownership of the world.

---

## Version 2.2.7

Release date: Fri Sep 20 2024
Expand Down
30 changes: 30 additions & 0 deletions docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## Version 2.2.8

Release date: Mon Sep 23 2024

### Patch changes

**[feat(store-sync): remove unused generics (#3218)](https://github.com/latticexyz/mud/commit/7c7bdb26d0f87e2a5fc20c4eb34abb5167000ab9)** (@latticexyz/common, @latticexyz/store-sync)

Removed unused generics and ensure that we're only passing around the generics we need, when we need them. Hopefully this improves TS performance in MUD projects.

**[fix(create-mud): add missing three deps, fix types (#3221)](https://github.com/latticexyz/mud/commit/4fffb79d433d1052e4b3c9cce0215cf81eba9b11)** (create-mud)

Fixed types in threejs template after dependency bump.

**[feat(cli): paginate world deploy logs (#3217)](https://github.com/latticexyz/mud/commit/0f5b2916edfa24b9d0ad1b82df56aed57f7e657d)** (@latticexyz/cli)

When deploying to an existing world, the deployer now paginates with [`fetchLogs`](https://github.com/latticexyz/mud/blob/main/packages/block-logs-stream/src/fetchLogs.ts) to find the world deployment.

**[feat(cli): paginate world deploy logs (#3217)](https://github.com/latticexyz/mud/commit/0f5b2916edfa24b9d0ad1b82df56aed57f7e657d)** (@latticexyz/block-logs-stream)

- For block range size errors, `fetchLogs` now reduces the max block range for subsequent requests in its loop. For block out of range or response size errors, only the current request's block range is reduced until the request succeeds, then it resets to the max block range.
- Added `fetchBlockLogs` to find all matching logs of the given block range, grouped by block number, in a single async call.
- Loosened the `publicClient` type and switched to tree shakable actions.

**[fix(cli): wait for world init before transferring ownership (#3220)](https://github.com/latticexyz/mud/commit/b0711983a5f72f9b3236e6cbcef3dae7a424a09c)** (@latticexyz/cli)

If the project is using a custom world, the deployer now waits for the init transaction to be confirmed before transferring ownership of the world.

---

## Version 2.2.7

Release date: Fri Sep 20 2024
Expand Down
2 changes: 2 additions & 0 deletions packages/abi-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @latticexyz/abi-ts

## 2.2.8

## 2.2.7

## 2.2.6
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@latticexyz/abi-ts",
"version": "2.2.7",
"version": "2.2.8",
"description": "Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files.",
"repository": {
"type": "git",
Expand Down
10 changes: 10 additions & 0 deletions packages/block-logs-stream/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @latticexyz/block-logs-stream

## 2.2.8

### Patch Changes

- 0f5b291: - For block range size errors, `fetchLogs` now reduces the max block range for subsequent requests in its loop. For block out of range or response size errors, only the current request's block range is reduced until the request succeeds, then it resets to the max block range.
- Added `fetchBlockLogs` to find all matching logs of the given block range, grouped by block number, in a single async call.
- Loosened the `publicClient` type and switched to tree shakable actions.
- Updated dependencies [7c7bdb2]
- @latticexyz/common@2.2.8

## 2.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/block-logs-stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@latticexyz/block-logs-stream",
"version": "2.2.7",
"version": "2.2.8",
"description": "Create a stream of EVM block logs for events",
"repository": {
"type": "git",
Expand Down
20 changes: 20 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## 2.2.8

### Patch Changes

- 0f5b291: When deploying to an existing world, the deployer now paginates with [`fetchLogs`](https://github.com/latticexyz/mud/blob/main/packages/block-logs-stream/src/fetchLogs.ts) to find the world deployment.
- b071198: If the project is using a custom world, the deployer now waits for the init transaction to be confirmed before transferring ownership of the world.
- Updated dependencies [7c7bdb2]
- Updated dependencies [0f5b291]
- @latticexyz/common@2.2.8
- @latticexyz/block-logs-stream@2.2.8
- @latticexyz/config@2.2.8
- @latticexyz/protocol-parser@2.2.8
- @latticexyz/store@2.2.8
- @latticexyz/world@2.2.8
- @latticexyz/world-module-metadata@2.2.8
- @latticexyz/abi-ts@2.2.8
- @latticexyz/gas-report@2.2.8
- @latticexyz/schema-type@2.2.8
- @latticexyz/utils@2.2.8

## 2.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@latticexyz/cli",
"version": "2.2.7",
"version": "2.2.8",
"description": "Command line interface for mud",
"repository": {
"type": "git",
Expand Down
48 changes: 22 additions & 26 deletions packages/cli/src/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { debug } from "./debug";
import { resourceToHex, resourceToLabel } from "@latticexyz/common";
import { ensureContractsDeployed } from "./ensureContractsDeployed";
import { randomBytes } from "crypto";
import { ensureWorldFactory } from "./ensureWorldFactory";
import { Table } from "@latticexyz/config";
import { ensureResourceTags } from "./ensureResourceTags";
import { waitForTransactions } from "./waitForTransactions";
Expand Down Expand Up @@ -62,9 +61,29 @@ export async function deploy({
}: DeployOptions): Promise<WorldDeploy> {
const deployerAddress = initialDeployerAddress ?? (await ensureDeployer(client));

await ensureWorldFactory(client, deployerAddress, config.deploy.upgradeableWorldImplementation);
const worldDeploy = existingWorldAddress
? await getWorldDeploy(client, existingWorldAddress)
: config.deploy.customWorld
? await deployCustomWorld({
client,
deployerAddress,
artifacts,
customWorld: config.deploy.customWorld,
})
: await deployWorld(
client,
deployerAddress,
salt ?? `0x${randomBytes(32).toString("hex")}`,
config.deploy.upgradeableWorldImplementation,
);

if (!supportedStoreVersions.includes(worldDeploy.storeVersion)) {
throw new Error(`Unsupported Store version: ${worldDeploy.storeVersion}`);
}
if (!supportedWorldVersions.includes(worldDeploy.worldVersion)) {
throw new Error(`Unsupported World version: ${worldDeploy.worldVersion}`);
}

// deploy all dependent contracts, because system registration, module install, etc. all expect these contracts to be callable.
const libraryMap = getLibraryMap(libraries);
await ensureContractsDeployed({
client,
Expand All @@ -88,29 +107,6 @@ export async function deploy({
],
});

const worldDeploy = existingWorldAddress
? await getWorldDeploy(client, existingWorldAddress)
: config.deploy.customWorld
? await deployCustomWorld({
client,
deployerAddress,
artifacts,
customWorld: config.deploy.customWorld,
})
: await deployWorld(
client,
deployerAddress,
salt ?? `0x${randomBytes(32).toString("hex")}`,
config.deploy.upgradeableWorldImplementation,
);

if (!supportedStoreVersions.includes(worldDeploy.storeVersion)) {
throw new Error(`Unsupported Store version: ${worldDeploy.storeVersion}`);
}
if (!supportedWorldVersions.includes(worldDeploy.worldVersion)) {
throw new Error(`Unsupported World version: ${worldDeploy.worldVersion}`);
}

const namespaceTxs = await ensureNamespaceOwner({
client,
worldDeploy,
Expand Down
37 changes: 18 additions & 19 deletions packages/cli/src/deploy/deployCustomWorld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,25 @@ export async function deployCustomWorld({
const deploy = logsToWorldDeploy(receipt.logs);
debug("deployed custom world to", deploy.address, "at block", deploy.deployBlock);

const initTxs = await Promise.all([
// initialize world via init module
writeContract(client, {
chain: client.chain ?? null,
address: deploy.address,
abi: worldAbi,
functionName: "initialize",
args: [contracts.InitModule.address],
}),
// transfer root namespace to deployer
writeContract(client, {
chain: client.chain ?? null,
address: deploy.address,
abi: worldAbi,
functionName: "transferOwnership",
args: [resourceToHex({ type: "namespace", namespace: "", name: "" }), client.account.address],
}),
]);
// initialize world via init module
const initTx = await writeContract(client, {
chain: client.chain ?? null,
address: deploy.address,
abi: worldAbi,
functionName: "initialize",
args: [contracts.InitModule.address],
});
await waitForTransactions({ client, hashes: [initTx], debugLabel: "world init" });

await waitForTransactions({ client, hashes: initTxs, debugLabel: "world init" });
// transfer root namespace to deployer after init module is installed so `transferOwnership` method is available
const transferOwnershipTx = await writeContract(client, {
chain: client.chain ?? null,
address: deploy.address,
abi: worldAbi,
functionName: "transferOwnership",
args: [resourceToHex({ type: "namespace", namespace: "", name: "" }), client.account.address],
});
await waitForTransactions({ client, hashes: [transferOwnershipTx], debugLabel: "world ownership transfer" });

return { ...deploy, stateBlock: deploy.deployBlock };
}
7 changes: 7 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 2.2.8

### Patch Changes

- 7c7bdb2: Removed unused generics and ensure that we're only passing around the generics we need, when we need them. Hopefully this improves TS performance in MUD projects.
- @latticexyz/schema-type@2.2.8

## 2.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@latticexyz/common",
"version": "2.2.7",
"version": "2.2.8",
"description": "Common low level logic shared between packages",
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## 2.2.8

### Patch Changes

- Updated dependencies [7c7bdb2]
- @latticexyz/common@2.2.8
- @latticexyz/schema-type@2.2.8

## 2.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@latticexyz/config",
"version": "2.2.7",
"version": "2.2.8",
"description": "Config for Store and World",
"repository": {
"type": "git",
Expand Down
6 changes: 6 additions & 0 deletions packages/create-mud/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 2.2.8

### Patch Changes

- 4fffb79: Fixed types in threejs template after dependency bump.

## 2.2.7

## 2.2.6
Expand Down
2 changes: 1 addition & 1 deletion packages/create-mud/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-mud",
"version": "2.2.7",
"version": "2.2.8",
"description": "Create a new MUD project",
"license": "MIT",
"author": "Lattice <[email protected]>",
Expand Down
14 changes: 14 additions & 0 deletions packages/dev-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @latticexyz/dev-tools

## 2.2.8

### Patch Changes

- Updated dependencies [7c7bdb2]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]

## 2.2.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@latticexyz/dev-tools",
"version": "2.2.7",
"version": "2.2.8",
"description": "MUD developer tools",
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions packages/explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @latticexyz/explorer

## 2.2.8

### Patch Changes

- Updated dependencies [7c7bdb2]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]
- @latticexyz/[email protected]

## 2.2.7

### Patch Changes
Expand Down
Loading

0 comments on commit 7d685e5

Please sign in to comment.