The AI Works community logo The Blockchain Works community logo The Functional Works community logo The Golang Works community logo The Java Works community logo The JavaScript Works community logo The Python Works community logo The Remote Works community logo The WorksHub company logo

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies.

We use cookies and other tracking technologies to improve your browsing experience on our site, analyze site traffic, and understand where our audience is coming from. To find out more, please read our privacy policy.

By choosing 'I Accept', you consent to our use of cookies and other tracking technologies. Less

We use cookies and other tracking technologies... More

Login or register
to publish this job!

Login or register
to save this job!

Login or register
to save interesting jobs!

Login or register
to get access to all your job applications!

Login or register to start contributing with an article!

Login or register
to see more jobs from this company!

Login or register
to boost this post!

Show some love to the author of this blog by giving their post some rocket fuel 🚀.

Login or register to search for your ideal job!

Login or register to start working on this issue!

Login or register
to save articles!

Login to see the application

Engineers who find a new job through Functional Works average a 15% increase in salary 🚀

You will be redirected back to this page right after signin

Simplify json encoding of Execute/InstantiateMsg

Issue closed
Pull requests: 1
Contributors: 0
Level: Intermediate
  • Go
Issue closed
Pull requests: 1
Contributors: 0
Level: Intermediate
  • Go

On GitHub

Basic cosmos-sdk app with web assembly smart contracts
More info >

Issue posted by: 
ethanfrey's avatar

Ethan Frey

Description

Summary

MsgInstantiateContract and MsgExecuteContract, both take a message for the wasm contract as []byte. Let's change that to json.RawMessage.

Problem Definition

Msg is json inside all cosmwasm contracts so far, and additional tooling, like cw-storage makes that implicit assumption. Without limiting in any way the message format, we can just assert this is json.RawMessage. This makes embedding and creating such a structure much easier.

Assume the message is {"approve":{}}. As is, when we create MsgExecuteContract, it will have a base64 encoded field, something like:

{
  "contract": "cosmos1qlc8f2fmw",
  "msg": "eyJhcHByb3ZlIjp7fX0=",
}

this would make it much simpler, without modifying the binary encoding at all.

{
  "contract": "cosmos1qlc8f2fmw",
  msg: {"approve":{}},
}

Which one is easier to understand, create, and debug?

If a chain does want to allow contracts to use another codec, they can simply modify this portion and it will enable eg. protobuf or cap't proto, just with a bit of dev ux impact.

Proposal

  • Update the field and ensure this works properly.
  • Manually check both binary and json amino encoding before and after.
  • Test the cli tools, and in particular viewing such a tx as json (both before and after) to ensure this is a nice enhancement to the UI.

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
  • API

Use Open Source to hire or get hired

On GitHub

Basic cosmos-sdk app with web assembly smart contracts
More info >

Issue posted by: 
ethanfrey's avatar

Ethan Frey

Use Open Source to hire or get hired

Simplify json encoding of Execute/InstantiateMsg
View on GitHub