-
Notifications
You must be signed in to change notification settings - Fork 74
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
Require input and output amounts for raw interactions #194
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.
The code itself looks good (nice refactor of TokenAmount
).
verify token conservation across tokens and orders...
Could harm be done by solvers lying about the input and output amounts?
I guess we would have to simulate each interaction to know whether those values are correct, right?
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!
Yes. What is unclear is whether or not we should verify this upfront (by simulating as you suggested) or if we should slash solvers that misbehave. |
Codecov Report
@@ Coverage Diff @@
## main #194 +/- ##
==========================================
+ Coverage 64.35% 64.44% +0.08%
==========================================
Files 189 189
Lines 38896 38988 +92
==========================================
+ Hits 25032 25125 +93
+ Misses 13864 13863 -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.
I guess this has been discussed already but doesn't this limit what an interaction can do in a potential important manner? What if you have an interaction with one input amount and two output amounts or vice versa? What if a first interaction facilitates a next interaction and either one alone doesn't have the proper in and out amounts?
Good point. I guess these should be
Then, given ☝️, the first interaction be modelled as |
I changed this PR to make the changes backwards compatible. This way we can start implementing the external solver checks (local and global token conservation) without breaking existing solvers while also allowing our existing solvers to change to use this new API. @MartinquaXD would appreciate a re-review. |
a4f98eb
to
f4ac00d
Compare
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.
Does still look good to me. 👍
This PR augments interaction data to also include input and output amounts. This will be required by the driver in order to verify token conservation across tokens and orders.
Test Plan
Added unit test to verify de-serialization. For now, there is no new logic changes.
Release notes
This PR introduces changes to the HTTP solver interface. Note that the API was kept backwards compatible to allow solver implementations time to adapt to the new API. These changes will be made required after a certain amount of time (since they are required for validating new solver rules around local and global token conservation).