Skip to content

Worker threads/signature verification pool tests #4089

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

acolytec3
Copy link
Contributor

A vibe coded experiment with worker threads for ecrecover

Copy link

codecov bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.84%. Comparing base (ee42ec5) to head (8888d90).

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 84.33% <ø> (ø)
blockchain 89.32% <ø> (ø)
common 97.45% <ø> (ø)
devp2p 86.78% <ø> (ø)
evm 73.11% <ø> (ø)
mpt 89.74% <ø> (ø)
statemanager 69.06% <ø> (ø)
static 99.11% <ø> (ø)
tx 89.89% <ø> (ø)
util 89.16% <ø> (ø)
vm 55.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

})
parentPort.postMessage({ results, taskId })
})
`
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, there is likely no way around this "string-ification of code"? 😬 Or will there be a more "solid" way to do this later on? Anyhow - even if not - guess the price would be worth it. If the snippets are not getting too extensive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pain point here is how worker threads work. The two ways to invoke worker threads are to pass the stringified code directly or invoke a separate file (e.g. worker.js). This issue shows how hard this once you integrate typescript into the equation. The worker thread environment doesn't inherit from the top level application so tsx doesn't run (or at least not easily). Nor do any of the tricks for having node run typescript directly. I spent a couple of hours thinking this through and my options are to either compile the code to Javascript (thus meaning we have js source files in our src directory (which is kinda weird) or I have to go the route suggested in the tsx issue and add this extra tsx/cli step to the thread loading step. Happy to go either way at this point.

@holgerd77
Copy link
Member

Looks super-great! Love that this is already so structurally cleanly integrated, so that we can likely keep/merge even if we do not follow up on this directly.

At least I would ad hoc suggest - that we do permanently keep such a code struct as test setup, so that we can do more easily do future experiments with other code parts and have the outer stuff already in place. 🤩 Maybe for this we could just move over the "production" code from src to test as well? But just thinking about loud! 😄

Two small direct nice-to-have suggestions:

  1. Maybe worth to put some of your findings directly into some short dev doc section, maybe first-round in VM DEVELOPER.md (and potentially shift around later on, but also did not have such a close look).
  2. There is this dedicated benchmark structure in Vitest https://vitest.dev/guide/features.html#benchmarking, might also be nice to directly apply here, also file-name-wise, but on the other hand fully discard if this side-tracks you or is not practicable

@holgerd77 holgerd77 changed the title Signature verification pool test Worker threads integration tests May 22, 2025
@holgerd77 holgerd77 changed the title Worker threads integration tests Worker threads/signature verification pool tests May 22, 2025
@acolytec3 acolytec3 force-pushed the parallelized-sig-verification-experiment branch from 44dc6a2 to a6b2eb2 Compare May 22, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants