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

Add Collectives Parachain #1346

Merged
merged 53 commits into from
Aug 11, 2022
Merged

Add Collectives Parachain #1346

merged 53 commits into from
Aug 11, 2022

Conversation

joepetrowski
Copy link
Contributor

@joepetrowski joepetrowski commented Jun 11, 2022

TODOs done, ready for review.

Copy link
Contributor

@gilescope gilescope left a comment

Choose a reason for hiding this comment

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

Looks good. It's a thumb's up from me once the TODOs in the code are addressed.

Common Good Parachains automation moved this from In progress to Review in progress Jun 17, 2022
// Collectives does not recognize a reserve location for any asset. Users must teleport DOT
// where allowed (e.g. with the Relay Chain).
type IsReserve = ();
type IsTeleporter = NativeAsset; // <- should be enough to allow teleportation of DOT
Copy link
Contributor

Choose a reason for hiding this comment

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

This would also allow any other chain to teleport their native token to the collectives parachain. I think to really reduce the liability of the collectives parachain, we really should only be accepting the DOT/KSM token from the relay chain, and nothing else.

…onfig.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
use sp_runtime::AccountId32;

/// Relay Chain treasury pallet id, used to convert into AccountId
pub const RELAY_TREASURY_PALL_ID: PalletId = PalletId(*b"py/trsry");
Copy link
Contributor

Choose a reason for hiding this comment

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

Someday these should go in a central repository (onchain) of all chain metadatas, so no one needs to hardcode them anymore -- discussed in the parachain summit as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

At the minimum, can't we move things that are constant like this to polkadot_core_primitives?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, @muharem and I discussed several options for this. We agreed that for now hardcode it to avoid waiting for a Polkadot release, but that these can go into crates similar to the Balances (ED, etc.) and be imported.

for ToParentTreasury<TreasuryAcc, TempAcc, T, I>
where
TreasuryAcc: Get<AccountIdOf<T>>,
TempAcc: Get<AccountIdOf<T>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is going to be SLASHED_IMBALANCE_ACC_ID, I don't think it is needed to make it a configurable generic anymore, but as you wish.

Comment on lines +204 to +205
/// Relay Chain `TransactionByteFee` / 10
pub const TransactionByteFee: Balance = 1 * MILLICENTS;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not really guaranteed, as I recall you have access to relay chain constant, perhaps it can be written better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it's not exported in constants. Perhaps a good one to add there to just import it.
https://github.com/paritytech/polkadot/blob/release-v0.9.27-1/runtime/polkadot/constants/src/lib.rs

/// Alliance proxy. Allows calls related to the Alliance.
Alliance,
}
impl Default for ProxyType {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? shouldn't default be actually the most restrained variant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kind of related to your comment on pre-defining common types. The default type is Any in Polkadot: https://github.com/paritytech/polkadot/blob/release-v0.9.27-1/runtime/polkadot/src/lib.rs#L1134L1138

However, I think it's hard to define "most restrained", because besides Any and NonTransfer they tend to be non-overlapping sets of call access.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also proxies allow addition/modification to less privileged ones, but not more. When creating an anon proxy you would almost always want Any, otherwise you could never spend from it.

Copy link
Member

Choose a reason for hiding this comment

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

It must be the most permissive value: https://github.com/paritytech/substrate/blob/a1a9b475c354d873f91135ed5fa028ac9ef6a2c4/frame/proxy/src/lib.rs#L127

IMO, we should introduce some custom trait for this, where the function name already expresses on what should be returned.

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

I have a bunch of comments that you probably want to address before going forward, but no blockers. LGTM

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
The job name - test-linux-stable
The job logs - https://gitlab.parity.io/parity/mirrors/cumulus/-/jobs/1735685

@joepetrowski
Copy link
Contributor Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 0e83ad2 into master Aug 11, 2022
Common Good Parachains automation moved this from Reviewer approved to Done Aug 11, 2022
@paritytech-processbot paritytech-processbot bot deleted the joe-alliance branch August 11, 2022 11:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants