Skip to content
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

Allow Ganache RPC methods in e2e test #18149

Closed
wants to merge 1 commit into from

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Mar 14, 2023

Ganache RPC methods can now be used in e2e tests. These methods allow greater control over when blocks are mined, letting us eliminate race conditions in our tests related to block time. They also make it easier to adjust blockchain state, such as account nonce and balance.

See here for more information on these methods: https://ganache.dev/#evm_addAccount

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

Ganache RPC methods can now be used in e2e tests. These methods allow
greater control over when blocks are mined, letting us eliminate race
conditions in our tests related to block time. They also make it easier
to adjust blockchain state, such as account nonce and balance.
@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 14, 2023

These methods aren't used anywhere yet, but I'm working on a test for #18129 that I wanted to use evm_mine in. I have tested that it works locally with this change.

@metamaskbot
Copy link
Collaborator

Builds ready [2ccf78b]
Page Load Metrics (1653 ± 69 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint98149124168
domContentLoaded14731990162612861
load14732100165314469
domInteractive14731990162612861
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 202 bytes
  • ui: 0 bytes
  • common: 0 bytes

@Gudahtt Gudahtt marked this pull request as ready for review March 14, 2023 17:28
@Gudahtt Gudahtt requested a review from a team as a code owner March 14, 2023 17:28
@Gudahtt Gudahtt requested a review from garrettbear March 14, 2023 17:28
Copy link
Contributor

@legobeat legobeat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@seaona
Copy link
Contributor

seaona commented Mar 17, 2023

If we pass the ganache provider to the test suite, we could already have access to all Ganache methods. It will look something like this: #18215
Would that be enough for what you are looking for @Gudahtt?

@Gudahtt
Copy link
Member Author

Gudahtt commented Mar 17, 2023

Absolutely!
Closing in favor of #18215

@Gudahtt Gudahtt closed this Mar 17, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2023
@GuillaumeRx GuillaumeRx deleted the allow-ganache-methods-in-e2e-tests branch March 28, 2023 06:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants