Skip to content

Commit 2e57965

Browse files
author
Jason Yellick
committed
FAB-10304 Allow idemix proto translation
Presently, the proto translation framework does not understand the new idemix MSP type. This CR adds the mapping from type '1' to the idemix config proto structures. Change-Id: I0ea4f27d617b4d2c319c4f0f4bdb7d0aef31a3ce Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent 73b97b4 commit 2e57965

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

common/tools/protolator/blackbox_test.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
/*
2-
Copyright IBM Corp. 2017 All Rights Reserved.
2+
Copyright IBM Corp. All Rights Reserved.
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
4+
SPDX-License-Identifier: Apache-2.0
155
*/
166

177
package protolator_test
@@ -25,6 +15,7 @@ import (
2515
genesisconfig "github.com/hyperledger/fabric/common/tools/configtxgen/localconfig"
2616
. "github.com/hyperledger/fabric/common/tools/protolator"
2717
cb "github.com/hyperledger/fabric/protos/common"
18+
"github.com/hyperledger/fabric/protos/msp"
2819
"github.com/hyperledger/fabric/protos/utils"
2920

3021
"github.com/golang/protobuf/proto"
@@ -67,6 +58,15 @@ func TestConfigUpdate(t *testing.T) {
6758
})
6859
}
6960

61+
func TestIdemix(t *testing.T) {
62+
bidirectionalMarshal(t, &msp.MSPConfig{
63+
Type: 1,
64+
Config: utils.MarshalOrPanic(&msp.IdemixMSPConfig{
65+
Name: "fooo",
66+
}),
67+
})
68+
}
69+
7070
func TestGenesisBlock(t *testing.T) {
7171
p := encoder.New(configtxgentest.Load(genesisconfig.SampleSingleMSPSoloProfile))
7272
gb := p.GenesisBlockForChannel("foo")

protos/msp/msp_config.go

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ func (mc *MSPConfig) VariablyOpaqueFieldProto(name string) (proto.Message, error
3333
switch mc.Type {
3434
case 0:
3535
return &FabricMSPConfig{}, nil
36+
case 1:
37+
return &IdemixMSPConfig{}, nil
3638
default:
3739
return nil, fmt.Errorf("unable to decode MSP type: %v", mc.Type)
3840
}

0 commit comments

Comments
 (0)