Skip to content

fix(hsm): correct ArbitrageExecuted profit measurement - #1480

Merged
enthusiastmartin merged 5 commits into
masterfrom
fix/hsm-arbitrage-profit-snapshot
Aug 7, 2026
Merged

fix(hsm): correct ArbitrageExecuted profit measurement#1480
enthusiastmartin merged 5 commits into
masterfrom
fix/hsm-arbitrage-profit-snapshot

Conversation

@iamyxsh

@iamyxsh iamyxsh commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

execute_arbitrage read the receiver's "initial" balance after the EVM
flash-loan call, which already settled the profit — so
ArbitrageExecuted.profit was always 0. Snapshot moved to before the call.

Funds unaffected; accounting/observability only. Fixes #1461.

Adds a regression test that fails on unpatched code and passes with the fix.

@iamyxsh
iamyxsh requested a review from enthusiastmartin July 6, 2026 08:11
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Crate versions that have been updated:

  • pallet-hsm: v1.7.0 -> v1.7.1

Runtime version has not been increased.

@enthusiastmartin
enthusiastmartin merged commit 5e61c1f into master Aug 7, 2026
11 of 12 checks passed
@enthusiastmartin
enthusiastmartin deleted the fix/hsm-arbitrage-profit-snapshot branch August 7, 2026 14:02
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Quick benchmark at commit a91fb3a has been executed successfully.
View results

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: HSM: execute_arbitrage Profit Measurement Always Returns Zero

2 participants