Feat: Proxy aware chain extensions#2383
Feat: Proxy aware chain extensions#2383LandynDev wants to merge 1 commit intoopentensor:devnet-readyfrom
Conversation
chain-extensions/src/lib.rs
Outdated
| pallet_proxy::Pallet::<T>::find_proxy( | ||
| &real_coldkey, | ||
| &caller, | ||
| Some(ProxyType::Staking), |
There was a problem hiding this comment.
Should we check other ProxyType like Any also enable the add_stake call.
|
All V2 extensions are not the upgrade or replace of V1. Could use the name like proxy_xxx. |
This comment was marked as outdated.
This comment was marked as outdated.
bab4fe2 to
59072b0
Compare
Add 12 proxy-delegated chain extension variants that allow a smart contract with proxy rights to manage stake on behalf of a proxied coldkey. Each handler verifies proxy authorization via zero-delay proxy storage lookup before dispatching as the proxied account. - verify_proxy: checks Proxies storage for matching delegate with correct ProxyType (Staking for most ops, Transfer for transfer_stake) - 12 Proxy* FunctionId variants in types.rs with NotAuthorizedProxy output - ink! contract bindings for all 12 proxy functions - 17 proxy tests (5 auth verification + 12 per-operation success) - 2 discriminant stability tests - Updated wasm-contracts.md documentation
59072b0 to
e4e98d5
Compare
I went ahead and implemented this with Regarding a single proxy_execute(real_coldkey, call: RuntimeCall) — I actually started with that approach (a generic proxy_call dispatcher that took SCALE-encoded RuntimeCall bytes). The problem is that ink! contract developers would have to manually SCALE-encode the target function selector and all arguments into raw bytes. Found it to be error-prone and a poor developer experience. I pretty much just implemented it how the |
Description
Adds 12 proxy-delegated chain extension variants that allow a smart contract with proxy rights to manage on behalf of a proxied coldkey. Each handler accepts an
on_behalf_of: AccountIdparameter, verifies the ProxyType and dispatches the operation as the proxied account.ProxyType::Anyis accepted as a superset of all types.Related Issue
Closes #2566
Type of Change
Breaking Change
This PR does not create a breaking change.
This introduces new proxy chain extensions to wrap runtime calls with correct proxy perms.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots
Unit Tests:

Additional Notes