Skip to content
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

Expose sudo powers on Router we give to Modules #453

Merged
merged 7 commits into from
Sep 28, 2021

Conversation

ethanfrey
Copy link
Member

@ethanfrey ethanfrey commented Sep 24, 2021

I came across this need when trying to implement a custom router that could perform privileged operations on contracts.

It actually seems like it can be generalised for all "governance proposals" and such as done in the sdk, which is a privileged interface to modules.

I implemented this for Wasm::Sudo and Bank::Mint

I also added a test for a CustomModule that makes these permissions calls to mint tokens (also needed by staking module) and came across a lot of usability issues with the UI, which I was able to sort out.

I am getting a much higher confidence we can start plugging in external implementations.

@ethanfrey ethanfrey requested a review from hashedone September 24, 2021 09:01
@@ -665,6 +665,33 @@ where
}
}

// TODO: extend this later to give privileged access to various modules
Copy link
Contributor

Choose a reason for hiding this comment

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

Just leaving a comment to create later issue for this one.

ueco-jb
ueco-jb previously approved these changes Sep 24, 2021
Copy link
Contributor

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@ueco-jb ueco-jb left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +881 to +889
type BasicRouter<ExecC = Empty, QueryC = Empty> = Router<
BankKeeper,
FailingModule<Empty, Empty>,
WasmKeeper<Empty, Empty>,
FailingModule<ExecC, QueryC, Empty>,
WasmKeeper<ExecC, QueryC>,
FailingStaking,
FailingDistribution,
> {
>;

fn mock_router() -> BasicRouter {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this!

@ethanfrey ethanfrey merged commit 2cda5fd into main Sep 28, 2021
@ethanfrey ethanfrey deleted the extend-multitest-router branch September 28, 2021 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants