Skip to content

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Aug 11, 2025

Description

Fixes asym position appearing as a dupe in asym RUNE card

Issue (if applicable)

closes #10254

Risk

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

None

Testing

  • Have a sym position for a given pool
  • Go to add liquidity and select that pool
  • Ensure position doesn't appear twice

Engineering

  • ^

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)
  • ^

Screenshots (if applicable)

  • develop
Screenshot 2025-08-11 at 20 48 16
  • this diff
Screenshot 2025-08-11 at 20 53 54

Summary by CodeRabbit

  • Bug Fixes
    • Corrected Rune balance display: for users with a symmetric-only position (no asymmetric Rune), the interface now shows the updated “new position” state instead of symmetric amounts.

@gomesalexandre gomesalexandre requested a review from a team as a code owner August 11, 2025 18:57
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

📝 Walkthrough

Walkthrough

Updated runeBalances logic in LpType.tsx to stop returning sym display amounts when only a sym position exists. It now returns AsymSide.Rune display amounts only if hasAsymRunePosition is true; otherwise it falls back to newPosition. Asset and sym computations unchanged; no exported API changes.

Changes

Cohort / File(s) Summary
ThorChain LP UI logic
src/pages/ThorChainLP/components/LpType.tsx
Removed sym-amounts branch from runeBalances. Now uses displayAmounts(AsymSide.Rune) only when hasAsymRunePosition; otherwise uses newPosition. No signature changes.

Sequence Diagram(s)

sequenceDiagram
  participant UI as LP Type Component
  participant State as Positions State
  participant Display as DisplayAmounts

  UI->>State: Check hasAsymRunePosition
  alt hasAsymRunePosition == true
    UI->>Display: displayAmounts(AsymSide.Rune)
    Display-->>UI: Rune asym amounts
  else
    UI->>UI: use newPosition path
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Assessment against linked issues

Objective Addressed Explanation
Prevent asym position from appearing under both asym and RUNE (#10254)

Assessment against linked issues: Out-of-scope changes

(no out-of-scope functional changes identified)

Suggested reviewers

  • kaladinlight

Poem

I thump my paws, a tidy fix in sight,
No double carrots twinned in moonlit light—
One pile for Rune, one burrow for asym,
Ledger neat as clover stems I trim.
Hippity hop, the pools align just right. 🥕✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac7797f and 138de2e.

📒 Files selected for processing (1)
  • src/pages/ThorChainLP/components/LpType.tsx (0 hunks)
💤 Files with no reviewable changes (1)
  • src/pages/ThorChainLP/components/LpType.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Install and Cache
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_dupe_sym_asym_rune

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@kaladinlight kaladinlight left a comment

Choose a reason for hiding this comment

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

This is not a bug, though maybe we can figure out how to be more clear. This was done intentionally as when you start with a symmetric position, adding asymmetric rune does not create a new position and the state is essentially shared between Sym/Asym Rune. This is exactly what is reflected in the UI, but you need to understand the why I suppose.

https://docs.thorchain.org/frequently-asked-questions/liquidity-providers#entering-and-leaving-a-pool

@gomesalexandre gomesalexandre marked this pull request as draft August 11, 2025 19:20
@gomesalexandre
Copy link
Contributor Author

gomesalexandre commented Aug 11, 2025

but you need to understand the why I suppose.

  • That seems like a bug from a user-perspective, shouldn't we disable it and explain why @kaladinlight ?
    i.e doesn't seem like trying to add in one and it being reflected in the other asym side is an expected user flow 👀 no matter your knowledge of THOR LP
  • At the very least, shouldn't we remove the amounts from here? (though, without the mention of "New Position")

@kaladinlight
Copy link
Contributor

but you need to understand the why I suppose.

  • That seems like a bug from a user-perspective, shouldn't we disable it and explain why @kaladinlight ?
    i.e doesn't seem like trying to add in one and it being reflected in the other asym side is an expected user flow 👀 no matter your knowledge of THOR LP
  • At the very least, shouldn't we remove the amounts from here? (though, without the mention of "New Position")

It is still possible and valid though. You can start with a sym position and add either sym or asym rune to the same position. That is why they show the same amounts because they are the same. We can remove the amounts, but then that would be confusing in a different way (ie. "How much is in the position I am adding to?"). Maybe like a link icon between the two? This is the only scenario of a shared position btw.

@gomesalexandre
Copy link
Contributor Author

but you need to understand the why I suppose.

  • That seems like a bug from a user-perspective, shouldn't we disable it and explain why @kaladinlight ?
    i.e doesn't seem like trying to add in one and it being reflected in the other asym side is an expected user flow 👀 no matter your knowledge of THOR LP
  • At the very least, shouldn't we remove the amounts from here? (though, without the mention of "New Position")

It is still possible and valid though. You can start with a sym position and add either sym or asym rune to the same position. That is why they show the same amounts because they are the same. We can remove the amounts, but then that would be confusing in a different way (ie. "How much is in the position I am adding to?"). Maybe like a link icon between the two? This is the only scenario of a shared position btw.

Think a link would be a very simple and valid solution! The fact that it's the only case like that, and that it only works when adding more asym RUNE (but not asset, which would be a new position) definitely seems like a case of us needing to disambiguate things to users.

Although counterpoint would be that we may not want to expose that capability because of how confusing it is.

@twblack88 @reallybeard ping ^^ let's disambiguate this guy!

@gomesalexandre
Copy link
Contributor Author

Meh LP

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.

Asym position appearing under both sym and RUNE

3 participants