Skip to content

Commit

Permalink
Merge branch 'develop' into ts-log-web3-shim-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
NiranjanaBinoy authored Jun 25, 2024
2 parents 0cba400 + 1cc54f6 commit aac4215
Show file tree
Hide file tree
Showing 2,280 changed files with 195,550 additions and 62,411 deletions.
633 changes: 446 additions & 187 deletions .circleci/config.yml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .circleci/scripts/bundle-stats-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ git clone git@github.com:MetaMask/extension_bundlesize_stats.git temp

{
echo " '${CIRCLE_SHA1}': ";
cat test-artifacts/chrome/mv3/bundle_size_stats.json;
cat test-artifacts/chrome/bundle_size_stats.json;
echo ", ";
} >> temp/stats/bundle_size_data.temp.js

Expand All @@ -57,14 +57,14 @@ if [ -f temp/stats/bundle_size_data.json ]; then
{
echo "},";
echo "\"$CIRCLE_SHA1\":";
cat test-artifacts/chrome/mv3/bundle_size_stats.json;
cat test-artifacts/chrome/bundle_size_stats.json;
echo "}";
} >> bundle_size_stats.temp.json
else
{
echo "{";
echo "\"$CIRCLE_SHA1\":";
cat test-artifacts/chrome/mv3/bundle_size_stats.json;
cat test-artifacts/chrome/bundle_size_stats.json;
echo "}";
} > bundle_size_stats.temp.json
fi
Expand Down
32 changes: 32 additions & 0 deletions .circleci/scripts/create-cherry-pick-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

# Takes in 3 args
# - 1 - Base PR Branch Name
# - 2 - Commit Hash
# - 3 - PR Number

BASE_PR_BRANCH_NAME="${1}"
COMMIT_HASH_TO_CHERRY_PICK="${2}"
PR_BRANCH_NAME="chore/cherry-pick-${3}"
PR_TITLE="chore: cherry-pick #${3}"
PR_BODY="This PR cherry-picks #${3}"

git config user.name "MetaMask Bot"
git config user.email "metamaskbot@users.noreply.github.com"

git checkout "${BASE_PR_BRANCH_NAME}"
git pull
git checkout -b "${PR_BRANCH_NAME}"
git cherry-pick "${COMMIT_HASH_TO_CHERRY_PICK}"

git push --set-upstream origin "${PR_BRANCH_NAME}"

gh pr create \
--draft \
--title "${PR_TITLE}" \
--body "${PR_BODY}" \
--head "${BASE_PR_BRANCH_NAME}"
29 changes: 27 additions & 2 deletions .circleci/scripts/create-lavamoat-viz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,33 @@ BUILD_DEST="./build-artifacts/build-viz/"
# prepare artifacts dir
mkdir -p "${BUILD_DEST}"

# generate lavamoat debug config
# generate lavamoat debug configs
yarn lavamoat:debug:build
yarn lavamoat:debug:webapp --parallel=false

# generate entries for all present policy dirs under lavamoat/browserify
# static entry for build-system
POLICY_DIR_NAMES=$(find lavamoat/browserify -maxdepth 1 -mindepth 1 -type d -printf '%f ')

