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

Refactor Call/PrivCall/PublicAux/aux into single Call + origin #651

@gavofyork

Description

@gavofyork

Treasury needs to implement multiple types of PrivCall other than merely superuser. This is non-trivial with the current design.

This should change the design entirely so that every module is free to specify an Origin type and much like Event, they are condensed into an overarching enum. This functions as what the PublicAux type did. After this there's no need for PrivCall; calls should check in advance what their origin is in much the same way that some check the aux value. PrivCall impls should ensure that the origin == Origin::Root.

Outer Origin should look something like:

enum Origin<T> {
	Root,
	<module_name>(module::Origin<T>),
}

system::Origin should look something like:

enum Origin<T> {
	Signed(T::AccountId),
	Inherent,
}

An example of the council module Origin:

enum Origin {
	Members(u32),// the number of members that approved.
}

Existing PrivCall impls should include a line at the beginning:

ensure!(origin == Root, "origin must be root");

Inherent Call impls should change their aux.is_empty() check into:

ensure!(origin == Inherent);

Metadata

Metadata

Labels

I7-refactorCode needs refactoring.Z3-substantialCan be fixed by an experienced coder with a working knowledge of the codebase.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions