diff --git a/internal/peer/chaincode/chaincode.go b/internal/peer/chaincode/chaincode.go index 109d673a80c..b6ac9bf80bd 100644 --- a/internal/peer/chaincode/chaincode.go +++ b/internal/peer/chaincode/chaincode.go @@ -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" ) @@ -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() @@ -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 diff --git a/internal/peer/chaincode/common.go b/internal/peer/chaincode/common.go index f1612dc3f8f..55bb5923535 100644 --- a/internal/peer/chaincode/common.go +++ b/internal/peer/chaincode/common.go @@ -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{} diff --git a/internal/peer/chaincode/common_test.go b/internal/peer/chaincode/common_test.go index 5bbada3c12a..fa82a02e36b 100644 --- a/internal/peer/chaincode/common_test.go +++ b/internal/peer/chaincode/common_test.go @@ -26,7 +26,6 @@ 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" @@ -34,24 +33,6 @@ import ( "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"