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

Generalize demo-related mock & fabric-gateway backends as well as return/error handling.

Open g2flyer opened this issue 6 years ago • 1 comments

The code in demo/client/backend is currently auction-specific but has the potential of being much more widely usable to either efficiently test chaincode (mock) or running UI apps (fabric-gateway). Note this is not even necessarily FPC specific but would apply also to other fabric chaincode!

Most of the code is already generic, the exception being the

  • /api/clockauction/getDefaultAuction action
  • a few other auction-specific parts in mock It probably also would be worth moving the calls to __init & __setup as well as the unpacking of the payload objects, which are specific to FPC to chaincode/fpc_chaincode.go (or handle these calls for non-fpc in chaincode/go_chaincode.go such that actual go chaincode doesn't have to know about it?)

A related issue is also whether the return value processing (see PR #196) could be generalized and abstracted into the FPC shim. Ultimately, the underlying problem here, though, is that fabric itself doesn't offer a good way to return program-actionable (e.g., numeric error codes) but only human actionable (i.e., a string) error messages. So doing it only in FPC would make the FPC programming model deviate from fabric and cleaner would be to extend/change fabric itself (by e.g., adding an enum or alike to the shim response).

g2flyer avatar Jan 09 '20 18:01 g2flyer

keyhole-fabric-api-gateway which just got accepted into hyperledger labs seems also to get in that direction (and beyond ...)

g2flyer avatar May 07 '20 20:05 g2flyer