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

ci: solidity test benchmarks #686

Open
wants to merge 10 commits into
base: feat/solidity-tests
Choose a base branch
from

Conversation

agostbiro
Copy link
Member

@agostbiro agostbiro commented Sep 26, 2024

This PR adds automated regression checks for the JS Solidity test runner. The setup is similar to how the RPC benchmark that benchmarks Hardhat Node-style workloads works.

Benchmark Suite

The benchmark runs the test harness of forge-std. This has two advantages:

  • Largest coverage of cheatcodes in a single test harness which is helpful to catch regressions in all features.
  • Makes sure our implementation works with forge-std which we intend to use.

The disadvantage is that forge-std is not representative of how users are writing Solidity tests. But this is not a concern as long as we’re not using the benchmark to guide optimizations, only to catch regressions.

There are multiple benchmark scenarios. The first one is called Total which measures the entire test harness execution of the forge-std test harness. The purpose of this scenario is to make sure that there are no regressions in the parallel test suite executor.

In addition to test suites, individual tests within test suites are also parallelized. This means that if we want to catch regressions in features covered by a certain test suite, we have to execute that test suite in isolation. For this reason, in addition to the Total scenario, we execute the following test suites as well:

  • StdCheatsTest: environment-related cheatcode coverage + fuzzing.
  • StdStorageTest: storage-related cheatcode coverage + fuzzing.
  • StdMathTest: math-related utilities + it's very quick (~15ms on my machine), so regressions from FFI overhead should show up on this.
  • StdUtilsForkTest: read-type programmatic fork tests.
  • StdCheatsForkTest: write + fuzz tests for programmatic forking.

The rest of the test suites in forge-std test things implemented in Solidity or test file-system utilities, so they're less interesting for us.

Benchmark Metric

The metric for all scenarios is the wall clock time measured from JS in milliseconds. The measurement excludes loading files from disk as that's out of scope for EDR. If there is a 10% regression on any of the scenarios above, the benchmark job fails (same as the RPC benchmark).

Baseline

The baseline is executing the same tests with forge test. Instructions to run the baseline are in the crates/tools/js/benchmark/src/solidity-tests.ts file.

I tested manually that performance is identical to forge test on my machine, so we don't have to keep running the baseline.

Benchmark Jobs

There are two benchmark workflows in the feat/solidity-tests branch and three benchmark jobs:

  • EDR Benchmarks:

  • EDR Benchmarks for feat/solidity-tests

    • Run JS scenario runner benchmark for Hardhat Node style workload
      • Stores results for feat/solidity-tests and compares PRs against against those results
      • Once feat/solidity-tests is merged to main, we'll remove this

I reorganized the workflow files a bit to share Rust compilation cache + start caching the RPC cache for the Solidity test runner benchmarks.

Copy link

changeset-bot bot commented Sep 26, 2024

⚠️ No Changeset found

Latest commit: e9a013b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@agostbiro agostbiro marked this pull request as draft September 26, 2024 14:57
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 14:57 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 14:57 — with GitHub Actions Inactive
@agostbiro agostbiro added the no changeset needed This PR doesn't require a changeset label Sep 26, 2024
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 14:59 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 14:59 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 15:04 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 15:04 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 15:05 — with GitHub Actions Inactive
@agostbiro agostbiro force-pushed the ci/soltest-benchmarks branch 2 times, most recently from ed784a8 to fe7e781 Compare September 26, 2024 15:56
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 15:57 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 15:57 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 17:42 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 17:42 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 17:43 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 17:43 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 17:43 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 19:12 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 19:12 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 19:13 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 19:13 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 26, 2024 19:13 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 16:04 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 16:04 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 16:05 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 16:06 — with GitHub Actions Inactive
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 18:19 — with GitHub Actions Inactive
@agostbiro agostbiro marked this pull request as ready for review September 30, 2024 18:19
@agostbiro agostbiro requested a review from a team September 30, 2024 18:20
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 18:20 — with GitHub Actions Inactive
@agostbiro agostbiro self-assigned this Sep 30, 2024
@agostbiro agostbiro temporarily deployed to github-action-benchmark September 30, 2024 18:22 — with GitHub Actions Inactive
@agostbiro agostbiro deployed to github-action-benchmark September 30, 2024 18:23 — with GitHub Actions Active
@agostbiro agostbiro had a problem deploying to github-action-benchmark October 1, 2024 05:59 — with GitHub Actions Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changeset needed This PR doesn't require a changeset
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant