diff --git a/contracts/zero-ex/scripts/rollback.ts b/contracts/zero-ex/scripts/rollback.ts index 6d014fa88c..cc99f2d6ba 100644 --- a/contracts/zero-ex/scripts/rollback.ts +++ b/contracts/zero-ex/scripts/rollback.ts @@ -236,13 +236,16 @@ async function functionHistoryAsync(proxyFunctions: ProxyFunctionEntity[]): Prom name: 'fnSelector', message: 'Enter the selector or name of the function:', choices: [ - ..._.flatMap(Object.entries(selectorToSignature), ([selector, signature]) => [ - { title: selector, value: selector, description: signature }, - { title: signature, value: selector, description: selector }, - ]), - ...proxyFunctions - .filter(fn => !Object.keys(selectorToSignature).includes(fn.id)) - .map(fn => ({ title: fn.id, value: fn.id, description: '(function signature not found)' })), + ...proxyFunctions.map(fn => ({ + title: fn.id, + value: fn.id, + description: selectorToSignature[fn.id] || '(function signature not found)', + })), + ...proxyFunctions.map(fn => ({ + title: selectorToSignature[fn.id] || '(function signature not found)', + value: fn.id, + description: fn.id, + })), ], }); const functionEntity = proxyFunctions.find(fn => fn.id === fnSelector); @@ -312,13 +315,17 @@ async function generateRollbackAsync(proxyFunctions: ProxyFunctionEntity[]): Pro value: constants.NULL_ADDRESS, description: 'Rolls back to address(0)', }, - { - title: 'PREVIOUS', - value: previousImpl, - description: `${previousImpl} (${timestampToUTC( - _.findLast(fullHistory, update => update.impl === previousImpl)!.timestamp, - )})`, - }, + ...(previousImpl !== constants.NULL_ADDRESS + ? [ + { + title: 'PREVIOUS', + value: previousImpl, + description: `${previousImpl} (${timestampToUTC( + _.findLast(fullHistory, update => update.impl === previousImpl)!.timestamp, + )})`, + }, + ] + : []), ...[...new Set(rollbackHistory)] .filter(impl => impl !== constants.NULL_ADDRESS) .map(impl => ({