-
Notifications
You must be signed in to change notification settings - Fork 5k
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: adds Anvil classes and migrates first specs from Ganache to Anvil #27246
base: main
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 updated dependencies detected. Learn more about Socket for GitHub ↗︎
|
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring: Next stepsTake 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!]
|
|
||
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 viem (meaning using publicClient/walletClient/testClient for the different actions), so we are able to expand to L2's in the future with L2 clients
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
<!-- 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** - Splits the logic of foundryup.ts file into functions, so they are easier to test - Adds unit tests - Updates file extensions from `mts` to `ts`. The reason for that is because otherwise the unit tests don't run out of the box and it was suggested to change the config file and add a new dependency to make it work, which seems unnecessary for the scoped task of installing foundry. Also, this way we get lint out of the box too (instead of having to update the lint rules to include mts files) The unit tests can be run with `yarn test:unit test/helpers/foundry/foundryup.test.ts` <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28833?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** - Run unit tests: `yarn test:unit test/helpers/foundry/foundryup.test.ts` - Install default (anvil with checksum verification) `yarn foundryup` - Install forge and cast - it should skip the checksum verification `yarn foundryup -b forge -b cast` - See commands `yarn foundryup --help` - Clean cache before installing `yarn foundryup cache clean` - Pass alternative repo `yarn foundryup --repo alternative-fork/foundry` ## **Screenshots/Recordings** ![Screenshot from 2024-12-10 11-47-37](https://github.com/user-attachments/assets/88893978-aa78-4bf1-b2bb-e17ab3d6748e) ## **Pre-merge author checklist** - [ ] 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. ## **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. --------- Co-authored-by: David Murdoch <[email protected]>
|
||
// Wait for balance to load | ||
await driver.delay(500); | ||
|
||
await driver.clickElement('[data-testid="eth-overview-send"]'); | ||
await driver.clickElement({ text: 'Account 1', tag: 'button' }); |
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 was a bug in the test. We are supposed to test a send to a multisig contract, but here we selected the account 1 as recipient. Now this is fixed
Builds ready [529314b]
Page Load Metrics (1508 ± 73 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
@SocketSecurity ignore npm/@viem/[email protected] npm/[email protected] ℹ️ Viem is used in e2e only with Anvil local network |
Description
This PR adds Anvil classes (Anvil, Anvil Seeder and Anvil Clients) and migrates 2 specs to use Anvil instead of Ganache.
The way it's done is as follows:
withFixtures
: it now accepts an argument calledlocalNode = 'ganache',
defaulting to ganache. This way, in every spec we are able to specify which localNode we want to use. Now we can choose between anvil or ganache, but in the future, this design should be kept, so we can add Bitcoin and Solana, and use those nodes in their specific testsNote that some functionalitites are not yet supported like doubleAnvil. this will be done in separate PRs (see below plan), so this PR doesn't become too big.
Ganache Migration Phase:
GanacheContractAddressRegistry
class in preparation for ganache migration #28595Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3321
Manual testing steps
yarn
locally --> in the post install script, anvil will be installed automatically, no need to do anything elseyarn start:test
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist