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

chore(bitcoin): add bitcoin build feature + disable it temporarily #30477

Merged
merged 3 commits into from
Feb 21, 2025

Conversation

ccharly
Copy link
Contributor

@ccharly ccharly commented Feb 20, 2025

Description

Temporarily disable Bitcoin support until we finalize the new Snap version with the latest updated architecture.

Important

Once this PR is merged, existing Bitcoin accounts might still be showing on your extension.
You might see some error messages on the console, but nothing should break. You can remove those
accounts, and the errors will be be gone.

Open in GitHub Codespaces

Related issues

N/A

Manual testing steps

  1. yarn start:flask
  2. You should not be able to create a Bitcoin account (using the preinstalled Bitcoin Snap)

Screenshots/Recordings

Before

After

Pre-merge author checklist

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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@ccharly ccharly force-pushed the feat/disable-bitcoin branch from fe5243d to 7f1b273 Compare February 20, 2025 21:49
@ccharly ccharly marked this pull request as ready for review February 20, 2025 22:09
@ccharly ccharly requested a review from a team as a code owner February 20, 2025 22:09
@metamaskbot
Copy link
Collaborator

Builds ready [7f1b273]
Page Load Metrics (1671 ± 67 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14901963166214368
domContentLoaded14751909163813766
load15031970167114067
domInteractive24203433919
backgroundConnect1291342110
firstReactRender14187444019
getState570292613
initialActions01000
loadScripts10621497121712661
setupStore768182010
uiStartup170626341954213102
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -296 Bytes (-0.01%)
  • ui: -268 Bytes (-0.00%)
  • common: -247 Bytes (-0.00%)

Copy link
Contributor

@GuillaumeRx GuillaumeRx left a comment

Choose a reason for hiding this comment

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

What about setting the E2E test to runnable only if bitcoin is enable ? Is it possible ?

@ccharly
Copy link
Contributor Author

ccharly commented Feb 21, 2025

What about setting the E2E test to runnable only if bitcoin is enable ? Is it possible ?

@GuillaumeRx I wanted to do something like this yes, having like a conditional it.skip basically. Looks like there are solutions, but this might break eslint integration.

From what I've read, there's not builtin support for this, and you need to use trick like:

const itif = (condition) => condition ? it : it.skip;

describe('suite name', () => {
  itif(true)('test name', async () => {
    // Your test
  });
});

See: https://stackoverflow.com/a/60438234

But itif won't be recognized properly.

So I ended up, not doing anything for this.

Also, the plan is to fully re-enable Bitcoin once we have catch up with the new APIs, so it's only a temporary solution IMO.


Another option could be to tweak the test launcher (in test/e2e) and use the test/e2e/flask/btc folder if Bitcoin is enabled, but that might requires some more efforts.


EDIT: Forgot to add the stackoverflow references

@@ -64,6 +64,7 @@ buildTypes:
features:
- build-flask
- keyring-snaps
# - bitcoin
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have we decided to leave this in place and comment on it rather than removing it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My initial idea was to comment it out with a description so people can easily add it back (like in most configuration files).

I can remove it if you prefer.

@@ -5,7 +5,7 @@ import BitcoinHomepage from '../../page-objects/pages/home/bitcoin-homepage';
import { withBtcAccountSnap } from './common-btc';

describe('BTC Account - Overview', function (this: Suite) {
it('has balance displayed and has portfolio button enabled for BTC accounts', async function () {
it.skip('has balance displayed and has portfolio button enabled for BTC accounts', async function () {
Copy link
Contributor

@salimtb salimtb Feb 21, 2025

Choose a reason for hiding this comment

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

maybe i miss some context here , but can you help me to understand why we are not doing something like:

    // function to check if bitcoin is supported based on the state
    if (!getIsBitcoinSupportEnabled()) {
      return;
    }

rather than skip, on the e2e tests ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We cannot use those kind of selector in e2e tests. And most of the Bitcoin e2e test are actually mocking "enabling" this flag with some fixtures.

Like here: https://github.com/MetaMask/metamask-extension/blob/main/test/e2e/flask/btc/common-btc.ts#L223

Also, we cannot use code-fence in e2e tests (at least, to my knowledge), so we would need to find a trick (using a test build)

Unless there are some known tricks to do this?

@ccharly ccharly added this pull request to the merge queue Feb 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 21, 2025
@zone-live
Copy link
Contributor

This needs to go 1st #30484

@ccharly ccharly added this pull request to the merge queue Feb 21, 2025
Merged via the queue into main with commit 472b5d9 Feb 21, 2025
83 checks passed
@ccharly ccharly deleted the feat/disable-bitcoin branch February 21, 2025 22:54
@github-actions github-actions bot locked and limited conversation to collaborators Feb 21, 2025
@metamaskbot metamaskbot added the release-12.14.0 Issue or pull request that will be included in release 12.14.0 label Feb 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.14.0 Issue or pull request that will be included in release 12.14.0 team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants