Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: simulation support in deploy-cli #406

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

danielattilasimon
Copy link
Collaborator

@danielattilasimon danielattilasimon commented Sep 4, 2024

Add the new flag --dry-run to deploy-cli, which can be used to simulate the deployment without broadcasting transactions. To make this work, we generate a deployment manifest (a JSON file of deployed addresses) from the Solidity script (DeployLiquity2) itself, which lets us avoid having to make RPC calls to get the deployed addresses (which wouldn't work when simulating).

Also add the --slow flag which tells Foundry to broadcast one transaction at a time, which is needed when deploying through providers like Alchemy.

Further, add a --gas-price flag which can be used to set maxFeePerGas in broadcast transactions.

@@ -33,7 +33,6 @@ const argv = minimist(process.argv.slice(2), {

const ZAddress = z.string().regex(/^0x[0-9a-fA-F]{40}$/);
const ZDeploymentContext = z.object({
deployedContracts: z.array(z.tuple([z.string(), ZAddress])),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not used anywhere, was it @bpierre?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only in the subgraph branch, but I will adapt to the new format 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks, I didn't know!

If it needs any contracts missing from the current output, we should be able to add them to protocolContracts or collateralContracts easily.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it’s only for the BoldToken address (the subgraph deployment script can update it from the latest deployment), which we have already :)

Comment on lines 229 to 233
await fs.writeJson("deployment-context-latest.json", {
options: safeOptions,
deployedContracts,
collateralContracts,
protocolContracts,
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this entirely? Or just keep the options there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could inline the JSON coming from the Solidity script as-is, for simplicity. Also, it would be more complete. It might make sense to keep the options. Also, we might want to add additional metadata at some point, like deployment block (might come in handy for the subgraph too), timestamp, etc.

Copy link
Contributor

@bpierre bpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@danielattilasimon danielattilasimon merged commit 176d209 into main Sep 4, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants