From fe711b1166dbde06d52fd63c94d50727d9343409 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 11 Oct 2024 14:59:35 -0500 Subject: [PATCH 1/6] change uids for user rw in the container --- .../version-v0.50.x/01-setup/01-system-setup.md | 9 --------- .../02-build-your-application/01-nameservice.md | 3 ++- simapp/Makefile | 5 ++++- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/versioned_docs/version-v0.50.x/01-setup/01-system-setup.md b/docs/versioned_docs/version-v0.50.x/01-setup/01-system-setup.md index c8523896..90e30d69 100644 --- a/docs/versioned_docs/version-v0.50.x/01-setup/01-system-setup.md +++ b/docs/versioned_docs/version-v0.50.x/01-setup/01-system-setup.md @@ -41,9 +41,6 @@ sudo apt update && sudo apt install snapd # Install Go (Snap) sudo snap install go --channel=1.23/stable --classic -# Clean module cache -go clean -modcache - # Install Base sudo apt install make gcc git jq wget @@ -80,9 +77,6 @@ gh auth login # Golang brew install go -# Clean module cache -go clean -modcache - # Docker brew install --cask docker open -a Docker # start docker desktop @@ -110,9 +104,6 @@ GO_VERSION=1.23.0 wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz -# Clean module cache -go clean -modcache - # Docker sudo apt -y install docker.io 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 1da2fee5..f4125c7e 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,7 +55,8 @@ spawn module new nameservice go clean -modcache -go mod tidy +# converts proto to go +make proto-gen ``` This creates a new template module with the name `nameservice` in the `x` and `proto` directories. It also automatically connected to your application and is ready for use. diff --git a/simapp/Makefile b/simapp/Makefile index 39bba614..f6bd1b0b 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -188,9 +188,12 @@ mod-tidy: ############################################################################### ### Protobuf ### ############################################################################### +CURRENT_UID := $(shell id -u) +CURRENT_GID := $(shell id -g) + protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) proto-all: proto-format proto-lint proto-gen format From 1619d65e383c0b7d5e4d959bf6cf0ea2d0332af5 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 11 Oct 2024 15:19:34 -0500 Subject: [PATCH 2/6] docs & debugging with this --- .../version-v0.50.x/01-setup/03-debugging.md | 12 ++++++++++++ .../02-build-your-application/02-proto-logic.md | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md b/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md index 59a8c811..83a78078 100644 --- a/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md +++ b/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md @@ -64,3 +64,15 @@ reboot # if you still get the error ``` Technically you can also `sudo chmod 666 /var/run/docker.sock` but this is NOT advised. --> + +## Generation + +### remote: Repository not found. fatal: reposity not found + +This error is due to not having properly `make proto-gen`ed the project. View the [Application](#running-the-binary-gives-me-panic-reflect-newnil) section for the solution. + +## Application + +### Running the binary gives me `panic: reflect: New(nil)` + +The `make proto-gen` command was either not run, or is causing issues. This could be due to your users permissions or the filesystem. By default, the protoc docker image uses your current users id and group. Try switching as a super user (i.e. `su -`) or fixing your permissions. A very ugly hack is to run `chmod a+rwx -R ./rollchain` where `./rollchain` is the project you generated. This will cause git to change all files, but it does fix it. Unsure of the long term side effects that may come up from this. diff --git a/docs/versioned_docs/version-v0.50.x/02-build-your-application/02-proto-logic.md b/docs/versioned_docs/version-v0.50.x/02-build-your-application/02-proto-logic.md index 56820f68..05ad03d0 100644 --- a/docs/versioned_docs/version-v0.50.x/02-build-your-application/02-proto-logic.md +++ b/docs/versioned_docs/version-v0.50.x/02-build-your-application/02-proto-logic.md @@ -72,8 +72,6 @@ proto/nameservice/v1/query.proto These .proto file templates will be converted into Golang source code for you to use. Build the Go source code using the command: ```bash -go clean -modcache - make proto-gen ``` From 369c3b626df62c10bddd34ca1fe7edb486f115aa Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 11 Oct 2024 15:31:58 -0500 Subject: [PATCH 3/6] fix --- .../version-v0.50.x/02-build-your-application/08-ibc-module.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md b/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md index 2afa31d1..4767a141 100644 --- a/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md +++ b/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md @@ -228,7 +228,7 @@ You just build an IBC module that interacts with your other nameservice module! ## What you Learned -* Scaffolding ab IBC module +* Scaffolding an IBC module * Importing another module * Adding business logic for an IBC request * Connecting two chains with a custom IBC protocol From 5f007720ed77bab1da8f0377b920355597d67483 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 11 Oct 2024 16:20:36 -0500 Subject: [PATCH 4/6] fix: macos cache issue --- simapp/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simapp/Makefile b/simapp/Makefile index f6bd1b0b..8d5ac4da 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -193,7 +193,8 @@ CURRENT_GID := $(shell id -g) protoVer=0.13.2 protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) -protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace:rw --user ${CURRENT_UID}:${CURRENT_GID} --workdir /workspace $(protoImageName) +# $(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) proto-all: proto-format proto-lint proto-gen format From 76374180729a1fbc3d2ea682e5517e157b95faac Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 11 Oct 2024 16:56:32 -0500 Subject: [PATCH 5/6] ignore .cache dir --- simapp/scripts/protocgen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simapp/scripts/protocgen.sh b/simapp/scripts/protocgen.sh index 054f2e65..2d062c7c 100644 --- a/simapp/scripts/protocgen.sh +++ b/simapp/scripts/protocgen.sh @@ -28,7 +28,7 @@ rm -rf github.com # Copy files over for dep injection rm -rf api && mkdir api -custom_modules=$(find . -name 'module' -type d -not -path "./proto/*") +custom_modules=$(find . -name 'module' -type d -not -path "./proto/*" -not -path "./.cache/*") # get the 1 up directory (so ./cosmos/mint/module becomes ./cosmos/mint) # remove the relative path starter from base namespaces. so ./cosmos/mint becomes cosmos/mint @@ -47,4 +47,4 @@ for module in $base_namespace; do find api/$module -type f -name '*.go' -exec sed -i -e 's|types1 "github.com/cosmos/cosmos-sdk/x/bank/types"|types1 "cosmossdk.io/api/cosmos/bank/v1beta1"|g' {} \; rm -rf $module -done \ No newline at end of file +done From 4f0b7f7463457eac5bc3f41ce0db1a382a95160b Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 11 Oct 2024 18:16:20 -0500 Subject: [PATCH 6/6] docs --- .../version-v0.50.x/01-setup/03-debugging.md | 8 ++++++-- .../02-build-your-application/01-nameservice.md | 11 +++++++++-- .../02-build-your-application/08-ibc-module.md | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md b/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md index 83a78078..e7c988fb 100644 --- a/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md +++ b/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md @@ -36,11 +36,15 @@ If the above does not work, your user or directory permissions may not be setup. If using WSL, try https://superuser.com/questions/1352207/windows-wsl-ubuntu-sees-wrong-permissions-on-files-in-mounted-disk. +--- + ## Windows / WSL ### make: /mnt/c/Program: No such file or directory -Delete your GOMODCACHE directory: `rm -rf $(go env GOMODCACHE)` or run the direct command `go clean -modcache`. +Delete your GOMODCACHE directory: `go clean -modcache` or run the direct command `rm -rf $(go env GOMODCACHE)`. + +--- ## Docker @@ -50,7 +54,7 @@ Start the docker daemon. Run [docker engine](https://docs.docker.com/engine/) or ### docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock -You don't have permissions to interact with the Docker daemon. Run the following command to fix this. +You don't have permissions to interact with the Docker daemon. 1) Install properly with https://docs.docker.com/get-started/get-docker/ 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 f4125c7e..75302c6f 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 @@ -53,9 +53,16 @@ cd rollchain # scaffolds your new nameservice module spawn module new nameservice -go clean -modcache +# 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 +# -# converts proto to go make proto-gen ``` diff --git a/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md b/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md index 4767a141..49be44ca 100644 --- a/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md +++ b/docs/versioned_docs/version-v0.50.x/02-build-your-application/08-ibc-module.md @@ -197,7 +197,7 @@ For example; transfer to transfer, nsibc to nsibc, but transfer to nsibc can not These values are found in the keys.go file as the module name. By default version is just the module name + "-1". ::: -Execute the command on the testnet to connect the two chains with the IBC module. +Execute the command on the testnet to connect the two chains with the IBC module with the relayer. ```bash # This will take a minute.