fabric-chaincode-wasm icon indicating copy to clipboard operation
fabric-chaincode-wasm copied to clipboard

wasm binary generation for unit test

Open kleash opened this issue 6 years ago • 9 comments

Use makefile to generate wasm binary for unit testing

kleash avatar Oct 12 '19 04:10 kleash

Should we remove wasm binary from repo and add it as part of make file for unit test and integration test?

kleash avatar Nov 14 '19 13:11 kleash

Two wasm files as of now :

  • For rust chaincode: https://github.com/hyperledger-labs/fabric-chaincode-wasm/blob/master/sample-wasm-chaincode/chaincode_example02/rust/app_main.wasm
  • For C chaincode: https://github.com/hyperledger-labs/fabric-chaincode-wasm/pull/24/files#diff-cb10420c29b4a5c425041df14b70572d

kleash avatar Nov 14 '19 13:11 kleash

If we can achieve that in the CI, it would help enforce the reproducibility of the repository.

Given how small these are, and that they're already in the repo, it's not going to save us any space.

I am in favor of the idea.

MHBauer avatar Nov 14 '19 17:11 MHBauer

Did you want to do this work, or merge #24?

MHBauer avatar Nov 14 '19 18:11 MHBauer

The only problem I see in removing wasm binaries from repo is, we need these binaries for running unit tests, and it takes an awful lot of time to compile and generate rust chaincode to wasm. Ignoring the fact that the user has to also install rust/c tools for generating this wasm binary for running wasmcc unit tests alone.

kleash avatar Nov 14 '19 18:11 kleash

How about, using Git Actions to publish wasm binaries under GitHub Packages.

And, make can curl download these GitHub packages for unit tests.

kleash avatar Nov 14 '19 18:11 kleash

In the last discussion, we were planning to build wasm binary as part of our CI and push it to the repository.

But that might result in a very bulky repository because it will add binary files in every PR.

Thoughts?

kleash avatar Nov 19 '19 15:11 kleash

I do not understand how it adds it to every pr. Binary push can be done pseudo outside of the repo by pushing to the repository "releases". https://help.github.com/en/github/administering-a-repository/creating-releases

MHBauer avatar Nov 19 '19 20:11 MHBauer

So should we publish both rust and C generated wasm binaries to releases?

kleash avatar Nov 22 '19 15:11 kleash