From 4354e9eb9339759366e2d932a4353f943c091e8d Mon Sep 17 00:00:00 2001 From: Thomas Huang Date: Mon, 22 Jun 2020 21:30:45 -0700 Subject: [PATCH] Call getMethodDataAsync when knownMethodData[fourBytePrefix] object is empty (#8836) Fixes #8835 In cases where the registry failed to load, and the sig is set to `{}` on this line: https://github.com/MetaMask/metamask-extension/blob/e85b162651e887d79bfd15469289abc2c6753cbc/ui/app/helpers/utils/transactions.util.js#L78 this proceeds to set the method prefix to `{}` in knownMethodData. Additionally check if the method prefix object is empty to proceed call getMethodDataAsync again. I could only reproduce by intentionally failing the method registry lookup and found this solution. I could not find an instance where the registry consistently failed to lookup even on slow/throttled/high latency networks. --- ui/app/store/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index c99a566ba12c..b118b02270cd 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -2160,7 +2160,7 @@ export function getContractMethodData (data = '') { const prefixedData = ethUtil.addHexPrefix(data) const fourBytePrefix = prefixedData.slice(0, 10) const { knownMethodData } = getState().metamask - if (knownMethodData && knownMethodData[fourBytePrefix]) { + if (knownMethodData && knownMethodData[fourBytePrefix] && Object.keys(knownMethodData[fourBytePrefix]).length !== 0) { return Promise.resolve(knownMethodData[fourBytePrefix]) }