Skip to content

Contract test dapp improvements#7587

Merged
Gudahtt merged 5 commits intodevelopfrom
contract-test-dapp-improvements
Dec 9, 2019
Merged

Contract test dapp improvements#7587
Gudahtt merged 5 commits intodevelopfrom
contract-test-dapp-improvements

Conversation

@Gudahtt
Copy link
Copy Markdown
Member

@Gudahtt Gudahtt commented Nov 27, 2019

  • Add Get Accounts button
    This button calls eth_accounts. This button is always enabled, even
    when not connected.

  • Disable account buttons by default
    The buttons that require you to have first connected have been disabled
    by default. Previously they would be enabled until the JavaScript
    finished initializing the page, at which point they'd be disabled. This
    resulted in a distracting flash as the page loaded and the buttons
    changed.

    The signTypedData button was added to the accounts button set as
    well, rather than being left enabled regardless of connected status.

  • Allow connect button to become re-enabled
    The Connect button was broken previously in that after being disabled,
    it would stay disabled even if the dapp lost access to MetaMask. The
    button will now be enabled whenever not connected.

  • Stringify signTypedData results

  • Defer metamask onboarding bundle to speed up page load

This button calls `eth_accounts`. This button is always enabled, even
when not connected.
The buttons that require you to have first connected have been disabled
by default. Previously they would be enabled until the JavaScript
finished initializing the page, at which point they'd be disabled. This
resulted in a distracting flash as the page loaded and the buttons
changed.

The `signTypedData` button was added to the accounts button set as
well, rather than being left enabled regardless of connected status.
The Connect button was broken previously in that after being disabled,
it would stay disabled even if the dapp lost access to MetaMask. The
button will now be enabled whenever not connected.
@Gudahtt Gudahtt force-pushed the contract-test-dapp-improvements branch from e57a3a5 to 245b58f Compare November 27, 2019 21:04
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [245b58f]

@Gudahtt Gudahtt requested a review from rickycodes December 4, 2019 01:39
Copy link
Copy Markdown
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

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

LGTM

@Gudahtt Gudahtt merged commit 812c546 into develop Dec 9, 2019
@whymarrh whymarrh deleted the contract-test-dapp-improvements branch December 9, 2019 18:43
bergeron added a commit that referenced this pull request Feb 13, 2024
## **Description**

Fixes a race condition during token detection after switching networks.

During the network switch, some controllers state are still on the old
chain id, and others are on the new chain id. This can cause different
issues depending which controllers win the race. The worst case is that
detected tokens are added to the wrong network (see related issues):


![image](https://github.com/MetaMask/metamask-extension/assets/3500406/c4dc4a21-9234-44a5-a915-7d2910a28a60)

In that ^ screenshot there are 2 mainnet tokens that we have a balance
of, but they incorrectly appear under linea.

There's a fix for each of the relevant controllers
(`DetectTokensController`, `TokensController`,
`AssetsContractController`) ensuring we use the chain ID being switched
*to*.

## **Related issues**

[Auto token detection list collision with other networks
#22512](#22512)

[Autodetect tokens display Mainnet tokens on another network
#7587](MetaMask/metamask-mobile#7587)


## **Manual testing steps**

It takes a few minutes of switching networks back and forth to reproduce
the bug. But basically keep doing that and we should not see tokens hop
from 1 network to the other.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
sahar-fehri pushed a commit that referenced this pull request Feb 14, 2024
## **Description**

Fixes a race condition during token detection after switching networks.

During the network switch, some controllers state are still on the old
chain id, and others are on the new chain id. This can cause different
issues depending which controllers win the race. The worst case is that
detected tokens are added to the wrong network (see related issues):


![image](https://github.com/MetaMask/metamask-extension/assets/3500406/c4dc4a21-9234-44a5-a915-7d2910a28a60)

In that ^ screenshot there are 2 mainnet tokens that we have a balance
of, but they incorrectly appear under linea.

There's a fix for each of the relevant controllers
(`DetectTokensController`, `TokensController`,
`AssetsContractController`) ensuring we use the chain ID being switched
*to*.

## **Related issues**

[Auto token detection list collision with other networks
#22512](#22512)

[Autodetect tokens display Mainnet tokens on another network
#7587](MetaMask/metamask-mobile#7587)


## **Manual testing steps**

It takes a few minutes of switching networks back and forth to reproduce
the bug. But basically keep doing that and we should not see tokens hop
from 1 network to the other.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've clearly explained what problem this PR is solving and how it
is solved.
- [ ] I've linked related issues
- [ ] I've included manual testing steps
- [ ] I've included screenshots/recordings if applicable
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [ ] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [ ] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
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.

3 participants