-
Notifications
You must be signed in to change notification settings - Fork 15
Conversation
af96b09
to
53bd145
Compare
Codecov Report
@@ Coverage Diff @@
## main #1169 +/- ##
==========================================
+ Coverage 66.63% 66.74% +0.11%
==========================================
Files 134 135 +1
Lines 26843 27025 +182
==========================================
+ Hits 17886 18039 +153
- Misses 8957 8986 +29 |
orderbook/src/api/validation.rs
Outdated
owner: H160, | ||
sell_token: H160, | ||
buy_token: H160, | ||
receiver: H160, | ||
valid_to: u32, | ||
buy_token_balance: BuyTokenDestination, | ||
sell_token_balance: SellTokenSource, |
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.
Probably want all of these pub
too.
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.
Yea good call, I made these all public in the next PR, but I can do it here in favour of less changes in the next one.
} | ||
|
||
#[tokio::test] | ||
async fn validate_partial_order_err() { |
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.
One underrated feature of this refactor is the ability to test order validation better.
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.
Perhaps in a follow up PR, I can make a similar method for the other parts of order validation.
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.
Love it.
In Preparation for the new Fee and Quote endpoint (cf #1155) we shift some of the order validation into its own file (to be shared among both
Orderbook.add_order
and theQuoteRequest
endpoint). More specifically, we move all order validations pertaining to the buy/sell tokens, order validity, balance sources and destinations, banned users, and transfer eth to contract into their ownPreOrderValidator
. Any order validations regarding balance or fee sufficiency and signature validity remain in theOrderbook.add_order
method.Test Plan
This is a refactor although I have added some tests to the new method
validate_partial_order