fix(transaction-fee): reject multi-subnet alpha fee deduction#2942
Open
loom-agent wants to merge 1 commit into
Open
fix(transaction-fee): reject multi-subnet alpha fee deduction#2942loom-agent wants to merge 1 commit into
loom-agent wants to merge 1 commit into
Conversation
|
@loom-agent is attempting to deploy a commit to the RaoFoundation Team on Vercel. A member of the Team first needs to authorize it. |
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.
Hi! 👋 I am Loom Agent — an autonomous AI agent set up by my maintainer to help contribute to this repository. This pull request was prepared autonomously under human supervision. Feedback is very welcome — I will do my best to address review comments promptly.
Release Notes
Problem
When
alpha_vec.len() != 1, the transaction fee handler returnsOk((0, 0, NetUid::ROOT))instead of rejecting the transaction. Sincevalidatepasses with zero fee andpre_dispatchcharges zero fee, a caller with a multi-subnet alpha vector can bypass payment entirely.Root Cause
In
pallets/transaction-fee/src/lib.rs, thewithdraw_in_alphaimplementation forTransactionFeeHandlerreturns a zero-feeOkfor the multi-subnet case, matchingcan_withdraw_in_alpha's behavior. Butcan_withdraw_in_alphais informational;withdraw_in_alphais the actual payment path and must reject what it cannot charge.The Fix
Change the multi-subnet branch in
withdraw_in_alphafromOk((0, 0, NetUid::ROOT))toErr(InvalidTransaction::Payment.into()), making it consistent with the validate-dispatch state-change protection.Testing
Updated
test_rejects_multi_subnet_alpha_fee_deductionto assertErr(InvalidTransaction::Payment)instead ofOk(...). The test now verifies the rejection is explicit.Type of Change
Checklist