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

support different tx result encodings (for call and run) when retrieving them #1655

Open
thehowl opened this issue Feb 13, 2024 · 0 comments
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 🌱 feature New update to Gno

Comments

@thehowl
Copy link
Member

thehowl commented 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:

  • 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).

See-also: #1415 #1038

@thehowl 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
@thehowl thehowl added 🌱 feature New update to Gno 📦 ⛰️ gno.land Issues or PRs gno.land package related labels Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 🌱 feature New update to Gno
Projects
Development

No branches or pull requests

1 participant