Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5334c9e
feat(extension/fsc): add FSC extension submodule for FPC integration
PsychoPunkSage May 26, 2026
366c9f7
feat(integration/echo): add echo FSC integration test via extension/fsc
PsychoPunkSage May 26, 2026
52eb794
fix(topology): migrate FPC topology helpers from FSC to extension/fsc
PsychoPunkSage May 26, 2026
44f3e20
fix(tests): register FPC platform factory via extension/fs
PsychoPunkSage May 26, 2026
5fd8996
fix(views): redirect FPC service imports from FSC to extension/fsc
PsychoPunkSage May 26, 2026
f023f3f
chore(deps): wire extension/fsc module and local FSC replace directives
PsychoPunkSage May 26, 2026
a450bdd
chore(makefile): add echo to integration test targets
PsychoPunkSage May 26, 2026
9fc9d09
chore: Updated imports
PsychoPunkSage May 26, 2026
f643e14
fix: fix Makefile
PsychoPunkSage May 26, 2026
957864a
Bump the actions-deps group across 1 directory with 2 updates
dependabot[bot] Mar 16, 2026
afabf9b
chore(build): bump Fabric version from 2.5.9 to 3.1.4
PsychoPunkSage Jun 24, 2026
a80926f
chore(deps): migrate from fabric monolith to split packages (fabric-c…
PsychoPunkSage Jun 24, 2026
0aacad5
chore(protos): regenerate protobuf bindings for apiv2
PsychoPunkSage Jun 25, 2026
7cf9aea
chore(imports): update internal packages to fabric-chaincode-go/v2 an…
PsychoPunkSage Jun 25, 2026
335c5df
chore(imports): update ecc and ercc to fabric-chaincode-go/v2
PsychoPunkSage Jun 26, 2026
abd0b67
chore(imports): update ecc_go and client_sdk to fabric-chaincode-go/v2
PsychoPunkSage Jun 26, 2026
9e5e80a
fix(integration): update go_chaincode tests for fabric-chaincode-go/v…
PsychoPunkSage Jun 27, 2026
f576ef1
chore(samples): update samples and demos to fabric-chaincode-go/v2
PsychoPunkSage Jun 28, 2026
124409d
chore(deps): update extension/fsc and FSC deployment module dependencies
PsychoPunkSage Jun 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
with:
go-version-file: 'go.mod'

- uses: dorny/paths-filter@v3
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
#
- name: Login to the ${{ env.DOCKER_REGISTRY }} Container Registry
if: env.PUSH_TO_MAIN == 'true' && steps.filter.outputs.docker == 'true'
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion client_sdk/go/pkg/core/contract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/hyperledger/fabric-private-chaincode/internal/crypto"
"github.com/hyperledger/fabric-private-chaincode/internal/utils"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric-lib-go/common/flogging"
)

var logger = flogging.MustGetLogger("fpc-client-contract")
Expand Down
4 changes: 2 additions & 2 deletions client_sdk/go/pkg/core/contract/contract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
fpccontract "github.com/hyperledger/fabric-private-chaincode/client_sdk/go/pkg/core/contract"
"github.com/hyperledger/fabric-private-chaincode/client_sdk/go/pkg/core/contract/fakes"
"github.com/hyperledger/fabric-private-chaincode/internal/crypto"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric/protoutil"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/hyperledger/fabric-x-common/protoutil"
"github.com/stretchr/testify/assert"
)

Expand Down
8 changes: 0 additions & 8 deletions client_sdk/go/pkg/core/contract/fakes/contract.go

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

2 changes: 0 additions & 2 deletions client_sdk/go/pkg/core/contract/fakes/contract_provider.go

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

4 changes: 0 additions & 4 deletions client_sdk/go/pkg/core/contract/fakes/encryption_context.go

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

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

2 changes: 0 additions & 2 deletions client_sdk/go/pkg/core/contract/fakes/transaction.go

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

2 changes: 1 addition & 1 deletion client_sdk/go/pkg/core/lifecycle/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SPDX-License-Identifier: Apache-2.0
package lifecycle

