Skip to content

Conversation

@gsteenkamp89
Copy link
Contributor

@gsteenkamp89 gsteenkamp89 commented Sep 18, 2025

closes UMA-2945

Fix Custom Bond Currency Matching Logic

Problem

Custom bonds were not being properly matched to price requests based on currency. The system was incorrectly applying custom bonds regardless of currency mismatch.

Solution

  • Fixed custom bond entity ID generation: Custom bond entities are now stored with IDs that include the currency address, ensuring proper currency-based matching
  • Implemented strict currency matching: Custom bonds are only applied when the request currency exactly matches the custom bond currency
  • Removed incorrect currency updates: Request currencies are no longer modified when custom bonds are applied

Key Changes

  • Updated handleCustomBondSet to use createCustomBondIdFromEvent for entity ID generation
  • Modified getCustomBond to only find custom bonds with matching currencies
  • Added test coverage

Technical Details

Custom bond IDs are now generated by hashing: requester + identifier + ancillaryData + currency. This ensures that custom bonds set for different currencies have different IDs, even with identical other parameters, preventing cross-currency bond application.

Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
@linear
Copy link

linear bot commented Sep 18, 2025

Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
"ID is managedRequestId, ie. the hash of requester, identifier, ancillaryData"
id: ID!

managedRequestId: String!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this, isn't it the same as it for CustomLiveness?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh true, we can probably remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Gerhard Steenkamp <gerhard@umaproject.org>
@gsteenkamp89 gsteenkamp89 force-pushed the fix/gsteenkamp-custom-bond branch from 3bd6928 to e1f62f5 Compare September 18, 2025 12:46
@gsteenkamp89 gsteenkamp89 merged commit 6d9cfb0 into master Sep 18, 2025
2 checks passed
@gsteenkamp89 gsteenkamp89 deleted the fix/gsteenkamp-custom-bond branch September 18, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants