You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We still need to support the custom message feature, but having this as a generic is quite annoying for users because it has to be carried through the whole code.
In our meeting, switching to dynamic dispatch with erased_serde / typetag was proposed.
We should make sure that downstream users are not affected by the fact that this makes CosmosMsg no longer Send + Sync and that the custom message type is not necessarily Sized anymore.
This could probably be looked at for something like MultiTest.
The text was updated successfully, but these errors were encountered:
What are the use cases of the generic param in CosmosMsg? As far as I can see the message is added to the response of entry points handlers in smart contracts. In wasmd it is translated from CosmosMsg into []sdk.Msg by a default message encoder:
So in other words, if a given blockchain developers does not configure otherwise, smart contracts should not return custom types.
Some blockchains may use the custom msg by implementing their own encoder. The problem is that Rust's type system cannot prevent mistakes related to mismatch between the chain's custom type and the one defined in the contracts.
My proposal is to use Custom(Binary) as a custom field. Contract devs experience would change negligibly - they'd need to serialize the custom message before creating CosmosMsg::Custom. We could add a new method for that:
I think the benefits that CosmosMsg::Custom has over CosmosMsg::Anyare:
some level of type safety (and chains can provide types for this in their own crates)
uses JSON, no need to choose a Protobuf library, get protobuf definitions, etc.
With the Custom(Binary) approach, we lose the first one. And in some sense, also the second one because we no longer have any control over the encoding of the data.
This change also seems to be breaking the contract <-> VM interface, i.e. contracts that use the new way don't work on pre-3.0 chains and the other way around. If we want to solve this issue, we can break the contracts on the source level, but not this interface.
We still need to support the custom message feature, but having this as a generic is quite annoying for users because it has to be carried through the whole code.
In our meeting, switching to dynamic dispatch with erased_serde / typetag was proposed.
We should make sure that downstream users are not affected by the fact that this makes
CosmosMsg
no longerSend + Sync
and that the custom message type is not necessarilySized
anymore.This could probably be looked at for something like MultiTest.
The text was updated successfully, but these errors were encountered: