Commit 2e57965a authored by Jason Yellick's avatar Jason Yellick
Browse files

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: default avatarJason Yellick <jyellick@us.ibm.com>
parent 73b97b44
/*
Copyright IBM Corp. 2017 All Rights Reserved.
Copyright IBM Corp. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
*/
package protolator_test
......@@ -25,6 +15,7 @@ import (
genesisconfig "github.com/hyperledger/fabric/common/tools/configtxgen/localconfig"
. "github.com/hyperledger/fabric/common/tools/protolator"
cb "github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/msp"
"github.com/hyperledger/fabric/protos/utils"
"github.com/golang/protobuf/proto"
......@@ -67,6 +58,15 @@ func TestConfigUpdate(t *testing.T) {
})
}
func TestIdemix(t *testing.T) {
bidirectionalMarshal(t, &msp.MSPConfig{
Type: 1,
Config: utils.MarshalOrPanic(&msp.IdemixMSPConfig{
Name: "fooo",
}),
})
}
func TestGenesisBlock(t *testing.T) {
p := encoder.New(configtxgentest.Load(genesisconfig.SampleSingleMSPSoloProfile))
gb := p.GenesisBlockForChannel("foo")
......
......@@ -33,6 +33,8 @@ func (mc *MSPConfig) VariablyOpaqueFieldProto(name string) (proto.Message, error
switch mc.Type {
case 0:
return &FabricMSPConfig{}, nil
case 1:
return &IdemixMSPConfig{}, nil
default:
return nil, fmt.Errorf("unable to decode MSP type: %v", mc.Type)
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment