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

Add optional system entry point #693

Closed
ethanfrey opened this issue Jan 5, 2021 · 0 comments · Fixed by #793
Closed

Add optional system entry point #693

ethanfrey opened this issue Jan 5, 2021 · 0 comments · Fixed by #793
Assignees
Milestone

Comments

@ethanfrey
Copy link
Member

ethanfrey commented Jan 5, 2021

This would look something like migrate or ibc (See #692), but be a extensible placeholder for any other privledged system callbacks a chain wants to add later. As you start allowing native code to call into contracts, we need some other interface than handle, which assumes an untrusted, external caller. The same way there is a Router and a GovRouter in the sdk - the second one exposes powerful message handlers that can only be reached by trusted code.

I am unsure of a concrete use case of this, but given we just added specific entry points in #691 and #692 I am sure there will be chain-specific extensions coming later, like with CosmosMsg and QueryRequest, so this would be a good extension point to include for 1.0.

It would look something like:

pub fn system(
    deps: DepsMut,
    env: Env,
    msg: SystemMsg,
) -> Result<SystemResponse, ContractError> {
 // ...
}

// or a custom type, but same format
type SystemResponse = HandleResponse;

The content of SystemMsg is an agreement between the contract and the chain it runs on, and is only interpreted in wasmd or a cosmos sdk app that imports wasmd.

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 a pull request may close this issue.

2 participants