-
Notifications
You must be signed in to change notification settings - Fork 83
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
Move executed_surplus_fee #2103
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.
How does this change affect existing orders in the database?
In order to make coordination with the frontend changes easier, I wonder if a migration plan could be:
- Populate
executed_fee_amount
for all order types (while keepingexecuted_surplus_fee
for limit orders) - Change frontend to read
executed_fee_amount
for all orders - Drop
executed_surplus_fee
from the model
Yes, that would be the way to go. Will prepare the PR for (1). |
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.
The change makes sense to me when executed in coordination with the frontend.
Updated the PR description and the code. Now the change is just to move the |
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 alright to me. However, if we introduce a new field this change needs to be tightly coordinated with the frontend team, doesn't it? Otherwise displaying the fee in the fronted will break. My understanding was that we would start exposing surplus fee as part of executed fee amount (the two values are already summed up iirc)
Can you test that change locally and show how a limit order fee would look like in the explorer?
#[serde_as(as = "HexOrDecimalU256")] | ||
pub executed_surplus_fee: U256, |
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.
If this is only used for the UI, can we not add it to the existing executed_fee_amount ?
This PR does not include new field, it just moves the filed from one struct to it's parent struct, but the serialization for the API is the same (as the unit test
I don't know. I've asked the frontend team this several times, but never got a clear yes/no answer, so I dropped the idea for now and decided to just refactor the backend side without changing the API. |
Description
OrderClass::Limit
variant containedexecuted_surplus_fee
field just for the needs of the API so the fee could be displayed to the users.I moved the
executed_surplus_fee
to parent struct since there is no good reason to keep it as part of theOrderClass
, on the contrary, we have a lot of places where we use the order class but omit the value ofexecuted_surplus_fee
as irrelevant.