PR: #27 (commit 4a9a6d3)
File: crates/charon-core/src/types.rs, lines 62-76
LiquidationOpportunity will be inserted into profit-ordered BinaryHeap in PR #40. Type currently derives only Debug, Clone, Serialize, Deserialize. Without PartialOrd + Ord, std::collections::BinaryHeap<LiquidationOpportunity> will not compile.
Risk: Downstream crate fails to compile on priority-queue insertion. Blocks PR #40.
Fix: Implement Ord by net_profit descending. Manual impl preferred over derive (derive uses lexicographic field order, not profit semantics).
impl Ord for LiquidationOpportunity {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.net_profit_wei.cmp(&other.net_profit_wei)
}
}
impl PartialOrd for LiquidationOpportunity {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}
PR: #27 (commit 4a9a6d3)
File: crates/charon-core/src/types.rs, lines 62-76
LiquidationOpportunitywill be inserted into profit-ordered BinaryHeap in PR #40. Type currently derives onlyDebug, Clone, Serialize, Deserialize. WithoutPartialOrd + Ord,std::collections::BinaryHeap<LiquidationOpportunity>will not compile.Risk: Downstream crate fails to compile on priority-queue insertion. Blocks PR #40.
Fix: Implement
Ordbynet_profitdescending. Manual impl preferred over derive (derive uses lexicographic field order, not profit semantics).