From b6bf4d2257f1ee3af490d6b32ef2941de6159096 Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 21:26:55 +0200 Subject: [PATCH 01/11] Add integration tests on PR --- .github/workflows/test.yaml | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1d210ef5..930bf495 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,7 @@ on: - main workflow_dispatch: -name: Test +name: Tests jobs: test: runs-on: ubuntu-latest @@ -19,9 +19,37 @@ jobs: - name: Setup go uses: actions/setup-go@v2 with: - go-version: "1.19.3" + go-version: 1.21.0 - name: Run Test run: | go test ./... -covermode=count -coverprofile=coverage.out go tool cover -func=coverage.out -o=coverage.out + + integration-tests: + name: integration tests + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + + - name: Set up Go 1.21.0 + uses: actions/setup-go@v2 + with: + go-version: 1.21.0 + + - name: Install Blockless Runtime + run: | + mkdir -p /app/runtime + curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz + tar xzf runtime.tar.gz -C /app/runtime + rm runtime.tar.gz + + - name: Run integration tests + run: | + export B7S_INTEG_RUNTIME_DIR=/app/runtime + go test --integration ./... -covermode=count -coverprofile=coverage.out + go tool cover -func=coverage.out -o=coverage.out From 9073dc04c7d109696642b1f204bfb10298756a42 Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 21:30:13 +0200 Subject: [PATCH 02/11] Change path for blockless runtime setup --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 930bf495..f0bafccb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -43,13 +43,13 @@ jobs: - name: Install Blockless Runtime run: | - mkdir -p /app/runtime + mkdir -p /tmp/blockless-runtime curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz - tar xzf runtime.tar.gz -C /app/runtime + tar xzf runtime.tar.gz -C /tmp/blockless-runtime rm runtime.tar.gz - name: Run integration tests run: | - export B7S_INTEG_RUNTIME_DIR=/app/runtime - go test --integration ./... -covermode=count -coverprofile=coverage.out + export B7S_INTEG_RUNTIME_DIR=/tmp/blockless-runtime + go test --integration ./... go tool cover -func=coverage.out -o=coverage.out From c5266f09296c8dbdb79b13467a188f4d8814c2bb Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 21:31:55 +0200 Subject: [PATCH 03/11] Fix go test tag --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f0bafccb..3caac177 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -51,5 +51,5 @@ jobs: - name: Run integration tests run: | export B7S_INTEG_RUNTIME_DIR=/tmp/blockless-runtime - go test --integration ./... + go test --tags=integration ./... go tool cover -func=coverage.out -o=coverage.out From ca2a9f8c0e58ddcec0fc74f4e7b6bb090e2904e5 Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 21:35:21 +0200 Subject: [PATCH 04/11] Remove cover function --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 3caac177..9971fd40 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -52,4 +52,3 @@ jobs: run: | export B7S_INTEG_RUNTIME_DIR=/tmp/blockless-runtime go test --tags=integration ./... - go tool cover -func=coverage.out -o=coverage.out From e1578e5eac7977468fa2745df0b9e574eddc6d1c Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 21:52:57 +0200 Subject: [PATCH 05/11] LibSSL fix --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9971fd40..858a5234 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -47,6 +47,8 @@ jobs: curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz tar xzf runtime.tar.gz -C /tmp/blockless-runtime rm runtime.tar.gz + curl -o ./libssl.deb -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb + dpkg -i ./libssl.deb - name: Run integration tests run: | From b0a2b2a684e1288b4792913792804e99ed7b1007 Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 21:59:27 +0200 Subject: [PATCH 06/11] Change how openssl is installed --- .github/workflows/test.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 858a5234..245916bc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -40,15 +40,18 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.21.0 - + + - name: Install OpenSSL + run: | + sudo apt update + sudo apt install -y libssl1.1=1.1.0g-2ubuntu4 + - name: Install Blockless Runtime run: | mkdir -p /tmp/blockless-runtime curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz tar xzf runtime.tar.gz -C /tmp/blockless-runtime rm runtime.tar.gz - curl -o ./libssl.deb -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb - dpkg -i ./libssl.deb - name: Run integration tests run: | From 41cd4dd7d08e77c1c84dfe0a607a50cb71429fdf Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 22:14:37 +0200 Subject: [PATCH 07/11] Tweak libssl version --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 245916bc..6cca85a1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -44,7 +44,7 @@ jobs: - name: Install OpenSSL run: | sudo apt update - sudo apt install -y libssl1.1=1.1.0g-2ubuntu4 + sudo apt install -y libssl1.1=1.1.0g - name: Install Blockless Runtime run: | From 77ebb34c62d55369785b5585cd0b4e5ea463dae2 Mon Sep 17 00:00:00 2001 From: Maelkum Date: Mon, 4 Sep 2023 22:19:28 +0200 Subject: [PATCH 08/11] Use older Ubuntu version for integ tests --- .github/workflows/test.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6cca85a1..f2cabfbc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,7 +28,8 @@ jobs: integration-tests: name: integration tests - runs-on: ubuntu-latest + # Run on older Ubuntu version because of older LibSSL dependency. + runs-on: ubuntu-20.04 steps: - name: Checkout Code uses: actions/checkout@v2 @@ -41,11 +42,6 @@ jobs: with: go-version: 1.21.0 - - name: Install OpenSSL - run: | - sudo apt update - sudo apt install -y libssl1.1=1.1.0g - - name: Install Blockless Runtime run: | mkdir -p /tmp/blockless-runtime From e0315c62dfcea4b430872b4acd111c121a54408a Mon Sep 17 00:00:00 2001 From: Maelkum Date: Tue, 5 Sep 2023 10:57:35 +0200 Subject: [PATCH 09/11] Quote go version string + libssl tweak on ubuntu latest --- .github/workflows/test.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f2cabfbc..c2f7f530 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,7 +19,7 @@ jobs: - name: Setup go uses: actions/setup-go@v2 with: - go-version: 1.21.0 + go-version: "1.21.0" - name: Run Test run: | @@ -29,7 +29,7 @@ jobs: integration-tests: name: integration tests # Run on older Ubuntu version because of older LibSSL dependency. - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v2 @@ -40,7 +40,7 @@ jobs: - name: Set up Go 1.21.0 uses: actions/setup-go@v2 with: - go-version: 1.21.0 + go-version: "1.21.0" - name: Install Blockless Runtime run: | @@ -48,6 +48,8 @@ jobs: curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz tar xzf runtime.tar.gz -C /tmp/blockless-runtime rm runtime.tar.gz + curl -o ./libssl.deb -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb + sudo dpkg -i ./libssl.deb - name: Run integration tests run: | From 1e54ad0d93e72fdc2eb467d4ff61c58e940dd40e Mon Sep 17 00:00:00 2001 From: Maelkum Date: Tue, 5 Sep 2023 15:47:48 +0200 Subject: [PATCH 10/11] Use latest runtime + compatible version of Ubuntu --- .github/workflows/test.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c2f7f530..a2707ef6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -29,7 +29,7 @@ jobs: integration-tests: name: integration tests # Run on older Ubuntu version because of older LibSSL dependency. - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout Code uses: actions/checkout@v2 @@ -45,11 +45,9 @@ jobs: - name: Install Blockless Runtime run: | mkdir -p /tmp/blockless-runtime - curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz + curl -L -o runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.ubuntu-20.04.x86_64.tar.gz tar xzf runtime.tar.gz -C /tmp/blockless-runtime rm runtime.tar.gz - curl -o ./libssl.deb -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb - sudo dpkg -i ./libssl.deb - name: Run integration tests run: | From ad19fc359b55a079a30676061fb551748149194c Mon Sep 17 00:00:00 2001 From: Maelkum Date: Wed, 6 Sep 2023 08:02:55 +0200 Subject: [PATCH 11/11] Update version of runtime --- Makefile | 2 +- cmd/node/README.md | 2 +- docker/Dockerfile | 2 +- docker/integration-tests/Dockerfile.testing | 2 +- executor/execute_function.go | 3 +-- models/blockless/runtime.go | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index cada67b9..1b528b8d 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,6 @@ clean: setup: @echo "\n📥 Downloading and extracting runtime...\n" mkdir -p /tmp/runtime - wget -O /tmp/blockless-runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.0.12/blockless-runtime.linux-latest.x86_64.tar.gz + wget -O /tmp/blockless-runtime.tar.gz https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.linux-latest.x86_64.tar.gz tar -xzf /tmp/blockless-runtime.tar.gz -C /tmp/runtime @echo "\n✅ Done.\n" diff --git a/cmd/node/README.md b/cmd/node/README.md index 5ac86d14..716a33fc 100644 --- a/cmd/node/README.md +++ b/cmd/node/README.md @@ -61,7 +61,7 @@ Database used to persist Node data between runs will be created in the `peer-dat On the other hand, Node will persist function data in the default database, in the `function-db` subdirectory. Blockless Runtime path is given as `~/.local/bin`. -At startup, node will check if the Blockless Runtime is actually found there, namely the [blockless-cli](https://blockless.network/docs/cli). +At startup, node will check if the Blockless Runtime is actually found there, namely the [bls-runtime](https://blockless.network/docs/protocol/runtime). Node Identity will be determined by the private key found in `priv.bin` file in the `keys` subdirectory. diff --git a/docker/Dockerfile b/docker/Dockerfile index b464cf28..9b5d58e3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,7 +11,7 @@ RUN curl -o ./gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/ RUN chmod 755 gomplate # get the runtime -RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.0.13/blockless-runtime.ubuntu-20.04.x86_64.tar.gz +RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.ubuntu-20.04.x86_64.tar.gz RUN mkdir /app/runtime && tar -xvkf ./runtime.tar.gz -C /app/runtime # install blockchain client diff --git a/docker/integration-tests/Dockerfile.testing b/docker/integration-tests/Dockerfile.testing index 67eae7d9..dd39f251 100644 --- a/docker/integration-tests/Dockerfile.testing +++ b/docker/integration-tests/Dockerfile.testing @@ -15,7 +15,7 @@ RUN rm -rf /usr/local/go && tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz ENV PATH=$PATH:/usr/local/go/bin # get the runtime -RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.0.12/blockless-runtime.linux-latest.x86_64.tar.gz +RUN curl -o ./runtime.tar.gz -sSL https://github.com/blocklessnetwork/runtime/releases/download/v0.3.1/blockless-runtime.linux-latest.x86_64.tar.gz RUN mkdir /app/runtime && tar -xvkf ./runtime.tar.gz -C /app/runtime diff --git a/executor/execute_function.go b/executor/execute_function.go index 7c5b87fc..ae47e72e 100644 --- a/executor/execute_function.go +++ b/executor/execute_function.go @@ -35,8 +35,7 @@ func (e *Executor) ExecuteFunction(requestID string, req execute.Request) (execu } // executeFunction handles the actual execution of the Blockless function. It returns the -// standard output of the blockless-cli that handled the execution. `Function` -// typically takes this output and uses it to create the appropriate execution response. +// execution information like standard output, standard error, exit code and resource usage. func (e *Executor) executeFunction(requestID string, req execute.Request) (execute.RuntimeOutput, execute.Usage, error) { log := e.log.With().Str("request", requestID).Str("function", req.FunctionID).Logger() diff --git a/models/blockless/runtime.go b/models/blockless/runtime.go index 1be4ac97..9e056d97 100644 --- a/models/blockless/runtime.go +++ b/models/blockless/runtime.go @@ -5,7 +5,7 @@ import ( ) const ( - runtimeCLI = "blockless-cli" + runtimeCLI = "bls-runtime" ) // RuntimeCLI returns the name of the Blockless Runtime executable.