-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Create validation in parallel-executor #3031
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
base: create_exec_sequencer_skeleton
Are you sure you want to change the base?
Conversation
This pull request introduces a new `DependencyGraph` module to the `parallel-executor` service and integrates it into the `Validator` implementation. The changes primarily focus on preparing the system for dependency graph management without yet implementing its full functionality. ### Dependency Graph Integration: * **Added `DependencyGraph` to imports**: The `DependencyGraph` type from the `dependency_graph` module was added to the imports in `validator.rs` to enable its usage. * **Introduced `dependency_graph` module**: A new `pub(crate)` module named `dependency_graph` was introduced in the `parallel-executor` service, laying the groundwork for dependency management. * **Initialized `DependencyGraph` in `Validator`**: A `DependencyGraph` instance is now initialized in the `Validator` implementation, using the size hint from the transaction source to determine its initial capacity. However, the graph is not yet actively used in the logic.
…abase changes to verify them
MitchTurner
left a comment
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.
wip
| #[test] | ||
| fn get_independent_transactions__mixed_dependencies__returns_only_independent() { | ||
| // given | ||
| let mut graph = DependencyGraph::new(2); | ||
| let contract_id = ContractId::from([1u8; 32]); | ||
|
|
||
| // Add transaction without contracts (ready) | ||
| let independent_tx = create_simple_transaction(); | ||
| graph.add_transaction(0, independent_tx); | ||
|
|
||
| // when: Add transaction with contract (ready - first to use contract) | ||
| let dependent_tx = create_transaction_with_contracts(vec![contract_id]); | ||
| graph.add_transaction(1, dependent_tx); | ||
|
|
||
| // then: Only independent transactions should be ready | ||
| let ready = graph.get_ready_transactions(); | ||
| assert_eq!(ready.len(), 2); | ||
| assert!(ready.contains(&0)); | ||
| assert!(ready.contains(&1)); // Both are ready now | ||
| } |
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.
These tests are all great. Awesome coverage. One little nit I have is there is an inconsistent use of // when and some of these tests the SUT is unclear.
// when should mark the SUT's usage. So in this test I see the SUT is get_independent_transactions but it looks like the SUT might just be get_ready_transactions()?
So I'd expect
let dependent_tx = create_transaction_with_contracts(vec![contract_id]);
graph.add_transaction(1, dependent_tx);
// when
let ready = graph.get_ready_transactions();
// then
assert_eq!(ready.len(), 2);I'm not as worried about the larger sanity tests like dependency_resolution_realistic_scenario below. That seems fine. But there are a few tests that could match the // when and SUT better.
Won't hold up the PR for that though. These tests are already a win.
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.
cc @rymnc
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.
i think the function was renamed and the test wasn't
Description
TBD