-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy origin for pallet-contracts #3196
Comments
Yes, will open a PR soon. Just wanted to confirm this is sensible first. |
Yes this makes sense to me. |
Actually, this is not as straightforward as I thought. The contracts api assumes that the origin is an account, which might not be the case if we want to do something as I suggested in the issue description. Maybe have something like this instead: type DeployOrigin: Contains<T::AccountId>; And then for example if we wanted to allow only members from a specific collective to deploy a contract we could have the following in the runtime config: type DeployOrigin = TechnicalCommitteeMembershipInstance; This is possible since the |
Can you explain what you mean? I don't really see why we need to use |
Yes, a contract assumes that any other contract has an type DeployOrigin: EnsureOrigin<Self::RuntimeOrigin>; |
You could add a signed extension to do whatever origin validation required. No need to modify the pallet. |
That would only work if you care about contracts deployed by a signed account but not by other contracts. Meaning you can't stop contracts from instantiating other contracts with that approach. |
For each contract we store |
Contracts do not have owners. At least not as a concept of You need to start getting more specific if you need further help. |
I get that. What I was referring to is this. I am definitely not deep into the contracts pallet, but AFAIU the deployed code has an owner: link. What I was asking was who would be the owner of the uploaded code if the origin is not signed(e.g. root)? |
Then you can use |
Okay yes I get it now. I thought you were talking about instantiating a contract. But you mean uploading new code. Which of the two you want to make permissioned? Only the uploading of new code? |
Yeah, this seems exactly like what would be needed. Since the contracts pallet assumes in code deployment and instantiation that an account id associated with the origin, by making this slight adjustment to my initial suggestion we can make it work: type DeployOrigin: EnsureOrigin<Self::RuntimeOrigin, Success = Self::AccountId>;
I think restricting both would make the most sense. |
Yes, but there is a shorthand for this as Basti mentioned:
I think two config knobs would make sense then. You might want to allow everyone to instantiate existing code but make the upload restricted. |
Seeing this a bit late, Zeigeist is doing something like this |
When discussing the issue here I thought the goal would be to also prevent contract from instantiating. Without this requirement the call filter would suffice AFAIK. |
Closes: #3196 --------- Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: PG Herveou <pgherveou@parity.io>
Closes: paritytech#3196 --------- Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: PG Herveou <pgherveou@parity.io>
In some cases, it could be useful to have permissioned contract deployment on a chain.
Probably the easiest way to enable this would be to add a new type to the config, e.g.:
The text was updated successfully, but these errors were encountered: