-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: ganache migration base setup #27246
base: develop
Are you sure you want to change the base?
Conversation
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. |
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@noble/[email protected], npm/@scure/[email protected], npm/[email protected], npm/[email protected], npm/[email protected] |
🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎ To accept the risk, merge this PR and you will not be notified again.
Next stepsWhat is network access?This module accesses the network. Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use. Take a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with
|
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #27246 +/- ##
===========================================
+ Coverage 70.00% 70.02% +0.02%
===========================================
Files 1445 1443 -2
Lines 50195 50165 -30
Branches 14041 14041
===========================================
- Hits 35139 35127 -12
+ Misses 15056 15038 -18 ☔ View full report in Codecov by Sentry. |
Builds ready [38b4b80]
Page Load Metrics (1636 ± 45 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
@@ -1,4 +1,4 @@ | |||
import GanacheContractAddressRegistry from '../seeder/ganache-contract-address-registry'; | |||
import ContractAddressRegistry from '../seeder/contract-address-registry'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a rename, as now it's used both with ganache and anvil - no functionality change
*/ | ||
class GanacheContractAddressRegistry { | ||
class ContractAddressRegistry { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a rename, as now it's used both with ganache and anvil - no functionality change
@@ -3,14 +3,14 @@ const { ContractFactory, Contract } = require('@ethersproject/contracts'); | |||
|
|||
const { ENTRYPOINT, GANACHE_ACCOUNT } = require('../constants'); | |||
const { SMART_CONTRACTS, contractConfiguration } = require('./smart-contracts'); | |||
const GanacheContractAddressRegistry = require('./ganache-contract-address-registry'); | |||
const ContractAddressRegistry = require('./contract-address-registry'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a rename, as now it's used both with ganache and anvil - no functionality change
@@ -18,11 +17,10 @@ describe('Send ETH', function () { | |||
await withFixtures( | |||
{ | |||
fixtures: new FixtureBuilder().build(), | |||
ganacheOptions: defaultGanacheOptions, | |||
title: this.test.fullTitle(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this spec is using anvil.
All tests that use defaultGanacheOptions, once migrated to anvil, won't need to pass defaultXYZOptions, since those will be already default in the anvil config, so we can remove this.
@@ -154,18 +150,17 @@ describe('Send ETH', function () { | |||
await withFixtures( | |||
{ | |||
fixtures: new FixtureBuilder().build(), | |||
ganacheOptions: { | |||
...defaultGanacheOptions, | |||
networkOptions: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this spec is using anvil! When we need to pass custom network options, we can pass them and we can omit the default.
I've name the options with a generic name networkOptions
@@ -321,8 +313,7 @@ describe('Send ETH', function () { | |||
fixtures: new FixtureBuilder() | |||
.withPermissionControllerConnectedToTestDapp() | |||
.build(), | |||
ganacheOptions: { | |||
...defaultGanacheOptions, | |||
networkOptions: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same. This spec is using anvil
@@ -11,7 +11,6 @@ describe('Simple send eth', function (this: Suite) { | |||
await withFixtures( | |||
{ | |||
fixtures: new FixtureBuilder().build(), | |||
ganacheOptions: defaultGanacheOptions, | |||
title: this.test?.fullTitle(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this spec is using anvil
|
||
return { publicClient, testClient, walletClient }; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file will be expanded in the future, for when we want to add Optimism clients for L2 network support. See:
@@ -0,0 +1,149 @@ | |||
const { DEFAULT_FIXTURE_ACCOUNT, ENTRYPOINT } = require('../constants'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file supports the same functionality as ganache seeder, but adapted to anvil (meaning using publicClient/walletClient/testClient for the different actions)
mnemonic: | ||
'spread raise short crane omit tent fringe mandate neglect detail suspect cradle', | ||
port: 8545, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This are the default network options. Since we have them defined here, there's no need for defaultAnvilOptions
, so we don't need to pass anything in the spec files, when we want the default options (see spec files above).
Likewise, we have ganache options defined in the ganache file, we wouldn't need the defaultGanacheOptions
(but it's implemented like this)
await this.#server.stop(); | ||
} catch (e) { | ||
console.log('Caught error while closing Anvil network:', e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are the same methods that we support on ganache, so functionality is preserved
); | ||
contractRegistry = ganacheSeeder.getContractRegistry(); | ||
if (smartContract) { | ||
if (ganacheServer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once we have migrated all tests, we'll be able to remove this code block and use the below one with the AnvilSeeder
Quality Gate failedFailed conditions |
Builds ready [a33e7ae]
Page Load Metrics (2019 ± 99 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Ganache Migration Phase:
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3321
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist