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

Multi-org/peer example/test

Open g2flyer opened this issue 6 years ago • 10 comments

To make sure all our design really work and also to illustrate to users how a multi-org (and hence, multi-peer) would work we should have a test-case with at least 2 orgs and peers ...

g2flyer avatar Jun 22 '19 03:06 g2flyer

This is a good idea! For solid multi-peer testing the use of the client SDK will make our life much easier.

In such a test we would execute (endorse) a transaction on peer A and check if peer B successfully commits this tx.

We could use the peer CLI for that (https://hyperledger-fabric.readthedocs.io/en/release-1.4/commands/peerchannel.html#peer-channel-fetch) but this requires polling blocks and parsing them in order to check. Not nice.

mbrandenburger avatar Jun 25 '19 10:06 mbrandenburger

Using the fabric client SDK (https://github.com/hyperledger/fabric-sdk-go) one can easily register for events. Eg.

client.RegisterChaincodeEvent(ccID, eventID)

mbrandenburger avatar Jun 25 '19 10:06 mbrandenburger

seems the peer CLI indeed provides an event listener, which we can use here (and also remove the sleep command)

--waitForEvent                   Whether to wait for the event from each peer's deliver filtered service signifying that the 'invoke' transaction has been committed successfully
--waitForEventTimeout duration   Time to wait for the event from each peer's deliver filtered service signifying that the 'invoke' transaction has been committed successfully (default 30s)

See here https://hyperledger-fabric.readthedocs.io/en/release-1.4/commands/peerchaincode.html#peer-chaincode-invoke

mbrandenburger avatar Jun 25 '19 13:06 mbrandenburger

relevant pointers of setting up multi-peer/multi-org: https://hyperledger-fabric.readthedocs.io/en/latest/channel_update_tutorial.html

g2flyer avatar Jul 22 '19 04:07 g2flyer

While the peer.sh wrapper tries to handle multi-peer, e.g., in setup as described in PR #144, it was not tested with multi-org/peer, so be warned ...

g2flyer avatar Aug 23 '19 14:08 g2flyer

Note: while in old lifecycle, our peer.sh wrapper logic should have worked with multiple peers and the ercc install&instantiate and the ecc onDemand setup, with the new lifecyle this is not true anymore, e.g., the ercc configuration in channel join would require tighter coordination between multiple peers. So this might require now more explicit additional management commands but also has to be looked at from the perspective of the additional steps necessary for th new key-managment protocols

g2flyer avatar Apr 02 '20 19:04 g2flyer

depends on resolution of issue #12

g2flyer avatar Jun 23 '20 01:06 g2flyer

Done in conjunction with #394 ..

g2flyer avatar Jul 02 '20 19:07 g2flyer

Another useful feature and test that can be added in this setting is the following:

  • 3 peers/orgs, only one of which is the SGX-capable FPC endorser, and only that has the code; the remaining two, however, must still be FPC peers (because of the validation plugins)
  • ensure that the LifecycleEndorsement policy is set to majority of orgs (i.e., only the majority can modify the chaincode definition; #313 handles upgrades)
  • ensure that the fabric network can go through the approveformyorg step (note: this requires a majority, and requires an org to install a package; so it should be checked whether an empty package or an empty package id is necessary at some org; the Fabric code here suggests that using an empty package id should be viable.)

bvavala avatar Jul 24 '20 03:07 bvavala

fabric-sample test-network does already do now in a minimalistical cut multi-peer setup (though no automated test yet)

g2flyer avatar Dec 08 '20 18:12 g2flyer