Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggity fixes: two small bug fixes #3558

Merged
merged 3 commits into from
Jul 20, 2023
Merged

Buggity fixes: two small bug fixes #3558

merged 3 commits into from
Jul 20, 2023

Conversation

Shadowfiend
Copy link
Contributor

@Shadowfiend Shadowfiend commented Jul 20, 2023

Two fixes here, one for a small edge case in internal signer emission
that meant that if for some reason the internal signers data was cleared
in redux, it would never be correctly repopulated (expectation is that
there's no production scenario that would really trigger this).

The other is an issue where adding a network to the extension that didn't
have an associated spot price oracle listed would cause price lookups for
that network to fail, and this would cascade into failing all price lookups.

The correct fix for the latter is probably to make price lookups less sensitive
to individual failure, but for now I'm making the spot price oracle bit be
safe for networks that don't have an entry in the spot price oracle list.

Latest build: extension-builds-3558 (as of Thu, 20 Jul 2023 10:37:18 GMT).

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.
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).
@Shadowfiend Shadowfiend requested a review from a team as a code owner July 20, 2023 01:55
Copy link
Contributor

@jagodarybacka jagodarybacka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing really blocking, some questions:

@@ -347,6 +345,8 @@ export default class InternalSignerService extends BaseService<Events> {
}

this.#unlock()
this.#emitInternalSigners()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it making ignoreExistingVaults argument useless? As we are always emitting signers after this change. RIght now we are only using it during password creation anyway which means there are no keys stored yet anyway. To keep this code clear I would remove ignoreExistingVaults argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That argument would result in cleared vaults here, which would clear the signers in redux--which is what we would want in a scenario where we were resetting a password, which is the non-onboarding reason that argument is in place, see the function docs:

* This option makes sense if a user has lost their password, and needs
* to generate a new vault.

We haven't implemented that yet but I don't think it's useful to remove it.

@@ -152,6 +152,10 @@ const getRatesForTokens = async (
}
}[]
> => {
if (SPOT_PRICE_ORACLE_CONSTANTS[network.chainID] === undefined) {
Copy link
Contributor

@jagodarybacka jagodarybacka Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks safe but I couldn't really trigger this line by testing UI, what are the testing steps here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, did it in a hurry and forgot to add test instructions 🤦 Adding a custom asset on a custom chain and then waiting for the price alarm to trigger price checks I think will do the trick here. Background script should log an error without this, no error with it.

@Shadowfiend
Copy link
Contributor Author

Because the scope of the internal signers change is pretty tight here, I'm going to bypass review by @mhluongo in the interest of shipping.

@Shadowfiend Shadowfiend merged commit ea7aedc into main Jul 20, 2023
6 checks passed
@Shadowfiend Shadowfiend deleted the buggity-fixes branch July 20, 2023 14:15
@jagodarybacka jagodarybacka mentioned this pull request Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants