Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for multiple solution proposals from the driver, which is a key feature for enabling EIP-7702 parallel submissions. The changes to Competition::solve to handle multiple solutions, including sorting, caching, and re-simulation, are well-implemented. The new configuration flag propose-all-solutions and associated validation are also correctly added. I've found one issue related to configuration validation for EIP-7702 setup that should be addressed to prevent runtime failures from misconfigurations.
|
This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed. |
| for (_, settlement) in &scored { | ||
| lock.push_front(settlement.clone()); | ||
| } |
There was a problem hiding this comment.
i wonder if the following would be faster:
- keeping scored as a vecdeque from the start
- extending scored with settlements
- replacing settlements with scored
| for (_, settlement) in &scored { | ||
| lock.push_front(settlement.clone()); | ||
| } | ||
| const MAX_SOLUTION_STORAGE: usize = 5; |
There was a problem hiding this comment.
But scored can hold more than 5 items, right? Should we truncate scored to MAX_SOLUTION_STORAGE before caching, so what is stored and what is returned are always in sync.
|
This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed. |
| let mut scored: Vec<(Option<Solved>, Settlement)> = scores | ||
| .into_iter() | ||
| .max_by_key(|(score, _)| score.to_owned()) | ||
| .sorted_by(|(a, _), (b, _)| b.cmp(a)) |
There was a problem hiding this comment.
Is the reason to switch away from max_by_key to avoid cloning the score? Otherwise I find max_by_key easier to understand by just reading the code.
There was a problem hiding this comment.
max_by_key give 1 element (the max), but now we actually want a vector of N best solutions.
Description
The driver currently proposes only the single highest-scoring solution to the autopilot. With EIP-7702 parallel submission in place, the autopilot's combinatorial auction can now benefit from receiving all valid solutions from a driver to find the optimal set of winners.
Changes
[x] Driver's solve() now returns Vec instead of Option with all valid solutions sorted best-first
[x] Block re-simulation loop now monitors all proposed solutions individually, voiding only those that revert
[x] New per-solver config flag propose-all-solutions (default: false) keeps existing behavior until EIP-7702 infrastructure is ready
How to test
To enable in production, add to the solver config:
propose-all-solutions = true(requires submission-accounts to also be configured along with the forwarder contract).