Skip to content

Commit

Permalink
Remove unused variables and functions
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Barger <artem@bargr.net>
  • Loading branch information
C0rWin committed Jan 3, 2024
1 parent 64fefb4 commit 19109bc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 64 deletions.
9 changes: 0 additions & 9 deletions internal/peer/chaincode/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/internal/peer/common"
"github.com/hyperledger/fabric/internal/peer/packaging"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
Expand All @@ -25,12 +24,6 @@ const (

var logger = flogging.MustGetLogger("chaincodeCmd")

// XXX This is a terrible singleton hack, however
// it simply making a latent dependency explicit.
// It should be removed along with the other package
// scoped variables
var platformRegistry = packaging.NewRegistry(packaging.SupportedPlatforms...)

func addFlags(cmd *cobra.Command) {
common.AddOrdererFlags(cmd)
flags := cmd.PersistentFlags()
Expand Down Expand Up @@ -59,11 +52,9 @@ var (
channelID string
chaincodeVersion string
policy string
policyMarshalled []byte
transient string
isInit bool
collectionsConfigFile string
collectionConfigBytes []byte
peerAddresses []string
tlsRootCertFiles []string
connectionProfile string
Expand Down
36 changes: 0 additions & 36 deletions internal/peer/chaincode/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,6 @@ import (
"github.com/spf13/viper"
)

// checkSpec to see if chaincode resides within current package capture for language.
func checkSpec(spec *pb.ChaincodeSpec) error {
// Don't allow nil value
if spec == nil {
return errors.New("expected chaincode specification, nil received")
}
if spec.ChaincodeId == nil {
return errors.New("expected chaincode ID, nil received")
}

return platformRegistry.ValidateSpec(spec.Type.String(), spec.ChaincodeId.Path)
}

// getChaincodeDeploymentSpec get chaincode deployment spec given the chaincode spec
func getChaincodeDeploymentSpec(spec *pb.ChaincodeSpec, crtPkg bool) (*pb.ChaincodeDeploymentSpec, error) {
var codePackageBytes []byte
if crtPkg {
var err error
if err = checkSpec(spec); err != nil {
return nil, err
}

codePackageBytes, err = platformRegistry.GetDeploymentPayload(spec.Type.String(), spec.ChaincodeId.Path)
if err != nil {
return nil, errors.WithMessage(err, "error getting chaincode package bytes")
}
chaincodePath, err := platformRegistry.NormalizePath(spec.Type.String(), spec.ChaincodeId.Path)
if err != nil {
return nil, errors.WithMessage(err, "failed to normalize chaincode path")
}
spec.ChaincodeId.Path = chaincodePath
}

return &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec, CodePackage: codePackageBytes}, nil
}

// getChaincodeSpec get chaincode spec from the cli cmd parameters
func getChaincodeSpec(cmd *cobra.Command) (*pb.ChaincodeSpec, error) {
spec := &pb.ChaincodeSpec{}
Expand Down
19 changes: 0 additions & 19 deletions internal/peer/chaincode/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,13 @@ import (
"github.com/hyperledger/fabric/core/config/configtest"
"github.com/hyperledger/fabric/internal/peer/chaincode/mock"
"github.com/hyperledger/fabric/internal/peer/common"
"github.com/hyperledger/fabric/internal/pkg/identity"
msptesttools "github.com/hyperledger/fabric/msp/mgmt/testtools"
. "github.com/onsi/gomega"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
)

//go:generate counterfeiter -o mock/signer_serializer.go --fake-name SignerSerializer . signerSerializer

type signerSerializer interface {
identity.SignerSerializer
}

//go:generate counterfeiter -o mock/deliver.go --fake-name Deliver . deliver

type deliver interface {
pb.Deliver_DeliverClient
}

//go:generate counterfeiter -o mock/deliver_client.go --fake-name PeerDeliverClient . peerDeliverClient

type peerDeliverClient interface {
pb.DeliverClient
}

func TestCheckChaincodeCmdParamsWithNewCallingSchema(t *testing.T) {
chaincodeCtorJSON = `{ "Args":["func", "param"] }`
chaincodePath = "some/path"
Expand Down

0 comments on commit 19109bc

Please sign in to comment.