From 449b053590fc6da192af7ad50b4d551833a5d19b Mon Sep 17 00:00:00 2001 From: Antonio Salazar Cardozo Date: Wed, 19 Jul 2023 21:46:13 -0400 Subject: [PATCH 1/2] Fix errors with price oracles on unsupported chains On these chains, the code attempted to interact with an undefined spot oracle key, which meant the price lookup failed. Unfortunately due to the way lookups are batched, this meant that adding a network with assets that did not have a spot price oracle defined killed all price lookups. --- background/lib/priceOracle.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/background/lib/priceOracle.ts b/background/lib/priceOracle.ts index 493ce39862..fce8eaa983 100644 --- a/background/lib/priceOracle.ts +++ b/background/lib/priceOracle.ts @@ -152,6 +152,10 @@ const getRatesForTokens = async ( } }[] > => { + if (SPOT_PRICE_ORACLE_CONSTANTS[network.chainID] === undefined) { + return [] + } + const multicall = new ethers.Contract( MULTICALL_CONTRACT_ADDRESS, MULTICALL_ABI, From 7543954c840545a9db716c484ea101869766caea Mon Sep 17 00:00:00 2001 From: Antonio Salazar Cardozo Date: Wed, 19 Jul 2023 21:48:00 -0400 Subject: [PATCH 2/2] Emit internal signers after unlocking in internal signers This ensures that by the time internal signers hit the redux store, the internal signers are known to be unlocked. This is useful because the store ignores emitted signers while the signers are known to be locked, to avoid clearing the signers list at lock time (which emits an empty list of working signers for any services that are relying on that list to know what can currently be actively signed). --- background/services/internal-signer/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/background/services/internal-signer/index.ts b/background/services/internal-signer/index.ts index a612012800..cd8b2f355b 100644 --- a/background/services/internal-signer/index.ts +++ b/background/services/internal-signer/index.ts @@ -334,8 +334,6 @@ export default class InternalSignerService extends BaseService { this.#hiddenAccounts = { ...plainTextVault.hiddenAccounts, } - - this.#emitInternalSigners() } } @@ -347,6 +345,8 @@ export default class InternalSignerService extends BaseService { } this.#unlock() + this.#emitInternalSigners() + return true }