From a0ed5d9c38224fa356e91f7a2f32018ce8058758 Mon Sep 17 00:00:00 2001 From: fafk Date: Thu, 19 Jun 2025 17:08:08 +0200 Subject: [PATCH 1/3] docs: instruct to not execute hooks with driver --- docs/cow-protocol/tutorials/arbitrate/solver/driver.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/cow-protocol/tutorials/arbitrate/solver/driver.md b/docs/cow-protocol/tutorials/arbitrate/solver/driver.md index 50619a93b..bddc02d51 100644 --- a/docs/cow-protocol/tutorials/arbitrate/solver/driver.md +++ b/docs/cow-protocol/tutorials/arbitrate/solver/driver.md @@ -70,6 +70,12 @@ The driver expects the solver engine to return a recipe on how to solve a set of In the post-processing step the driver applies multiple sanity checks to the solution, encodes it into a transaction that can be executed on-chain and verifies that it actually simulates successfully before it considers the solution valid. All this is done because solvers can get slashed for misbehaving so the reference driver checks all it can to reduce the risk of running a solver as much as possible. +:::note + +The driver runs pre- and post-hooks for the solver, don't execute these yourself in your solver code. + +::: + Since the solver engine is allowed to propose multiple solutions the driver also contains some logic to pick the best one. First it will try to merge disjoint solutions to create bigger and more gas efficient batches. Afterwards it will simulate the solutions to get an accurate gas usage for them which is used to compute a score for each one. @@ -164,7 +170,7 @@ For each flash loan, the following encoding has to be added: ## Considerations -As you can see the driver has many responsibilities and discussing all of them in detail would be beyond the scope of this documentation but it's worth mentioning one guiding principle that applies to most of them: +As you can see the driver has many responsibilities and discussing all of them in detail would be beyond the scope of this documentation but it's worth mentioning one guiding principle that applies to most of them: make the driver do as _little_ work as possible in the hot path when processing an auction. Because having more time for the solver to compute a solution leads to a more competitive solver every process in the driver should introduce as little latency as possible. From 7d43faf3fa99d18b3f70732736ab71a2252be331 Mon Sep 17 00:00:00 2001 From: "Jan [Yann]" Date: Fri, 20 Jun 2025 15:47:16 +0200 Subject: [PATCH 2/3] Change wording Co-authored-by: Martin Magnus --- docs/cow-protocol/tutorials/arbitrate/solver/driver.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cow-protocol/tutorials/arbitrate/solver/driver.md b/docs/cow-protocol/tutorials/arbitrate/solver/driver.md index bddc02d51..714cf9398 100644 --- a/docs/cow-protocol/tutorials/arbitrate/solver/driver.md +++ b/docs/cow-protocol/tutorials/arbitrate/solver/driver.md @@ -72,7 +72,7 @@ All this is done because solvers can get slashed for misbehaving so the referenc :::note -The driver runs pre- and post-hooks for the solver, don't execute these yourself in your solver code. +The driver encodes all matched orders' pre- and post-hooks for the solver, the solver does not have to add them in its solution. The `preInteractions` and `postInteractions` that can be added to a solution are only needed for additional calls the solver needs to execute to make the solution work. ::: From 3da693b2e069d2d540a6f7119b4b52980fcb8c0c Mon Sep 17 00:00:00 2001 From: "Jan [Yann]" Date: Mon, 23 Jun 2025 14:25:34 +0200 Subject: [PATCH 3/3] Update docs/cow-protocol/tutorials/arbitrate/solver/driver.md Co-authored-by: Miguel Naveira <47919901+mrnaveira@users.noreply.github.com> --- docs/cow-protocol/tutorials/arbitrate/solver/driver.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cow-protocol/tutorials/arbitrate/solver/driver.md b/docs/cow-protocol/tutorials/arbitrate/solver/driver.md index 714cf9398..3a2112687 100644 --- a/docs/cow-protocol/tutorials/arbitrate/solver/driver.md +++ b/docs/cow-protocol/tutorials/arbitrate/solver/driver.md @@ -72,7 +72,7 @@ All this is done because solvers can get slashed for misbehaving so the referenc :::note -The driver encodes all matched orders' pre- and post-hooks for the solver, the solver does not have to add them in its solution. The `preInteractions` and `postInteractions` that can be added to a solution are only needed for additional calls the solver needs to execute to make the solution work. +The driver encodes all matched orders' pre- and post-hooks for the solver, so the solver does not have to add them in its solution. The `preInteractions` and `postInteractions` that can be added to a solution are only needed for additional calls that the solver needs to execute to make the solution work. :::