Skip to content

Commit

Permalink
Purge more stuff not necessary in FPC 1.0 (aka FPC Lite)
Browse files Browse the repository at this point in the history
* tlcc* and validation plugins, some related fabric
  makefile stuff
  (note: look at `pre-fpc-lite` & `ccr2.0.0` if you want
   pre-fpc-lite/fpc 1.0 code with original trusted-ledger
   and validation code ...)

Signed-off-by: Michael Steiner <[email protected]>
  • Loading branch information
g2flyer committed Dec 8, 2020
1 parent 89f489a commit 537f812
Show file tree
Hide file tree
Showing 61 changed files with 9 additions and 3,763 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
TOP = .
include $(TOP)/build.mk

SUB_DIRS = protos common internal ercc ecc_enclave ecc tlcc_enclave tlcc fabric examples utils integration # demo # docs
SUB_DIRS = protos common internal ercc ecc_enclave ecc fabric examples utils integration # demo # docs

FPC_SDK_DEP_DIRS = protos utils/fabric common ecc_enclave ecc
FPC_PEER_DEP_DIRS = protos common ercc tlcc_enclave tlcc fabric ecc_enclave ecc
# FPC_PEER_DEP_DIRS has to include ecc, ecc_enclave, common and ercc only if we run chaincode in external builder directly on host and not indirectly via docker
FPC_PEER_DEP_DIRS = protos common ercc fabric ecc_enclave ecc
# FPC_PEER_DEP_DIRS has to include protos, ecc, ecc_enclave, common and ercc only if we run chaincode in external builder directly on host and not indirectly via docker
FPC_PEER_CLI_WRAPPER_DEP_DIRS = utils/fabric


Expand Down
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export SGX_ARCH ?= x64
#--------------------------------------------------
# Give the option to override by custom protoc
# e.g. this is overloaded by travis and docker dev as we use protoc 3.11.4 to build
# protos in tlcc_enclave but use protoc 3.0.x to build SGX SDK and SSL
# protos in ecc_enclave but use protoc 3.0.x to build SGX SDK and SSL
export PROTOC_CMD ?= protoc

JAVA ?= java
Expand Down
19 changes: 3 additions & 16 deletions fabric/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ include $(TOP)/build.mk
FABRIC_VERSION ?= 2.2.0
FABRIC_VERSION_TAG =v$(FABRIC_VERSION)
FABRIC_PEER_BIN = $(FABRIC_PATH)/build/bin/peer
TLCC_GO_SRC = ${TOP}/tlcc/*.go
TLCC_ENCLAVE_DIR = ${TOP}/tlcc_enclave
TLCC_ENCLAVE_LIB = ${TLCC_ENCLAVE_DIR}/_build/libtl.so

FABRIC_PATCHED = $(FABRIC_PATH)/.fpc_patched
FABRIC_CURRENT_DIFF_COMMITS_CMD = git log $(FABRIC_VERSION_TAG)..HEAD --oneline
Expand All @@ -37,7 +34,7 @@ $(FABRIC_PATCHED): patches/*.patch $(FABRIC_PATH)/.git
$(GO) mod vendor

clean-patch:
# Note: for below to work with exit 0, this has to be a single shell command!
# Note: for below to work with exit 0, this has to be a single shell command!
@echo "Cleaning Fabric patches ..."; \
echo "(Warning: as go.{mod,sum} and vendor/ are auto-updated, we also (blindly) auto-reset them to committed version!)"; \
(cd $(FABRIC_PATH) && git checkout -- go.mod go.sum && git checkout HEAD -- vendor && git clean -fd vendor) || exit 1; \
Expand Down Expand Up @@ -74,25 +71,15 @@ clean-patch:
git reset --hard $(FABRIC_VERSION_TAG) && \
rm -f $(FABRIC_PATCHED) $(FABRIC_PATCHED).tmp

$(TLCC_ENCLAVE_LIB):
${MAKE} -C ${TLCC_ENCLAVE_DIR} build

peer: patch $(FABRIC_PEER_BIN)

$(FABRIC_PEER_BIN): $(TLCC_GO_SRC) $(TLCC_ENCLAVE_LIB) $(FABRIC_PATCHED)
# Note: above does not have enough dependencies to trigger a rebuild if (recursively)
# any TLCC and dependent code changes. however, it should at least make sure it will
# build properly if tlcc enclave is not yet built ..
$(FABRIC_PEER_BIN): $(FABRIC_PATCHED)
cd $(FABRIC_PATH) && \
env \
CGO_CFLAGS="-I${FPC_PATH}/common -I${FPC_PATH}/common/sgxcclib -I${FPC_PATH}/tlcc_enclave/trusted_ledger -I${FPC_PATH}/common/logging/untrusted" \
CGO_LDFLAGS="-L${FPC_PATH}/tlcc_enclave/_build/lib" \
GO_TAGS=FPC \
$(MAKE) peer

native: peer
cd $(FABRIC_PATH) && \
GOFLAGS="-mod=mod" $(MAKE) -j orderer cryptogen configtxgen
$(MAKE) -j orderer cryptogen configtxgen

clean: clean-native clean-patch

Expand Down
16 changes: 1 addition & 15 deletions fabric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,13 @@ https://creativecommons.org/licenses/by/4.0/

# Build Fabric with FPC support

To build the Fabric peer manually make sure you have built [tlcc_enclave](../tlcc_enclave) before.
Then run the following command:
Run the following command:

$ cd $FPC_PATH/fabric
$ make

## Common errors

### TLCC not built yet

```
# github.com/hyperledger/fabric/cmd/peer
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -ltl
collect2: error: ld returned 1 exit status
```

Seems that the Trusted Ledger has not been built before.
Try to run `pushd $FPC_PATH/tlcc_enclave; make; popd;` followed by `make` again.


### Wrong Fabric version
```
Patching Fabric ...
Expand Down
44 changes: 0 additions & 44 deletions fabric/patches.disabled/3_0001-Add-FPC-validator-to-library.patch

This file was deleted.

1 change: 0 additions & 1 deletion internal/utils/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func ReplayReadWrites(stub shim.ChaincodeStubInterface, rwset *kvrwset.KVRWSet)

func Validate(responseMsg *protos.ChaincodeResponseMessage, readset, writeset [][]byte, attestedData *protos.AttestedData) error {
// Note: below signature was created in ecc_enclave/enclave/enclave.cpp::gen_response
// see also replicated verification in tlcc_enclave/enclave/ledger.cpp::int parse_endorser_transaction (for TLCC)
hash := ComputedHash(responseMsg, readset, writeset)

// perform enclave signature validation
Expand Down
1 change: 0 additions & 1 deletion scripts/cpplinter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ FILES_TO_PARSE=`find $SCRIPTDIR/.. -iname *.cpp -o -iname *.h -o -iname *.c`
RET=0

EXCLUDED_PATTERNS="\
tlcc_enclave/nanopb \
common/protobuf \
common/base64 \
common/json \
Expand Down
8 changes: 0 additions & 8 deletions tlcc/.gitignore

This file was deleted.

15 changes: 0 additions & 15 deletions tlcc/Makefile

This file was deleted.

32 changes: 0 additions & 32 deletions tlcc/README.md

This file was deleted.

18 changes: 0 additions & 18 deletions tlcc/enclave/Makefile

This file was deleted.

Loading

0 comments on commit 537f812

Please sign in to comment.