From 2e885fc6ee8426119e810d195cd2f1733a7b50b2 Mon Sep 17 00:00:00 2001 From: Daniel <77058885+0xDEnYO@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:40:19 +0700 Subject: [PATCH] add handling for when multicall returns invalid results (#898) --- config/sigs.json | 5 +++-- script/tasks/diamondSyncSigs.ts | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/config/sigs.json b/config/sigs.json index 042d9107b..d927ab4bf 100644 --- a/config/sigs.json +++ b/config/sigs.json @@ -151,6 +151,7 @@ "0xc4af5a74", "0x03b87e5f", "0x0d5f0e3b", - "0x08298b5a" + "0x08298b5a", + "0xff84aafa" ] -} \ No newline at end of file +} diff --git a/script/tasks/diamondSyncSigs.ts b/script/tasks/diamondSyncSigs.ts index 9374b91b5..814e93b1b 100644 --- a/script/tasks/diamondSyncSigs.ts +++ b/script/tasks/diamondSyncSigs.ts @@ -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