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
On a discussion with @moul (which resulted in #1600), we discussed how we can have a system to avoid the need for implementing JSON marshalers.
The problem with adding JSON marshaling, to create a system which can communicate data within Gno to a frontend, is that one of the "promises" of avoiding "network-layer" code in the backend is broken by the need to encode data: imagine, for instance, a func Hello() *User, which needs to have a end-user facing alternative which marshals the user (ie. func Hello_Realm() string { return json.MustMarshal(Hello()) }).
MsgRun can aid in this sense, by providing a way for end-users to call a function and perform "post-processing" to it, like JSON marshaling. However, this does not address the fact that the underlying issue should be resolved on the networking layer rather than the VM layer.
The idea is the following:
instead of doing any marshaling at all in the VM, let's store the result of MsgCall (or possibly, with supporting different expressions for maketx run #1600 implemented, MsgRun with an expression), for instance using amino. (note: per the same issue, the stdout output should also be stored, but it should be returned separately from the tx result)
The result of the transaction can then be retrieved by the end user in the format of their preference; ie. JSON, XML, Amino, protobuf, cap'n'proto, msgpack, gob, ... (this is an exaggeration, it's just to say that the user should be able to control the output and the node to re-encode the data into the desired output).
The text was updated successfully, but these errors were encountered:
thehowl
changed the title
support different value marshaling methods when retrieving tx results
support different tx result encodings (for call and run) when retrieving them
Feb 13, 2024
On a discussion with @moul (which resulted in #1600), we discussed how we can have a system to avoid the need for implementing JSON marshalers.
The problem with adding JSON marshaling, to create a system which can communicate data within Gno to a frontend, is that one of the "promises" of avoiding "network-layer" code in the backend is broken by the need to encode data: imagine, for instance, a
func Hello() *User
, which needs to have a end-user facing alternative which marshals the user (ie.func Hello_Realm() string { return json.MustMarshal(Hello()) }
).MsgRun
can aid in this sense, by providing a way for end-users to call a function and perform "post-processing" to it, like JSON marshaling. However, this does not address the fact that the underlying issue should be resolved on the networking layer rather than the VM layer.The idea is the following:
MsgCall
(or possibly, with supporting different expressions formaketx run
#1600 implemented,MsgRun
with an expression), for instance using amino. (note: per the same issue, the stdout output should also be stored, but it should be returned separately from the tx result)See-also: #1415 #1038
The text was updated successfully, but these errors were encountered: