Skip to content

Commit

Permalink
add handling for when multicall returns invalid results (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xDEnYO authored Dec 10, 2024
1 parent c689987 commit 2e885fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions config/sigs.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"0xc4af5a74",
"0x03b87e5f",
"0x0d5f0e3b",
"0x08298b5a"
"0x08298b5a",
"0xff84aafa"
]
}
}
20 changes: 16 additions & 4 deletions script/tasks/diamondSyncSigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,23 @@ const main = defineCommand({

// Get list of function signatures to approve
const sigsToApprove: Hex[] = []
let multicallSuccess = true
for (let i = 0; i < results.length; i++) {
if (!results[i].result) {
console.log('Function not approved:', sigs[i])
sigsToApprove.push(sigs[i] as Hex)
}
if (results[i].status == 'success') {
if (!results[i].result) {
console.log('Function not approved:', sigs[i])
sigsToApprove.push(sigs[i] as Hex)
}
} else multicallSuccess = false
}

if (!multicallSuccess) {
consola.error(
`The multicall failed, could not check all currently registered signatures. Please use a different RPC for this network and try to run the script again.`
)
// returning a success code here cause otherwise the wrapping bash script will always run the "old approach"
// and we still end up re-approving all signatures again and again
process.exit(0)
}

// Instantiate wallet (write enabled) client
Expand Down

0 comments on commit 2e885fc

Please sign in to comment.