Skip to content

fix: cross-subnet received amount in stake move display#910

Merged
thewhaleking merged 1 commit intolatent-to:stagingfrom
bitloi:fix/stake-move-display-cross-subnet
Apr 7, 2026
Merged

fix: cross-subnet received amount in stake move display#910
thewhaleking merged 1 commit intolatent-to:stagingfrom
bitloi:fix/stake-move-display-cross-subnet

Conversation

@bitloi
Copy link
Copy Markdown
Contributor

@bitloi bitloi commented Apr 7, 2026

Closes #909

Use sim_swap.alpha_amount for the cross-subnet received amount instead of recalculating it with linear math. Add missing if not proxy: guard for extrinsic fee deduction in the cross-subnet path.

@bitloi bitloi changed the base branch from main to staging April 7, 2026 12:57
@bitloi bitloi force-pushed the fix/stake-move-display-cross-subnet branch from d0fe30e to 4e208a7 Compare April 7, 2026 13:02
@thewhaleking thewhaleking requested a review from a team April 7, 2026 13:29
Copy link
Copy Markdown
Contributor

@thewhaleking thewhaleking left a comment

Choose a reason for hiding this comment

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

I'll look into this more later, but I also want @ibraheem-abe's insight, specifically involving the fact it seems from this we'd be doing pricing calculations twice: once within SimSwap, and once within MovementPricing

@bitloi
Copy link
Copy Markdown
Contributor Author

bitloi commented Apr 7, 2026

I'll look into this more later, but I also want @ibraheem-abe's insight, specifically involving the fact it seems from this we'd be doing pricing calculations twice: once within SimSwap, and once within MovementPricing

Thanks for your feedback. This PR only switches the confirmation table’s received value to sim_swap, since that’s the part that was incorrect. MovementPricing is still used for the existing spot-rate / safe-staking path. If you want to consolidate those pricing paths further, I will do that as a follow-up refactor.

Copy link
Copy Markdown
Contributor

@ibraheem-abe ibraheem-abe left a comment

Choose a reason for hiding this comment

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

The previous calculation was consistent as a spot-price / linear-pricing estimate, but sim_swap is the more authoritative source for received since it reflects the runtime swap path directly.

I tried a few scenarios (dynamic -> 0, dynamic -> dynamic) and the behavior looked reasonable.
In the cases I checked, the displayed delta versus the old estimate was small, roughly 0.02% to 0.06%.

@thewhaleking thewhaleking merged commit 271a4e4 into latent-to:staging Apr 7, 2026
88 checks passed
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.

bug: cross-subnet stake move/swap/transfer displays inaccurate received amounts

3 participants