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(governance) refactored the script to check multisig signers and settings #13488
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,25 @@ const { networks } = require('@unlock-protocol/networks') | |
|
||
const SafeApiKit = require('@safe-global/api-kit').default | ||
|
||
const getMultigiInfo = async (chainId, multisig) => { | ||
const prodSigners = [ | ||
'0x9d3ea9e9adde71141f4534dB3b9B80dF3D03Ee5f', // cc | ||
'0x4Ce2DD8373ECe0d7baAA16E559A5817CC875b16a', // jg | ||
'0x4011d09a86D0acA8377a4A8baD691F1ACeeCd672', // nf | ||
'0xcFd35259E3A468E7bDF84a95bCddAc0B614A9212', // aa | ||
'0xccb5D94FbfBFDc4953Ca8a114f88773C2fF98e80', // sm | ||
'0x246A13358Fb27523642D86367a51C2aEB137Ac6C', // cr | ||
].sort() | ||
|
||
const devSigners = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idem maybe use Sepolia as reference ? |
||
'0x4Ce2DD8373ECe0d7baAA16E559A5817CC875b16a', // jg | ||
'0x246A13358Fb27523642D86367a51C2aEB137Ac6C', // cr | ||
'0x9d3ea9e9adde71141f4534dB3b9B80dF3D03Ee5f', // cc | ||
].sort() | ||
|
||
const getMultiSigInfo = async (chainId, multisig) => { | ||
const errors = [] | ||
const { isTestNetwork } = networks[chainId] | ||
const expectedSigners = isTestNetwork ? devSigners : prodSigners | ||
const provider = await getProvider(chainId) | ||
// get Safe service | ||
const safeService = new SafeApiKit({ | ||
|
@@ -26,24 +43,37 @@ const getMultigiInfo = async (chainId, multisig) => { | |
// queued: false, | ||
// }) | ||
|
||
const safe = new ethers.Contract(multisig, multisigABI, provider) | ||
const owners = await safe.getOwners() | ||
const policy = await safe.getThreshold() | ||
if (!multisig) { | ||
errors.push('Missing multisig') | ||
} else { | ||
if (policy == 1) { | ||
errors.push('❌ Single policy owner!') | ||
const safe = new ethers.Contract(multisig, multisigABI, provider) | ||
const owners = await safe.getOwners() | ||
const policy = await safe.getThreshold() | ||
|
||
if (isTestNetwork && policy < 2) { | ||
errors.push('❌ Policy below 2!') | ||
} | ||
if (!isTestNetwork && policy < 4) { | ||
errors.push( | ||
`❌ Unexpected policy: ${policy}/${owners.length} for 4/${expectedSigners.length} expected` | ||
) | ||
} | ||
if (policy <= 2 || policy / BigInt(owners.length) > 1.5) { | ||
errors.push(`Low policy owner (${policy}/${owners.length})`) | ||
|
||
let extraSigners = owners.filter((x) => !expectedSigners.includes(x)) | ||
if (extraSigners.length > 0) { | ||
errors.push(`❌ Extra signers: ${[...extraSigners].sort()}`) | ||
} | ||
|
||
let missingSigners = expectedSigners.filter((x) => !owners.includes(x)) | ||
if (missingSigners.length > 0) { | ||
errors.push(`❌ Missing signers: ${missingSigners}`) | ||
} | ||
} | ||
return errors | ||
} | ||
|
||
const log = (name, chainId, msg) => | ||
console.log(`[${name} (${chainId})]: ${msg}`) | ||
const log = (name, chainId, multisig, msg) => | ||
console.log(`[${name} (${chainId})]: ${multisig} ${msg}`) | ||
|
||
async function main() { | ||
for (let chainId in networks) { | ||
|
@@ -52,11 +82,11 @@ async function main() { | |
const { multisig, name } = networks[chainId] | ||
|
||
try { | ||
errors = await getMultigiInfo(chainId, multisig) | ||
errors = await getMultiSigInfo(chainId, multisig) | ||
} catch (error) { | ||
errors = [`Couldn't fetch multisig info: ${error.message}`] | ||
} | ||
errors.forEach((error) => log(name, chainId, error)) | ||
errors.forEach((error) => log(name, chainId, multisig, error)) | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we get these from mainnet directly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering about that, but then realized it was going to be weird to check something against itself...