Skip to content

Commit

Permalink
Move duplicate and sort checking to validate-deployment-config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dcroote committed Sep 24, 2024
1 parent 862eb7c commit 250f3f0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 60 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/validate-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
- name: Validate deployment config
run: pnpm validate-deployment-config

- name: Validate chain support
run: pnpm validate-chain-support

- name: Validate deployments
run: pnpm validate-deployments
if: always()
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"test:coverage": "hardhat coverage",
"test:extended": "EXTENDED_TEST=TRUE hardhat test --parallel",
"test:gas": "REPORT_GAS=TRUE hardhat test",
"validate-chain-support": "ts-node scripts/validate-chain-support.ts",
"validate-deployment-config": "hardhat run scripts/validate-deployment-config.ts",
"validate-deployments": "hardhat run scripts/validate-deployments.ts",
"verify-deployments": "hardhat run scripts/verify-deployments.ts",
Expand Down
51 changes: 0 additions & 51 deletions scripts/validate-chain-support.ts

This file was deleted.

20 changes: 15 additions & 5 deletions scripts/validate-deployment-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ import managerMultisigAddresses from '../data/manager-multisig.json';

function main() {
const chainAliases = new Set(CHAINS.map((chain) => chain.alias));
[
Object.keys(managerMultisigAddresses),
const records: Record<string, string[]> = {
managerMultisigAddresses: Object.keys(managerMultisigAddresses),
chainsSupportedByDapis,
chainsSupportedByMarket,
chainsSupportedByOevAuctions,
].map((supportedChainAliases) => {
supportedChainAliases.map((supportedChainAlias) => {
};

Object.entries(records).forEach(([fieldName, supportedChainAliases]) => {
supportedChainAliases.forEach((supportedChainAlias) => {
if (!chainAliases.has(supportedChainAlias)) {
throw new Error(`Supported chain with alias ${supportedChainAlias} does not exist`);
throw new Error(`Supported chain in ${fieldName} with alias ${supportedChainAlias} does not exist`);
}
});
if (new Set(supportedChainAliases).size !== supportedChainAliases.length) {
throw new Error(`Duplicates found in ${fieldName}`);
}
const sortedSupportedChainAliases = [...supportedChainAliases].sort();
if (JSON.stringify(supportedChainAliases) !== JSON.stringify(sortedSupportedChainAliases)) {
throw new Error(`${fieldName} is not sorted`);
}
});

Object.entries(managerMultisigAddresses).map(([alias, address]) => {
if (!ethers.isAddress(address)) {
throw new Error(`Manager multisig address of ${alias}, ${address as string}, is not valid`);
Expand Down

0 comments on commit 250f3f0

Please sign in to comment.