Skip to content

fix(transaction-fee): reject multi-subnet alpha fee deduction#2942

Open
loom-agent wants to merge 1 commit into
RaoFoundation:mainfrom
loom-agent:sec/txfee-reject-multi-alpha
Open

fix(transaction-fee): reject multi-subnet alpha fee deduction#2942
loom-agent wants to merge 1 commit into
RaoFoundation:mainfrom
loom-agent:sec/txfee-reject-multi-alpha

Conversation

@loom-agent

Copy link
Copy Markdown
Contributor

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

  • Fixed a fee-evasion path where multi-subnet alpha fee deduction silently returned zero fee, allowing a validate-dispatch state change to skip payment.

Problem

When alpha_vec.len() != 1, the transaction fee handler returns Ok((0, 0, NetUid::ROOT)) instead of rejecting the transaction. Since validate passes with zero fee and pre_dispatch charges zero fee, a caller with a multi-subnet alpha vector can bypass payment entirely.

Root Cause

In pallets/transaction-fee/src/lib.rs, the withdraw_in_alpha implementation for TransactionFeeHandler returns a zero-fee Ok for the multi-subnet case, matching can_withdraw_in_alpha's behavior. But can_withdraw_in_alpha is informational; withdraw_in_alpha is the actual payment path and must reject what it cannot charge.

The Fix

Change the multi-subnet branch in withdraw_in_alpha from Ok((0, 0, NetUid::ROOT)) to Err(InvalidTransaction::Payment.into()), making it consistent with the validate-dispatch state-change protection.

Testing

Updated test_rejects_multi_subnet_alpha_fee_deduction to assert Err(InvalidTransaction::Payment) instead of Ok(...). The test now verifies the rejection is explicit.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

@loom-agent is attempting to deploy a commit to the RaoFoundation Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant