Skip to content

Commit

Permalink
Merge branch 'main' into 27742-sentry-error-transactionscontroller-ca…
Browse files Browse the repository at this point in the history
…n-only-call-updateeditableparams-on-an-unapproved-transaction
  • Loading branch information
OGPoyraz authored Dec 19, 2024
2 parents 9d15372 + 22490c3 commit f674c72
Show file tree
Hide file tree
Showing 639 changed files with 40,658 additions and 29,016 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ workflows:
- test-api-specs:
requires:
- prep-build-test
- get-changed-files-with-git-diff
- test-e2e-chrome-multiple-providers:
requires:
- prep-build-test
Expand Down
13 changes: 8 additions & 5 deletions .circleci/scripts/git-diff-default-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ async function storeGitDiffOutputAndPrBody() {
// even if we want to skip this step.
fs.mkdirSync(CHANGED_FILES_DIR, { recursive: true });

console.log(
`Determining whether to run git diff...`,
);
console.log(`Determining whether to run git diff...`);
if (!PR_NUMBER) {
console.log('Not a PR, skipping git diff');
return;
Expand All @@ -141,7 +139,9 @@ async function storeGitDiffOutputAndPrBody() {
console.log(`This is for a PR targeting '${baseRef}', skipping git diff`);
writePrBodyToFile(prInfo.body);
return;
} else if (prInfo.labels.some(label => label.name === 'skip-e2e-quality-gate')) {
} else if (
prInfo.labels.some((label) => label.name === 'skip-e2e-quality-gate')
) {
console.log('PR has the skip-e2e-quality-gate label, skipping git diff');
return;
}
Expand All @@ -164,4 +164,7 @@ async function storeGitDiffOutputAndPrBody() {
}
}

storeGitDiffOutputAndPrBody();
// If main module (i.e. this is the TS file that was run directly)
if (require.main === module) {
storeGitDiffOutputAndPrBody();
}
23 changes: 19 additions & 4 deletions .circleci/scripts/test-run-e2e-timeout-minutes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import { fetchManifestFlagsFromPRAndGit } from '../../development/lib/get-manifest-flag';
import { filterE2eChangedFiles } from '../../test/e2e/changedFilesUtil';

const changedOrNewTests = filterE2eChangedFiles();
fetchManifestFlagsFromPRAndGit().then((manifestFlags) => {
let timeout;

// 20 minutes, plus 3 minutes for every changed file, up to a maximum of 30 minutes
const extraTime = Math.min(20 + changedOrNewTests.length * 3, 30);
if (manifestFlags.circleci?.timeoutMinutes) {
timeout = manifestFlags.circleci?.timeoutMinutes;
} else {
const changedOrNewTests = filterE2eChangedFiles();

console.log(extraTime);
// 20 minutes, plus 3 minutes for every changed file, up to a maximum of 30 minutes
timeout = Math.min(20 + changedOrNewTests.length * 3, 30);
}

// If this is the Merge Queue, add 10 minutes
if (process.env.CIRCLE_BRANCH?.startsWith('gh-readonly-queue')) {
timeout += 10;
}

// This is an essential log, that feeds into a bash script
console.log(timeout);
});
6 changes: 5 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ ui/pages/settings/security-tab/profile-sync-toggle @MetaMask/identity

app/scripts/lib/snap-keyring @MetaMask/accounts-engineers

# Swaps team to own code for the swaps folder
# Swaps-Bridge team to own code for the swaps folder
ui/pages/swaps @MetaMask/swaps-engineers
app/scripts/controllers/swaps @MetaMask/swaps-engineers

# Swaps-Bridge team to own code for the bridge folder
**/bridge/** @MetaMask/swaps-engineers
**/bridge-status/** @MetaMask/swaps-engineers

# Ramps team to own code for the ramps folder
**/ramps/** @MetaMask/ramp

Expand Down
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ body:
- In production (default)
- In beta
- During release testing
- On the development branch
- On main branch
- On a feature branch
validations:
required: true
- type: input
Expand Down
1 change: 1 addition & 0 deletions .github/guidelines/LABELING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ It's essential to ensure that PRs have the appropriate labels before they are co

### Optional labels:
- **regression-main**: 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., `main`, but is not yet released in production.
- **feature-branch-bug**: This label can manually be added to a bug report issue at the time of its creation if the bug is present on a feature branch, i.e., before merging to `main`.
- **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
20 changes: 15 additions & 5 deletions .github/scripts/check-template-and-add-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import { TemplateType, templates } from './shared/template';
import { retrievePullRequest } from './shared/pull-request';

enum RegressionStage {
Development,
DevelopmentFeature,
DevelopmentMain,
Testing,
Beta,
Production
Expand Down Expand Up @@ -217,8 +218,10 @@ function extractRegressionStageFromBugReportIssueBody(
const extractedAnswer = match ? match[1].trim() : undefined;

switch (extractedAnswer) {
case 'On the development branch':
return RegressionStage.Development;
case 'On a feature branch':
return RegressionStage.DevelopmentFeature;
case 'On main branch':
return RegressionStage.DevelopmentMain;
case 'During release testing':
return RegressionStage.Testing;
case 'In beta':
Expand Down Expand Up @@ -332,11 +335,18 @@ async function userBelongsToMetaMaskOrg(
// This function crafts appropriate label, corresponding to regression stage and release version.
function craftRegressionLabel(regressionStage: RegressionStage | undefined, releaseVersion: string | undefined): Label {
switch (regressionStage) {
case RegressionStage.Development:
case RegressionStage.DevelopmentFeature:
return {
name: `feature-branch-bug`,
color: '5319E7', // violet
description: `bug that was found on a feature branch, but not yet merged in main branch`,
};

case RegressionStage.DevelopmentMain:
return {
name: `regression-main`,
color: '5319E7', // violet
description: `Regression bug that was found on development branch, but not yet present in production`,
description: `Regression bug that was found on main branch, but not yet present in production`,
};

case RegressionStage.Testing:
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/check-attributions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ name: Check Attributions
on:
push:
branches: Version-v*
pull_request:
branches: Version-v*
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
check-attributions:
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ jobs:
name: Run tests
uses: ./.github/workflows/run-tests.yml

wait-for-circleci-workflow-status:
name: Wait for CircleCI workflow status
uses: ./.github/workflows/wait-for-circleci-workflow-status.yml

all-jobs-completed:
name: All jobs completed
runs-on: ubuntu-latest
needs:
- check-workflows
- run-tests
- wait-for-circleci-workflow-status
outputs:
PASSED: ${{ steps.set-output.outputs.PASSED }}
steps:
Expand All @@ -58,3 +63,16 @@ jobs:
if [[ $passed != "true" ]]; then
exit 1
fi
log-merge-group-failure:
name: Log merge group failure
# Only run this job if the merge group event fails, skip on forks
if: ${{ github.event_name == 'merge_group' && failure() && !github.event.repository.fork }}
needs:
- all-jobs-pass
uses: metamask/github-tools/.github/workflows/log-merge-group-failure.yml@6bbad335a01fce1a9ec1eabd9515542c225d46c0
secrets:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
GOOGLE_SERVICE_ACCOUNT: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
SPREADSHEET_ID: ${{ secrets.GOOGLE_MERGE_QUEUE_SPREADSHEET_ID }}
SHEET_NAME: ${{ secrets.GOOGLE_MERGE_QUEUE_SHEET_NAME }}
24 changes: 22 additions & 2 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# actions that may result in code from that branch being executed
# such as installing dependencies or running build scripts.

# For security reasons, this file always uses the latest version from the default branch.
# Changes made in feature branches or forks will not take effect until they are merged.

name: SonarCloud

on:
Expand All @@ -17,9 +20,9 @@ permissions:

jobs:
sonarcloud:
# Only scan code from non-forked repositories that have passed the tests
# Only scan code from non-forked repositories that have completed successfully using the push and pull_request events
# This will skip scanning the code for forks, but will run for the main repository on PRs from forks
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.repository.fork == false }}
if: ${{ github.event.workflow_run.conclusion == 'success' && contains(fromJSON('["push", "pull_request"]'), github.event.workflow_run.event) && !github.event.workflow_run.repository.fork }}
name: SonarCloud
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -50,6 +53,23 @@ jobs:
fi
echo "$sonar_project_properties" > sonar-project.properties
- name: Update sonar-project.properties with branch information
env:
EVENT: ${{ github.event.workflow_run.event }}
HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
BASE_BRANCH: ${{ github.event.workflow_run.pull_requests[0].base.ref || '' }}
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number || '' }}
run: |
if [ "$EVENT" == "pull_request" ]; then
{
echo "sonar.pullrequest.branch=$HEAD_BRANCH"
echo "sonar.pullrequest.base=$BASE_BRANCH"
echo "sonar.pullrequest.key=$PR_NUMBER"
} >> sonar-project.properties
else
echo "sonar.branch.name=$HEAD_BRANCH" >> sonar-project.properties
fi
- name: SonarCloud Scan
# This is SonarSource/[email protected]
uses: SonarSource/sonarcloud-github-action@4b4d7634dab97dcee0b75763a54a6dc92a9e6bc1
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/wait-for-circleci-workflow-status.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Wait for CircleCI workflow status

on:
workflow_call:

jobs:
wait-for-circleci-workflow-status:
name: Wait for CircleCI workflow status
runs-on: ubuntu-latest
steps:
- name: Wait for CircleCI workflow status
env:
OWNER: ${{ github.repository_owner }}
REPOSITORY: ${{ github.event.repository.name }}
BRANCH: ${{ github.head_ref || github.ref_name }}
# For a `push` event, the HEAD commit hash is `github.sha`.
# For a `pull_request` event, `github.sha` is instead the base branch commit hash. The
# HEAD commit hash is `pull_request.head.sha`.
HEAD_COMMIT_HASH: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
pipeline_id=$(curl --silent "https://circleci.com/api/v2/project/gh/$OWNER/$REPOSITORY/pipeline?branch=$BRANCH" | jq -r ".items | map(select(.vcs.revision == \"${HEAD_COMMIT_HASH}\" )) | first | .id")
echo "Waiting for pipeline '${pipeline_id}' for commit hash '${HEAD_COMMIT_HASH}'"
workflow_status=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].status")
if [ "$workflow_status" == "running" ]; then
while [ "$workflow_status" == "running" ]; do
sleep 30
workflow_status=$(curl --silent "https://circleci.com/api/v2/pipeline/$pipeline_id/workflow" | jq -r ".items[0].status")
done
fi
if [ "$workflow_status" != "success" ]; then
echo "::error::Workflow status is '$workflow_status'. Exiting with error."
exit 1
fi
18 changes: 18 additions & 0 deletions .storybook/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Fixes for any styles that are not compatible with Storybook */

.create-snap-account-page, .remove-snap-account-page, .snap-ui-renderer {
width: 100% !important;
}

.snap-ui-renderer__footer-centered {
position: initial !important;
margin-top: auto !important;
}

.snap-ui-renderer__container {
padding-bottom: 0 !important;
}

.snap-ui-renderer__panel {
overflow-y: auto !important;
}
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { metamaskStorybookTheme } from './metamask-storybook-theme';
import { DocsContainer } from '@storybook/addon-docs';
import { themes } from '@storybook/theming';
import { AlertMetricsProvider } from '../ui/components/app/alert-system/contexts/alertMetricsContext';
import './index.css';

// eslint-disable-next-line
/* @ts-expect-error: Avoids error from window property not existing */
Expand Down Expand Up @@ -185,7 +186,6 @@ const withColorScheme = (Story, context) => {
<div
{...props}
style={{
display: 'flex',
padding: '1rem',
backgroundColor: 'var(--color-background-default)',
color: 'var(--color-text-default)',
Expand Down
1 change: 1 addition & 0 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ const state = {
useBlockie: false,
featureFlags: {},
welcomeScreenSeen: false,
slides: [],
currentLocale: 'en',
preferences: {
showNativeTokenAsMainBalance: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
diff --git a/PATCH.txt b/PATCH.txt
new file mode 100644
index 0000000000000000000000000000000000000000..ce3b18534f055ee00aa5821793f855fd300fb72c
index 0000000000000000000000000000000000000000..376255036ca54b83a3f3c3e0277c2666473df30e
--- /dev/null
+++ b/PATCH.txt
@@ -0,0 +1,4 @@
+We remove lookupNetwork from initializeProvider in the network controller to prevent network requests before user onboarding is completed.
+The network lookup is done after onboarding is completed, and when the extension reloads if onboarding has been completed.
+This patch is part of a temporary fix that will be reverted soon to make way for a more permanent solution. https://github.com/MetaMask/metamask-extension/pull/23005
+You can see the changes before compilation on this branch: https://github.com/MetaMask/core/compare/pnf/ext-23622-review?expand=1
\ No newline at end of file
diff --git a/dist/NetworkController.cjs b/dist/NetworkController.cjs
index cc9793f576eb39a51ab141b7d03de57cf99e5570..c573b5134d40f522217a6ab6df129040d02e9660 100644
index cc9793f576eb39a51ab141b7d03de57cf99e5570..184153067f2bbd58ea76d7db33c2af56245cd8c0 100644
--- a/dist/NetworkController.cjs
+++ b/dist/NetworkController.cjs
@@ -422,7 +422,6 @@ class NetworkController extends base_controller_1.BaseController {
Expand All @@ -22,7 +21,7 @@ index cc9793f576eb39a51ab141b7d03de57cf99e5570..c573b5134d40f522217a6ab6df129040
/**
* Refreshes the network meta with EIP-1559 support and the network status
diff --git a/dist/NetworkController.mjs b/dist/NetworkController.mjs
index 806f32edeffaad9f7eb1cafa4184368ec95f63e7..9268947cbed4bf717729ca6ac8ea83a8b91b6e8a 100644
index 806f32edeffaad9f7eb1cafa4184368ec95f63e7..7ba60e613ec8de7d273c32282be564f36873cbd2 100644
--- a/dist/NetworkController.mjs
+++ b/dist/NetworkController.mjs
@@ -397,7 +397,6 @@ export class NetworkController extends BaseController {
Expand Down
Loading

0 comments on commit f674c72

Please sign in to comment.