Skip to content

Commit b999c2f

Browse files
committed
chore: Add validation
1 parent 4665387 commit b999c2f

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

  • crates

crates/solver-core/src/handlers/intent.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ impl IntentHandler {
166166
}
167167
},
168168
Err(e) => {
169+
tracing::warn!(
170+
reason = %e,
171+
"Intent rejected during validation"
172+
);
169173
self.event_bus
170174
.publish(SolverEvent::Discovery(DiscoveryEvent::IntentRejected {
171175
intent_id: intent.id,

crates/solver-order/src/implementations/standards/_7683.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,26 @@ impl OrderInterface for Eip7683OrderImpl {
238238
))
239239
})?;
240240

241+
// Early validation: Check if the specific routes exist
242+
let supported_destinations: std::collections::HashSet<u64> =
243+
supported_outputs.iter().map(|info| info.chain_id).collect();
244+
245+
for output in &order_data.outputs {
246+
let dest_chain = output.chain_id.to::<u64>();
247+
248+
// Skip same-chain outputs as they don't need cross-chain routes
249+
if dest_chain == origin_chain {
250+
continue;
251+
}
252+
253+
if !supported_destinations.contains(&dest_chain) {
254+
return Err(OrderError::ValidationFailed(format!(
255+
"Route from chain {} to chain {} is not supported (oracle {} has no route to destination)",
256+
origin_chain, dest_chain, order_data.input_oracle
257+
)));
258+
}
259+
}
260+
241261
// Validate each output oracle
242262
for output in &order_data.outputs {
243263
let dest_chain = output.chain_id.to::<u64>();

crates/solver-settlement/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ impl SettlementService {
267267
}
268268
}
269269

270-
supported_routes.insert(input_info, valid_outputs);
270+
// Only insert if there are valid routes from this input oracle
271+
if !valid_outputs.is_empty() {
272+
supported_routes.insert(input_info, valid_outputs);
273+
}
271274
}
272275
}
273276
}

0 commit comments

Comments
 (0)