Skip to content

Commit 959811e

Browse files
committed
[FAB-10293] Make MSP protos conform to official style
This change set makes the MSP protos conform to the official proto style Change-Id: I766cc341833279fcd4149aeea124978145595fed Signed-off-by: yacovm <yacovm@il.ibm.com>
1 parent 6528c9d commit 959811e

13 files changed

+189
-188
lines changed

common/crypto/expiration_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestIdemixIdentityExpiresAt(t *testing.T) {
4545
idemixId := &msp.SerializedIdemixIdentity{
4646
NymX: []byte{1, 2, 3},
4747
NymY: []byte{1, 2, 3},
48-
OU: []byte("OU1"),
48+
Ou: []byte("OU1"),
4949
}
5050
idemixBytes, err := proto.Marshal(idemixId)
5151
assert.NoError(t, err)

core/handlers/auth/filter/expiration_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func createIdemixIdentity(t *testing.T) []byte {
4646
idemixId := &msp.SerializedIdemixIdentity{
4747
NymX: []byte{1, 2, 3},
4848
NymY: []byte{1, 2, 3},
49-
OU: []byte("OU1"),
49+
Ou: []byte("OU1"),
5050
}
5151
idemixBytes, err := proto.Marshal(idemixId)
5252
assert.NoError(t, err)

msp/configbuilder.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.M
301301

302302
nodeOUs = &msp.FabricNodeOUs{
303303
Enable: configuration.NodeOUs.Enable,
304-
ClientOUIdentifier: &msp.FabricOUIdentifier{OrganizationalUnitIdentifier: configuration.NodeOUs.ClientOUIdentifier.OrganizationalUnitIdentifier},
305-
PeerOUIdentifier: &msp.FabricOUIdentifier{OrganizationalUnitIdentifier: configuration.NodeOUs.PeerOUIdentifier.OrganizationalUnitIdentifier},
304+
ClientOuIdentifier: &msp.FabricOUIdentifier{OrganizationalUnitIdentifier: configuration.NodeOUs.ClientOUIdentifier.OrganizationalUnitIdentifier},
305+
PeerOuIdentifier: &msp.FabricOUIdentifier{OrganizationalUnitIdentifier: configuration.NodeOUs.PeerOUIdentifier.OrganizationalUnitIdentifier},
306306
}
307307

308308
// Read certificates, if defined
@@ -313,7 +313,7 @@ func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.M
313313
if err != nil {
314314
mspLogger.Infof("Failed loading ClientOU certificate at [%s]: [%s]", f, err)
315315
} else {
316-
nodeOUs.ClientOUIdentifier.Certificate = raw
316+
nodeOUs.ClientOuIdentifier.Certificate = raw
317317
}
318318

319319
// PeerOU
@@ -322,7 +322,7 @@ func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.M
322322
if err != nil {
323323
mspLogger.Debugf("Failed loading PeerOU certificate at [%s]: [%s]", f, err)
324324
} else {
325-
nodeOUs.PeerOUIdentifier.Certificate = raw
325+
nodeOUs.PeerOuIdentifier.Certificate = raw
326326
}
327327
}
328328
} else {
@@ -347,7 +347,7 @@ func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.M
347347
CryptoConfig: cryptoConfig,
348348
TlsRootCerts: tlsCACerts,
349349
TlsIntermediateCerts: tlsIntermediateCerts,
350-
FabricNodeOUs: nodeOUs,
350+
FabricNodeOus: nodeOUs,
351351
}
352352

