diff --git a/crates/driver/src/infra/solver/dto/notification.rs b/crates/driver/src/infra/solver/dto/notification.rs index aad9a72fb8..b2f3c21b1f 100644 --- a/crates/driver/src/infra/solver/dto/notification.rs +++ b/crates/driver/src/infra/solver/dto/notification.rs @@ -4,7 +4,7 @@ use { competition::{auction, solution}, eth, }, - infra::{notify, notify::SimulationSucceededAtLeastOnce}, + infra::notify, util::serialize, }, serde::Serialize, @@ -25,41 +25,39 @@ impl Notification { kind: match kind { notify::Kind::Timeout => Kind::Timeout, notify::Kind::EmptySolution => Kind::EmptySolution, - notify::Kind::SimulationFailed(block, tx, simulated_once) => { - Kind::SimulationFailed( - block.0, - Tx { + notify::Kind::SimulationFailed(block, tx, succeeded_once) => { + Kind::SimulationFailed { + block: block.0, + tx: Tx { from: tx.from.into(), to: tx.to.into(), input: tx.input.into(), value: tx.value.into(), access_list: tx.access_list.into(), }, - simulated_once, - ) - } - notify::Kind::ScoringFailed(notify::ScoreKind::ZeroScore) => { - Kind::ScoringFailed(ScoreKind::ZeroScore) + succeeded_once, + } } + notify::Kind::ScoringFailed(notify::ScoreKind::ZeroScore) => Kind::ZeroScore, notify::Kind::ScoringFailed(notify::ScoreKind::ScoreHigherThanQuality( score, quality, - )) => Kind::ScoringFailed(ScoreKind::ScoreHigherThanQuality { + )) => Kind::ScoreHigherThanQuality { score: score.0.get(), quality: quality.0, - }), + }, notify::Kind::ScoringFailed(notify::ScoreKind::SuccessProbabilityOutOfRange( success_probability, - )) => Kind::ScoringFailed(ScoreKind::SuccessProbabilityOutOfRange { + )) => Kind::SuccessProbabilityOutOfRange { probability: success_probability, - }), + }, notify::Kind::ScoringFailed(notify::ScoreKind::ObjectiveValueNonPositive( quality, gas_cost, - )) => Kind::ScoringFailed(ScoreKind::ObjectiveValueNonPositive { + )) => Kind::ObjectiveValueNonPositive { quality: quality.0, gas_cost: gas_cost.get().0, - }), + }, notify::Kind::NonBufferableTokensUsed(tokens) => Kind::NonBufferableTokensUsed { tokens: tokens.into_iter().map(|token| token.0 .0).collect(), }, @@ -69,16 +67,16 @@ impl Notification { } } notify::Kind::DuplicatedSolutionId => Kind::DuplicatedSolutionId, - notify::Kind::Settled(kind) => Kind::Settled(match kind { - notify::Settlement::Success(hash) => Settlement::Success { + notify::Kind::Settled(kind) => match kind { + notify::Settlement::Success(hash) => Kind::Success { transaction: hash.0, }, - notify::Settlement::Revert(hash) => Settlement::Revert { + notify::Settlement::Revert(hash) => Kind::Revert { transaction: hash.0, }, - notify::Settlement::SimulationRevert => Settlement::SimulationRevert, - notify::Settlement::Fail => Settlement::Fail, - }), + notify::Settlement::SimulationRevert => Kind::Cancelled, + notify::Settlement::Fail => Kind::Fail, + }, }, } } @@ -95,42 +93,17 @@ pub struct Notification { #[serde_as] #[derive(Debug, Serialize)] -#[serde(rename_all = "lowercase")] +#[serde(rename_all = "lowercase", tag = "kind")] pub enum Kind { Timeout, EmptySolution, DuplicatedSolutionId, - SimulationFailed(BlockNo, Tx, SimulationSucceededAtLeastOnce), - ScoringFailed(ScoreKind), - NonBufferableTokensUsed { - tokens: BTreeSet, - }, - SolverAccountInsufficientBalance { - #[serde_as(as = "serialize::U256")] - required: eth::U256, + #[serde(rename_all = "camelCase")] + SimulationFailed { + block: BlockNo, + tx: Tx, + succeeded_once: bool, }, - Settled(Settlement), -} - -type BlockNo = u64; - -#[serde_as] -#[derive(Debug, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct Tx { - pub from: eth::H160, - pub to: eth::H160, - #[serde_as(as = "serialize::Hex")] - pub input: Vec, - #[serde_as(as = "serialize::U256")] - pub value: eth::U256, - pub access_list: AccessList, -} - -#[serde_as] -#[derive(Debug, Serialize)] -#[serde(rename_all = "lowercase")] -pub enum ScoreKind { ZeroScore, ScoreHigherThanQuality { #[serde_as(as = "serialize::U256")] @@ -148,14 +121,34 @@ pub enum ScoreKind { #[serde_as(as = "serialize::U256")] gas_cost: eth::U256, }, + NonBufferableTokensUsed { + tokens: BTreeSet, + }, + SolverAccountInsufficientBalance { + #[serde_as(as = "serialize::U256")] + required: eth::U256, + }, + Success { + transaction: eth::H256, + }, + Revert { + transaction: eth::H256, + }, + Cancelled, + Fail, } +type BlockNo = u64; + #[serde_as] #[derive(Debug, Serialize)] -#[serde(rename_all = "lowercase")] -pub enum Settlement { - Success { transaction: eth::H256 }, - Revert { transaction: eth::H256 }, - SimulationRevert, - Fail, +#[serde(rename_all = "camelCase")] +pub struct Tx { + pub from: eth::H160, + pub to: eth::H160, + #[serde_as(as = "serialize::Hex")] + pub input: Vec, + #[serde_as(as = "serialize::U256")] + pub value: eth::U256, + pub access_list: AccessList, } diff --git a/crates/driver/src/infra/solver/dto/solution.rs b/crates/driver/src/infra/solver/dto/solution.rs index d916296867..8f9dd40ba8 100644 --- a/crates/driver/src/infra/solver/dto/solution.rs +++ b/crates/driver/src/infra/solver/dto/solution.rs @@ -200,9 +200,9 @@ impl Solutions { Score::Solver { score } => { competition::solution::SolverScore::Solver(score) } - Score::RiskAdjusted(success_probability) => { - competition::solution::SolverScore::RiskAdjusted(success_probability) - } + Score::RiskAdjusted { + success_probability, + } => competition::solution::SolverScore::RiskAdjusted(success_probability), }, weth, ) @@ -377,11 +377,12 @@ enum SigningScheme { #[serde_as] #[derive(Debug, Deserialize)] -#[serde(rename_all = "lowercase", deny_unknown_fields)] +#[serde(rename_all = "lowercase", deny_unknown_fields, tag = "kind")] pub enum Score { Solver { #[serde_as(as = "serialize::U256")] score: eth::U256, }, - RiskAdjusted(f64), + #[serde(rename_all = "camelCase")] + RiskAdjusted { success_probability: f64 }, } diff --git a/crates/driver/src/tests/cases/score_competition.rs b/crates/driver/src/tests/cases/score_competition.rs index 6ce2c66c2d..bdd4ce82ae 100644 --- a/crates/driver/src/tests/cases/score_competition.rs +++ b/crates/driver/src/tests/cases/score_competition.rs @@ -12,7 +12,7 @@ async fn solver_score_winner() { .pool(ab_pool()) .order(ab_order()) .solution(ab_solution().score(Score::Solver { score: 2902421280589416499u128.into()})) // higher than objective value - .solution(ab_solution().score(Score::RiskAdjusted(0.4))) + .solution(ab_solution().score(Score::RiskAdjusted{ success_probability: 0.4})) .done() .await; @@ -31,7 +31,9 @@ async fn risk_adjusted_score_winner() { .solution(ab_solution().score(Score::Solver { score: DEFAULT_SCORE_MIN.into(), })) - .solution(ab_solution().score(Score::RiskAdjusted(0.9))) + .solution(ab_solution().score(Score::RiskAdjusted { + success_probability: 0.9, + })) .done() .await; diff --git a/crates/driver/src/tests/setup/mod.rs b/crates/driver/src/tests/setup/mod.rs index eee1f63cef..5a10f74f86 100644 --- a/crates/driver/src/tests/setup/mod.rs +++ b/crates/driver/src/tests/setup/mod.rs @@ -56,18 +56,21 @@ pub enum Partial { #[serde_as] #[derive(Debug, Clone, serde::Serialize)] -#[serde(rename_all = "lowercase")] +#[serde(rename_all = "lowercase", tag = "kind")] pub enum Score { Solver { #[serde_as(as = "serialize::U256")] score: eth::U256, }, - RiskAdjusted(f64), + #[serde(rename_all = "camelCase")] + RiskAdjusted { success_probability: f64 }, } impl Default for Score { fn default() -> Self { - Self::RiskAdjusted(1.0) + Self::RiskAdjusted { + success_probability: 1.0, + } } } diff --git a/crates/shared/src/http_solver/model.rs b/crates/shared/src/http_solver/model.rs index 12bf287d48..e15fae0fdf 100644 --- a/crates/shared/src/http_solver/model.rs +++ b/crates/shared/src/http_solver/model.rs @@ -7,7 +7,7 @@ use { ethcontract::{Bytes, H160}, model::{ auction::AuctionId, - order::{Interactions, OrderData, OrderUid}, + order::{OrderData, OrderUid}, ratio_as_decimal, signature::Signature, }, @@ -347,8 +347,6 @@ pub struct NativeLiquidityOrder { pub data: OrderData, #[serde(flatten)] pub signature: Signature, - #[serde(default)] - pub interactions: Interactions, } #[serde_as] @@ -1166,7 +1164,6 @@ mod tests { ..Default::default() }, signature: Signature::Eip1271(vec![1, 2, 3, 4]), - interactions: Default::default(), }, exec_sell_amount: 50.into(), exec_buy_amount: 51.into(), diff --git a/crates/solver/src/solver/http_solver/settlement.rs b/crates/solver/src/solver/http_solver/settlement.rs index 4b850e9c53..990704a78c 100644 --- a/crates/solver/src/solver/http_solver/settlement.rs +++ b/crates/solver/src/solver/http_solver/settlement.rs @@ -338,7 +338,7 @@ fn convert_foreign_liquidity_orders( }, data: liquidity.order.data, signature: liquidity.order.signature, - interactions: liquidity.order.interactions, + interactions: Default::default(), }; let converted = order_converter.normalize_limit_order(BalancedOrder::full(order))?; Ok(ExecutedLimitOrder { @@ -609,7 +609,6 @@ mod tests { ..Default::default() }, signature: Signature::PreSign, - interactions: Default::default(), }, exec_sell_amount: 101.into(), exec_buy_amount: 102.into(), diff --git a/crates/solvers/openapi.yml b/crates/solvers/openapi.yml index b3f1dfc2f2..0f6e7e8f88 100644 --- a/crates/solvers/openapi.yml +++ b/crates/solvers/openapi.yml @@ -23,13 +23,43 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/Solution" + type: array + items: + $ref: "#/components/schemas/Solution" 400: description: There is something wrong with the request. 429: description: The solver cannot keep up. It is too busy to handle more requests. 500: description: Something went wrong when handling the request. + /notify: + post: + description: | + Receive a status notification about a previously provided solution + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + auctionId: + description: | + The auction ID of the auction that the solution was provided + for. + type: number + solutionId: + description: | + The solution ID within the auction for which the notification applies + type: number + kind: + description: | + The kind of notification. + type: string + enum: [Timeout, EmptySolution, DuplicatedSolutionId, SimulationFailed, ZeroScore, ScoreHigherThanQuality, SuccessProbabilityOutOfRange, ObjectiveValueNonPositive, NonBufferableTokensUsed, SolverAccountInsufficientBalance, Success, Revert, Cancelled, Failed] + responses: + 200: + description: notification successfully received. components: schemas: @@ -282,6 +312,9 @@ components: $ref: "#/components/schemas/Decimal" fee: $ref: "#/components/schemas/Decimal" + version: + type: string + enum: ["v0", "v3plus"] StablePool: description: | @@ -535,6 +568,17 @@ components: must be included in the auction input. allOf: - $ref: "#/components/schemas/OrderUid" + fee: + description: | + The sell token amount that should be taken as a fee for this + trade. This only gets returned for partially fillable limit + orders and only refers to the actual amount filled by the trade. + executedAmount: + description: | + The amount of the order that was executed. This is denoted in + "sellToken" for sell orders, and "buyToken" for buy orders. + allOf: + - $ref: "#/components/schemas/TokenAmount" JitTrade: description: | @@ -546,34 +590,23 @@ components: kind: type: string enum: [jit] + executedAmount: + description: | + The amount of the order that was executed. This is denoted in + "sellToken" for sell orders, and "buyToken" for buy orders. + allOf: + - $ref: "#/components/schemas/TokenAmount" order: description: | The just-in-time liquidity order to execute in a solution. allOf: - $ref: "#/components/schemas/JitOrder" - Trade: description: | A trade for a CoW Protocol order included in a solution. - allOf: - - oneOf: - - $ref: "#/components/schemas/Fulfillment" - - $ref: "#/components/schemas/JitTrade" - - type: object - required: - - executedAmount - properties: - executedAmount: - description: | - The amount of the order that was executed. This is denoted in - "sellToken" for sell orders, and "buyToken" for buy orders. - allOf: - - $ref: "#/components/schemas/TokenAmount" - fee: - description: | - The sell token amount that should be taken as a fee for this - trade. This only gets returned for partially fillable limit - orders and only refers to the actual amount filled by the trade. + oneOf: + - $ref: "#/components/schemas/Fulfillment" + - $ref: "#/components/schemas/JitTrade" LiquidityInteraction: description: | @@ -630,7 +663,7 @@ components: - kind - target - value - - callData + - calldata - inputs - outputs properties: @@ -641,7 +674,7 @@ components: $ref: "#/components/schemas/Address" value: $ref: "#/components/schemas/TokenAmount" - callData: + calldata: description: | The EVM calldata bytes. type: string @@ -681,10 +714,15 @@ components: The computed solution for a given auction. type: object required: + - id - prices - trades - interactions + - score properties: + id: + description: An opaque identifier for the solution. + type: number prices: description: | A clearing price map of token address to price. The price can have @@ -704,3 +742,30 @@ components: type: array items: $ref: "#/components/schemas/Interaction" + score: + description: | + Information required by the driver to score the solution. + + Can either be a raw score or a success probability. + oneOf: + - type: object + properties: + kind: + type: string + enum: [solver] + score: + description: | + The raw score of the solution. This is the score that is + used by the driver to rank solutions. + allOf: + - $ref: "#/components/schemas/Decimal" + - type: object + properties: + kind: + type: string + enum: [riskadjusted] + successProbability: + description: | + The revert probability of the solution. Used by the driver to compute a risk-adjusted score. + type: number + example: 0.9 diff --git a/crates/solvers/src/api/routes/notify/dto/notification.rs b/crates/solvers/src/api/routes/notify/dto/notification.rs index b72be73932..8f4ef4e318 100644 --- a/crates/solvers/src/api/routes/notify/dto/notification.rs +++ b/crates/solvers/src/api/routes/notify/dto/notification.rs @@ -3,7 +3,7 @@ use { domain::{ auction, eth, - notification::{self, SimulationSucceededAtLeastOnce}, + notification::{self}, }, util::serialize, }, @@ -26,20 +26,22 @@ impl Notification { kind: match &self.kind { Kind::Timeout => notification::Kind::Timeout, Kind::EmptySolution => notification::Kind::EmptySolution, - Kind::SimulationFailed(block, tx, succeeded_at_least_once) => { - notification::Kind::SimulationFailed( - *block, - eth::Tx { - from: tx.from.into(), - to: tx.to.into(), - input: tx.input.clone().into(), - value: tx.value.into(), - access_list: tx.access_list.clone(), - }, - *succeeded_at_least_once, - ) - } - Kind::ScoringFailed(ScoreKind::ObjectiveValueNonPositive { quality, gas_cost }) => { + Kind::SimulationFailed { + block, + tx, + succeeded_once, + } => notification::Kind::SimulationFailed( + *block, + eth::Tx { + from: tx.from.into(), + to: tx.to.into(), + input: tx.input.clone().into(), + value: tx.value.into(), + access_list: tx.access_list.clone(), + }, + *succeeded_once, + ), + Kind::ObjectiveValueNonPositive { quality, gas_cost } => { notification::Kind::ScoringFailed( notification::ScoreKind::ObjectiveValueNonPositive( (*quality).into(), @@ -47,10 +49,10 @@ impl Notification { ), ) } - Kind::ScoringFailed(ScoreKind::ZeroScore) => { + Kind::ZeroScore => { notification::Kind::ScoringFailed(notification::ScoreKind::ZeroScore) } - Kind::ScoringFailed(ScoreKind::ScoreHigherThanQuality { score, quality }) => { + Kind::ScoreHigherThanQuality { score, quality } => { notification::Kind::ScoringFailed( notification::ScoreKind::ScoreHigherThanQuality( (*score).into(), @@ -58,7 +60,7 @@ impl Notification { ), ) } - Kind::ScoringFailed(ScoreKind::SuccessProbabilityOutOfRange { probability }) => { + Kind::SuccessProbabilityOutOfRange { probability } => { notification::Kind::ScoringFailed( notification::ScoreKind::SuccessProbabilityOutOfRange( (*probability).into(), @@ -78,16 +80,16 @@ impl Notification { notification::Kind::SolverAccountInsufficientBalance(eth::Ether(*required)) } Kind::DuplicatedSolutionId => notification::Kind::DuplicatedSolutionId, - Kind::Settled(kind) => notification::Kind::Settled(match kind { - Settlement::Success { transaction } => { - notification::Settlement::Success(*transaction) - } - Settlement::Revert { transaction } => { - notification::Settlement::Revert(*transaction) - } - Settlement::SimulationRevert => notification::Settlement::SimulationRevert, - Settlement::Fail => notification::Settlement::Fail, - }), + Kind::Success { transaction } => { + notification::Kind::Settled(notification::Settlement::Success(*transaction)) + } + Kind::Revert { transaction } => { + notification::Kind::Settled(notification::Settlement::Revert(*transaction)) + } + Kind::Cancelled => { + notification::Kind::Settled(notification::Settlement::SimulationRevert) + } + Kind::Fail => notification::Kind::Settled(notification::Settlement::Fail), }, } } @@ -100,47 +102,23 @@ pub struct Notification { #[serde_as(as = "Option")] auction_id: Option, solution_id: Option, + #[serde(flatten)] kind: Kind, } #[serde_as] #[derive(Debug, Deserialize)] -#[serde(rename_all = "lowercase")] +#[serde(rename_all = "lowercase", tag = "kind")] pub enum Kind { Timeout, EmptySolution, DuplicatedSolutionId, - SimulationFailed(BlockNo, Tx, SimulationSucceededAtLeastOnce), - ScoringFailed(ScoreKind), - NonBufferableTokensUsed { - tokens: BTreeSet, - }, - SolverAccountInsufficientBalance { - #[serde_as(as = "serialize::U256")] - required: U256, + #[serde(rename_all = "camelCase")] + SimulationFailed { + block: BlockNo, + tx: Tx, + succeeded_once: bool, }, - Settled(Settlement), -} - -type BlockNo = u64; - -#[serde_as] -#[derive(Debug, Deserialize)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Tx { - from: H160, - to: H160, - #[serde_as(as = "serialize::Hex")] - input: Vec, - #[serde_as(as = "serialize::U256")] - value: U256, - access_list: AccessList, -} - -#[serde_as] -#[derive(Debug, Deserialize)] -#[serde(rename_all = "lowercase")] -pub enum ScoreKind { ZeroScore, ScoreHigherThanQuality { #[serde_as(as = "serialize::U256")] @@ -158,14 +136,34 @@ pub enum ScoreKind { #[serde_as(as = "serialize::U256")] gas_cost: U256, }, + NonBufferableTokensUsed { + tokens: BTreeSet, + }, + SolverAccountInsufficientBalance { + #[serde_as(as = "serialize::U256")] + required: U256, + }, + Success { + transaction: H256, + }, + Revert { + transaction: H256, + }, + Cancelled, + Fail, } +type BlockNo = u64; + #[serde_as] #[derive(Debug, Deserialize)] -#[serde(rename_all = "lowercase")] -pub enum Settlement { - Success { transaction: H256 }, - Revert { transaction: H256 }, - SimulationRevert, - Fail, +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct Tx { + from: H160, + to: H160, + #[serde_as(as = "serialize::Hex")] + input: Vec, + #[serde_as(as = "serialize::U256")] + value: U256, + access_list: AccessList, } diff --git a/crates/solvers/src/api/routes/solve/dto/solution.rs b/crates/solvers/src/api/routes/solve/dto/solution.rs index 8476716a95..cc8fd0c1c0 100644 --- a/crates/solvers/src/api/routes/solve/dto/solution.rs +++ b/crates/solvers/src/api/routes/solve/dto/solution.rs @@ -67,16 +67,6 @@ impl Solutions { buy_token_balance: BuyTokenBalance::Erc20, signing_scheme, signature, - pre_interactions: trade - .order - .pre_interactions - .iter() - .map(|i| OrderInteraction { - target: i.target, - value: i.value.0, - calldata: i.calldata.clone(), - }) - .collect(), }, executed_amount: trade.executed, }) @@ -134,7 +124,9 @@ impl Solutions { .collect(), score: match solution.score.clone() { solution::Score::Solver(score) => Score::Solver { score }, - solution::Score::RiskAdjusted(score) => Score::RiskAdjusted(score.0), + solution::Score::RiskAdjusted(score) => Score::RiskAdjusted { + success_probability: score.0, + }, }, }) .collect(), @@ -212,7 +204,6 @@ struct JitOrder { signing_scheme: SigningScheme, #[serde_as(as = "serialize::Hex")] signature: Vec, - pre_interactions: Vec, } #[derive(Debug, Serialize)] @@ -321,11 +312,12 @@ enum SigningScheme { /// A score for a solution. The score is used to rank solutions. #[serde_as] #[derive(Debug, Serialize)] -#[serde(rename_all = "lowercase")] +#[serde(rename_all = "lowercase", tag = "kind")] pub enum Score { Solver { #[serde_as(as = "serialize::U256")] score: U256, }, - RiskAdjusted(f64), + #[serde(rename_all = "camelCase")] + RiskAdjusted { success_probability: f64 }, } diff --git a/crates/solvers/src/boundary/legacy.rs b/crates/solvers/src/boundary/legacy.rs index d26d65520c..19ff71c9ae 100644 --- a/crates/solvers/src/boundary/legacy.rs +++ b/crates/solvers/src/boundary/legacy.rs @@ -394,17 +394,6 @@ fn to_domain_solution( trades.push(solution::Trade::Jit(solution::JitTrade { order: order::JitOrder { owner: jit.order.from, - pre_interactions: jit - .order - .interactions - .pre - .iter() - .map(|i| order::Interaction { - target: i.target, - value: eth::Ether(i.value), - calldata: i.call_data.clone(), - }) - .collect(), signature: jit.order.signature.clone().into(), sell: eth::Asset { token: eth::TokenAddress(jit.order.data.sell_token), diff --git a/crates/solvers/src/domain/order.rs b/crates/solvers/src/domain/order.rs index 2a686e3b98..0e1e51531c 100644 --- a/crates/solvers/src/domain/order.rs +++ b/crates/solvers/src/domain/order.rs @@ -142,9 +142,6 @@ pub struct JitOrder { pub side: Side, pub class: Class, pub partially_fillable: bool, - /// Interactions that get executed before tokens get transfer from users - /// into the settlement contract. - pub pre_interactions: Vec, pub valid_to: u32, pub app_data: AppData, pub receiver: Address, diff --git a/crates/solvers/src/tests/balancer/market_order.rs b/crates/solvers/src/tests/balancer/market_order.rs index b9c96d6195..3c7d9fc07b 100644 --- a/crates/solvers/src/tests/balancer/market_order.rs +++ b/crates/solvers/src/tests/balancer/market_order.rs @@ -156,7 +156,8 @@ async fn sell() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -313,7 +314,8 @@ async fn buy() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/baseline/bal_liquidity.rs b/crates/solvers/src/tests/baseline/bal_liquidity.rs index 1180ec567a..1552c89953 100644 --- a/crates/solvers/src/tests/baseline/bal_liquidity.rs +++ b/crates/solvers/src/tests/baseline/bal_liquidity.rs @@ -117,7 +117,8 @@ async fn weighted() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -232,7 +233,8 @@ async fn weighted_v3plus() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -370,7 +372,8 @@ async fn stable() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }, { @@ -400,7 +403,8 @@ async fn stable() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }, ] @@ -533,7 +537,8 @@ async fn composable_stable_v4() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }, ] diff --git a/crates/solvers/src/tests/baseline/buy_order_rounding.rs b/crates/solvers/src/tests/baseline/buy_order_rounding.rs index bc41d57332..e0a4bad99e 100644 --- a/crates/solvers/src/tests/baseline/buy_order_rounding.rs +++ b/crates/solvers/src/tests/baseline/buy_order_rounding.rs @@ -101,7 +101,8 @@ async fn uniswap() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -266,7 +267,8 @@ async fn balancer_weighted() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -381,7 +383,8 @@ async fn balancer_weighted_v3plus() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -496,7 +499,8 @@ async fn distant_convergence() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -646,7 +650,8 @@ async fn same_path() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -785,7 +790,8 @@ async fn balancer_stable() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }, ] diff --git a/crates/solvers/src/tests/baseline/direct_swap.rs b/crates/solvers/src/tests/baseline/direct_swap.rs index af58827cd9..148ece9ef0 100644 --- a/crates/solvers/src/tests/baseline/direct_swap.rs +++ b/crates/solvers/src/tests/baseline/direct_swap.rs @@ -97,7 +97,8 @@ async fn test() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/baseline/internalization.rs b/crates/solvers/src/tests/baseline/internalization.rs index 7c9d0be68d..ee8185c6a9 100644 --- a/crates/solvers/src/tests/baseline/internalization.rs +++ b/crates/solvers/src/tests/baseline/internalization.rs @@ -97,7 +97,8 @@ async fn trusted_token() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -198,7 +199,8 @@ async fn untrusted_sell_token() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -299,7 +301,8 @@ async fn insufficient_balance() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/baseline/partial_fill.rs b/crates/solvers/src/tests/baseline/partial_fill.rs index b4f5273545..ade53c6dd5 100644 --- a/crates/solvers/src/tests/baseline/partial_fill.rs +++ b/crates/solvers/src/tests/baseline/partial_fill.rs @@ -98,7 +98,8 @@ async fn test() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/dex/partial_fill.rs b/crates/solvers/src/tests/dex/partial_fill.rs index c575926592..e054545c3f 100644 --- a/crates/solvers/src/tests/dex/partial_fill.rs +++ b/crates/solvers/src/tests/dex/partial_fill.rs @@ -246,7 +246,8 @@ endpoint = 'http://{}/sor' } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }) @@ -580,7 +581,8 @@ endpoint = 'http://{}/sor' } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }) @@ -847,7 +849,8 @@ async fn market() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }) diff --git a/crates/solvers/src/tests/legacy/attaching_approvals.rs b/crates/solvers/src/tests/legacy/attaching_approvals.rs index 19f7ef35c1..51e293550b 100644 --- a/crates/solvers/src/tests/legacy/attaching_approvals.rs +++ b/crates/solvers/src/tests/legacy/attaching_approvals.rs @@ -147,7 +147,8 @@ async fn test() { }, ], "score": { - "riskadjusted": 1.0 + "kind": "riskadjusted", + "successProbability": 1.0, } }] }), diff --git a/crates/solvers/src/tests/legacy/concentrated_liquidity.rs b/crates/solvers/src/tests/legacy/concentrated_liquidity.rs index b60c613eaa..1052466d61 100644 --- a/crates/solvers/src/tests/legacy/concentrated_liquidity.rs +++ b/crates/solvers/src/tests/legacy/concentrated_liquidity.rs @@ -139,7 +139,8 @@ async fn test() { } ], "score": { - "riskadjusted": 1.0 + "kind": "riskadjusted", + "successProbability": 1.0, } }] }), diff --git a/crates/solvers/src/tests/legacy/jit_order.rs b/crates/solvers/src/tests/legacy/jit_order.rs index 700e7c12ba..76c45c0519 100644 --- a/crates/solvers/src/tests/legacy/jit_order.rs +++ b/crates/solvers/src/tests/legacy/jit_order.rs @@ -57,13 +57,7 @@ async fn test() { 0202020202020202020202020202020202020202020202020202020202020202\ 03", "interactions": { - "pre": [ - { - "target": "0x2222222222222222222222222222222222222222", - "value": "200", - "callData": "0xabcd", - } - ], + "pre": [], "post": [] } }, @@ -115,20 +109,14 @@ async fn test() { 0101010101010101010101010101010101010101010101010101010101010101\ 0202020202020202020202020202020202020202020202020202020202020202\ 03", - "preInteractions": [ - { - "target": "0x2222222222222222222222222222222222222222", - "value": "200", - "callData": "0xabcd", - } - ] }, "executedAmount": "100", } ], "interactions": [], "score": { - "riskadjusted": 1.0 + "kind": "riskadjusted", + "successProbability": 1.0, } }] }), diff --git a/crates/solvers/src/tests/legacy/market_order.rs b/crates/solvers/src/tests/legacy/market_order.rs index 033c3ffd57..8726091a01 100644 --- a/crates/solvers/src/tests/legacy/market_order.rs +++ b/crates/solvers/src/tests/legacy/market_order.rs @@ -205,7 +205,8 @@ async fn quote() { } ], "score": { - "riskadjusted": 1.0 + "kind": "riskadjusted", + "successProbability": 1.0, } }] }), @@ -410,7 +411,8 @@ async fn solve() { } ], "score": { - "riskadjusted": 1.0 + "kind": "riskadjusted", + "successProbability": 1.0, } }] }), diff --git a/crates/solvers/src/tests/naive/extract_deepest_pool.rs b/crates/solvers/src/tests/naive/extract_deepest_pool.rs index a17aae1bd4..241375e088 100644 --- a/crates/solvers/src/tests/naive/extract_deepest_pool.rs +++ b/crates/solvers/src/tests/naive/extract_deepest_pool.rs @@ -120,7 +120,8 @@ async fn test() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/naive/filters_out_of_price_orders.rs b/crates/solvers/src/tests/naive/filters_out_of_price_orders.rs index ea9af51d19..3f55137aef 100644 --- a/crates/solvers/src/tests/naive/filters_out_of_price_orders.rs +++ b/crates/solvers/src/tests/naive/filters_out_of_price_orders.rs @@ -122,7 +122,8 @@ async fn sell_orders_on_both_sides() { ], "interactions": [], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/naive/matches_orders.rs b/crates/solvers/src/tests/naive/matches_orders.rs index 31fa6f73ac..4152d053f5 100644 --- a/crates/solvers/src/tests/naive/matches_orders.rs +++ b/crates/solvers/src/tests/naive/matches_orders.rs @@ -102,7 +102,8 @@ async fn sell_orders_on_both_sides() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -208,7 +209,8 @@ async fn sell_orders_on_one_side() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -314,7 +316,8 @@ async fn buy_orders_on_both_sides() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -420,7 +423,8 @@ async fn buy_and_sell_orders() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/naive/reserves_too_small.rs b/crates/solvers/src/tests/naive/reserves_too_small.rs index 99b2776da1..9ec0d31e99 100644 --- a/crates/solvers/src/tests/naive/reserves_too_small.rs +++ b/crates/solvers/src/tests/naive/reserves_too_small.rs @@ -95,7 +95,8 @@ async fn test() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/naive/rounds_prices_in_favour_of_traders.rs b/crates/solvers/src/tests/naive/rounds_prices_in_favour_of_traders.rs index 0f1420888e..0fc77ea3f2 100644 --- a/crates/solvers/src/tests/naive/rounds_prices_in_favour_of_traders.rs +++ b/crates/solvers/src/tests/naive/rounds_prices_in_favour_of_traders.rs @@ -109,7 +109,8 @@ async fn test() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/naive/without_pool.rs b/crates/solvers/src/tests/naive/without_pool.rs index 27681ec1d2..fd0047afb7 100644 --- a/crates/solvers/src/tests/naive/without_pool.rs +++ b/crates/solvers/src/tests/naive/without_pool.rs @@ -92,7 +92,8 @@ async fn test() { ], "interactions": [], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/oneinch/market_order.rs b/crates/solvers/src/tests/oneinch/market_order.rs index f1fbc39dba..eab3a46890 100644 --- a/crates/solvers/src/tests/oneinch/market_order.rs +++ b/crates/solvers/src/tests/oneinch/market_order.rs @@ -207,7 +207,8 @@ async fn sell() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } } ] diff --git a/crates/solvers/src/tests/paraswap/market_order.rs b/crates/solvers/src/tests/paraswap/market_order.rs index a545ac2d5e..a6ee053bb7 100644 --- a/crates/solvers/src/tests/paraswap/market_order.rs +++ b/crates/solvers/src/tests/paraswap/market_order.rs @@ -236,7 +236,8 @@ async fn sell() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } } ] @@ -490,7 +491,8 @@ async fn buy() { } ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } } ] diff --git a/crates/solvers/src/tests/zeroex/market_order.rs b/crates/solvers/src/tests/zeroex/market_order.rs index 7fb7123e8c..5d6a1872f1 100644 --- a/crates/solvers/src/tests/zeroex/market_order.rs +++ b/crates/solvers/src/tests/zeroex/market_order.rs @@ -187,7 +187,8 @@ async fn sell() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), @@ -368,7 +369,8 @@ async fn buy() { }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }), diff --git a/crates/solvers/src/tests/zeroex/options.rs b/crates/solvers/src/tests/zeroex/options.rs index c0b2a009d8..7af99a3ec4 100644 --- a/crates/solvers/src/tests/zeroex/options.rs +++ b/crates/solvers/src/tests/zeroex/options.rs @@ -294,7 +294,8 @@ enable-slippage-protection = true }, ], "score": { - "riskadjusted": 0.5 + "kind": "riskadjusted", + "successProbability": 0.5, } }] }),