feat: v5 + Spoke#1481
Conversation
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
* feat: SpokePool V5 fill Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * add gateway param to all contracts Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * address feedback Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * require gateway Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * update deploy scripts Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * add _fillRelayV5 Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * faactor out _recordFill Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * refactor _transferTokensToRecipient Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * update comments Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * add executeAcrossV5 call Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * add nonV5Fill guard to rest of functions Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * check for msg.value Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * missing error Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * tests Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * return outputToken and recipientToSend from _transferTokensToRecipient Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * check relayer provided message Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * udpate var naming Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * update _fillRelayV5 param names Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * add nonReentrant Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
* init commit: SpokePool as v5 adapter for deposits Signed-off-by: Ihor Farion <ihor@umaproject.org> * impl _resolveDynamicParams Signed-off-by: Ihor Farion <ihor@umaproject.org> * change constructors of all Spokes Signed-off-by: Ihor Farion <ihor@umaproject.org> * bind to pathId instead Signed-off-by: Ihor Farion <ihor@umaproject.org> * improve comments, remove one static call Signed-off-by: Ihor Farion <ihor@umaproject.org> * move things around a bit Signed-off-by: Ihor Farion <ihor@umaproject.org> * only active v5 flow Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove comment Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix after-merge build + move structs Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org>
* feat: SpokePool fill as adapter Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * udpate struct names Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * restructure the functions Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> * reduce natspec length Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com> --------- Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
* update Spoke to match new fill logic Signed-off-by: Ihor Farion <ihor@umaproject.org> * adjust tests Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org>
* foundry profile and sizes Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove spoke-as-adapter functionality Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove size snapshots Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org>
|
|
||
| V3RelayData memory relayData = V3RelayData({ | ||
| depositor: fillJit.depositor, | ||
| recipient: fillInput.recipient, |
There was a problem hiding this comment.
Why is the recipient and outputToken an input, while other fields are JIT? Not saying that's wrong, just trying to understand the reasoning.
There was a problem hiding this comment.
user's money is tied to the witness, which in turn gets constructed (waves hands) from input
- input.recipient makes sure that when a
pathIdis emitted => the funds went to the user (same as havingTRANSFERcmd in the general tape) - input.token + input.minAmount makes sure that no one can spam-create
pathIdfrom a user order without first spending at leastminAmount(this acts as a sort ofBALANCE_REQ)
So these two make spoke-as-executor similar to:
[BALANCE_REQ, TRANSFER(recipient), optional-handleV3]
Let's say we didn't commit to input.recipient:
- pathId could be emitted for an unrelated fill that spammer would just send to self
If we didn't commit to token, minAmount:
- pathId could be emitted with 1 wei
Also, take another tape:
[ADAPTER_CALL, TRANSFER-or-actions-from-input]
ADAPTER_CALL gets BALANCE_REQ included in it basically for free, giving us the same pathId guarantees as in the spoke-as-executor case.
If we didn't have these, we'd have to have a BALANCE_REQ in this flow. (just in the spirit of making simple flows more lean)
There was a problem hiding this comment.
Makes sense. The minAmount ties it together. I missed that in my review.
| inputToken: fillJit.inputToken, | ||
| outputToken: fillInput.outputToken, | ||
| inputAmount: fillJit.inputAmount, | ||
| outputAmount: fillJit.outputAmount, |
There was a problem hiding this comment.
Any concerns around the case where someone sends an invalid fill (0 output amount), but the indexer thinks this is complete because the rest of the actions don't care about the output amount of the fill?
There was a problem hiding this comment.
That's what minAmount protection gives us (see above). Even if minAmount is static (e.g. with 5% slippage), whereas fill.outputAmount is dynamic, noone can "just emit a pathId for free"
There was a problem hiding this comment.
Makes sense. I missed that.
Signed-off-by: Faisal Usmani <faisal.of.usmani@gmail.com>
Signed-off-by: Ihor Farion <ihor@umaproject.org>
Uh oh!
There was an error while loading. Please reload this page.