353353
fmpsjs, _ := proto.Marshal(fmspconf)
@@ -379,7 +379,7 @@ func GetIdemixMspConfig(dir string, ID string) (*msp.MSPConfig, error) {
379379

380380
idemixConfig := &msp.IdemixMSPConfig{
381381
Name: ID,
382-
IPk: ipkBytes,
382+
Ipk: ipkBytes,
383383
RevocationPk: revocationPkBytes,
384384
}
385385

msp/idemixmsp.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (msp *idemixmsp) Setup(conf1 *m.MSPConfig) error {
9898
mspLogger.Debugf("Setting up Idemix MSP instance %s", msp.name)
9999

100100
ipk := new(idemix.IssuerPublicKey)
101-
err = proto.Unmarshal(conf.IPk, ipk)
101+
err = proto.Unmarshal(conf.Ipk, ipk)
102102
if err != nil {
103103
return errors.Wrap(err, "failed to unmarshal ipk from idemix msp config")
104104
}
@@ -266,7 +266,7 @@ func (msp *idemixmsp) deserializeIdentityInternal(serializedID []byte) (Identity
266266
Nym := FP256BN.NewECPbigs(FP256BN.FromBytes(serialized.NymX), FP256BN.FromBytes(serialized.NymY))
267267

268268
ou := &m.OrganizationUnit{}
269-
err = proto.Unmarshal(serialized.OU, ou)
269+
err = proto.Unmarshal(serialized.Ou, ou)
270270
if err != nil {
271271
return nil, errors.Wrap(err, "cannot deserialize the OU of the identity")
272272
}
@@ -542,7 +542,7 @@ func (id *idemixidentity) Serialize() ([]byte, error) {
542542
return nil, errors.Wrapf(err, "could not marshal role of identity %s", id.id)
543543
}
544544

545-
serialized.OU = ouBytes
545+
serialized.Ou = ouBytes
546546
serialized.Role = roleBytes
547547

548548
serialized.Proof, err = proto.Marshal(id.associationProof)

msp/idemixmsp_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestSetupBad(t *testing.T) {
9797
assert.NoError(t, err)
9898
ipkBytes, err := proto.Marshal(key.Ipk)
9999
assert.NoError(t, err)
100-
idemixconfig.IPk = ipkBytes
100+
idemixconfig.Ipk = ipkBytes
101101

102102
idemixConfigBytes, err := proto.Marshal(idemixconfig)
103103
assert.NoError(t, err)
@@ -109,7 +109,7 @@ func TestSetupBad(t *testing.T) {
109109

110110
// Create MSP config with bad IPK bytes
111111
ipkBytes = []byte("barf")
112-
idemixconfig.IPk = ipkBytes
112+
idemixconfig.Ipk = ipkBytes
113113

114114
idemixConfigBytes, err = proto.Marshal(idemixconfig)
115115
assert.NoError(t, err)

msp/mspimplsetup.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -228,24 +228,24 @@ func (msp *bccspmsp) finalizeSetupCAs(config *m.FabricMSPConfig) error {
228228
}
229229

230230
func (msp *bccspmsp) setupNodeOUs(config *m.FabricMSPConfig) error {
231-
if config.FabricNodeOUs != nil {
231+
if config.FabricNodeOus != nil {
232232

233-
msp.ouEnforcement = config.FabricNodeOUs.Enable
233+
msp.ouEnforcement = config.FabricNodeOus.Enable
234234

235235
// ClientOU
236-
msp.clientOU = &OUIdentifier{OrganizationalUnitIdentifier: config.FabricNodeOUs.ClientOUIdentifier.OrganizationalUnitIdentifier}
237-
if len(config.FabricNodeOUs.ClientOUIdentifier.Certificate) != 0 {
238-
certifiersIdentifier, err := msp.getCertifiersIdentifier(config.FabricNodeOUs.ClientOUIdentifier.Certificate)
236+
msp.clientOU = &OUIdentifier{OrganizationalUnitIdentifier: config.FabricNodeOus.ClientOuIdentifier.OrganizationalUnitIdentifier}
237+
if len(config.FabricNodeOus.ClientOuIdentifier.Certificate) != 0 {
238+
certifiersIdentifier, err := msp.getCertifiersIdentifier(config.FabricNodeOus.ClientOuIdentifier.Certificate)
239239
if err != nil {
240240
return err
241241
}
242242
msp.clientOU.CertifiersIdentifier = certifiersIdentifier
243243
}
244244

245245
// PeerOU
246-
msp.peerOU = &OUIdentifier{OrganizationalUnitIdentifier: config.FabricNodeOUs.PeerOUIdentifier.OrganizationalUnitIdentifier}
247-
if len(config.FabricNodeOUs.PeerOUIdentifier.Certificate) != 0 {
248-
certifiersIdentifier, err := msp.getCertifiersIdentifier(config.FabricNodeOUs.PeerOUIdentifier.Certificate)
246+
msp.peerOU = &OUIdentifier{OrganizationalUnitIdentifier: config.FabricNodeOus.PeerOuIdentifier.OrganizationalUnitIdentifier}
247+
if len(config.FabricNodeOus.PeerOuIdentifier.Certificate) != 0 {
248+
certifiersIdentifier, err := msp.getCertifiersIdentifier(config.FabricNodeOus.PeerOuIdentifier.Certificate)
249249
if err != nil {
250250
return err
251251
}

orderer/common/msgprocessor/expiration_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func createIdemixIdentity(t *testing.T) []byte {
5050
idemixId := &msp.SerializedIdemixIdentity{
5151
NymX: []byte{1, 2, 3},
5252
NymY: []byte{1, 2, 3},
53-
OU: []byte("OU1"),
53+
Ou: []byte("OU1"),
5454
}
5555
idemixBytes, err := proto.Marshal(idemixId)
5656
assert.NoError(t, err)

protos/msp/identities.pb.go

+28-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/msp/identities.proto

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ message SerializedIdentity {
2828
// The IdemixMSP will first serialize an idemix identity to bytes using
2929
// this proto, and then uses these bytes as id_bytes in SerializedIdentity
3030
message SerializedIdemixIdentity {
31-
// NymX is the X-component of the pseudonym elliptic curve point.
31+
// nym_x is the X-component of the pseudonym elliptic curve point.
3232
// It is a []byte representation of an amcl.BIG
3333
// The pseudonym can be seen as a public key of the identity, it is used to verify signatures.
34-
bytes NymX = 1;
34+
bytes nym_x = 1;
3535

36-
// NymY is the Y-component of the pseudonym elliptic curve point.
36+
// nym_y is the Y-component of the pseudonym elliptic curve point.
3737
// It is a []byte representation of an amcl.BIG
3838
// The pseudonym can be seen as a public key of the identity, it is used to verify signatures.
39-
bytes NymY = 2;
39+
bytes nym_y = 2;
4040

41-
// OU contains the organizational unit of the idemix identity
42-
bytes OU = 3;
41+
// ou contains the organizational unit of the idemix identity
42+
bytes ou = 3;
4343

44-
// Role contains the role of this identity (e.g., ADMIN or MEMBER)
45-
bytes Role = 4;
44+
// role contains the role of this identity (e.g., ADMIN or MEMBER)
45+
bytes role = 4;
4646

47-
// Proof contains the cryptographic evidence that this identity is valid
48-
bytes Proof = 5;
47+
// proof contains the cryptographic evidence that this identity is valid
48+
bytes proof = 5;
4949
}

0 commit comments

Comments
 (0)