Skip to content

Add view functions to Proxy pallet for runtime-specific type configuration #7297#7320

Merged
bkchr merged 24 commits into
paritytech:masterfrom
Nathy-bajo:proxy-pallet-runtime
Feb 15, 2025
Merged

Add view functions to Proxy pallet for runtime-specific type configuration #7297#7320
bkchr merged 24 commits into
paritytech:masterfrom
Nathy-bajo:proxy-pallet-runtime

Conversation

@Nathy-bajo

@Nathy-bajo Nathy-bajo commented Jan 23, 2025

Copy link
Copy Markdown
Contributor

Solves #7297

I added a ProxyApi runtime API to the Proxy pallet with two methods:

check_permissions: Checks if a RuntimeCall passes a ProxyType's InstanceFilter.
is_superset: Verifies if one ProxyType includes another.

Polkadot address: 121HJWZtD13GJQPD82oEj3gSeHqsRYm1mFgRALu4L96kfPD1

@Nathy-bajo Nathy-bajo requested a review from a team as a code owner January 23, 2025 21:33
@Nathy-bajo

Copy link
Copy Markdown
Contributor Author

Please review @bkchr

@Nathy-bajo

Copy link
Copy Markdown
Contributor Author

Please review @bkchr

@Nathy-bajo

Copy link
Copy Markdown
Contributor Author

As @kianenigma requested in #7297 (comment)

I updated the implementation by adding #[pallet::view_functions_experimental] attribute to the Proxy pallet and implemented two new view functions:

check_permissions: Checks if a given RuntimeCall is allowed for a specific ProxyType using the InstanceFilter trait.

is_superset: Checks if one ProxyType is a superset of another ProxyType by comparing them using the PartialOrd trait.

@Nathy-bajo Nathy-bajo changed the title Add runtime api to Proxy pallet crate #7297 Add view functions to Proxy pallet for runtime-specific type configuration #7297 Feb 10, 2025
@kianenigma kianenigma requested a review from re-gius February 10, 2025 16:17

@kianenigma kianenigma left a comment

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.

LGTM, the lock files need to be updated?

The idea of view functions is to be a stable interface as well. The two functions added here seem pretty reasonable to me, but good for other reviewers to also double check that.

@github-actions github-actions Bot requested a review from kianenigma February 10, 2025 16:31
@github-actions

Copy link
Copy Markdown
Contributor

Review required! Latest push from author must always be reviewed

@Nathy-bajo

Nathy-bajo commented Feb 10, 2025

Copy link
Copy Markdown
Contributor Author

LGTM, the lock files need to be updated?

I think it was because I updated cargo

The idea of view functions is to be a stable interface as well. The two functions added here seem pretty reasonable to me, but good for other reviewers to also double check that.

Comment thread substrate/frame/proxy/src/lib.rs Outdated
@bkchr bkchr added the T2-pallets This PR/Issue is related to a particular pallet. label Feb 10, 2025
@bkchr bkchr enabled auto-merge February 10, 2025 21:41
@bkchr bkchr enabled auto-merge February 14, 2025 22:44
@bkchr bkchr added this pull request to the merge queue Feb 15, 2025
Merged via the queue into paritytech:master with commit 87ac3f2 Feb 15, 2025
@Nathy-bajo

Copy link
Copy Markdown
Contributor Author

Glad to see this merged🎉

please see my Polkadot address in the description @bkchr

@bkchr

bkchr commented Feb 16, 2025

Copy link
Copy Markdown
Member

/tip small

@substrate-tip-bot

Copy link
Copy Markdown

@bkchr A referendum for a small (20 DOT) tip was successfully submitted for @Nathy-bajo (121HJWZtD13GJQPD82oEj3gSeHqsRYm1mFgRALu4L96kfPD1 on polkadot).

Referendum number: 1446.
tip

@substrate-tip-bot

Copy link
Copy Markdown

The referendum has appeared on Polkassembly.

@Nathy-bajo Nathy-bajo deleted the proxy-pallet-runtime branch February 17, 2025 00:42
clangenb pushed a commit to clangenb/polkadot-sdk that referenced this pull request Feb 19, 2025
…ation paritytech#7297 (paritytech#7320)

Solves paritytech#7297

I added a ProxyApi runtime API to the Proxy pallet with two methods:

check_permissions: Checks if a RuntimeCall passes a ProxyType's
InstanceFilter.
is_superset: Verifies if one ProxyType includes another.




Polkadot address: 121HJWZtD13GJQPD82oEj3gSeHqsRYm1mFgRALu4L96kfPD1

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Bastian Köcher <info@kchr.de>
@Polkadot-Forum

Copy link
Copy Markdown

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/private-study-group-runtime-developer-guide/12655/1

proxy_type.filter(&call)
}

/// Check if one `ProxyType` is a subset of another `ProxyType`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

super-set, not sub-set.

@Polkadot-Forum

Copy link
Copy Markdown

This pull request has been mentioned on Polkadot Forum. There might be relevant details there:

https://forum.polkadot.network/t/sponsorship-for-active-devs-and-community-members-during-polkadot-symbiosis-in-buenos-aires/14723/65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T2-pallets This PR/Issue is related to a particular pallet.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants