Skip to content

[V133-specific] Fix Streaming Savers Affiliate THORName broken invariant, and add validate check of affiliate address chain

[V133-specific]

Intended to fully or partly close #1877 (closed)
'Failed savers add swallowed funds'.
Following #1877 (closed)'s closure, intended to close #1904
'Streaming Swap actions which fail on the last swap only refund the last-swap amount and leave the invariant-breaking successful outputs floating'.

At time of writing, this Merge Request has three main aims (each with its respective commit and regression test update):

  1. (Error clarification) Return a more informative error on add liquidity handler validate wrong-chain-address than errAddLiquidityMismatchAddr .
    (Update: Also, a validate check if non-zero AffiliateBasisPoints of whether the AffiliateAddress is of the wrong chain for a Savers add.)

  2. (Broken-invariant-fixing) Handle the final-streaming-swap code from within the swap handler (an internal handler) only for non-streaming swaps,
    and for streaming swaps handle it within the swap queue manager,
    so an error can attempt refund for the entire successful output rather than only the final sub-swap's output.

  3. (Refund inbound rather than fail to refund swap output) Check in the add liquidity handler's validate whether the AffiliateAddress is of the necessary chain (when AffiliateBasisPoints is non-zero).

Edited by Multipartite

Merge request reports