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

Deployment scripts #144

Draft
wants to merge 66 commits into
base: main
Choose a base branch
from
Draft

Deployment scripts #144

wants to merge 66 commits into from

Conversation

solanoepalacio
Copy link

No description provided.

}
});

await Promise.all(result);
Copy link

Choose a reason for hiding this comment

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

Why not Promise.allSettled? This will break the script at the first error and discard successful work on other chains, perhaps entire successful deployments.

Copy link
Author

Choose a reason for hiding this comment

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

cb is wrapped on a try/catch statement anyways, I don't think an error can bubble up, or could it? 🤔

Copy link

Choose a reason for hiding this comment

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

Hm, yeah, now that I look at it closer, I guess not. It would blow up when some other function fails like getSigner but that should be fine.

import { ethers } from "ethers";
import { ChainInfo, ecosystemChains, getEnv, LoggerFn } from "./index";

export type EvmScriptCb = (chain: ChainInfo, signer: ethers.Signer, logFn: LoggerFn) => Promise<void>;
Copy link

Choose a reason for hiding this comment

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

This is practical for deployment and configuration scripts but you're enforcing read-only scripts to have a signer by implementing it this way. Which in the worst case means having a ledger connected and unlocked before running such a script 😛

Copy link
Author

Choose a reason for hiding this comment

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

ye, not great right now... but at the same time truth is that I will always have the ledger connected when trying to run a script at the moment... so I decided not to worry about that as much rn, but added this as a requirement for our work methodology

Copy link

Choose a reason for hiding this comment

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

I think it could be worth writing an explicit constructorArgs object that is passed into the ethers arguments matching the ABI named parameters. This is supported for struct members but I don't remember if it's supported for function parameters 🤔 . In this way, we could automatically produce the list of arguments with a generic implementation whenever we need them for verification and also keep them human readable in the configuration.

return dependency;
}

export function writeDeployedContract(chain: ChainId, contractName: string, address: string) {
Copy link

Choose a reason for hiding this comment

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

I think we should start considering writing further output. For example, writing the tx hash that created a contract would be useful to implement specific kinds of deployments or verifying constructor arguments among other things.

Copy link
Author

Choose a reason for hiding this comment

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

cool, sounds like a good idea. But do you agree that we don't need to worry as much about performance on this scripts so we can write atomic pieces of data to files instead of batching up multiple updates?
What I mean is that if we want to store some other datum we should create a simple interface like this one specifically to write the tx hash corresponding to 1 deployment

Copy link

Choose a reason for hiding this comment

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

Choosing a minimal interface would help reduce the burden on whoever writes the script though. I mean, if you figure out that just passing in the ethers contract object plus the receipt is good enough to write absolutely everything, then I see no reason to do any other thing. This is just an example, I'm not sure both of those suffice but they probably bring us very close to what the output should look like.

@gator-boi
Copy link
Contributor

Should this PR be converted to draft? It looks like the last commit mentions WIP.

@AgusVelez5 AgusVelez5 marked this pull request as draft June 24, 2024 17:11
@AgusVelez5 AgusVelez5 marked this pull request as ready for review July 2, 2024 14:46
@AgusVelez5 AgusVelez5 marked this pull request as draft July 17, 2024 18:17
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.

6 participants