Description
My experiments show that .wasm files can be gziped to 30-50% of the original size. That could get us from eg. 50kb down to 20kb. Very nice size to fit in a tx.
I would use only uncompressed wasm internally, but idea to optionally allow compressed variant in the tx body. Of course, you need to use a LimitReader when unzipping, with eg. 300-400kb limit, to avoid zip bombs going to many GB.
Look at https://golang.org/pkg/compress/gzip/
This means the Wasm []byte
in CreateMsg
may either be wasm or a gzip payload. The go-cosmwasm code should check if it starts with the gzip "magic bytes" and if so, decompress it and then pass it into the rust library.
The rust library will validate if the input is valid wasm and do some compatibility checks as well, so no need to check that part in go, just the unzipping.
Note: this logic can be implemented in github.com/cosmwasm/wasmd rather than go-cosmwasm
if so desired.