POLICY_FILE_PATHS_JSON=$(echo -n "${POLICY_DIR_NAMES}" \
| jq --raw-input --slurp --indent 0 '
rtrimstr(" ")
| split(" ")
| map({
"key": .,
"value": {
"debug": ("lavamoat/browserify/"+.+"/policy-debug.json"),
"override":"lavamoat/browserify/policy-override.json",
"primary":("lavamoat/browserify/"+.+"/policy.json")
}
})
| from_entries
|."build-system"= {
"debug": "lavamoat/build-system/policy-debug.json",
"override":"lavamoat/build-system/policy-override.json",
"primary": "lavamoat/build-system/policy.json"
}'
)
# generate viz
npx lavamoat-viz --dest "${BUILD_DEST}"
# shellcheck disable=SC2086
yarn lavamoat-viz --dest "${BUILD_DEST}" --policyNames build-system ${POLICY_DIR_NAMES} --policyFilePathsJson "${POLICY_FILE_PATHS_JSON}"
4 changes: 2 additions & 2 deletions .circleci/scripts/release-create-gh-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ then
release_body="$(awk -v version="${tag##v}" -f .circleci/scripts/show-changelog.awk CHANGELOG.md)"
hub release create \
--attach builds/metamask-chrome-*.zip \
--attach builds/metamask-firefox-*.zip \
--attach builds-mv2/metamask-firefox-*.zip \
--attach builds-flask/metamask-flask-chrome-*.zip \
--attach builds-flask/metamask-flask-firefox-*.zip \
--attach builds-flask-mv2/metamask-flask-firefox-*.zip \
--attach builds-mmi/metamask-mmi-chrome-*.zip \
--attach builds-mmi/metamask-mmi-firefox-*.zip \
--message "Version ${tag##v}" \
Expand Down
4 changes: 2 additions & 2 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ ignores:
- 'wait-on'
- 'tsx' # used in .devcontainer
- 'prettier-eslint' # used by the Prettier ESLint VSCode extension
# development tool
- 'nyc'
# storybook
- '@storybook/cli'
- '@storybook/core'
Expand All @@ -62,6 +60,8 @@ ignores:
- 'jest-environment-jsdom'
# babel
- '@babel/plugin-transform-logical-assignment-operators'
# trezor
- 'ts-mixer'

# files depcheck should not parse
ignorePatterns:
Expand Down
5 changes: 3 additions & 2 deletions .devcontainer/download-builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ async function getBuilds(branch: string, jobNames: string[]) {

console.log(`jobName: ${jobName}, jobId: ${jobId}`);

// Using the CircleCI API version 1.1 here, because this endpoint recently started requiring Authorization in v2
const response = await fetch(
`https://circleci.com/api/v2/project/gh/MetaMask/metamask-extension/${jobId}/artifacts`,
`https://circleci.com/api/v1.1/project/gh/MetaMask/metamask-extension/${jobId}/artifacts`,
);

const artifacts = (await response.json()).items;
const artifacts = await response.json();

if (!artifacts || artifacts.length === 0) {
return [];
Expand Down
52 changes: 26 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ module.exports = {
ignorePatterns: readFileSync('.prettierignore', 'utf8').trim().split('\n'),
// eslint's parser, esprima, is not compatible with ESM, so use the babel parser instead
parser: '@babel/eslint-parser',
plugins: ['@metamask/design-tokens'],
rules: {
'@metamask/design-tokens/color-no-hex': 'warn',
},
overrides: [
/**
* == Modules ==
Expand All @@ -42,9 +46,7 @@ module.exports = {
'development/**/*.js',
'test/e2e/**/*.js',
'test/helpers/*.js',
'test/lib/wait-until-called.js',
'test/run-unit-tests.js',
'test/merge-coverage.js',
],
extends: [
path.resolve(__dirname, '.eslintrc.base.js'),
Expand Down Expand Up @@ -90,8 +92,6 @@ module.exports = {
'test/stub/**/*.js',
'test/unit-global/**/*.js',
],
// TODO: Convert these files to modern JS
excludedFiles: ['test/lib/wait-until-called.js'],
extends: [
path.resolve(__dirname, '.eslintrc.base.js'),
path.resolve(__dirname, '.eslintrc.node.js'),
Expand Down Expand Up @@ -135,6 +135,7 @@ module.exports = {
path.resolve(__dirname, '.eslintrc.typescript-compat.js'),
],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
// this rule is new, but we didn't use it before, so it's off now
'@typescript-eslint/no-duplicate-enum-values': 'off',
'@typescript-eslint/no-shadow': [
Expand Down Expand Up @@ -256,26 +257,7 @@ module.exports = {
* Mocha library.
*/
{
files: [
'**/*.test.js',
'test/lib/wait-until-called.js',
'test/e2e/**/*.spec.js',
],
excludedFiles: [
'app/scripts/controllers/app-state.test.js',
'app/scripts/controllers/mmi-controller.test.js',
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
'app/scripts/metamask-controller.test.js',
'app/scripts/migrations/*.test.js',
'app/scripts/platforms/*.test.js',
'development/**/*.test.js',
'shared/**/*.test.js',
'ui/**/*.test.js',
'ui/__mocks__/*.js',
'test/e2e/helpers.test.js',
],
files: ['test/e2e/**/*.spec.js', 'test/unit-global/*.test.js'],
extends: ['@metamask/eslint-config-mocha'],
rules: {
// In Mocha tests, it is common to use `this` to store values or do
Expand All @@ -288,13 +270,19 @@ module.exports = {
* Jest tests
*
* These are files that make use of globals and syntax introduced by the
* Jest library. The files in this section should match the Mocha excludedFiles section.
* Jest library.
* TODO: This list of files is incomplete, and should be replaced with globs that match the
* Jest config.
*/
{
files: [
'**/__snapshots__/*.snap',
'app/scripts/controllers/app-state.test.js',
'app/scripts/controllers/mmi-controller.test.ts',
'app/scripts/metamask-controller.actions.test.js',
'app/scripts/detect-multiple-instances.test.js',
'app/scripts/controllers/swaps.test.js',
'app/scripts/controllers/metametrics.test.js',
'app/scripts/controllers/permissions/**/*.test.js',
'app/scripts/controllers/preferences.test.js',
'app/scripts/lib/**/*.test.js',
Expand Down Expand Up @@ -378,7 +366,6 @@ module.exports = {
'test/e2e/benchmark.js',
'test/helpers/setup-helper.js',
'test/run-unit-tests.js',
'test/merge-coverage.js',
],
rules: {
'node/no-process-exit': 'off',
Expand Down Expand Up @@ -438,5 +425,18 @@ module.exports = {
],
},
},
/**
* Don't check for static hex values in .test, .spec or .stories files
*/
{
files: [
'**/*.test.{js,ts,tsx}',
'**/*.spec.{js,ts,tsx}',
'**/*.stories.{js,ts,tsx}',
],
rules: {
'@metamask/design-tokens/color-no-hex': 'off',
},
},
],
};
37 changes: 35 additions & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ offscreen/scripts/offscreen.ts @MetaMask/snaps-devs
# empower our CI steps. ANY addition of orbs to our CircleCI config
# should be brought to the attention of engineering leadership for
# discussion
.circleci/ @MetaMask/library-admins @kumavis @brad-decker
.circleci/ @MetaMask/library-admins @kumavis

# The privacy-snapshot.json file includes a list of all hosts that the
# extension communicates with during the E2E test suite runs. It is not a
Expand All @@ -50,4 +50,37 @@ privacy-snapshot.json @MetaMask/extension-privacy-reviewers

# For now, restricting approvals inside the .devcontainer folder to devs
# who were involved with the Codespaces project.
.devcontainer/ @MetaMask/library-admins @HowardBraham @plasmacorral @brad-decker
.devcontainer/ @MetaMask/library-admins @HowardBraham @plasmacorral

# Confirmations team to own code for confirmations on UI.
ui/pages/confirmations @MetaMask/confirmations

# MMI team is responsible for code related with Institutioanl version of MetaMask
ui/pages/institutional @MetaMask/mmi
ui/components/institutional @MetaMask/mmi
ui/ducks/institutional @MetaMask/mmi
ui/selectors/institutional @MetaMask/mmi

# Design System to own code for the component-library folder
# Slack handle: @metamask-design-system-team | Slack channel: #metamask-design-system
ui/components/component-library @MetaMask/design-system-engineers

# The Notifications team is responsible for code related to notifications,
# authentication, and profile syncing inside the Extension.

# Controllers
**/controllers/authentication/** @MetaMask/notifications
**/controllers/metamask-notifications/** @MetaMask/notifications
**/controllers/push-platform-notifications/** @MetaMask/notifications
**/controllers/user-storage/** @MetaMask/notifications

# UI
**/metamask-notifications/** @MetaMask/notifications
**/multichain/notification*/** @MetaMask/notifications
**/pages/notification*/** @MetaMask/notifications
**/utils/notification.util.ts @MetaMask/notifications

# Accounts team is responsible for code related with snap management accounts
# Slack handle: @accounts-team-devs | Slack channel: #metamask-accounts-team

app/scripts/lib/snap-keyring @MetaMask/accounts-engineers
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ body:
id: screenshot-recording
attributes:
label: Screenshots/Recordings
description: Please include screenshots/recordings if applicable! (https://recordit.co/ is recommended)
description: Please include screenshots/recordings if applicable!
- type: textarea
id: reproduce
attributes:
Expand Down Expand Up @@ -105,6 +105,7 @@ body:
- GridPlus Lattice1
- AirGap Vault
- imToken
- OneKey
- Other (please elaborate in the "Additional Context" section)
- type: textarea
id: additional
Expand Down
4 changes: 3 additions & 1 deletion .github/guidelines/LABELING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ It's essential to ensure that PRs have the appropriate labels before they are co
### Mandatory release version labels:
- **release-x.y.z**: This label is automatically added to a PR and its linked issues upon the PR's merge. The `x.y.z` in the label represents the version in which the changes from the PR will be included. This label is auto-generated by a [GitHub action](../workflows/add-release-label.yml), which determines the version by incrementing the minor version number from the most recent release. Manual intervention is only required in specific cases. For instance, if a merged PR is cherry-picked into a release branch, typically done to address Release Candidate (RC) bugs, the label would need to be manually updated to reflect the correct version.
- **regression-prod-x.y.z**: This label is automatically added to a bug report issue at the time of its creation. The `x.y.z` in the label represents the version in which the bug first appeared. This label is auto-generated by a [GitHub action](../workflows/check-template-and-add-labels.yml), which determines the `x.y.z` value based on the version information provided in the bug report issue form. Manual intervention is only necessary under certain circumstances. For example, if a user submits a bug report and specifies the version they are currently using, but the bug was actually introduced in a prior version, the label would need to be manually updated to accurately reflect the version where the bug originated.
- **regression-RC-x.y.z**: This label is manually added to a bug report issue by release engineers when a bug is found during release regerssion testing phase. The `x.y.z` in the label represents the release candidate (RC) version in which the bug's been discovered.

### Optional QA labels:
### Optional labels:
- **regression-develop**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on the development branch, i.e., `develop`, but is not yet released in production.
- **needs-qa**: If the PR includes a new features, complex testing steps, or large refactors, this label must be added to indicated PR requires a full manual QA prior being merged and added to a release.

### Labels prohibited when PR needs to be merged:
Expand Down
16 changes: 8 additions & 8 deletions .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Expand Down Expand Up @@ -32,17 +38,11 @@ Fixes:

## **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 followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] 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**

Expand Down
Loading

0 comments on commit aac4215

Please sign in to comment.