Skip to content

Spec cache system based on test decorators #4440

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

leolara
Copy link
Member

@leolara leolara commented Jul 12, 2025

Introduces a system to cache spec functions in tests

  • Each test select which functions need to be cached for that test.
  • The cache is shared between the tests that cache the same function.

This system is used in this PR to speed-up some PeerDAS tests, in my laptop in single-thread it reduces the total time in around 66%.

The new cache system is less than 240 lines of code, 1800+ plus lines are tests testing the system.

Note: currently the cache is not shared between parallel processes.

@leolara leolara marked this pull request as ready for review July 12, 2025 10:07
@jtraglia
Copy link
Member

There's little benefit to this if it doesn't help multi-threaded test execution as well. The goal of this should be to noticeably reduce the CI's fulu tests step, which currently takes ~30 minutes.

@jtraglia jtraglia added the testing CI, actions, tests label Jul 15, 2025
@leolara
Copy link
Member Author

leolara commented Jul 21, 2025

There's little benefit to this if it doesn't help multi-threaded test execution as well. The goal of this should be to noticeably reduce the CI's fulu tests step, which currently takes ~30 minutes.

  1. This is a new feature.

The previously accepted solution #4391 (https://github.com/ethereum/consensus-specs/pull/4391/files#diff-394c9e5d60550c94a80937fe82a9c448d67126e983797fc979c611c9c5628d48R160-R162)
did not have the feature of being multiprocess.

Also, proposed solution of using @functools.cache directly in specs also would not have worked in multi-process.

  1. Multi-process cache can be added to this system. Not something really specially complicated, normal software engineering. However, it would be better to add it IMO in another PR, otherwise much more code to review at once.

Anyway, I can add it to this PR or in another PR.

@jtraglia jtraglia changed the base branch from dev to master July 21, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing CI, actions, tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants