Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/integrate with cc tools #779

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9994daa
feat: integrate with cc-tools-demo
osamamagdy Aug 14, 2024
c6b9259
fix: resolve conflict
osamamagdy Aug 14, 2024
5bf43ed
fix: export FPC and CCAAS envs
osamamagdy Aug 14, 2024
f369725
feat: ccapi is working
osamamagdy Sep 8, 2024
1f860dc
add uodate external connection script
osamamagdy Sep 15, 2024
a13460d
handle corner cases
osamamagdy Sep 15, 2024
8892936
edit script
osamamagdy Sep 15, 2024
c395ce2
add cc-tools-demo tutorial
osamamagdy Sep 27, 2024
2838217
add readme for the cc-tools-demo tutorial
osamamagdy Sep 27, 2024
237a3b1
rename ccapi and FPC_MODE
osamamagdy Sep 27, 2024
9bf539a
fixing documentation
osamamagdy Oct 2, 2024
db0cb7f
edit
osamamagdy Oct 2, 2024
a064eb0
fix: fix go.mod
osamamagdy Oct 11, 2024
5ed35d4
fix: upgrade fabric-sdk-go
osamamagdy Oct 11, 2024
8250fbf
fix: resolve comments
osamamagdy Oct 15, 2024
1ec09a9
revert go.mod and go.sum changes
osamamagdy Oct 15, 2024
ed720cd
fix: revert changes of the protos
osamamagdy Oct 15, 2024
171ea9c
fix: add the right ccapi
osamamagdy Oct 18, 2024
57a9ff3
fix: return Error for not implemented functions
osamamagdy Oct 18, 2024
c710be0
docs: add tutorial for ccapi
osamamagdy Oct 18, 2024
ae668f1
comments resolved
osamamagdy Oct 21, 2024
1ae8062
Merge branch 'main' into feature/integrate-with-cc-tools
osamamagdy Oct 22, 2024
934b941
move ccapi to another PR
osamamagdy Oct 22, 2024
e027bcf
fix: edit error message
osamamagdy Oct 22, 2024
3c62109
fix: ignore the linter for protobuf
osamamagdy Oct 25, 2024
cdbf3d8
feat: edit readme
osamamagdy Nov 1, 2024
6d8ac47
Merge branch 'feature/integrate-with-cc-tools' of https://github.com/…
osamamagdy Nov 1, 2024
5f5eaa9
fix: update makefile variable setting
osamamagdy Nov 5, 2024
60efa3a
docs: add note about org names
osamamagdy Nov 6, 2024
63fe3dd
Merge branch 'main' into feature/integrate-with-cc-tools
osamamagdy Nov 6, 2024
8bd3cfd
docs: edit readme
osamamagdy Nov 6, 2024
31d982d
fix: rename enclave.json
osamamagdy Nov 8, 2024
ae77fce
fix: edit readme
osamamagdy Nov 8, 2024
9c485b8
fix: remove unwanted step
osamamagdy Nov 14, 2024
99ab55e
docs: edit note
osamamagdy Nov 22, 2024
1085cd2
chore: change ccToolsDemoEnclave.json path
osamamagdy Nov 22, 2024
42f1fef
feat: pass file paths to Makefile from terminal
osamamagdy Nov 22, 2024
c3150b6
fix: edit readme notes
osamamagdy Nov 25, 2024
e11d630
feat: relocate extra compose file
osamamagdy Nov 26, 2024
06e1453
fix: sudo commands
osamamagdy Nov 29, 2024
62409a0
Update samples/chaincode/cc-tools-demo/README.md
osamamagdy Nov 29, 2024
d16dc4b
Update samples/chaincode/cc-tools-demo/README.md
osamamagdy Nov 29, 2024
2e80ab2
fix: fix typo
osamamagdy Nov 29, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
!ecc/ecc
!ecc_go/ecc_go
!ecc_go/enclave.json
!ecc_go/ccToolsDemoEnclave.json
!ecc_enclave/_build/lib/libsgxcc.so
# note: docker seems to have troubles with '+' in filenames in this file, at least in exceptions ..
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ cscope.*
common/protos
internal/protos
coverage.out
vendor
7 changes: 4 additions & 3 deletions ecc_go/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,22 @@ HW_EXTENSION=$(shell if [ "${SGX_MODE}" = "HW" ]; then echo "-hw"; fi)
DOCKER_IMAGE ?= fpc/$(CC_NAME)${HW_EXTENSION}
DOCKER_FILE ?= $(FPC_PATH)/ecc_go/Dockerfile
EGO_CONFIG_FILE ?= $(FPC_PATH)/ecc_go/enclave.json
ECC_MAIN_FILES ?= main.go
ECC_BINARY ?= ecc
ECC_BUNDLE ?= $(ECC_BINARY)-bundle

