add origin in extension#2550
Conversation
…tensions Replace the single ProxyCall dispatcher (FunctionId 16) with 12 typed Proxy* chain extensions (FunctionIds 34-45) that verify proxy authorization via pallet_proxy::Proxies storage and dispatch as the delegated account. Each handler reads an on_behalf_of AccountId, verifies the contract is an authorized zero-delay proxy (with is_superset support for ProxyType::Any), and dispatches the pallet call with RawOrigin::Signed(on_behalf_of). ProxyTransferStakeV1 requires ProxyType::Transfer; all others require ProxyType::Staking. IDs 16-19 reserved for recycle/burn, 20-33 for Junius's Caller* variants (PR opentensor#2550).
…st coverage - Renumber Proxy* FunctionIds to 16-27 (no gaps after existing IDs) - Move verify_proxy to module-level free function (matches convert_origin pattern from PR opentensor#2550) - Restructure proxy tests into nested proxy_dispatch_tests module with shared setup helpers and per-operation success tests - Coverage: 5 proxy verification tests (staking, any/superset, no proxy, wrong type, delayed) + 8 per-operation tests covering all input shapes
camfairchild
left a comment
There was a problem hiding this comment.
Waiting on response on the issue about using delegate_call instead
Are we able to modify the delegate function to allow it to work? This might be a better solution. Or possibly a dedicated "delegate_extension" call? |
delegate_extension, do you mean the origin as caller case? If yes, it should be doable, just add a new extension. To make the delegate_call works for runtime extension, I need do some research in Ink. will update here after it is done. |
|
tests still failing |
Fixed the tests, please check again. |
| assert.ok(stake > BigInt(0)) | ||
| } | ||
|
|
||
| async function initSecondColdAndHotkey() { |
There was a problem hiding this comment.
Test "Can set coldkey auto stake hotkey" and "Can add and remove proxy" read hotkey2.publicKey without calling this helper first. This may lead to order dependent failures.
There was a problem hiding this comment.
It should use the hotkey in both test cases. will fix it.
read through Ink documentation, don't find out the approach that we can delegate to runtime extension. |
Description
Add the origin in the Ink, use can choose the contract add as signed account or real origin as account
Related Issue(s)
Type of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
./scripts/fix_rust.shto ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.