Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into account-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed May 1, 2024
2 parents ec6f0f7 + 338c8e5 commit d04b822
Show file tree
Hide file tree
Showing 81 changed files with 510 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ name: Build
on:
pull_request:

env:
NODE_OPTIONS: "--max-old-space-size=4096"

jobs:
build:
name: Build and validate artifacts
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm

env:
NODE_OPTIONS: "--max-old-space-size=4096"

jobs:
prerelease:
name: Changesets Prerelease
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm

env:
NODE_OPTIONS: "--max-old-space-size=4096"

jobs:
release:
name: Release
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
# Ensure only one workflow/job is publishing to npm at a time
concurrency: publish-to-npm

env:
NODE_OPTIONS: "--max-old-space-size=4096"

jobs:
release-snapshot:
name: Publish snapshot release to npm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
if: steps.check_changes.outputs.changes_outside_docs
env:
DATABASE_URL: "postgres://postgres@localhost:5432/postgres"
KMS_ENDPOINT: "http://localhost:8080"
AWS_ENDPOINT_URL: "http://localhost:8080"
run: pnpm test:ci

- name: Generate gas reports
Expand Down
64 changes: 64 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
## Version 2.0.9

Release date: Wed May 01 2024

### Patch changes

**[fix(cli): do not require `PRIVATE_KEY` if using KMS (#2765)](https://github.com/latticexyz/mud/commit/30318687f35a57217e932f9f2b4c80a9d6617ee5)** (@latticexyz/cli)

Fixed `mud deploy` to not require the `PRIVATE_KEY` environment variable when using a KMS signer.

**[feat(create-mud): redstone and garnet chains (#2776)](https://github.com/latticexyz/mud/commit/6b247fb9d1902a5138ad4a05b634b4d0921af433)** (create-mud)

Updated templates with Redstone and Garnet chains and removed the deprecated Lattice testnet chain.

**[feat(store-indexer): add metric for distance from block tag to follow (#2763)](https://github.com/latticexyz/mud/commit/93690fdb1d51f8ef470fd4f1d84490c14bf1f442)** (@latticexyz/store-indexer)

Added a `distance_from_follow_block` metric to compare the latest stored block number with the block number corresponding to the block tag the indexer follows.

**[feat(cli): blockscout is default verifier (#2775)](https://github.com/latticexyz/mud/commit/0b6b70ffd2f8e7eaa9732d2aa5b158fd0927d10b)** (@latticexyz/cli)

`mud verify` now defaults to blockscout if no `--verifier` is provided.

**[fix(cli): run postdeploy with aws flag when kms is enabled (#2766)](https://github.com/latticexyz/mud/commit/428ff972198425cb19d363c92eb49002accdc6a0)** (@latticexyz/cli)

Fixed `mud deploy` to use the `forge script --aws` flag when executing `PostDeploy` with a KMS signer.

Note that you may need to update your `PostDeploy.s.sol` script, with `vm.startBroadcast` receiving no arguments instead of reading a private key from the environment:

```diff
-uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
-vm.startBroadcast(deployerPrivateKey);

+vm.startBroadcast();
```

**[feat(common): add indexer URL to chain configs (#2771)](https://github.com/latticexyz/mud/commit/764ca0a0c390ddce5d8a618fd4e801e9fc542a0b)** (@latticexyz/store-sync)

Updated `createStoreSync` to default to the chain's indexer URL when no `indexerUrl` is passed in. To intentionally unset the value and not use the indexer at all, `indexerUrl` can now also be `false`.

**[fix(cli): remove postdeploy gas setting in favor of script options (#2756)](https://github.com/latticexyz/mud/commit/074ed66eb64df377e37684c47d7ff15ced16885b)** (@latticexyz/cli)

Removed manual gas setting in PostDeploy step of `mud deploy` in favor of `forge script` fetching it from the RPC.

If you still want to manually set gas, you can use `mud deploy --forgeScriptOptions="--with-gas-price 1000000"`.

**[refactor(common,cli): kms deployer gets keyId from environment (#2760)](https://github.com/latticexyz/mud/commit/e03830ebe3ee3ea6fb1384be53fc26b668fbe607)** (@latticexyz/cli)

The key ID for deploying via KMS signer is now set via an `AWS_KMS_KEY_ID` environment variable to better align with Foundry tooling. To enable KMS signing with this environment variable, use the `--kms` flag.

```diff
-mud deploy --awsKmsKeyId [key ID]
+AWS_KMS_KEY_ID=[key ID] mud deploy --kms
```

**[feat(common): add indexer URL to chain configs (#2771)](https://github.com/latticexyz/mud/commit/764ca0a0c390ddce5d8a618fd4e801e9fc542a0b)** (@latticexyz/common)

Added an optional `indexerUrl` property to `MUDChain`, and populated it in the Redstone and Garnet chain configs.

**[feat(common): add chain icons (#2778)](https://github.com/latticexyz/mud/commit/bad3ad1bd9bb86bc7eb83cfb299df92d14c64c46)** (@latticexyz/common)

Added chain icons to Redstone and Garnet chain configs via `chain.iconUrls`.

---

## Version 2.0.8

Release date: Sat Apr 27 2024
Expand Down
64 changes: 64 additions & 0 deletions docs/pages/changelog.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
## Version 2.0.9

Release date: Wed May 01 2024

### Patch changes

**[fix(cli): do not require `PRIVATE_KEY` if using KMS (#2765)](https://github.com/latticexyz/mud/commit/30318687f35a57217e932f9f2b4c80a9d6617ee5)** (@latticexyz/cli)

Fixed `mud deploy` to not require the `PRIVATE_KEY` environment variable when using a KMS signer.

**[feat(create-mud): redstone and garnet chains (#2776)](https://github.com/latticexyz/mud/commit/6b247fb9d1902a5138ad4a05b634b4d0921af433)** (create-mud)

Updated templates with Redstone and Garnet chains and removed the deprecated Lattice testnet chain.

**[feat(store-indexer): add metric for distance from block tag to follow (#2763)](https://github.com/latticexyz/mud/commit/93690fdb1d51f8ef470fd4f1d84490c14bf1f442)** (@latticexyz/store-indexer)

Added a `distance_from_follow_block` metric to compare the latest stored block number with the block number corresponding to the block tag the indexer follows.

**[feat(cli): blockscout is default verifier (#2775)](https://github.com/latticexyz/mud/commit/0b6b70ffd2f8e7eaa9732d2aa5b158fd0927d10b)** (@latticexyz/cli)

`mud verify` now defaults to blockscout if no `--verifier` is provided.

**[fix(cli): run postdeploy with aws flag when kms is enabled (#2766)](https://github.com/latticexyz/mud/commit/428ff972198425cb19d363c92eb49002accdc6a0)** (@latticexyz/cli)

Fixed `mud deploy` to use the `forge script --aws` flag when executing `PostDeploy` with a KMS signer.

Note that you may need to update your `PostDeploy.s.sol` script, with `vm.startBroadcast` receiving no arguments instead of reading a private key from the environment:

```diff
-uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
-vm.startBroadcast(deployerPrivateKey);

+vm.startBroadcast();
```

**[feat(common): add indexer URL to chain configs (#2771)](https://github.com/latticexyz/mud/commit/764ca0a0c390ddce5d8a618fd4e801e9fc542a0b)** (@latticexyz/store-sync)

Updated `createStoreSync` to default to the chain's indexer URL when no `indexerUrl` is passed in. To intentionally unset the value and not use the indexer at all, `indexerUrl` can now also be `false`.

**[fix(cli): remove postdeploy gas setting in favor of script options (#2756)](https://github.com/latticexyz/mud/commit/074ed66eb64df377e37684c47d7ff15ced16885b)** (@latticexyz/cli)

Removed manual gas setting in PostDeploy step of `mud deploy` in favor of `forge script` fetching it from the RPC.

If you still want to manually set gas, you can use `mud deploy --forgeScriptOptions="--with-gas-price 1000000"`.

**[refactor(common,cli): kms deployer gets keyId from environment (#2760)](https://github.com/latticexyz/mud/commit/e03830ebe3ee3ea6fb1384be53fc26b668fbe607)** (@latticexyz/cli)

The key ID for deploying via KMS signer is now set via an `AWS_KMS_KEY_ID` environment variable to better align with Foundry tooling. To enable KMS signing with this environment variable, use the `--kms` flag.

```diff
-mud deploy --awsKmsKeyId [key ID]
+AWS_KMS_KEY_ID=[key ID] mud deploy --kms
```

**[feat(common): add indexer URL to chain configs (#2771)](https://github.com/latticexyz/mud/commit/764ca0a0c390ddce5d8a618fd4e801e9fc542a0b)** (@latticexyz/common)

Added an optional `indexerUrl` property to `MUDChain`, and populated it in the Redstone and Garnet chain configs.

**[feat(common): add chain icons (#2778)](https://github.com/latticexyz/mud/commit/bad3ad1bd9bb86bc7eb83cfb299df92d14c64c46)** (@latticexyz/common)

Added chain icons to Redstone and Garnet chain configs via `chain.iconUrls`.

---

## Version 2.0.8

Release date: Sat Apr 27 2024
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/cli/verify.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Otherwise, the generated bytecode is different and therefore verification fails.
| ---------------- | ------------------------------------------------------ | ------- | ---------------------------- |
| `--worldAddress` | Verify the contracts of the World at the given address | string | none, error if unspecified |
| `--configPath` | Path to the config file | string | `mud.config.ts` |
| `--verifier` | The verifier to use (`sourcify`, or `blockscout`) | string | `sourcify` |
| `--verifier` | The verifier to use (`sourcify`, or `blockscout`) | string | `blockscout` |
| `--verifierUrl` | URL to use to access the verifier's API | string | depends on the verifier used |
| `--profile` | The foundry profile to use | string | `local` |
| `--rpc` | URL to the blockchain | string | |
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.0.9

## 2.0.8

## 2.0.7
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.0.8",
"version": "2.0.9",
"description": "Create TypeScript type declaration files (`.d.ts`) for your ABI JSON files.",
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions packages/block-logs-stream/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @latticexyz/block-logs-stream

## 2.0.9

### Patch Changes

- Updated dependencies [764ca0a0]
- Updated dependencies [bad3ad1b]
- @latticexyz/common@2.0.9

## 2.0.8

### 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.0.8",
"version": "2.0.9",
"description": "Create a stream of EVM block logs for events",
"repository": {
"type": "git",
Expand Down
42 changes: 42 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# Change Log

## 2.0.9

### Patch Changes

- 30318687: Fixed `mud deploy` to not require the `PRIVATE_KEY` environment variable when using a KMS signer.
- 0b6b70ff: `mud verify` now defaults to blockscout if no `--verifier` is provided.
- 428ff972: Fixed `mud deploy` to use the `forge script --aws` flag when executing `PostDeploy` with a KMS signer.

Note that you may need to update your `PostDeploy.s.sol` script, with `vm.startBroadcast` receiving no arguments instead of reading a private key from the environment:

```diff
-uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
-vm.startBroadcast(deployerPrivateKey);

+vm.startBroadcast();
```

- 074ed66e: Removed manual gas setting in PostDeploy step of `mud deploy` in favor of `forge script` fetching it from the RPC.

If you still want to manually set gas, you can use `mud deploy --forgeScriptOptions="--with-gas-price 1000000"`.

- e03830eb: The key ID for deploying via KMS signer is now set via an `AWS_KMS_KEY_ID` environment variable to better align with Foundry tooling. To enable KMS signing with this environment variable, use the `--kms` flag.

```diff
-mud deploy --awsKmsKeyId [key ID]
+AWS_KMS_KEY_ID=[key ID] mud deploy --kms
```

- Updated dependencies [764ca0a0]
- Updated dependencies [bad3ad1b]
- @latticexyz/common@2.0.9
- @latticexyz/config@2.0.9
- @latticexyz/protocol-parser@2.0.9
- @latticexyz/store@2.0.9
- @latticexyz/world@2.0.9
- @latticexyz/world-modules@2.0.9
- @latticexyz/abi-ts@2.0.9
- @latticexyz/gas-report@2.0.9
- @latticexyz/schema-type@2.0.9
- @latticexyz/services@2.0.9
- @latticexyz/utils@2.0.9

## 2.0.8

### 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.0.8",
"version": "2.0.9",
"description": "Command line interface for mud",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/dev-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const commandModule: CommandModule<typeof devOptions, InferredOptionTypes<typeof
worldAddress,
srcDir,
salt: "0x",
awsKmsKeyId: undefined,
kms: undefined,
});
worldAddress = deploy.address;
// if there were changes while we were deploying, trigger it again
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const verifyOptions = {
desc: "Enable batch processing of RPC requests in viem client (defaults to batch size of 100 and wait of 1s)",
},
srcDir: { type: "string", desc: "Source directory. Defaults to foundry src directory." },
verifier: { type: "string", desc: "The verifier to use. Default to sourcify", default: "sourcify" },
verifier: { type: "string", desc: "The verifier to use. Defaults to blockscout", default: "blockscout" },
verifierUrl: {
type: "string",
desc: "The verification provider.",
Expand Down
49 changes: 34 additions & 15 deletions packages/cli/src/runDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export const deployOptions = {
type: "string",
desc: "The deployment salt to use. Defaults to a random salt.",
},
awsKmsKeyId: {
type: "string",
desc: "Optional AWS KMS key ID. If set, the World is deployed using a KMS signer instead of local private key.",
kms: {
type: "boolean",
desc: "Deploy the World with an AWS KMS key instead of local private key.",
},
} as const satisfies Record<string, Options>;

Expand Down Expand Up @@ -84,19 +84,31 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
await build({ config: configV2, srcDir, foundryProfile: profile });
}

const privateKey = process.env.PRIVATE_KEY as Hex;
if (!privateKey) {
throw new MUDError(
`Missing PRIVATE_KEY environment variable.
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
in your contracts directory to use the default anvil private key.`,
);
}

const resolvedConfig = resolveConfig({ config, forgeSourceDir: srcDir, forgeOutDir: outDir });

const keyId = opts.awsKmsKeyId ?? process.env.AWS_KMS_KEY_ID;
const account = keyId ? await kmsKeyToAccount({ keyId }) : privateKeyToAccount(privateKey);
const account = await (async () => {
if (opts.kms) {
const keyId = process.env.AWS_KMS_KEY_ID;
if (!keyId) {
throw new MUDError(
"Missing `AWS_KMS_KEY_ID` environment variable. This is required when using with `--kms` option.",
);
}

return await kmsKeyToAccount({ keyId });
} else {
const privateKey = process.env.PRIVATE_KEY;
if (!privateKey) {
throw new MUDError(
`Missing PRIVATE_KEY environment variable.
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
in your contracts directory to use the default anvil private key.`,
);
}

return privateKeyToAccount(privateKey as Hex);
}
})();

const client = createWalletClient({
transport: http(rpc, {
Expand All @@ -122,7 +134,14 @@ in your contracts directory to use the default anvil private key.`,
withWorldProxy: configV2.deploy.upgradeableWorldImplementation,
});
if (opts.worldAddress == null || opts.alwaysRunPostDeploy) {
await postDeploy(config.postDeployScript, worldDeploy.address, rpc, profile, opts.forgeScriptOptions);
await postDeploy(
config.postDeployScript,
worldDeploy.address,
rpc,
profile,
opts.forgeScriptOptions,
opts.kms ? true : false,
);
}
console.log(chalk.green("Deployment completed in", (Date.now() - startTime) / 1000, "seconds"));

Expand Down
Loading

0 comments on commit d04b822

Please sign in to comment.