From 554aace60bee9a32346da3f9e74cf7f198348fc1 Mon Sep 17 00:00:00 2001 From: Denis Date: Thu, 11 Apr 2024 18:30:20 +0400 Subject: [PATCH] Merge change from x/compliance for build --- .github/workflows/build-ci-multiplatform.yml | 1 + .github/workflows/build-deb.yml | 11 +++++----- docker/deb.Dockerfile | 2 +- go-sgxvm/internal/api/lib_nosgx.go | 22 +++++++++++--------- sgxvm/Makefile | 2 +- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-ci-multiplatform.yml b/.github/workflows/build-ci-multiplatform.yml index 72c75616..205f4c1a 100644 --- a/.github/workflows/build-ci-multiplatform.yml +++ b/.github/workflows/build-ci-multiplatform.yml @@ -3,6 +3,7 @@ name: Build CI multiplatform on: push: branches: [ feat/x-compliance, '**-release' ] + workflow_dispatch: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} diff --git a/.github/workflows/build-deb.yml b/.github/workflows/build-deb.yml index 181a876c..97b35647 100644 --- a/.github/workflows/build-deb.yml +++ b/.github/workflows/build-deb.yml @@ -3,12 +3,13 @@ name: Build Deb on: push: branches: [ feat/x-compliance, '**-release' ] + workflow_dispatch: env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} jobs: build-deb: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: SGX_MODE: HW steps: @@ -44,9 +45,9 @@ jobs: target: build-deb - name: Run .deb Package Image run: | - docker run -e VERSION=${{ steps.get_version.outputs.version-without-v }} -v $GITHUB_WORKSPACE/build:/build deb_build - cp build/swisstronik_${{ steps.get_version.outputs.version-without-v }}_amd64.deb swisstronik_${{ steps.get_version.outputs.version-without-v }}_amd64.deb + docker run -e VERSION=${{ steps.vars.outputs.short_sha }} -v $GITHUB_WORKSPACE/build:/build deb_build + cp build/swisstronik_${{ steps.vars.outputs.short_sha }}_amd64.deb swisstronik_${{ steps.vars.outputs.short_sha }}_${{ env.BRANCH_NAME }}_amd64.deb - uses: actions/upload-artifact@v3 with: - name: swisstronik_${{ steps.get_version.outputs.version-without-v }}_amd64.deb - path: swisstronik_${{ steps.get_version.outputs.version-without-v }}_amd64.deb \ No newline at end of file + name: swisstronik_${{ steps.vars.outputs.short_sha }}_${{ env.BRANCH_NAME }}_amd64.deb + path: swisstronik_${{ steps.vars.outputs.short_sha }}_${{ env.BRANCH_NAME }}_amd64.deb \ No newline at end of file diff --git a/docker/deb.Dockerfile b/docker/deb.Dockerfile index e9cd0a39..aa0437cf 100644 --- a/docker/deb.Dockerfile +++ b/docker/deb.Dockerfile @@ -18,7 +18,7 @@ RUN curl https://sh.rustup.rs -sSf | bash -s -- -y > /dev/null 2>&1 RUN cargo install protobuf-codegen --version "2.8.1" -f # Install golang -ADD https://go.dev/dl/go1.19.linux-amd64.tar.gz go.linux-amd64.tar.gz +ADD https://go.dev/dl/go1.22.1.linux-amd64.tar.gz go.linux-amd64.tar.gz RUN tar -C /usr/local -xzf go.linux-amd64.tar.gz && rm go.linux-amd64.tar.gz RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest > /dev/null 2>&1 diff --git a/go-sgxvm/internal/api/lib_nosgx.go b/go-sgxvm/internal/api/lib_nosgx.go index d91d9f1c..18ba75f5 100644 --- a/go-sgxvm/internal/api/lib_nosgx.go +++ b/go-sgxvm/internal/api/lib_nosgx.go @@ -8,9 +8,10 @@ package api import "C" import ( - "net" "github.com/SigmaGmbH/librustgo/types" ethtypes "github.com/ethereum/go-ethereum/core/types" + "math/rand" + "net" ) // Value types @@ -32,6 +33,13 @@ type cu8_ptr = *C.uint8_t // Connector is our custom connector type Connector = types.Connector +func CheckNodeStatus() error { + return nil +} +func RequestMasterKey(host string, port int, isDCAP bool) error { + return nil +} + // IsNodeInitialized checks if node was initialized and master key was sealed func IsNodeInitialized() (bool, error) { return false, nil @@ -58,7 +66,9 @@ func RequestSeed(hostname string, port int) error { // GetNodePublicKey handles request for node public key func GetNodePublicKey() (*types.NodePublicKeyResponse, error) { - return nil, nil + key := make([]byte, 32) + rand.Read(key) + return &types.NodePublicKeyResponse{PublicKey: key}, nil } // Call handles incoming call to contract or transfer of value @@ -89,11 +99,3 @@ func Create( func StartAttestationServer(epidAddress, dcapAddress string) error { return nil } - -func CheckNodeStatus() error { - return nil -} - -func RequestMasterKey(host string, port int, isDCAP bool) error { - return nil -} \ No newline at end of file diff --git a/sgxvm/Makefile b/sgxvm/Makefile index 10b895ea..f89a086e 100644 --- a/sgxvm/Makefile +++ b/sgxvm/Makefile @@ -77,7 +77,7 @@ define compile_unsigned_enclave @echo "Compile into unsinged enclave" @g++ $(CURDIR)/Enclave_t.o -o $(CURDIR)/enclave.unsigned.so -Wl,--no-undefined -nostdlib -nodefaultlibs -nostartfiles -L/opt/intel/sgxsdk/lib64 \ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive \ - -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_dcap_tvl -l$(Service_Library_Name) -lsgx_tcrypto -lsgx_tprotected_fs -lpthread \ + -Wl,--start-group -lsgx_tstdc -lsgx_tcxx -lsgx_dcap_tvl -l$(Service_Library_Name) -lsgx_tcrypto -lsgx_tprotected_fs -lsgx_pthread \ -L$(CURDIR)/sgx-artifacts/lib -lenclave -Wl,--end-group -Wl,--version-script=$(CURDIR)/Enclave.lds -Wl,-z,relro,-z,now,-z,noexecstack -Wl,-Bstatic -Wl,-Bsymbolic \ -Wl,--no-undefined -Wl,-pie,-eenclave_entry -Wl,--export-dynamic -Wl,--gc-sections -Wl,--defsym,__ImageBase=0 endef