-
Notifications
You must be signed in to change notification settings - Fork 29
In-process tests and automatic builder variant tests #91
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update: Mosts tests are passing now.
|
All tests are passing now:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Summary
This PR closes the following issues:
Few things happened here:
RBuilder running in-process
Now we have a new type called
LocalInstance
that runs an entire RBuilder instance in-process. It uses IPC transport instead of HTTP for RPC and EngineAPI. ThisLocalInstance
representsop-rbuilder
node and can be configured by giving it an optionalNodeConfig
orRBuilderArgs
structures. Examples:Better
OpRbuilderArgs
defaultsThe
Default
implementation of the cli arguments type and all its descendants will use the defaults specified by clap attributes instead of rust default values.Chain Driver
When interacting with a
LocalInstance
we have nowChainDriver
that is used to trigger production of new blocks, get latest blocks, etc. It can be either instantiated byChainDriver::new(&local_instance)
orlocal_instance.driver()
.Better transaction pool events inspector
In
LocalInstance
all transaction pool events are recorded in a strongly typed manner insideTransactionPoolObserver
. We record their entire state history, so we can later validate the correct order of transitions. The public API for this is:Transactions have states that are instance of
TransactionEvent
from thetransaction-pool
crate in reth. Namely:Automatic unit tests generation for both standard and flashblocks builders.
When writing unit or integration tests instead of using
#[tokio::test] async test_name()
use therb_test
macro and let theLocalInstance
be injected by the macro by the test infrastructure. In this mode a sample unit test would look as follows:then when you run
cargo test
it will automatically generate both variants of this test:This macro can be configured to either run in only flashbots mode, only standard mode, use custom
RBuilderArgs
use customNodeConfig
, etc. Examples of using this macro are in thetests
directory.There is also a new macro called
if_flashblocks!
that allows you to specify a block of code that runs only under the flashblocks variant of a test. Example:Use this macro if the differences between variants are minimal and don't merit writing two versions of the test, otherwise use
#[rb_test(standard)]
and#[rb_test(flashbots)]
to narrow down the generation to one builder.Test tracing
You can now see detailed logs of your unit tests by setting the
TEST_TRACE
env variable. That will print out all reth and op-rbuilder logs to console when they're running. Usage:❌ Known issues ❌
Most
flashblocks
variants of tests are failing. When using standardsend_transaction
ETH api, transactions are not included in produced blocks. They are also not included in the flashblocks that get generated. Fixing those tests are outside of the scope of this PR and will happen in a follow-up PR. I've intentionally left the tests failing now so we are aware of this. The tests landscape now looks as follows:✅ I have completed the following steps:
make lint
make test