Skip to content

fix(runtime): allow transfer_stake through the contracts CallFilter - #3139

Closed
masterdubs wants to merge 1 commit into
RaoFoundation:mainfrom
masterdubs:fix/contract-call-filter-transfer-stake
Closed

masterdubs wants to merge 1 commit into
RaoFoundation:mainfrom
masterdubs:fix/contract-call-filter-transfer-stake

Conversation

@masterdubs

@masterdubs masterdubs commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Context

Release 453's proxy fix (origin-filter inheritance in do_proxy) rightly closed the filter-laundering loophole — but it also broke a production escrow contract on this chain that executes deposits as:

call_runtime(Proxy::proxy(real = depositor, SubtensorModule::transfer_stake { .. }))

with an explicit proxy delegation registered by the depositor. Pre-453 the inner transfer_stake ran on a freshly authenticated origin; post-453 it must also pass ContractCallFilter, which only whitelists Proxy::proxy — so the inner call fails with CallFiltered inside ProxyExecuted and every deposit reverts (TransferNotVerified at the contract level). All inbound bridging has been down since the upgrade.

Change

Whitelist the single inner call the flow needs: SubtensorModule::transfer_stake.

Security

  • The transfer still requires the user's explicit proxy delegation to the contract — no new capability is granted to contracts over arbitrary accounts.
  • The 453 inherited-filter mechanism keeps working as intended for every other nested call.
  • Direct transfer_stake dispatched by a contract as itself only moves the contract's own stake.

Happy to adjust scope (e.g. gate it further) if you prefer a narrower shape.

The proxy origin-filter inheritance fix in release 453 (do_proxy now
propagates the caller's call filter into the proxied call) closed a real
filter-laundering loophole — but it also broke contracts that legitimately
execute transfer_stake through an explicit user proxy delegation.

An escrow contract deployed on this chain performs deposits as:
  call_runtime(Proxy::proxy(real = depositor, TransferStake { .. }))
where the depositor has registered the contract as a proxy beforehand.
Pre-453 the inner TransferStake ran on a freshly authenticated origin and
succeeded; post-453 it must pass ContractCallFilter, which only whitelists
Proxy::proxy, so the inner call fails with CallFiltered inside
ProxyExecuted and every deposit reverts.

Whitelist the single inner call the flow needs. Security posture is
preserved: the transfer still requires the user's explicit proxy
delegation, and the inherited-filter mechanism keeps every other nested
call blocked.
@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

@masterdubs is attempting to deploy a commit to the RaoFoundation Team on Vercel.

A member of the Team first needs to authorize it.

@unarbos

unarbos commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Closing: already on main as 4b92d4b (identical diff).

@unarbos unarbos closed this Sep 16, 2026
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.

2 participants