build: ecc docker env

ecc: ecc_dependencies
ego-go build $(GOTAGS) -o $(ECC_BINARY) main.go
cp $(EGO_CONFIG_FILE) .
ego-go build $(GOTAGS) -o $(ECC_BINARY) $(ECC_MAIN_FILES)
cp $(EGO_CONFIG_FILE) ./enclave.json
ego sign
ego uniqueid $(ECC_BINARY) > mrenclave
ego bundle $(ECC_BINARY) $(ECC_BUNDLE)

.PHONY: with_go
with_go: ecc_dependencies
$(GO) build $(GOTAGS) -o $(ECC_BUNDLE) main.go
$(GO) build $(GOTAGS) -o $(ECC_BUNDLE) $(ECC_MAIN_FILES)
echo "fake_mrenclave" > mrenclave

ecc_dependencies:
Expand Down
27 changes: 23 additions & 4 deletions ecc_go/chaincode/enclave_go/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ SPDX-License-Identifier: Apache-2.0
package enclave_go

import (
"fmt"
//lint:ignore SA1019 the package is needed to unmarshall the header
protoV1 "github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-private-chaincode/internal/utils"
common "github.com/hyperledger/fabric-protos-go/common"
pb "github.com/hyperledger/fabric-protos-go/peer"

"google.golang.org/protobuf/proto"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
)

Expand Down Expand Up @@ -177,7 +183,7 @@ func (f *FpcStubInterface) SplitCompositeKey(compositeKey string) (string, []str
}

func (f *FpcStubInterface) GetQueryResult(query string) (shim.StateQueryIteratorInterface, error) {
panic("not implemented") // TODO: Implement
return nil, fmt.Errorf("function not yet supported")
}

func (f *FpcStubInterface) GetQueryResultWithPagination(query string, pageSize int32, bookmark string) (shim.StateQueryIteratorInterface, *pb.QueryResponseMetadata, error) {
Expand Down Expand Up @@ -233,7 +239,7 @@ func (f *FpcStubInterface) GetCreator() ([]byte, error) {
}

func (f *FpcStubInterface) GetTransient() (map[string][]byte, error) {
panic("not implemented") // TODO: Implement
return nil, fmt.Errorf("function not yet supported")
}

func (f *FpcStubInterface) GetBinding() ([]byte, error) {
Expand All @@ -249,9 +255,22 @@ func (f *FpcStubInterface) GetSignedProposal() (*pb.SignedProposal, error) {
}

func (f *FpcStubInterface) GetTxTimestamp() (*timestamp.Timestamp, error) {
panic("not implemented") // TODO: Implement
hdr := &common.Header{}
proposal, Proposalerr := f.GetSignedProposal()
if Proposalerr != nil {
return nil, fmt.Errorf("error retrieving the proposal from the FPC Stub")
}
if err := proto.Unmarshal(proposal.ProposalBytes, protoV1.MessageV2(hdr)); err != nil {
return nil, fmt.Errorf("error unmarshaling Header: %s", err)
}

chdr := &common.ChannelHeader{}
if err := proto.Unmarshal(hdr.ChannelHeader, protoV1.MessageV2(chdr)); err != nil {
return nil, fmt.Errorf("error unmarshaling ChannelHeader: %s", err)
}
return chdr.GetTimestamp(), nil
}

func (f *FpcStubInterface) SetEvent(name string, payload []byte) error {
panic("not implemented") // TODO: Implement
return fmt.Errorf("function not yet supported")
}
Loading