import (
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric-lib-go/common/flogging"
"github.com/pkg/errors"

"github.com/hyperledger/fabric-private-chaincode/client_sdk/go/pkg/sgx"
Expand Down
4 changes: 0 additions & 4 deletions client_sdk/go/pkg/core/lifecycle/fakes/channelclient.go

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

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

56 changes: 51 additions & 5 deletions client_sdk/go/pkg/fab/ccpackager/packager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,67 @@ package ccpackager

import (
"archive/tar"
"bufio"
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"os"
"path/filepath"
"regexp"
"strings"

"github.com/hyperledger/fabric-private-chaincode/client_sdk/go/pkg/sgx"
"github.com/hyperledger/fabric-private-chaincode/internal/utils"
"github.com/hyperledger/fabric/core/chaincode/persistence"
"github.com/hyperledger/fabric/core/chaincode/platforms/util"
"github.com/pkg/errors"
)

// labelRegexp controls the allowed characters for a chaincode label.
var labelRegexp = regexp.MustCompile(`^[[:alnum:]][[:alnum:]_.+-]*$`)

func validateLabel(label string) error {
if !labelRegexp.MatchString(label) {
return errors.Errorf("invalid label '%s'. Label must be non-empty, can only consist of alphanumerics, symbols from '.+-_', and can only begin with alphanumerics", label)
}
return nil
}

func writeFileToPackage(localpath string, packagepath string, tw *tar.Writer) error {
fd, err := os.Open(localpath)
if err != nil {
return fmt.Errorf("%s: %s", localpath, err)
}
defer fd.Close()

fi, err := fd.Stat()
if err != nil {
return fmt.Errorf("%s: %s", localpath, err)
}

header, err := tar.FileInfoHeader(fi, localpath)
if err != nil {
return fmt.Errorf("failed calculating FileInfoHeader: %s", err)
}

header.Name = packagepath
header.Mode = 0100644
header.Uid = 500
header.Gid = 500
header.Uname = ""
header.Gname = ""

if err = tw.WriteHeader(header); err != nil {
return fmt.Errorf("failed to write header for %s: %s", localpath, err)
}

_, err = io.Copy(tw, bufio.NewReader(fd))
if err != nil {
return fmt.Errorf("failed to write %s as %s: %s", localpath, packagepath, err)
}
return nil
}

const (
codePackageName = "code.tar.gz"
metadataPackageName = "metadata.json"
Expand Down Expand Up @@ -132,7 +178,7 @@ func validateRegularPackageInput(p *Descriptor) error {
return errors.Errorf("SGXMode must be set either to %s or %s, actual: %s", sgx.SGXModeHwType, sgx.SGXModeSimType, p.SGXMode)
}

if err := persistence.ValidateLabel(p.Label); err != nil {
if err := validateLabel(p.Label); err != nil {
return err
}
return nil
Expand All @@ -145,7 +191,7 @@ func validateCaaSPackageInput(p *Descriptor) error {
return errors.Wrap(err, "CaaSEndpoint is invalid")
}

if err := persistence.ValidateLabel(p.Label); err != nil {
if err := validateLabel(p.Label); err != nil {
return err
}
return nil
Expand Down Expand Up @@ -284,7 +330,7 @@ func getDeploymentPayload(ccPath string) ([]byte, error) {
tw := tar.NewWriter(gw)

for _, file := range files {
err = util.WriteFileToPackage(filepath.Join(file.Path, file.Name), file.Name, tw)
err = writeFileToPackage(filepath.Join(file.Path, file.Name), file.Name, tw)
if err != nil {
return nil, errors.Wrapf(err, "error writing %s to tar", file.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ PLANTUML_IMG_FORMAT ?= png # pdf / png / svg
#--------------------------------------------------
PROJECT_NAME=fabric-private-chaincode

export FABRIC_VERSION ?= 2.5.9
export FABRIC_VERSION ?= 3.1.4
export FABRIC_CA_VERSION ?= 1.5.12

export FPC_VERSION := main
Expand Down
24 changes: 12 additions & 12 deletions ecc/chaincode/ecc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"encoding/base64"
"fmt"

"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-private-chaincode/ecc/chaincode/ercc"
"github.com/hyperledger/fabric-private-chaincode/internal/endorsement"
"github.com/hyperledger/fabric-private-chaincode/internal/protos"
"github.com/hyperledger/fabric-private-chaincode/internal/utils"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/protoutil"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/hyperledger/fabric-lib-go/common/flogging"
"github.com/hyperledger/fabric-x-common/protoutil"
)

var logger = flogging.MustGetLogger("ecc")
Expand All @@ -31,12 +31,12 @@ type EnclaveChaincode struct {
}

// Init sets the chaincode state to "init"
func (t *EnclaveChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
func (t *EnclaveChaincode) Init(stub shim.ChaincodeStubInterface) *pb.Response {
return shim.Success(nil)
}

// Invoke receives transactions and forwards to op handlers
func (t *EnclaveChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
func (t *EnclaveChaincode) Invoke(stub shim.ChaincodeStubInterface) *pb.Response {
function, _ := stub.GetFunctionAndParameters()
logger.Infof("Invoke is running [%s]", function)

Expand All @@ -52,7 +52,7 @@ func (t *EnclaveChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response
}
}

func (t *EnclaveChaincode) initEnclave(stub shim.ChaincodeStubInterface) pb.Response {
func (t *EnclaveChaincode) initEnclave(stub shim.ChaincodeStubInterface) *pb.Response {
// extract all enclave inputs from invocation params
initMsg, err := t.Extractor.GetInitEnclaveMessage(stub)
if err != nil {
Expand Down Expand Up @@ -96,7 +96,7 @@ func (t *EnclaveChaincode) initEnclave(stub shim.ChaincodeStubInterface) pb.Resp
return shim.Success([]byte(base64.StdEncoding.EncodeToString(credentialsBytes)))
}

func (t *EnclaveChaincode) invoke(stub shim.ChaincodeStubInterface) pb.Response {
func (t *EnclaveChaincode) invoke(stub shim.ChaincodeStubInterface) *pb.Response {
var errMsg string

serializedChaincodeRequest, err := t.Extractor.GetSerializedChaincodeRequest(stub)
Expand All @@ -116,15 +116,15 @@ func (t *EnclaveChaincode) invoke(stub shim.ChaincodeStubInterface) pb.Response
signedChaincodeResponseMessageB64 := []byte(base64.StdEncoding.EncodeToString(signedChaincodeResponseMessage))
logger.Debugf("base64-encoded response message: '%s'", signedChaincodeResponseMessageB64)

var response pb.Response
var response *pb.Response
if errInvoke == nil {
response = pb.Response{
response = &pb.Response{
Status: shim.OK,
Payload: signedChaincodeResponseMessageB64,
Message: errMsg,
}
} else {
response = pb.Response{
response = &pb.Response{
Status: shim.ERROR,
Payload: signedChaincodeResponseMessageB64,
Message: errMsg,
Expand All @@ -134,7 +134,7 @@ func (t *EnclaveChaincode) invoke(stub shim.ChaincodeStubInterface) pb.Response
return response
}

func (t *EnclaveChaincode) endorse(stub shim.ChaincodeStubInterface) pb.Response {
func (t *EnclaveChaincode) endorse(stub shim.ChaincodeStubInterface) *pb.Response {

chaincodeParams, err := t.Extractor.GetChaincodeParams(stub)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions ecc/chaincode/ecc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"fmt"
"testing"

"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-private-chaincode/ecc/chaincode/ercc"
"github.com/hyperledger/fabric-private-chaincode/ecc/chaincode/fakes"
"github.com/hyperledger/fabric-private-chaincode/internal/endorsement"
"github.com/hyperledger/fabric-private-chaincode/internal/protos"
"github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/types/known/anypb"
)
Expand Down Expand Up @@ -262,7 +262,7 @@ func TestEndorse(t *testing.T) {
assert.EqualValues(t, []byte("OK"), r.Payload)
}

func expectError(t *testing.T, errorMsg string, r peer.Response) {
func expectError(t *testing.T, errorMsg string, r *peer.Response) {
assert.EqualValues(t, shim.ERROR, r.Status)
assert.EqualValues(t, errorMsg, r.Message)
}
2 changes: 1 addition & 1 deletion ecc/chaincode/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SPDX-License-Identifier: Apache-2.0
package chaincode

import (
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
)

type Enclave interface {
Expand Down
6 changes: 3 additions & 3 deletions ecc/chaincode/enclave/enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"fmt"
"unsafe"

"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric/protoutil"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-lib-go/common/flogging"
"github.com/hyperledger/fabric-x-common/protoutil"
"golang.org/x/sync/semaphore"
)

Expand Down
2 changes: 1 addition & 1 deletion ecc/chaincode/enclave/logging_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package enclave

import (
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric-lib-go/common/flogging"
)

// #cgo CFLAGS: -I${SRCDIR}/../../../common/logging/untrusted
Expand Down
6 changes: 3 additions & 3 deletions ecc/chaincode/enclave/mock_enclave.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
"fmt"
"strings"

"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-private-chaincode/internal/crypto"
"github.com/hyperledger/fabric-private-chaincode/internal/protos"
"github.com/hyperledger/fabric-protos-go/ledger/rwset/kvrwset"
"github.com/hyperledger/fabric/common/flogging"
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/kvrwset"
"github.com/hyperledger/fabric-lib-go/common/flogging"
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
Expand Down
2 changes: 1 addition & 1 deletion ecc/chaincode/enclave/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"sync"
"unsafe"

"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-private-chaincode/internal/utils"
)

Expand Down
2 changes: 1 addition & 1 deletion ecc/chaincode/ercc/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package ercc
import (
"fmt"

"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-chaincode-go/v2/shim"
"github.com/hyperledger/fabric-private-chaincode/internal/protos"
"github.com/hyperledger/fabric-private-chaincode/internal/utils"
)
Expand Down
Loading
Loading