feat(hbar): skip amount validation for claim rewards self-transfer#8784
Draft
Doddanna17 wants to merge 1 commit into
Draft
feat(hbar): skip amount validation for claim rewards self-transfer#8784Doddanna17 wants to merge 1 commit into
Doddanna17 wants to merge 1 commit into
Conversation
f0cc9ed to
dbe06cd
Compare
…ansfer
HBAR claim rewards uses a 1-tinybar self-transfer where the wire format
merges [{acct,-1},{acct,+1}] into [{acct,0}]. This causes a legitimate
amount mismatch (buildParams="1" vs explained="0") in
validateBuiltStakingTransaction. Add isHbarClaimRewards() guard to skip
the amount check when sender == recipient for HBAR claim rewards.
Add tests verifying the skip for claim_rewards and that non-claim
transactions still catch amount mismatches.
Ticket: SI-605
dbe06cd to
52c47c2
Compare
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
isHbarClaimRewards()helper tostakingWallet.ts(follows existingisBtcUndelegate(),isTrxStaking(),isStx()pattern)validateBuiltStakingTransaction()when HBAR claim rewards self-transfer is detected (sender address == recipient address)Problem
After merging the wire format fix (PR #8774), HBAR claim rewards fails post-signing:
Root cause: HBAR claim rewards is a 1-tinybar self-transfer. The wire format correctly merges
[{acct, -1}, {acct, +1}]into[{acct, 0}], butvalidateBuiltStakingTransaction()comparesbuildParams.recipients[0].amount("1") againstexplainedTransaction.outputs[0].amount("0") and throws.Why BitGoJS (not multi-repo fix)
BaseClaimRewardsRequestStrategy(all coins)Test plan
stakingWalletNonTSS.tstests pass (no regression)Ticket: SI-605