Details

    • Type: Sub-task
    • Status: Closed (View Workflow)
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: fabric-chaincode-node
    • Labels:
      None

      Description

      among other things, v8 introduced native "async" and "await" support that transforms messy Promise-based source code like this:

      Invoke(stub) {
      	let ret = stub.getFunctionAndParameters();
      
      	return stub.getState('dummyKey')
      	.then((value) => {
      		if (value.toString() === 'dummyValue') {
      			return stub.success();
      		} else {
      			console.error('Failed to retrieve dummyKey or the retrieved value is not expected: ' + value);
      			return shim.error();
      		}
      	}
      }
      

      to this:

      Invoke(stub) {
      	let ret = stub.getFunctionAndParameters();
      
      	let value = await stub.getState('dummyKey');
      	if (value.toString() === 'dummyValue') {
      		return stub.success();
      	} else {
      		console.error('Failed to retrieve dummyKey or the retrieved value is not expected: ' + value);
      		return shim.error();
      	}
      }
      

      There's also performance benefits due to "Ignition" (interpreter) and "Turbofan" (JIT compiler).

      Note that node 8 does not enter LTS (Long-Term Service) status until October (exact date to be determined), but we have obtained agreement from node.js engine committers for support on possible bug fixes during the interim. Thus we felt it's appropriate to introduce the node.js chaincode feature directly on top of node 8 rather than 6.x.

      For developers who are writing both chaincode and client applications with the node.js SDK, although the node.js SDK may still be stuck on 6.x for official support (pending further discussions), the good news is that node 8 has excellent backward compatibility, so they should be able to continue to write both code for app and chaincode under node 8 and test. As long as they don't accidentally introduce language features that are not supported by 6.x in the client app, they should be fine.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jimthematrix Jim Zhang
                Reporter:
                jimthematrix Jim Zhang
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 3 days
                  3d
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days
                  3d

                    Git Source Code