Skip to content

Commit

Permalink
fix(cli): run postdeploy with aws flag when kms is enabled (#2766)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
yonadaaa and holic authored Apr 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e03830e commit 428ff97
Showing 3 changed files with 24 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .changeset/hip-chairs-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@latticexyz/cli": patch
---

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();
```
9 changes: 8 additions & 1 deletion packages/cli/src/runDeploy.ts
Original file line number Diff line number Diff line change
@@ -134,7 +134,14 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> {
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.awsKmsKeyId !== undefined,
);
}
console.log(chalk.green("Deployment completed in", (Date.now() - startTime) / 1000, "seconds"));

2 changes: 2 additions & 0 deletions packages/cli/src/utils/postDeploy.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ export async function postDeploy(
rpc: string,
profile: string | undefined,
forgeOptions: string | undefined,
kms: boolean,
): Promise<void> {
// TODO: make this more robust as it is likely to fail for any args that have a space in them
const userOptions = forgeOptions?.replaceAll("\\", "").split(" ") ?? [];
@@ -31,6 +32,7 @@ export async function postDeploy(
"--rpc-url",
rpc,
"-vvv",
kms ? "--aws" : "",
...userOptions,
],
{

0 comments on commit 428ff97

Please sign in to comment.