From 312af12e4d39006efb66128c2763a895075896de Mon Sep 17 00:00:00 2001 From: jiangyaoguo Date: Sat, 22 Apr 2017 12:58:00 +0800 Subject: [PATCH] [FAB-3334] Add ChaincodeID to ChaincodeAction Add ChaincodeID to ChaincodeAction, so that we can set it while endorsing proposal (FAB-3329) and validate version (FAB-3330) in committer. Make this minimal CR for following CRs could be committed concurrently. Change-Id: I16f8d8c2c0d06ce7cae155791665f98bb52fe000 Signed-off-by: jiangyaoguo --- protos/peer/proposal.pb.go | 72 +++++++++++++++++++++++--------------- protos/peer/proposal.proto | 7 ++++ 2 files changed, 50 insertions(+), 29 deletions(-) diff --git a/protos/peer/proposal.pb.go b/protos/peer/proposal.pb.go index 82f4acc1d7e..077880ed234 100644 --- a/protos/peer/proposal.pb.go +++ b/protos/peer/proposal.pb.go @@ -156,6 +156,12 @@ type ChaincodeAction struct { Events []byte `protobuf:"bytes,2,opt,name=events,proto3" json:"events,omitempty"` // This field contains the result of executing this invocation. Response *Response `protobuf:"bytes,3,opt,name=response" json:"response,omitempty"` + // This field contains the ChaincodeID of executing this invocation. Endorser + // will set it with the ChaincodeID called by endorser while simulating proposal. + // Committer will validate the version matching with latest chaincode version. + // Adding ChaincodeID to keep version opens up the possibility of multiple + // ChaincodeAction per transaction. + ChaincodeId *ChaincodeID `protobuf:"bytes,4,opt,name=chaincode_id,json=chaincodeId" json:"chaincode_id,omitempty"` } func (m *ChaincodeAction) Reset() { *m = ChaincodeAction{} } @@ -170,6 +176,13 @@ func (m *ChaincodeAction) GetResponse() *Response { return nil } +func (m *ChaincodeAction) GetChaincodeId() *ChaincodeID { + if m != nil { + return m.ChaincodeId + } + return nil +} + func init() { proto.RegisterType((*SignedProposal)(nil), "protos.SignedProposal") proto.RegisterType((*Proposal)(nil), "protos.Proposal") @@ -181,33 +194,34 @@ func init() { func init() { proto.RegisterFile("peer/proposal.proto", fileDescriptor7) } var fileDescriptor7 = []byte{ - // 438 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x64, 0x53, 0x5b, 0x6b, 0xd4, 0x40, - 0x14, 0x66, 0x77, 0xb1, 0x97, 0xb3, 0x6b, 0x2f, 0xd3, 0x22, 0x61, 0xe9, 0x43, 0x09, 0x08, 0x15, - 0x34, 0x81, 0x15, 0x44, 0x7c, 0x11, 0x57, 0x0b, 0xf6, 0x41, 0x28, 0x51, 0xfb, 0xd0, 0x97, 0x75, - 0x92, 0x1c, 0x93, 0xa1, 0x71, 0x66, 0x9c, 0x99, 0x2c, 0xe6, 0xd1, 0x9f, 0xe7, 0xbf, 0x92, 0x64, - 0x2e, 0xdd, 0x76, 0x9f, 0x76, 0xcf, 0xf9, 0x2e, 0xe7, 0x36, 0x81, 0x13, 0x89, 0xa8, 0x52, 0xa9, - 0x84, 0x14, 0x9a, 0x36, 0x89, 0x54, 0xc2, 0x08, 0xb2, 0x33, 0xfc, 0xe8, 0xf9, 0xe9, 0x00, 0x16, - 0x35, 0x65, 0xbc, 0x10, 0x25, 0x5a, 0x74, 0x7e, 0xf6, 0x40, 0xb2, 0x52, 0xa8, 0xa5, 0xe0, 0xda, - 0xa1, 0xf1, 0x77, 0x38, 0xf8, 0xca, 0x2a, 0x8e, 0xe5, 0xb5, 0x23, 0x90, 0xe7, 0x70, 0x10, 0xc8, - 0x79, 0x67, 0x50, 0x47, 0xa3, 0xf3, 0xd1, 0xc5, 0x2c, 0x7b, 0xea, 0xb3, 0xcb, 0x3e, 0x49, 0xce, - 0x60, 0x5f, 0xb3, 0x8a, 0x53, 0xd3, 0x2a, 0x8c, 0xc6, 0x03, 0xe3, 0x3e, 0x11, 0xdf, 0xc2, 0x5e, - 0x30, 0x7c, 0x06, 0x3b, 0x35, 0xd2, 0x12, 0x95, 0x33, 0x72, 0x11, 0x89, 0x60, 0x57, 0xd2, 0xae, - 0x11, 0xb4, 0x74, 0x7a, 0x1f, 0xf6, 0xde, 0xf8, 0xc7, 0x20, 0xd7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e5, - 0xb3, 0xc0, 0x58, 0xfe, 0x80, 0x58, 0xa8, 0x2a, 0xa9, 0x3b, 0x89, 0xaa, 0xc1, 0xb2, 0x42, 0x95, - 0xfc, 0xa4, 0xb9, 0x62, 0x85, 0xd7, 0xf4, 0x6f, 0x76, 0x79, 0x78, 0xbf, 0x8a, 0xe2, 0x8e, 0x56, - 0x78, 0xfb, 0xa2, 0x62, 0xa6, 0x6e, 0xf3, 0xa4, 0x10, 0xbf, 0xd2, 0x0d, 0x6d, 0x6a, 0xb5, 0xa9, - 0xd5, 0xa6, 0xbd, 0x36, 0xb7, 0xdf, 0xc4, 0xeb, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x47, 0x68, - 0x89, 0x7a, 0x31, 0x03, 0x00, 0x00, + // 452 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0x96, 0x93, 0xf7, 0xed, 0xc7, 0x24, 0xf4, 0x63, 0x5b, 0x21, 0x2b, 0xea, 0xa1, 0xb2, 0x84, + 0x54, 0x24, 0xb0, 0xa5, 0x20, 0x21, 0xc4, 0x05, 0x11, 0xa8, 0x44, 0x0f, 0x48, 0x95, 0x81, 0x1e, + 0x7a, 0x09, 0x6b, 0x7b, 0x70, 0x56, 0x35, 0xbb, 0xab, 0xdd, 0x75, 0x84, 0x8f, 0xfc, 0x1c, 0x7e, + 0x0a, 0xff, 0x0a, 0xd9, 0xfb, 0xd1, 0x94, 0x5c, 0x38, 0x25, 0x33, 0xf3, 0x3c, 0xcf, 0xcc, 0x3c, + 0xb3, 0x86, 0x13, 0x89, 0xa8, 0x32, 0xa9, 0x84, 0x14, 0x9a, 0x36, 0xa9, 0x54, 0xc2, 0x08, 0xb2, + 0x33, 0xfc, 0xe8, 0xd9, 0xe9, 0x50, 0x2c, 0x57, 0x94, 0xf1, 0x52, 0x54, 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, 0xe6, 0xf3, 0xad, 0x56, 0x7f, 0xa9, 0xa5, 0x9b, 0xa4, 0x4b, 0x6e, 0x54, 0x97, 0x3f, + 0xd0, 0x99, 0xbd, 0x81, 0xe3, 0x2d, 0x08, 0x39, 0x82, 0xf1, 0x1d, 0xda, 0xbd, 0xf7, 0xf3, 0xfe, + 0x6f, 0x3f, 0xd4, 0x9a, 0x36, 0xad, 0xbf, 0x95, 0x0d, 0x5e, 0x8f, 0x5e, 0x45, 0xc9, 0xaf, 0x08, + 0x0e, 0x43, 0xf7, 0xb7, 0xa5, 0xe9, 0x6d, 0x8c, 0x61, 0x57, 0xa1, 0x6e, 0x1b, 0xe3, 0xaf, 0xef, + 0xc3, 0xfe, 0x9a, 0xb8, 0x46, 0x6e, 0xb4, 0x13, 0x72, 0x11, 0x79, 0x06, 0x7b, 0xfe, 0x69, 0x0d, + 0x27, 0x9b, 0xcc, 0x8f, 0xfc, 0x6a, 0xb9, 0xcb, 0xe7, 0x01, 0xb1, 0xe5, 0xfb, 0x7f, 0xff, 0xe6, + 0xfb, 0xe2, 0x2b, 0x24, 0x42, 0xd5, 0xe9, 0xaa, 0x93, 0xa8, 0x1a, 0xac, 0x6a, 0x54, 0xe9, 0x37, + 0x5a, 0x28, 0x56, 0x7a, 0x66, 0xff, 0xd8, 0x17, 0x87, 0xf7, 0x1e, 0x96, 0x77, 0xb4, 0xc6, 0xdb, + 0xa7, 0x35, 0x33, 0xab, 0xb6, 0x48, 0x4b, 0xf1, 0x3d, 0xdb, 0xe0, 0x66, 0x96, 0x9b, 0x59, 0x6e, + 0xd6, 0x73, 0x0b, 0xfb, 0x31, 0xbd, 0xf8, 0x13, 0x00, 0x00, 0xff, 0xff, 0x12, 0x75, 0xb6, 0xaf, + 0x6a, 0x03, 0x00, 0x00, } diff --git a/protos/peer/proposal.proto b/protos/peer/proposal.proto index a036712a153..657266da82b 100644 --- a/protos/peer/proposal.proto +++ b/protos/peer/proposal.proto @@ -263,4 +263,11 @@ message ChaincodeAction { // This field contains the result of executing this invocation. Response response = 3; + + // This field contains the ChaincodeID of executing this invocation. Endorser + // will set it with the ChaincodeID called by endorser while simulating proposal. + // Committer will validate the version matching with latest chaincode version. + // Adding ChaincodeID to keep version opens up the possibility of multiple + // ChaincodeAction per transaction. + ChaincodeID chaincode_id = 4; }