Only use subgraph query result to populate function history (#93)
* Only use subgraph query result to populate function history * Fix rollback for functions with no rollback history
This commit is contained in:
		@@ -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,6 +315,8 @@ async function generateRollbackAsync(proxyFunctions: ProxyFunctionEntity[]): Pro
 | 
			
		||||
                    value: constants.NULL_ADDRESS,
 | 
			
		||||
                    description: 'Rolls back to address(0)',
 | 
			
		||||
                },
 | 
			
		||||
                ...(previousImpl !== constants.NULL_ADDRESS
 | 
			
		||||
                    ? [
 | 
			
		||||
                          {
 | 
			
		||||
                              title: 'PREVIOUS',
 | 
			
		||||
                              value: previousImpl,
 | 
			
		||||
@@ -319,6 +324,8 @@ async function generateRollbackAsync(proxyFunctions: ProxyFunctionEntity[]): Pro
 | 
			
		||||
                                  _.findLast(fullHistory, update => update.impl === previousImpl)!.timestamp,
 | 
			
		||||
                              )})`,
 | 
			
		||||
                          },
 | 
			
		||||
                      ]
 | 
			
		||||
                    : []),
 | 
			
		||||
                ...[...new Set(rollbackHistory)]
 | 
			
		||||
                    .filter(impl => impl !== constants.NULL_ADDRESS)
 | 
			
		||||
                    .map(impl => ({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user