Fix Tron solverLock MsgValueMismatch revert with native reward token#168
Merged
Conversation
The Tron TP worker recomputed call_value only from the lock amount when the lock token was native TRX, ignoring the reward. When the reward token was native (regardless of the lock token), msg.value had to include the reward too — otherwise the Train contract reverted with MsgValueMismatch(). The shared EVM TransactionBuilderService already returns the correct native amount (amount + reward when either is native) in PrepareTransactionDto.Amount. Use that value directly instead of recomputing it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TronTransactionProcessorWorkerrecomputedcall_valueonly from the lock amount when the lock token was native TRX, ignoring the reward. When the reward token was native,msg.valuehad to include the reward too — otherwise the Train contract reverted withMsgValueMismatch()(selectorbc6f88c5).TransactionBuilderService.BuildSolverLockTransactionAsyncalready computes the correct native amount ((isNative ? amount : 0) + (isNativeReward ? reward : 0)) and returns it inPrepareTransactionDto.Amount. The Tron worker now uses that value instead of recomputing it.Amount = "0", so this change is universal across lock/redeem/refund payloads.Background
Observed three on-chain
solverLockreverts on Tron Nile (e.g. tx7dc8bcc9e5413a155bac9705131e02ad91b4e3b385f2ba7b2f551e3219571b3b) withcontractResult=bc6f88c5=MsgValueMismatch(). The selector being sent (62bfdaab) matches the deployed contract's bytecode dispatcher; the revert happened inside the function on themsg.valuecheck, not at dispatch. (Tronscan's UI shows wrong selectors720444a4/6df0184abecause Tron's on-chain ABI drops tuplecomponents, but that's purely cosmetic — unrelated to this fix.)Test plan
solverLockwithRewardToken = native TRXandTokenContract = TRC-20— should now succeed (previously reverted)solverLockwith bothTokenContractandRewardTokennative —msg.valueshould equalamount + rewardsolverLockwith both non-native —msg.valueshould be0(unchanged behavior)call_value=0(since their builders returnAmount="0")🤖 Generated with Claude Code