Skip to content

Commit

Permalink
Enable blockaid in main build (#21352)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri authored Oct 17, 2023
1 parent e8cd9c2 commit 3bc7780
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 7 deletions.
6 changes: 6 additions & 0 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ export const SENTRY_BACKGROUND_STATE = {
onboardingTabs: false,
seedPhraseBackedUp: true,
},
PPOMController: {
chainStatus: true,
securityAlertsEnabled: false,
storageMetadata: [],
versionInfo: [],
},
PermissionController: {
subjects: false,
},
Expand Down
1 change: 1 addition & 0 deletions builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildTypes:
- build-main
- snaps
- keyring-snaps
- blockaid
# Additional env variables that are specific to this build
env:
- INFURA_PROD_PROJECT_ID
Expand Down
16 changes: 16 additions & 0 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,22 @@
"eslint>optionator>fast-levenshtein": true
}
},
"@metamask/ppom-validator": {
"globals": {
"URL": true,
"clearInterval": true,
"console.error": true,
"setInterval": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/controller-utils": true,
"@metamask/ppom-validator>elliptic": true,
"await-semaphore": true,
"browserify>buffer": true,
"eth-query>json-rpc-random-id": true
}
},
"@metamask/ppom-validator>elliptic": {
"packages": {
"@metamask/ppom-validator>elliptic>brorand": true,
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"dist": "yarn build dist",
"build": "yarn lavamoat:build",
"build:dev": "node development/build/index.js",
"start:test": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build:dev testDev",
"start:test:flask": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 BLOCKAID_FILE_CDN=storage.googleapis.com/ppom-mock-cdn yarn build:dev testDev --build-type flask --apply-lavamoat=false --snow=false",
"start:test": "BLOCKAID_FILE_CDN=static.metafi-dev.codefi.network/api/v1/confirmations/ppom SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build:dev testDev",
"start:test:flask": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 BLOCKAID_FILE_CDN=static.metafi-dev.codefi.network/api/v1/confirmations/ppom yarn build:dev testDev --build-type flask --apply-lavamoat=false --snow=false",
"start:test:mv3": "ENABLE_MV3=true SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build:dev testDev",
"benchmark:chrome": "SELENIUM_BROWSER=chrome ts-node test/e2e/benchmark.js",
"mv3:stats:chrome": "SELENIUM_BROWSER=chrome ENABLE_MV3=true ts-node test/e2e/mv3-perf-stats/index.js",
"user-actions-benchmark:chrome": "SELENIUM_BROWSER=chrome ts-node test/e2e/user-actions-benchmark.js",
"benchmark:firefox": "SELENIUM_BROWSER=firefox ts-node test/e2e/benchmark.js",
"build:test": "SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build test",
"build:test:flask": "BLOCKAID_FILE_CDN=storage.googleapis.com/ppom-mock-cdn yarn build test --build-type flask",
"build:test": "BLOCKAID_FILE_CDN=static.metafi-dev.codefi.network/api/v1/confirmations/ppom SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build test",
"build:test:flask": "BLOCKAID_FILE_CDN=static.metafi-dev.codefi.network/api/v1/confirmations/ppom yarn build test --build-type flask",
"build:test:mmi": "yarn build test --build-type mmi",
"build:test:mv3": "ENABLE_MV3=true SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build test",
"build:test:dev:mv3": "ENABLE_MV3=true SEGMENT_HOST='https://api.segment.io' SEGMENT_WRITE_KEY='FAKE' SENTRY_DSN_DEV=https://[email protected]/0000000 PORTFOLIO_URL=http://127.0.0.1:8080 yarn build:dev testDev --apply-lavamoat=false",
Expand Down
3 changes: 2 additions & 1 deletion privacy-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
"token-api.metaswap.codefi.network",
"tx-insights.metaswap.codefi.network",
"unresponsive-rpc.url",
"www.4byte.directory"
"www.4byte.directory",
"static.metafi-dev.codefi.network"
]
20 changes: 20 additions & 0 deletions test/e2e/metrics/signature-approved.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
assert.deepStrictEqual(events[1].properties, {
account_type: 'MetaMask',
Expand All @@ -89,6 +91,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
},
);
Expand Down Expand Up @@ -126,6 +130,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
assert.deepStrictEqual(events[1].properties, {
account_type: 'MetaMask',
Expand All @@ -134,6 +140,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
},
);
Expand Down Expand Up @@ -170,6 +178,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
assert.deepStrictEqual(events[1].properties, {
account_type: 'MetaMask',
Expand All @@ -178,6 +188,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
},
);
Expand Down Expand Up @@ -214,6 +226,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
assert.deepStrictEqual(events[1].properties, {
account_type: 'MetaMask',
Expand All @@ -222,6 +236,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
},
);
Expand Down Expand Up @@ -267,6 +283,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
assert.deepStrictEqual(events[1].properties, {
account_type: 'MetaMask',
Expand All @@ -275,6 +293,8 @@ describe('Signature Approved Event @no-mmi', function () {
locale: 'en',
chain_id: '0x539',
environment_type: 'background',
security_alert_reason: 'NotApplicable',
security_alert_response: 'NotApplicable',
});
},
);
Expand Down
1 change: 1 addition & 0 deletions test/e2e/tests/errors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const removedBackgroundFields = [
// These properties are set to undefined, causing inconsistencies between Chrome and Firefox
'AppStateController.currentPopupId',
'AppStateController.timeoutMinutes',
'PPOMController.chainStatus.0x539.lastVisited',
];

const removedUiFields = removedBackgroundFields.map(backgroundToUiField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@
"completedOnboarding": true,
"onboardingTabs": "object"
},
"PPOMController": {
"versionInfo": {},
"storageMetadata": {},
"chainStatus": {
"0x539": { "chainId": "0x539", "dataFetched": false, "versionInfo": [] }
}
},
"PermissionController": { "subjects": "object" },
"PermissionLogController": {
"permissionHistory": "object",
Expand All @@ -131,6 +138,7 @@
"use4ByteResolution": true,
"useCurrencyRateCheck": true,
"openSeaEnabled": false,
"securityAlertsEnabled": "boolean",
"addSnapAccountEnabled": "boolean",
"advancedGasFee": {},
"featureFlags": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"useNftDetection": false,
"useCurrencyRateCheck": true,
"openSeaEnabled": false,
"securityAlertsEnabled": "boolean",
"addSnapAccountEnabled": "boolean",
"advancedGasFee": {},
"incomingTransactionsPreferences": {},
Expand Down Expand Up @@ -196,7 +197,12 @@
"ensResolutionsByAddress": "object",
"pendingApprovals": "object",
"pendingApprovalCount": "number",
"approvalFlows": "object"
"approvalFlows": "object",
"versionInfo": {},
"storageMetadata": {},
"chainStatus": {
"0x539": { "chainId": "0x539", "dataFetched": false, "versionInfo": [] }
}
},
"send": "object",
"swaps": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
TextColor,
TextVariant,
Display,
///: BEGIN:ONLY_INCLUDE_IN(blockaid,desktop,keyring-snaps)
///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps)
FontWeight,
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(desktop)
Expand Down

0 comments on commit 3bc7780

Please sign in to comment.