Skip to content

Create pre deployment addition script - #1290

Open
Fbartoli wants to merge 15 commits into
safe-fndn:mainfrom
Fbartoli:main
Open

Create pre deployment addition script#1290
Fbartoli wants to merge 15 commits into
safe-fndn:mainfrom
Fbartoli:main

Conversation

@Fbartoli

@Fbartoli Fbartoli commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Fbartoli and others added 9 commits November 21, 2025 09:59
- Add scripts/add-predeployment.ts to create pre-deployment artifacts
- Add GitHub Action workflow callable from UI and other workflows
- Always creates a PR for review
- Runs prettier after adding artifact via npm post script
feat: add pre-deployment workflow for OP Stack and ZKsync networks
- Add scripts/add-predeployment.ts to create pre-deployment artifacts
- Add GitHub Action workflow callable from UI and other workflows
- Always creates a PR for review
- Runs prettier after adding artifact via npm post script
feat: add pre-deployment workflow for OP Stack and ZKsync networks
@Fbartoli
Fbartoli requested a review from a team as a code owner December 1, 2025 13:25
- Adjusted error message formatting for consistency and clarity in the PredeploymentError class.
- Ensured proper line breaks in error details for better readability.
- Enhanced consistency and readability of error messages in the PredeploymentError class.
- Adjusted line breaks for better clarity in error details.
Comment thread .github/workflows/add-predeployment.yml Outdated
env:
CHAIN_ID: ${{ inputs.chain_id }}
RPC: ${{ inputs.rpc_url }}
SKIP_CHAINLIST_CHECK: ${{ inputs.skip_chainlist_check }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think we should have this. We currently have a policy "no non-chainlist networks", and I don't think this CI workflow and script should support it.

Comment thread package.json Outdated
Comment on lines +24 to +25
"add:predeployment": "ts-node scripts/add-predeployment.ts",
"postadd:predeployment": "npm run fmt",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is formatting really necessary here? Can't we just write a correctly formatted file and simplify the process? (IMO, its different to the safe-deployments case where you are editing a JSON file - here you are just writing a pre-baked file).

Comment thread package.json Outdated
"compile:zk": "hardhat compile && hardhat deploy-zksync --script compile-zk.ts",
"verify": "ts-node scripts/verify.ts",
"verify:new-chain-request": "ts-node scripts/new-chain.ts",
"add:predeployment": "ts-node scripts/add-predeployment.ts",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ubernit:

Suggested change
"add:predeployment": "ts-node scripts/add-predeployment.ts",
"add-predeployment": "ts-node scripts/add-predeployment.ts",

Comment thread scripts/add-predeployment.ts Outdated
Comment on lines +162 to +164
"Chain ID not provided",
`**⛔️ Error:**<br>` +
`Chain ID not provided. Please set the CHAIN_ID environment variable.`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These errors with formatting and emojis seem unnecessary to me, and IMO add quite a bit of "noise" to the script.

They were there for the new chain script because these are formatted messages for posting to GitHub issues, but here they are just echo-ed to the GitHub action console. In fact, I don't know if the <br> or the ** bold markers even render correctly.

Comment thread scripts/add-predeployment.ts Outdated
}

// Verify chain is in chainlist (optional)
const skipChainlistCheck = process.env.SKIP_CHAINLIST_CHECK === "true";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is against the policy of the repo, we should not include it here.

Comment thread scripts/add-predeployment.ts Outdated
await verifyPredeployment(rpcUrl, chainId);
} else {
console.log(
"Warning: No RPC URL provided. Skipping on-chain verification.",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should get the RPC from the Chainlist rocs.json no?


fs.writeFileSync(
artifactPath,
JSON.stringify(PREDEPLOYMENT_ARTIFACT, null, "\t") + "\n",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This makes me think that we don't need to run npm run fmt after execution.

- Remove SKIP_CHAINLIST_CHECK option (repo policy: no non-chainlist networks)
- Auto-fetch RPC URL from chainlist rpcs.json
- Simplify error messages (remove markdown formatting and emojis)
- Rename script from add:predeployment to add-predeployment
- Remove postadd:predeployment script (file already correctly formatted)
- Remove rpc_url and skip_chainlist_check inputs from workflow
- Update workflow to use new script name and simplified outputs
- Changed npm install command from 'npm ci --ignore-scripts' to 'npm ci' for consistency and to ensure all scripts are executed during installation.
Comment thread scripts/add-predeployment.ts Outdated
Comment on lines 179 to 184
class PredeploymentError extends Error {
constructor(message: string) {
super(message);
this.name = "PredeploymentError";
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we just use a regular Error? I don't think the additional type gives us anything.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

- Removed unused RPC URL fetching and verification logic from the add-predeployment script.
- Streamlined error handling for chainlist verification.
- Updated type definitions for better clarity and removed unnecessary
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