Skip to content

Commit

Permalink
NodeSDK - update to latest proto
Browse files Browse the repository at this point in the history
Changes for the configtx.proto with the removal
of the channel_header. Included are the config files
needed to support the latest orderer addressing
required when creating a channel.

Change-Id: Icd0f728cb690a7c57700a2a7935d1496e78d6356
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
  • Loading branch information
harrisob committed Mar 7, 2017
1 parent 45a3778 commit 2a0fa90
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 23 deletions.
9 changes: 2 additions & 7 deletions fabric-client/lib/Chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,16 +784,11 @@ var Chain = class {
*/
loadConfigEnvelope(config_envelope) {
logger.debug('loadConfigEnvelope - start');
logger.debug('loadConfigEnvelope - Config channel_header.type :: %s', config_envelope.config.header.type);
logger.debug('loadConfigEnvelope - Config channel_header.tx_id :: %s', config_envelope.config.header.tx_id);
logger.debug('loadConfigEnvelope - Config channel_header.version :: %s', config_envelope.config.header.version);

let channel = config_envelope.config.channel;
logger.debug('loadConfigEnvelope - Channel version :: %s', channel.version);
logger.debug('loadConfigEnvelope - Channel mod policy :: %s', channel.mod_policy);
let group = config_envelope.config.channel_group;

var found_MSPs = []; //save all the MSP's found
this.loadConfigGroup(channel, 'base', found_MSPs, true, false);
this.loadConfigGroup(group, 'base', found_MSPs, true, false);
this._msp_manager.loadMSPs(found_MSPs);
}

Expand Down
9 changes: 3 additions & 6 deletions fabric-client/lib/protos/common/configtx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// XXX This is the older mechanism for specifying channel configuration
// it is intended to be removed once there is no more dependency on it.

syntax = "proto3";

import "common.proto";
Expand Down Expand Up @@ -65,8 +62,8 @@ message ConfigPolicySchema {}

// Config represents the config for a particular channel
message Config {
ChannelHeader header = 1;
ConfigGroup channel = 2;
uint64 sequence = 1;
ConfigGroup channel_group = 2;
}

message ConfigUpdateEnvelope {
Expand All @@ -84,7 +81,7 @@ message ConfigUpdateEnvelope {
// 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected
// 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal
message ConfigUpdate {
ChannelHeader header = 1; // Header scopes the update to a particular Channel
string channel_id = 1; // Which channel this config update is for
ConfigGroup read_set = 2; // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set
ConfigGroup write_set = 3; // WriteSet lists the portion of the config which was written, this should included updated Versions
}
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/channel/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Orderer: &OrdererDefaults
OrdererType: solo

Addresses:
- 127.0.0.1:7050
- orderer:7050

# Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 10s
Expand All @@ -170,7 +170,7 @@ Orderer: &OrdererDefaults
# Brokers: A list of Kafka brokers to which the orderer connects
# NOTE: Use IP:port notation
Brokers:
- 127.0.0.1:9092
- orderer:9092

# Organizations is the list of orgs which are defined as participants on
# the orderer side of the network
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/channel/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ services:
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_ID=peer0
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/configtx/crypto-config/peerOrganizations/peerOrg1/peers/peerOrg1Peer1/
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
Expand Down Expand Up @@ -86,7 +85,6 @@ services:
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_ID=peer1
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/configtx/crypto-config/peerOrganizations/peerOrg1/peers/peerOrg1Peer2/
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
Expand Down Expand Up @@ -117,7 +115,6 @@ services:
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_ID=peer2
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/configtx/crypto-config/peerOrganizations/peerOrg2/peers/peerOrg2Peer1/
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
Expand Down Expand Up @@ -149,7 +146,6 @@ services:
- CORE_PEER_ENDORSER_ENABLED=true
- CORE_PEER_ID=peer3
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/configtx/crypto-config/peerOrganizations/peerOrg2/peers/peerOrg2Peer2/
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
Expand Down
Binary file modified test/fixtures/channel/mychannel.tx
Binary file not shown.
Binary file modified test/fixtures/channel/twoorgs.orderer.block
Binary file not shown.
13 changes: 9 additions & 4 deletions test/integration/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ var _ccProposalProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/pe
var _ccEventProto = grpc.load(__dirname + '/../../fabric-client/lib/protos/peer/chaincodeevent.proto').protos;

var client = new hfc();
// IMPORTANT ------>>>>> MUST RUN new-chain.js FIRST
var chain_id = 'foo';
// IMPORTANT ------>>>>> MUST RUN e2e/create-channel.js FIRST
var chain_id = 'mychannel';
var chain = client.newChain(chain_id);

var webUser = null;
Expand Down Expand Up @@ -94,8 +94,13 @@ test(' ---->>>>> get config <<<<<-----', function(t) {
t.pass('Chain was successfully initialized');
var orgs = chain.getOrganizationUnits();
logger.debug(' Got the following orgs back %j', orgs);
t.equals(orgs.length, 1, 'Checking the that we got back the right number of orgs');
t.equals(orgs[0].id, 'DEFAULT', 'Checking the org name');
t.equals(orgs.length, 2, 'Checking the that we got back the right number of orgs');
if(orgs[0].id.indexOf('Org') == 0) {
t.pass('Found the org name '+ orgs[0].id);
}
else {
t.fail('Did not find the org name of \'org\' :: found ' + orgs[0].id);
}
t.end();
},
function(err) {
Expand Down

0 comments on commit 2a0fa90

Please sign in to comment.