Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Limit derived accounts per parachain? #3641

Open
4meta5 opened this issue Aug 16, 2021 · 5 comments
Open

Limit derived accounts per parachain? #3641

4meta5 opened this issue Aug 16, 2021 · 5 comments

Comments

@4meta5
Copy link
Contributor

4meta5 commented Aug 16, 2021

Background: parachains need a way for smart contracts to control relay chain accounts

As of now, the relay chain supports 1 sovereign account (on the relay chain) per parachain. Each parachain can send upward XCM to the relay chain to dispatch actions on behalf of this account.

For example, if a parachain account owns a relay chain token derivative stored on the parachain, they could burn the token derivative on the parachain to trigger an upward XCM that transfers a proportional amount of relay chain token out of the parachain's sovereign account to an account they control on the relay chain.

However, the above example assumes the user burning the token derivative on the parachain is an individual who controls the private key of a relay chain account. If the user is a smart contract on the parachain, then that contract needs a way to control a relay chain account from the parachain.

Parachain solution: account derivation from sovereign account

The Moonbeam team implemented an attempted workaround wherein the parachain derives proxy accounts from its relay chain sovereign account and dispatches calls for these proxy accounts on behalf of its smart contracts. A similar implementation could use pallet_utility::as_derivative to control up to u16::MAX derived accounts from a single sovereign account.

While this approach would work from the parachain perspective, discussions have revealed a preference to limit the number of relay chain accounts controlled by each parachain. This desire to limit parachain-controlled relay chain accounts is related to a practical limit on the number of balance-holding accounts for any given substrate chain (related frontier issue).

Accessibility for creating relay chain accounts should be independent of parachain-controlled relay chain accounts; unbounded parachain-controlled accounts could lead to the relay chain ExistentialDeposit increasing such that creating new relay chain accounts for users is inaccessible.

Feature request: bounded account derivation from sovereign account

Due to the above justification, the relay chain will likely filter deriving accounts from the parachain sovereign account if this functionality is (ab)used.

The purpose of this issue is to request an explicit limit on the number of derived accounts controlled by a parachain. The number mentioned in previous discussions was 1_000 accounts to start.

Parachains will need to implement some simple auction to decide who controls the limited number of derived relay chain accounts.

@4meta5 4meta5 changed the title Limit derived accounts for each parachain Limit derived accounts per parachain Aug 16, 2021
@xlc
Copy link
Contributor

xlc commented Aug 16, 2021

We also need to prevent nested as_derivative call, and anonymous proxy, and as_multi_threshold_1.

I just don't feel this is the right approach. A normal account on relaychain requires pay ED to exists. Same restriction for sub accounts. I don't see why there is a need for an additional limit just for parachains sovereign accounts.

@4meta5 4meta5 changed the title Limit derived accounts per parachain Limit derived accounts per parachain? Aug 16, 2021
@4meta5
Copy link
Contributor Author

4meta5 commented Aug 16, 2021

I don't see why there is a need for an additional limit just for parachains sovereign accounts.

I'd also prefer no additional limit for parachain sovereign accounts! If that is how this issue is resolved, then I'll be happy.

I opened this so we can figure out the path forward instead of assuming no limit and then building things out without planning for a limit.

I recited the explanation given to me for why the additional limit would be necessary:

Accessibility for creating relay chain accounts should be independent of parachain-controlled relay chain accounts; unbounded parachain-controlled accounts could lead to the relay chain ExistentialDeposit increasing such that creating new relay chain accounts for users is inaccessible.

For example, if there are 1,000 parachains and each has >1,000 derivative accounts, then the relay chain Existential Deposit would be raised to inaccessible levels for normal users in order to implicitly limit the number of balance-holding accounts stored on-chain.

@xlc
Copy link
Contributor

xlc commented Aug 16, 2021

It still going to cost 1 ed for parachain sub accounts. Same cost for non parachain sub accounts.

I don’t see why we want / can only increase the cost of parachain sub accounts.

Also people should avoid using relaychain in future anyway.

@4meta5
Copy link
Contributor Author

4meta5 commented Aug 16, 2021

It still going to cost 1 ed for parachain sub accounts. Same cost for non parachain sub accounts.

They're going to increase the ed so that there aren't more than 1 million accounts on-chain. If we reach 500k accounts, they'll double the ed and then they'll double the ed again at 750k accounts. If the parachain sub accounts are driving the increase in accounts and the ed increase, then non parachain sub accounts are less accessible than they were before.

Also people should avoid using relaychain in future anyway.

Agreed. If someone at Parity wants to close this because no limits will be enforced, please do. I'll be happy.

@xlc
Copy link
Contributor

xlc commented Aug 16, 2021

But limiting sub accounts of parachain is not solving the right problem.
People can create non parachain sub account cheaply and that also is going to drive up number of relaychain accounts and hence ed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@xlc @4meta5 and others