Skip to content

Propagate proxy inner post-dispatch weight - #3063

Open
UnArbosSix wants to merge 1 commit into
mainfrom
fix/proxy-post-dispatch-weight-refund
Open

Propagate proxy inner post-dispatch weight#3063
UnArbosSix wants to merge 1 commit into
mainfrom
fix/proxy-post-dispatch-weight-refund

Conversation

@UnArbosSix

@UnArbosSix UnArbosSix commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix proxy calls failing to refund unused inner-call weight.

Both Proxy::proxy and Proxy::proxy_announced declared the inner call's worst-case weight but returned a plain DispatchResult. Although the inner dispatch populated post_info.actual_weight, do_proxy discarded it after recording the result.

This caused transaction payment to charge the full declared weight for proxied calls, even when the inner call reported lower actual weight.

Changes

  • Return DispatchResultWithPostInfo from proxy and proxy_announced.
  • Extract the inner call's actual weight with extract_actual_weight.
  • Return the proxy overhead plus the inner actual weight.
  • Preserve existing LastCallResult and ProxyExecuted behavior.
  • Add regression tests for both proxy paths.

Validation

  • All 28 pallet-subtensor-proxy tests pass.
  • Proxy no_std check passes.
  • Native runtime check passes.
  • Live three-node localnet assertion passes:
    • Declared weight: 2,664,017,457
    • Actual weight: 735,182,257
    • Worst-case quoted fee: 1,386,563 rao
    • Actual charged fee: 368,067 rao
    • Refunded: 1,018,496 rao
  • The fee payer's balance delta exactly matched the emitted TransactionFeePaid.actual_fee.

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subtensor Ready Ready Preview Aug 7, 2026 7:57pm

Request Review

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: VULNERABLE

HIGH scrutiny: account is under 90 days old with no public repositories, mitigated by repository write permission and substantive merged contributions; fix/proxy-post-dispatch-weight-refund targets main.

Findings

Sev File Finding
HIGH runtime/src/lib.rs Bump the runtime spec version (off-diff)

Other findings

  • [HIGH] Bump the runtime spec version (runtime/src/lib.rs) — This pallet is part of the runtime, and the PR changes proxy and proxy_announced post-dispatch weight behavior. Leaving runtime/src/lib.rs at spec_version: 443 allows nodes whose different native runtime also reports version 443 to execute different fee/weight logic than the newly deployed Wasm runtime, risking consensus divergence. Increment spec_version for this runtime-affecting change.

Conclusion

The weight-refund implementation appears sound, but changing runtime dispatch behavior without incrementing spec_version can cause native/Wasm runtime divergence. The version must be bumped before merge.


# 🔍 AI Review — Auditor (domain review) has not yet run on this PR.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

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