Skip to content

Commit

Permalink
Added new proto files to replace structures that were manually made t…
Browse files Browse the repository at this point in the history
…o look like proto. These will be difficult to maintain in the future.

Signed-off-by: Fedor Partanskiy <fredprtnsk@gmail.com>
  • Loading branch information
pfi79 authored and denyeart committed Aug 26, 2024
1 parent e442909 commit 86a5fde
Show file tree
Hide file tree
Showing 12 changed files with 697 additions and 142 deletions.
18 changes: 0 additions & 18 deletions core/committer/txvalidator/v14/testdata/test_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,6 @@ func NewSampleValidationPlugin(t *testing.T) *SampleValidationPlugin {
return &SampleValidationPlugin{t: t}
}

type MarshaledSignedData struct {
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
}

func (sd *MarshaledSignedData) Reset() {
*sd = MarshaledSignedData{}
}

func (*MarshaledSignedData) String() string {
panic("implement me")
}

func (*MarshaledSignedData) ProtoMessage() {
panic("implement me")
}

func (p *SampleValidationPlugin) Validate(block *common.Block, namespace string, txPosition int, actionPosition int, contextData ...validation.ContextDatum) error {
txData := block.Data.Data[0]
txn := &MarshaledSignedData{}
Expand Down
98 changes: 98 additions & 0 deletions core/committer/txvalidator/v14/testdata/test_plugin.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions core/committer/txvalidator/v14/testdata/test_plugin.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

syntax = "proto3";

option go_package = "github.com/hyperledger/fabric/core/committer/txvalidator/v14/testdata";

package testdata;

message MarshaledSignedData {
bytes data = 1;
bytes signature = 2;
bytes identity = 3;
}
18 changes: 0 additions & 18 deletions core/committer/txvalidator/v20/testdata/test_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,6 @@ func NewSampleValidationPlugin(t *testing.T) *SampleValidationPlugin {
return &SampleValidationPlugin{t: t}
}

type MarshaledSignedData struct {
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
Identity []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
}

func (sd *MarshaledSignedData) Reset() {
*sd = MarshaledSignedData{}
}

func (*MarshaledSignedData) String() string {
panic("implement me")
}

func (*MarshaledSignedData) ProtoMessage() {
panic("implement me")
}

func (p *SampleValidationPlugin) Validate(block *common.Block, namespace string, txPosition int, actionPosition int, contextData ...validation.ContextDatum) error {
txData := block.Data.Data[0]
txn := &MarshaledSignedData{}
Expand Down
98 changes: 98 additions & 0 deletions core/committer/txvalidator/v20/testdata/test_plugin.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions core/committer/txvalidator/v20/testdata/test_plugin.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/

syntax = "proto3";

option go_package = "github.com/hyperledger/fabric/core/committer/txvalidator/v20/testdata";

package testdata;

message MarshaledSignedData {
bytes data = 1;
bytes signature = 2;
bytes identity = 3;
}
43 changes: 0 additions & 43 deletions core/common/ccprovider/ccprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,54 +353,11 @@ func GetInstalledChaincodes() (*pb.ChaincodeQueryResponse, error) {
return cqr, nil
}

// -------- ChaincodeData is stored on the LSCC -------

// ChaincodeData defines the datastructure for chaincodes to be serialized by proto
// Type provides an additional check by directing to use a specific package after instantiation
// Data is Type specific (see CDSPackage and SignedCDSPackage)
type ChaincodeData struct {
// Name of the chaincode
Name string `protobuf:"bytes,1,opt,name=name"`

// Version of the chaincode
Version string `protobuf:"bytes,2,opt,name=version"`

// Escc for the chaincode instance
Escc string `protobuf:"bytes,3,opt,name=escc"`

// Vscc for the chaincode instance
Vscc string `protobuf:"bytes,4,opt,name=vscc"`

// Policy endorsement policy for the chaincode instance
Policy []byte `protobuf:"bytes,5,opt,name=policy,proto3"`

// Data data specific to the package
Data []byte `protobuf:"bytes,6,opt,name=data,proto3"`

// Id of the chaincode that's the unique fingerprint for the CC This is not
// currently used anywhere but serves as a good eyecatcher
Id []byte `protobuf:"bytes,7,opt,name=id,proto3"`

// InstantiationPolicy for the chaincode
InstantiationPolicy []byte `protobuf:"bytes,8,opt,name=instantiation_policy,proto3"`
}

// ChaincodeID is the name by which the chaincode will register itself.
func (cd *ChaincodeData) ChaincodeID() string {
return cd.Name + ":" + cd.Version
}

// implement functions needed from proto.Message for proto's mar/unmarshal functions

// Reset resets
func (cd *ChaincodeData) Reset() { *cd = ChaincodeData{} }

// String converts to string
func (cd *ChaincodeData) String() string { return proto.CompactTextString(cd) }

// ProtoMessage just exists to make proto happy
func (*ChaincodeData) ProtoMessage() {}

// TransactionParams are parameters which are tied to a particular transaction
// and which are required for invoking chaincode.
type TransactionParams struct {
Expand Down
Loading

0 comments on commit 86a5fde

Please sign in to comment.