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

feat: add utility function to get supported chains from the Security Alerts API #10267

Merged
merged 14 commits into from
Aug 1, 2024

Conversation

vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Jul 9, 2024

Description

This PR aims to include a new utility function to get supported chains from the Security Alerts API when enabled.

Related Repository

Refer to the Security Alerts API repository for more details.

Related issues

Fixes: https://github.com/MetaMask/mobile-planning/issues/1870

Manual testing steps

  1. Test blockaid regression

  2. add the envs

export SECURITY_ALERTS_API_URL='https://security-alerts.dev-api.cx.metamask.io'
export SECURITY_ALERTS_API_ENABLED='true'
  • Go to test dapp and trigger on of the malicious signatures
  • To verify in chrome go to dev tools > network. Search for security-alerts and find the call to the API service.

Existing PPOM logic should function as before, even with the above environment variables added, due to the fallback to the controller in the event of an error.

Screenshots/Recordings

Screencast.from.19-07-2024.14.42.48.webm

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

github-actions bot commented Jul 9, 2024

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.

@metamaskbot metamaskbot added the team-confirmations Push issues to confirmations team label Jul 9, 2024
@vinistevam vinistevam marked this pull request as ready for review July 10, 2024 12:21
@vinistevam vinistevam requested review from a team as code owners July 10, 2024 12:21
@vinistevam vinistevam added the Run Smoke E2E Triggers smoke e2e on Bitrise label Jul 10, 2024
Copy link
Contributor

github-actions bot commented Jul 10, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: a5129ef
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/1b92f74d-0db8-4195-b34e-ead46ea98544

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@jpuri
Copy link
Contributor

jpuri commented Jul 10, 2024

There is usage of BLOCKAID_SUPPORTED_CHAIN_IDS here also:

export const isSupportedChainId = (chainId: string) => {

app/lib/ppom/security-alerts-api.ts Outdated Show resolved Hide resolved
app/lib/ppom/security-alerts-api.ts Outdated Show resolved Hide resolved
app/lib/ppom/ppom-util.ts Outdated Show resolved Hide resolved
app/lib/ppom/ppom-util.test.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.69%. Comparing base (b2cce87) to head (ee0185f).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10267      +/-   ##
==========================================
+ Coverage   49.67%   49.69%   +0.02%     
==========================================
  Files        1450     1450              
  Lines       34888    34899      +11     
  Branches     3950     3952       +2     
==========================================
+ Hits        17330    17343      +13     
+ Misses      16456    16454       -2     
  Partials     1102     1102              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

matthewwalsh0
matthewwalsh0 previously approved these changes Jul 12, 2024
app/lib/ppom/ppom-util.ts Outdated Show resolved Hide resolved
matthewwalsh0
matthewwalsh0 previously approved these changes Jul 17, 2024
@vinistevam vinistevam added No E2E Smoke Needed If the PR does not need E2E smoke test run Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise No E2E Smoke Needed If the PR does not need E2E smoke test run labels Jul 22, 2024
Copy link
Contributor

github-actions bot commented Jul 22, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 2a87725
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/2d68bc0a-76b6-4d17-ace9-cb50b4f7e3bd

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@vinistevam
Copy link
Contributor Author

There is usage of BLOCKAID_SUPPORTED_CHAIN_IDS here also:

export const isSupportedChainId = (chainId: string) => {

I will open a ticket and the refactor will be handled in this PR, cause it was getting too big.

Copy link

sonarqubecloud bot commented Aug 1, 2024

@vinistevam vinistevam merged commit 5835f66 into main Aug 1, 2024
31 checks passed
@vinistevam vinistevam deleted the feat/add-utility-function-supported-chains branch August 1, 2024 10:24
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2024
@metamaskbot metamaskbot added the release-7.29.0 Issue or pull request that will be included in release 7.29.0 label Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.29.0 Issue or pull request that will be included in release 7.29.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants