-
Notifications
You must be signed in to change notification settings - Fork 341
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
One or multiple msg_response in Reply #2009
Comments
|
Good stuff. I was thinking about some more cases for 1.: here is a case where we created two SDK messages from one CosmWasm message. It was semantically buggy to do that but we might have such cases again in the future if we add IBC fees as fields to Okay, good to assume 1 element, but no type safety. So we end up with two nested loops, each is expected to only have one element. However, we never really know if it remains like that. So what I propose is keep the vector and flatten the results of the loops. Then the majority of users find their response in |
See CosmWasm/wasmd#1800 for how this can look like in wasmd. |
The approach in CosmWasm/wasmd#1800 looks good to me. Once the wasmvm prerelease is done, we can finish that off. |
@chipshort could you close this ticket with a doc comment in cosmwasm-std explaining how the value is filled by wasmd such that contract developers know what to expect? |
This is how the data in the reply is currently handled in wasmd: https://github.com/CosmWasm/wasmd/blob/v0.50.0/x/wasm/keeper/msg_dispatcher.go#L103-L150. It has been implemented like that in the original implementation: https://github.com/CosmWasm/wasmd/pull/441/files
The list of
data
s is coming from here: https://github.com/CosmWasm/wasmd/blob/v0.50.0/x/wasm/keeper/handler_plugin.go#L69-L89. There the functionturns a single
msg wasmvmtypes.CosmosMsg
into multiple[]sdk.Msg
. This was needed at some point in the past where we had a claim rewards message in cosmwasm that translated to a set withdrawl address + withdraw message. I wonder if this is still needed.Then I wonder why each result again has a list of responses. As far as I can tell, the idea of message services is that each message leads to one response (e.g.
MsgExecuteContract
/MsgExecuteContractResponse
,MsgSend
/MsgSendResponse
, ...)So open questions for me are
sdk.Msg
or is one sufficient?*sdk.Result
inhandleSdkMessage
really contain multiple responses? Or is it just a list because it is also used for transactions that can contain multiple messages?The text was updated successfully, but these errors were encountered: