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
Parallel EVM Tests #444
Parallel EVM Tests #444
Conversation
This allows us to instantiate as many EVMs as we want inside of the runner, which in turn will enable running tests in parallel
previously we'd reuse the same EVM, now, we use a different EVM per test, allowing us to get rid of the mutable reference on self
There's a TODO here around how we should do the evm.debug_calls check which we should figure out
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.
LGTM gg
what are your thoughts for this item @gakonst
|
Manual testing for now, not sure if we can properly integration test & benchmark yet. |
self.run_tests(name, abi, backend, deploy_code.clone(), filter)? | ||
} | ||
BackendKind::Shared(ref backend) => { | ||
self.run_tests(name, abi, backend, deploy_code.clone(), filter)? |
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.
cloning is a bit expensive,
perhaps we can at a later stage either consume on fn test
or remove the bytecode or wrap it in an arc
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.
ethers::types::Bytes
is a wrapper around bytes::Bytes
, which is cheap to clone https://docs.rs/bytes/latest/bytes/struct.Bytes.html
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.
ah right, great!
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.
lgtm,
sputnik's borrowing behavior makes it a bit more verbose than it should be
@brockelmore said he'll take over the conflict & merge, else I'll wrap it in the morning |
Co-authored with @brockelmore, converts unit & fuzz tests to be run in parallel.
This achieves a significant speedup, especially for fuzz tests.
Things in this PR:
EvmOpts
(refactor EvmOpts to evm-adapters)new_sputnik_evm
, this tightly couples us to SputnikEVM a bit, but should be fine, we weren't using evmodin either way)SharedBackend
(instead ofForkMemoryBackend
), which is cheap to clone, but allows sharing state across forked tests, deduplicating work as much as possible&self
instead of&mut self
, which makes parallelization withrayon
very easy: we just replace.iter()
withpar_iter()
.Supersedes #435
Also contains the fixes from #430.
spells-mainnet
from 2m37 go to 1m43 (~30% improv)guni-lev
from to 33s to 27.7s (~20% improvement)drai
from ~18s to ~9s (2x improv)solmate
from 2m48 to 47s (3.5x)evm.debug_calls()
in the CLI'srun.rs
(fix debugging #445)