From 998edbc8ac259d84b19ad1b23479da650385574c Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:14:55 -0500 Subject: [PATCH 01/12] test: ICS with custom module generation --- .github/workflows/reusable-e2e.yaml | 17 +++++++++++++++-- .github/workflows/spawn-e2e.yaml | 11 ++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-e2e.yaml b/.github/workflows/reusable-e2e.yaml index 2dc1f38f..41892d11 100644 --- a/.github/workflows/reusable-e2e.yaml +++ b/.github/workflows/reusable-e2e.yaml @@ -17,6 +17,10 @@ on: type: string required: true description: 'The command which runs the chain via the shell' + spawn-extra-cmd: + type: string + required: false + description: 'Extra command to run after the chain is created' env: GO_VERSION: 1.22.3 @@ -68,7 +72,16 @@ jobs: # === Chain Creation & Validation === - name: Spawn Gen - '${{inputs.id}}' - run: ${{ inputs.spawn-create-cmd }} + run: | + git config --global --add url."git@github.com:".insteadOf "https://github.com/" + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + ${{ inputs.spawn-create-cmd }} + pwd + + - name: Spawn Extra Generation + if : ${{ inputs.spawn-extra-cmd }} + run: ${{ inputs.spawn-extra-cmd }} - name: Build and Run '${{inputs.id}}' run: | @@ -95,4 +108,4 @@ jobs: done lsof -i tcp:26657 | awk 'NR!=1 {print $2}' | xargs kill || true - exit 1 \ No newline at end of file + exit 1 diff --git a/.github/workflows/spawn-e2e.yaml b/.github/workflows/spawn-e2e.yaml index bb68cb5a..156ab90a 100644 --- a/.github/workflows/spawn-e2e.yaml +++ b/.github/workflows/spawn-e2e.yaml @@ -68,4 +68,13 @@ jobs: with: id: ICS - Cosmos Hub spawn-create-cmd: ./spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug - start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & \ No newline at end of file + start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & + + ics-with-user-modules: + needs: build-spawn + uses: ./.github/workflows/reusable-e2e.yaml + with: + id: ICS - Module Plugins + spawn-create-cmd: spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --disabled=explorer --org=rollchains-org --denom=uroll --debug --log-level=debug + spawn-extra-cmd: cd mychain && spawn module new aaaaaa && make proto-gen + start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & From 1681aa1a50ecf772f030f4b016975f5a2ddb49a2 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:20:20 -0500 Subject: [PATCH 02/12] fix workflow (ref spawn ../) --- .github/workflows/spawn-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spawn-e2e.yaml b/.github/workflows/spawn-e2e.yaml index 156ab90a..b2ef625e 100644 --- a/.github/workflows/spawn-e2e.yaml +++ b/.github/workflows/spawn-e2e.yaml @@ -76,5 +76,5 @@ jobs: with: id: ICS - Module Plugins spawn-create-cmd: spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --disabled=explorer --org=rollchains-org --denom=uroll --debug --log-level=debug - spawn-extra-cmd: cd mychain && spawn module new aaaaaa && make proto-gen + spawn-extra-cmd: cd mychain && ../spawn module new aaaaaa && make proto-gen start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & From 876e167de436e6abb2b22871bc59e0d503dff6b6 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:23:50 -0500 Subject: [PATCH 03/12] move spawn bin into path --- .github/workflows/reusable-e2e.yaml | 7 +++++-- .github/workflows/spawn-e2e.yaml | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/reusable-e2e.yaml b/.github/workflows/reusable-e2e.yaml index 41892d11..abc366bb 100644 --- a/.github/workflows/reusable-e2e.yaml +++ b/.github/workflows/reusable-e2e.yaml @@ -66,9 +66,10 @@ jobs: uses: actions/download-artifact@master with: name: spawn + path: /home/runner/go/bin - - name: Spawn Permission - run: chmod +x ./spawn && ls -l + - name: Spawn Permission # put into path + run: chmod +x /home/runner/go/bin/spawn && ls -l # === Chain Creation & Validation === - name: Spawn Gen - '${{inputs.id}}' @@ -88,6 +89,8 @@ jobs: cd mychain ${{ inputs.start-chain-cmd }} + # Runs the unit test after the chain is started in the background + # This way the work is parallelized - name: Unit Test - '${{inputs.id}}' run: | cd mychain diff --git a/.github/workflows/spawn-e2e.yaml b/.github/workflows/spawn-e2e.yaml index b2ef625e..d6f01446 100644 --- a/.github/workflows/spawn-e2e.yaml +++ b/.github/workflows/spawn-e2e.yaml @@ -51,7 +51,7 @@ jobs: uses: ./.github/workflows/reusable-e2e.yaml with: id: Proof of Stake - spawn-create-cmd: ./spawn new mychain --consensus=proof-of-stake --bypass-prompt --bech32=prefix --bin=appd --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug + spawn-create-cmd: spawn new mychain --consensus=proof-of-stake --bypass-prompt --bech32=prefix --bin=appd --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug start-chain-cmd: HOME_DIR="~/.simapp" CHAIN_ID="localchain-1" BLOCK_TIME="2000ms" CLEAN=true sh scripts/test_node.sh & proof-of-authority: @@ -59,7 +59,7 @@ jobs: uses: ./.github/workflows/reusable-e2e.yaml with: id: Proof of Authority - spawn-create-cmd: ./spawn new mychain --consensus=proof-of-authority --bypass-prompt --bech32=cosmos --bin=appd --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug + spawn-create-cmd: spawn new mychain --consensus=proof-of-authority --bypass-prompt --bech32=cosmos --bin=appd --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug start-chain-cmd: HOME_DIR="~/.simapp" CHAIN_ID="localchain-1" BLOCK_TIME="2000ms" CLEAN=true sh scripts/test_node.sh & normal-ics: @@ -67,7 +67,7 @@ jobs: uses: ./.github/workflows/reusable-e2e.yaml with: id: ICS - Cosmos Hub - spawn-create-cmd: ./spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug + spawn-create-cmd: spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --no-git --org=rollchains-org --denom=uroll --debug --log-level=debug start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & ics-with-user-modules: @@ -76,5 +76,5 @@ jobs: with: id: ICS - Module Plugins spawn-create-cmd: spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --disabled=explorer --org=rollchains-org --denom=uroll --debug --log-level=debug - spawn-extra-cmd: cd mychain && ../spawn module new aaaaaa && make proto-gen + spawn-extra-cmd: cd mychain && spawn module new aaaaaa && make proto-gen start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & From 8d8feb3c7d4ea2e787a1e337d7d4456d6237915b Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:29:18 -0500 Subject: [PATCH 04/12] try `/.cache/buf` directly --- simapp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index 8d5ac4da..f57422d1 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -194,7 +194,7 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) # $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw -v $(CURDIR)/.cache:/.cache:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw -v $(CURDIR)/.cache/buf:/.cache/buf:rwx --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From 5f6cfcd29777e282ce77ba17f05410091aff84b2 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:32:18 -0500 Subject: [PATCH 05/12] rm the x --- simapp/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index f57422d1..b4793f88 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -194,7 +194,8 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) # $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw -v $(CURDIR)/.cache/buf:/.cache/buf:rwx --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +# TODO: maybe mount instead? ref cosmwasm container / https://docs.docker.com/engine/storage/bind-mounts/ +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw -v $(CURDIR)/.cache/buf:/.cache/buf:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From c1ba32f98746a030c74075004226bb0779339bda Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:37:22 -0500 Subject: [PATCH 06/12] try a mount instead? (like cw optimizer) --- simapp/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/simapp/Makefile b/simapp/Makefile index b4793f88..87b51910 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -194,8 +194,7 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) # $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory -# TODO: maybe mount instead? ref cosmwasm container / https://docs.docker.com/engine/storage/bind-mounts/ -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw -v $(CURDIR)/.cache/buf:/.cache/buf:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --mount type=volume,source=tmp,target=/.cache --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From 26d06057330523eb8c95bea790c1f64e810a9b69 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:41:41 -0500 Subject: [PATCH 07/12] tmp cache buf v2 --- simapp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index 87b51910..4334ea03 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -194,7 +194,7 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) # $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --mount type=volume,source=tmp,target=/.cache --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --mount type=volume,source=tmp,target=/.cache/buf/v2 --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From d8657f1b17d489fab8b0bc9e259c3ca581522190 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:44:41 -0500 Subject: [PATCH 08/12] /module --- simapp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index 4334ea03..ecba2717 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -194,7 +194,7 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) # $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --mount type=volume,source=tmp,target=/.cache/buf/v2 --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --mount type=volume,source=tmp,target=/.cache/buf/v2/module --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From 743d256e8bf7b15e3149d5f333a90693d66e73de Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:48:38 -0500 Subject: [PATCH 09/12] set BUF_CACHE_DIR --- simapp/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index ecba2717..aee21650 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -194,7 +194,7 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) # $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --mount type=volume,source=tmp,target=/.cache/buf/v2/module --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +protoImage=$(DOCKER) run -e BUF_CACHE_DIR=/tmp/buf --rm -v $(CURDIR):/workspace:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From 915eba4568bdacbabf82a8d61bd837feb5b2abfa Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:52:49 -0500 Subject: [PATCH 10/12] rm comment --- simapp/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index aee21650..185f8a5a 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -193,7 +193,6 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) -# $(CURDIR)/.cache:/.cache:rw is macOS specific due to buf saving to a read-only directory protoImage=$(DOCKER) run -e BUF_CACHE_DIR=/tmp/buf --rm -v $(CURDIR):/workspace:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From 3ef393b61c14ba416cbbcc388b5ce08d442e6bab Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 14:59:50 -0500 Subject: [PATCH 11/12] `--ibc-module` e2e --- .github/workflows/spawn-e2e.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spawn-e2e.yaml b/.github/workflows/spawn-e2e.yaml index d6f01446..7d342a4d 100644 --- a/.github/workflows/spawn-e2e.yaml +++ b/.github/workflows/spawn-e2e.yaml @@ -74,7 +74,16 @@ jobs: needs: build-spawn uses: ./.github/workflows/reusable-e2e.yaml with: - id: ICS - Module Plugins + id: ICS - Module spawn-create-cmd: spawn new mychain --consensus=ics --bin=appd --bypass-prompt --bech32=roll --disabled=explorer --org=rollchains-org --denom=uroll --debug --log-level=debug spawn-extra-cmd: cd mychain && spawn module new aaaaaa && make proto-gen start-chain-cmd: HOME_DIR="~/.icsnetwork" CHAIN_ID="localchain-2" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_ics_node.sh & + + poa-with-ibc-module: + needs: build-spawn + uses: ./.github/workflows/reusable-e2e.yaml + with: + id: POA - IBC Module + spawn-create-cmd: spawn new mychain --consensus=poa --bin=appd --bypass-prompt --bech32=roll --disabled=explorer --org=rollchains-org --denom=upoa --debug --log-level=debug + spawn-extra-cmd: cd mychain && spawn module new aaaaaa --ibc-module && make proto-gen + start-chain-cmd: HOME_DIR="~/.simapp" CHAIN_ID="localchain-10" CLEAN=true BLOCK_TIME="2000ms" sh scripts/test_node.sh & From 2d56c16f56e1c74ceca907be98a1ff07ba6aebf8 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 12 Oct 2024 15:01:36 -0500 Subject: [PATCH 12/12] remove chmod req. from docs --- .../02-build-your-application/01-nameservice.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md b/docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md index 75302c6f..f1b43a68 100644 --- a/docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md +++ b/docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md @@ -55,14 +55,8 @@ spawn module new nameservice # proto-gen proto files to go # -# If you get a /.cache permission error, run: -# sudo chmod -R 777 $(pwd)/.cache -# sudo chown -R $USER $(pwd)/.cache -# # If you get a cannot find module error # go clean -modcache -# - make proto-gen ```