-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove executed_solver_fee #2178
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but why do we still need to store order_executions
at all from the autopilot?
What information do we not have in the decoded settlement from OnSettlementEventUpdater
that needs to be persisted?
Would you prefer for it to be done "in flight" by the consumers of this table? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good!
let uniform_sell_price = self.clearing_prices.get(sell_index).cloned()?; | ||
let uniform_buy_price = self.clearing_prices.get(buy_index).cloned()?; | ||
|
||
let sell_index = trade.sell_token_index.as_u64() as usize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: buy_token
and buy_token_index
are only needed in the ExecutedFee::Surplus
case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Together with the comment 👇 , I tried to find more readable code but failed. Note that most of the orders will go through the ExecutedFee::Surplus
code path once swap with zero fees feature is enabled. Feel free to reorganize the code in another way in a separate PR, since I failed to make any improvements (or even in this one).
let adjusted_sell_price = self.clearing_prices.get(sell_index).cloned()?; | ||
let adjusted_buy_price = self.clearing_prices.get(buy_index).cloned()?; | ||
|
||
// get uniform prices | ||
let sell_index = self.tokens.iter().position(|token| token == sell_token)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found it pretty confusing that (sell|buy)_index
was used once to refer to the adjusted price and once for the UCP.
It would help to either prefix them maybe ucp_sell_index
or limit the scope where you change the meaning like:
// get uniform prices
let uniform_sell_price = {
let sell_index = self.tokens.iter().position(|token| token == sell_token)?;
self.clearing_prices.get(sell_index).cloned()?
};
let uniform_buy_price = {
let buy_index = self.tokens.iter().position(|token| token == buy_token)?;
self.clearing_prices.get(buy_index).cloned()?
};
Description
executed_solver_fee
was only used to storesolver_fee
of market orders during execution, so that it could be easily fetched byOnSettlementEventUpdater
.Now is removed and
executed_solver_fee
for market orders is fetched directly from the order.I hope this change finally opens the door for other cleanups:
OnSettlementEventUpdater
.solver_fee
(this is now safe to do since the column is not used for anything)