Skip to content

add origin in extension#2550

Merged
sam0x17 merged 33 commits into
devnet-readyfrom
add-origin-ink
May 1, 2026
Merged

add origin in extension#2550
sam0x17 merged 33 commits into
devnet-readyfrom
add-origin-ink

Conversation

@open-junius
Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

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

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run ./scripts/fix_rust.sh to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots (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.

@open-junius open-junius self-assigned this Mar 31, 2026
LandynDev added a commit to LandynDev/subtensor that referenced this pull request Apr 2, 2026
…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).
LandynDev added a commit to LandynDev/subtensor that referenced this pull request Apr 2, 2026
…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
@open-junius open-junius marked this pull request as ready for review April 3, 2026 06:30
@open-junius open-junius added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Apr 3, 2026
Copy link
Copy Markdown
Contributor

@camfairchild camfairchild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting on response on the issue about using delegate_call instead

sam0x17
sam0x17 previously approved these changes Apr 17, 2026
gztensor
gztensor previously approved these changes Apr 17, 2026
@camfairchild
Copy link
Copy Markdown
Contributor

camfairchild commented Apr 20, 2026

In Ink, we must delegate call with the contract codehash like follows.
There is no codehash for runtime extension part, so we can't do

  • user call -> delegate call contract -> runtime extension

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?

@open-junius
Copy link
Copy Markdown
Contributor Author

In Ink, we must delegate call with the contract codehash like follows.
There is no codehash for runtime extension part, so we can't do

  • user call -> delegate call contract -> runtime extension

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.

@open-junius open-junius dismissed stale reviews from sam0x17 and gztensor via de528be April 24, 2026 15:06
@sam0x17
Copy link
Copy Markdown
Contributor

sam0x17 commented Apr 24, 2026

tests still failing

@open-junius
Copy link
Copy Markdown
Contributor Author

tests still failing

Fixed the tests, please check again.

sam0x17
sam0x17 previously approved these changes Apr 29, 2026
assert.ok(stake > BigInt(0))
}

async function initSecondColdAndHotkey() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should use the hotkey in both test cases. will fix it.

@open-junius
Copy link
Copy Markdown
Contributor Author

In Ink, we must delegate call with the contract codehash like follows.
There is no codehash for runtime extension part, so we can't do

  • user call -> delegate call contract -> runtime extension

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?

read through Ink documentation, don't find out the approach that we can delegate to runtime extension.
delegate just between two smart contracts.

@sam0x17 sam0x17 merged commit 28380b6 into devnet-ready May 1, 2026
207 of 208 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants