From 323063da234f99c6ab71cfbec20a628efcd07fd2 Mon Sep 17 00:00:00 2001 From: adrian Date: Thu, 18 Sep 2025 10:08:30 +0200 Subject: [PATCH] fix: move adapter contract building/finding after filtering components --- protocol-testing/src/test_runner.rs | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/protocol-testing/src/test_runner.rs b/protocol-testing/src/test_runner.rs index 96b863b..c8faa29 100644 --- a/protocol-testing/src/test_runner.rs +++ b/protocol-testing/src/test_runner.rs @@ -324,6 +324,22 @@ fn validate_state( } // Step 3: Run Tycho Simulation + // Filter out components that have skip_simulation = true + let simulation_component_ids: std::collections::HashSet = expected_components + .iter() + .filter(|c| !c.skip_simulation) + .map(|c| c.base.id.to_lowercase()) + .collect(); + + info!("Components to simulate: {}", simulation_component_ids.len()); + for id in &simulation_component_ids { + info!(" Simulating component: {}", id); + } + + if simulation_component_ids.is_empty() { + info!("No components to simulate, skipping simulation validation"); + return Ok(()); + } // Build/find the adapter contract let adapter_contract_path = @@ -362,23 +378,6 @@ fn validate_state( decoder_context, ); - // Filter out components that have skip_simulation = true (match Python behavior) - let simulation_component_ids: std::collections::HashSet = expected_components - .iter() - .filter(|c| !c.skip_simulation) - .map(|c| c.base.id.to_lowercase()) - .collect(); - - info!("Components to simulate: {}", simulation_component_ids.len()); - for id in &simulation_component_ids { - info!(" Simulating component: {}", id); - } - - if simulation_component_ids.is_empty() { - info!("No components to simulate, skipping simulation validation"); - return Ok(()); - } - // Mock a stream message, with only a Snapshot and no deltas let mut states: HashMap = HashMap::new(); for (id, component) in &components_by_id {