Skip to content

Conversation

@AurelienFT
Copy link
Contributor

Description

TBD

@AurelienFT AurelienFT changed the base branch from master to create_exec_sequencer_skeleton May 27, 2025 13:29
@rymnc rymnc added the no changelog Skip the CI check of the changelog modification label May 27, 2025
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.
@rymnc rymnc self-assigned this Jun 2, 2025
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

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

wip

Comment on lines +540 to +559
#[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
}
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @rymnc

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog Skip the CI check of the changelog modification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants