Description
Summary
The keeper in wasmd needs to implement OpaqueMsg dispatch. See TODO panic here
Problem Definition
OpaqueMsg is a way that any blockchain-specific transaction can be relayed to a contract for approval (eg. multisig), then re-dispatched by that contract to the blockchain. We cannot have any (possibly upgradable) data structures in a contract as it will break on a chain upgrade. We also want contracts to be chain angostic.
This means that the meaning of the bytes is opaque to the contracts, which just accept them as input, and send them as output (like theproposed mask contract). However, we need to define a clear format and have an agreement between the clients and the (go) blockchain app.
Proposal
First, we define the structure, either as go-amino or "canonical json". I would go with the JSON encoding for ease of debugging to start (even if this is amino-json). We can swap this out later before a production release if so desired, but the internal cosmos-sdk encoding is also up for discussion now.
We can then parse any returned "opaque msg" with this codec, into a sdk.Msg
, and then send it to the router.
To test this, we should deploy the mask contract, and send a proper encoded message on behalf of the mask. Since the wasm module has access to the entire router (https://github.com/cosmwasm/wasmd/blob/master/app/app.go#L179-L184), as an integration test for approval, we should be able to:
- send tokens to a mask
- re-send tokens to another account via send msg
- re-send tokens to another account via opaque msg
- stake tokens on behalf of the mask via opaque msg (this is too hard to do in unit tests... will do manually)
- document how to create opaque payloads
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned