From 843227d063960da510e0a3bae4105a1d6a1ff954 Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 3 Jan 2024 15:25:10 -0300 Subject: [PATCH 01/12] added makefile step for test-rosetta-ci --- .github/issue_labeler.yml | 2 -- .github/pr_labeler.yml | 2 -- .github/workflows/build.yml | 5 +---- .github/workflows/pr_labeler.yml | 18 ------------------ .github/workflows/rosetta-cli-test.yaml | 2 +- .github/workflows/test.yml | 3 +-- Makefile | 14 +++++++++----- README.md | 2 +- scripts/simapp-start-node.sh | 10 ++++++++++ 9 files changed, 23 insertions(+), 35 deletions(-) delete mode 100644 .github/issue_labeler.yml delete mode 100644 .github/pr_labeler.yml delete mode 100644 .github/workflows/pr_labeler.yml create mode 100644 scripts/simapp-start-node.sh diff --git a/.github/issue_labeler.yml b/.github/issue_labeler.yml deleted file mode 100644 index cd0e254..0000000 --- a/.github/issue_labeler.yml +++ /dev/null @@ -1,2 +0,0 @@ -needs-triage: # if no label is set then set triage - - '' diff --git a/.github/pr_labeler.yml b/.github/pr_labeler.yml deleted file mode 100644 index b646f19..0000000 --- a/.github/pr_labeler.yml +++ /dev/null @@ -1,2 +0,0 @@ -"C:Rosetta": - - /**/* \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b7409f..4ce9078 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,9 +37,6 @@ jobs: **/go.sum **/Makefile Makefile - ################### - #### Build App #### - ################### - name: Build if: env.GIT_DIFF run: GOARCH=${{ matrix.go-arch }} make build @@ -48,4 +45,4 @@ jobs: ################### - name: Build Rosetta if: env.GIT_DIFF - run: GOARCH=${{ matrix.go-arch }} make rosetta \ No newline at end of file + run: GOARCH=${{ matrix.go-arch }} make build \ No newline at end of file diff --git a/.github/workflows/pr_labeler.yml b/.github/workflows/pr_labeler.yml deleted file mode 100644 index 885d8b4..0000000 --- a/.github/workflows/pr_labeler.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: "Pull Request Labeler" -on: - - pull_request_target - -permissions: - contents: read - -jobs: - labeler: - permissions: - contents: read # for actions/labeler to determine modified files - pull-requests: write # for actions/labeler to add labels to PRs - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@main - with: - configuration-path: .github/pr_labeler.yml - repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/rosetta-cli-test.yaml b/.github/workflows/rosetta-cli-test.yaml index f98986b..3d4ce1c 100644 --- a/.github/workflows/rosetta-cli-test.yaml +++ b/.github/workflows/rosetta-cli-test.yaml @@ -39,7 +39,7 @@ jobs: - name: Check blockchain status run: curl localhost:26657/status - name: Build Rosetta - run: go mod tidy && make rosetta && make plugin + run: go mod tidy && make build && make plugin - name: Run Rosetta service run: ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & - name: Wait for rosetta boot up for 30 secs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c068d55..77b092d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,5 +37,4 @@ jobs: - name: tests if: env.GIT_DIFF run: | - make plugin && make test - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic ./... + make plugin && make test \ No newline at end of file diff --git a/Makefile b/Makefile index bf1c812..b3f53c4 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ #!/usr/bin/make -f -all: build - -rosetta: - go build -mod=readonly ./cmd/rosetta +all: build plugin test test-rosetta-ci build: go build -mod=readonly ./cmd/rosetta @@ -12,7 +9,14 @@ plugin: cd plugins/cosmos-hub && make plugin test: - go test -mod=readonly ./... + go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic ./... + +test-rosetta-ci: + sh ./scripts/simapp-start-node.sh & + go mod tidy && make build && make plugin + ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & + sleep 30 + sh ./tests/rosetta-cli/rosetta-cli-test.sh ############################################################################### ### Linting ### diff --git a/README.md b/README.md index 936666f..de74d98 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Install Rosetta standalone server with the following command: go install github.com/cosmos/rosetta ``` -Alternatively, for building from source, simply run `make rosetta`. The binary will be located in the root folder. +Alternatively, for building from source, simply run `make build`. The binary will be located in the root folder. ### Native - As a node command diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh new file mode 100644 index 0000000..b046546 --- /dev/null +++ b/scripts/simapp-start-node.sh @@ -0,0 +1,10 @@ +git clone https://github.com/cosmos/cosmos-sdk.git +# shellcheck disable=SC2164 +cd cosmos-sdk +make build +export SIMD_BIN=./build/simd +make init-simapp --dry-run +$SIMD_BIN start +until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do + sleep 1 +done \ No newline at end of file From df7d298fb55180e70787676240909c9d769722c2 Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 3 Jan 2024 16:17:28 -0300 Subject: [PATCH 02/12] downsized github workflow --- .github/workflows/rosetta-cli-test.yaml | 38 ++----------------------- Makefile | 10 +++---- 2 files changed, 6 insertions(+), 42 deletions(-) diff --git a/.github/workflows/rosetta-cli-test.yaml b/.github/workflows/rosetta-cli-test.yaml index 3d4ce1c..5d37345 100644 --- a/.github/workflows/rosetta-cli-test.yaml +++ b/.github/workflows/rosetta-cli-test.yaml @@ -19,41 +19,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: '^1.21.1' - - name: Get cosmos-sdk repo - uses: actions/checkout@v4 - with: - repository: cosmos/cosmos-sdk - ref: main - path: './cosmos-sdk' - - name: set up simapp - run: - cd cosmos-sdk && - make build && - export SIMD_BIN=./build/simd && - make init-simapp - - name: Run simapp - run: ./cosmos-sdk/build/simd start & - - name: Wait for simd to boot up for 2 mins and produce blocks - run: sleep 120s - shell: bash - - name: Check blockchain status - run: curl localhost:26657/status - - name: Build Rosetta - run: go mod tidy && make build && make plugin - - name: Run Rosetta service - run: ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & - - name: Wait for rosetta boot up for 30 secs - run: sleep 30s - shell: bash - - name: Check rosetta status - run: curl localhost:8080/block - - name: Generate wallets and transactions - run: - export SIMD_BIN=./cosmos-sdk/build/simd && - chmod +x ./tests/rosetta-cli/data.sh && - ./tests/rosetta-cli/data.sh - shell: bash - - name: Test rosetta through Rosetta-cli + - name: Run make test-rosetta-ci run: - make rosetta-cli + make test-rosetta-ci shell: bash \ No newline at end of file diff --git a/Makefile b/Makefile index b3f53c4..b9fe83f 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,9 @@ build: plugin: cd plugins/cosmos-hub && make plugin +docker: + docker build . --tag rosetta + test: go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic ./... @@ -16,6 +19,7 @@ test-rosetta-ci: go mod tidy && make build && make plugin ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & sleep 30 + export SIMD_BIN=./cosmos-sdk/build/simd && chmod +x ./tests/rosetta-cli/data.sh && sh ./tests/rosetta-cli/data.sh sh ./tests/rosetta-cli/rosetta-cli-test.sh ############################################################################### @@ -34,9 +38,3 @@ lint-fix: @./scripts/go-lint-all.bash --fix .PHONY: all build rosetta test lint lint-fix - -docker: - docker build . --tag rosetta - -rosetta-cli: - ./tests/rosetta-cli/rosetta-cli-test.sh \ No newline at end of file From 52117f5c7d36172f36b1bcd7925965d4d0fed64c Mon Sep 17 00:00:00 2001 From: Carlos Santiago Yanzon <27785807+bizk@users.noreply.github.com> Date: Mon, 8 Jan 2024 16:32:24 -0300 Subject: [PATCH 03/12] Update Makefile Co-authored-by: Ezequiel Raynaudo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b9fe83f..19137d1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/make -f -all: build plugin test test-rosetta-ci +all: build plugin build: go build -mod=readonly ./cmd/rosetta From 68e2e65cb2d1d3f204c098d2f2f9e8b1538722cb Mon Sep 17 00:00:00 2001 From: bizk Date: Tue, 9 Jan 2024 20:33:38 -0300 Subject: [PATCH 04/12] fixed makefile message --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 19137d1..f6a4d0d 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ test: test-rosetta-ci: sh ./scripts/simapp-start-node.sh & - go mod tidy && make build && make plugin + make build && make plugin ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & sleep 30 export SIMD_BIN=./cosmos-sdk/build/simd && chmod +x ./tests/rosetta-cli/data.sh && sh ./tests/rosetta-cli/data.sh From 4bf54e5ce08cdee4dfc53471b7f63f92ef3060ea Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 10 Jan 2024 14:30:10 -0300 Subject: [PATCH 05/12] debugging workflow --- Makefile | 2 +- scripts/simapp-start-node.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f6a4d0d..f7aa988 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,10 @@ test: test-rosetta-ci: sh ./scripts/simapp-start-node.sh & + sleep 30 make build && make plugin ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & sleep 30 - export SIMD_BIN=./cosmos-sdk/build/simd && chmod +x ./tests/rosetta-cli/data.sh && sh ./tests/rosetta-cli/data.sh sh ./tests/rosetta-cli/rosetta-cli-test.sh ############################################################################### diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh index b046546..30a706a 100644 --- a/scripts/simapp-start-node.sh +++ b/scripts/simapp-start-node.sh @@ -6,5 +6,6 @@ export SIMD_BIN=./build/simd make init-simapp --dry-run $SIMD_BIN start until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do + echo "trying" sleep 1 done \ No newline at end of file From 54169bfc9d090f425b2a14b974a0c21639548e00 Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 10 Jan 2024 14:34:47 -0300 Subject: [PATCH 06/12] debug --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f7aa988..274dbe5 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ test: test-rosetta-ci: sh ./scripts/simapp-start-node.sh & - sleep 30 + sleep 120 make build && make plugin ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & sleep 30 @@ -31,7 +31,7 @@ golangci_version=v1.51.2 lint: @echo "--> Running linter" @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) - @./scripts/go-lint-all.bash --timeout=15m + @./scripts/gog-lint-all.bash --timeout=15m lint-fix: @echo "--> Running linter" @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) From 3ac81b7085f37de45f04f16dc14d1337a172f284 Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 10 Jan 2024 14:40:29 -0300 Subject: [PATCH 07/12] debug --- Makefile | 2 +- scripts/simapp-start-node.sh | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 274dbe5..62f6a13 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ test: go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic ./... test-rosetta-ci: - sh ./scripts/simapp-start-node.sh & + sh ./scripts/simapp-start-node.sh sleep 120 make build && make plugin ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh index 30a706a..6205f97 100644 --- a/scripts/simapp-start-node.sh +++ b/scripts/simapp-start-node.sh @@ -5,7 +5,6 @@ make build export SIMD_BIN=./build/simd make init-simapp --dry-run $SIMD_BIN start -until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do - echo "trying" +until curl --silent --head --fail http://localhost:26657/health; do sleep 1 done \ No newline at end of file From ea39d32c5a34a123b1fc551fe7faa59aa55e5527 Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 10 Jan 2024 15:01:20 -0300 Subject: [PATCH 08/12] debug --- scripts/simapp-start-node.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh index 6205f97..cd809d2 100644 --- a/scripts/simapp-start-node.sh +++ b/scripts/simapp-start-node.sh @@ -4,7 +4,9 @@ cd cosmos-sdk make build export SIMD_BIN=./build/simd make init-simapp --dry-run -$SIMD_BIN start +echo "simapp started" +$SIMD_BIN start & +echo "start" until curl --silent --head --fail http://localhost:26657/health; do sleep 1 done \ No newline at end of file From 32202926330fb96c1395e7fa1898984f1810a738 Mon Sep 17 00:00:00 2001 From: bizk Date: Mon, 15 Jan 2024 19:14:46 -0300 Subject: [PATCH 09/12] merge with main --- Makefile | 3 +-- scripts/simapp-start-node.sh | 8 ++++---- tests/rosetta-cli/data.sh | 29 ----------------------------- 3 files changed, 5 insertions(+), 35 deletions(-) delete mode 100644 tests/rosetta-cli/data.sh diff --git a/Makefile b/Makefile index 62f6a13..9b9a8cb 100644 --- a/Makefile +++ b/Makefile @@ -16,11 +16,10 @@ test: test-rosetta-ci: sh ./scripts/simapp-start-node.sh - sleep 120 make build && make plugin ./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090" & sleep 30 - sh ./tests/rosetta-cli/rosetta-cli-test.sh + export SIMD_BIN=./cosmos-sdk/build/simd && sh ./tests/rosetta-cli/rosetta-cli-test.sh ############################################################################### ### Linting ### diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh index cd809d2..aac6e4a 100644 --- a/scripts/simapp-start-node.sh +++ b/scripts/simapp-start-node.sh @@ -3,10 +3,10 @@ git clone https://github.com/cosmos/cosmos-sdk.git cd cosmos-sdk make build export SIMD_BIN=./build/simd -make init-simapp --dry-run -echo "simapp started" +chmod 777 ./scripts/init-simapp.sh +sh ./scripts/init-simapp.sh --just-print $SIMD_BIN start & -echo "start" -until curl --silent --head --fail http://localhost:26657/health; do +until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do +>>>>>>> 7db5729 (Ci fixed (?)) sleep 1 done \ No newline at end of file diff --git a/tests/rosetta-cli/data.sh b/tests/rosetta-cli/data.sh deleted file mode 100644 index 8328f6b..0000000 --- a/tests/rosetta-cli/data.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -SIMD_BIN=${SIMD_BIN:=$(which simd 2>/dev/null)} - -if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run make install before"; exit 1; fi - -# Global variables -KEY_RING_BACKEND="test" -CHAIN_ID="demo" -amount_of_wallets=100 - -validator_address=$($SIMD_BIN keys show alice -a --keyring-backend "$KEY_RING_BACKEND") - -echo "[INFO] Generating wallets: $amount_of_wallets" -for ((index=0; index<"$amount_of_wallets"; index++)) -do - random_number=$((1 + RANDOM % 10000)) - - wallet_name="wallet-$random_number" - $SIMD_BIN keys add $wallet_name --keyring-backend "$KEY_RING_BACKEND" - wallet_address=$($SIMD_BIN keys show $wallet_name -a --keyring-backend "$KEY_RING_BACKEND") - echo "[DEBUG] Generated wallet: $wallet_name - $wallet_address" - - amount="$((RANDOM*10))stake" - echo "[DEBUG] Generating tx from validator: $validator_address sending $amount to $wallet_address" - $SIMD_BIN tx bank send "$validator_address" "$wallet_address" "$amount" --chain-id "$CHAIN_ID" --keyring-backend "$KEY_RING_BACKEND" -y - - sleep 1s # Wait so the TXs can happen in different blocks -done From e09017fff9da67055f21132f9bd5309f9e3760c7 Mon Sep 17 00:00:00 2001 From: bizk Date: Mon, 15 Jan 2024 19:21:05 -0300 Subject: [PATCH 10/12] removed merge typo --- scripts/simapp-start-node.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh index aac6e4a..1e099ff 100644 --- a/scripts/simapp-start-node.sh +++ b/scripts/simapp-start-node.sh @@ -7,6 +7,5 @@ chmod 777 ./scripts/init-simapp.sh sh ./scripts/init-simapp.sh --just-print $SIMD_BIN start & until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do ->>>>>>> 7db5729 (Ci fixed (?)) sleep 1 done \ No newline at end of file From 0fbf3c4be19e61b3bf1d6f59c7059570063946b0 Mon Sep 17 00:00:00 2001 From: bizk Date: Thu, 18 Jan 2024 11:28:48 -0300 Subject: [PATCH 11/12] added checkout to cosmos-sdk versioning --- .github/workflows/rosetta-cli-test.yaml | 1 + scripts/simapp-start-node.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/rosetta-cli-test.yaml b/.github/workflows/rosetta-cli-test.yaml index 5d37345..8453983 100644 --- a/.github/workflows/rosetta-cli-test.yaml +++ b/.github/workflows/rosetta-cli-test.yaml @@ -21,5 +21,6 @@ jobs: go-version: '^1.21.1' - name: Run make test-rosetta-ci run: + COSMOS_SDK_VERSION=v0.50.3 make test-rosetta-ci shell: bash \ No newline at end of file diff --git a/scripts/simapp-start-node.sh b/scripts/simapp-start-node.sh index 1e099ff..c327c46 100644 --- a/scripts/simapp-start-node.sh +++ b/scripts/simapp-start-node.sh @@ -1,6 +1,7 @@ git clone https://github.com/cosmos/cosmos-sdk.git # shellcheck disable=SC2164 cd cosmos-sdk +git checkout "$COSMOS_SDK_VERSION" make build export SIMD_BIN=./build/simd chmod 777 ./scripts/init-simapp.sh From 5384d4f1b27e4289f6e5f53077eeaea6956e4751 Mon Sep 17 00:00:00 2001 From: bizk Date: Thu, 18 Jan 2024 11:29:47 -0300 Subject: [PATCH 12/12] fix makefile typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9b9a8cb..7789f61 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ golangci_version=v1.51.2 lint: @echo "--> Running linter" @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version) - @./scripts/gog-lint-all.bash --timeout=15m + @./scripts/go-lint-all.bash --timeout=15m lint-fix: @echo "--> Running linter" @go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)