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/01-setup/03-debugging.md b/docs/versioned_docs/version-v0.50.x/01-setup/03-debugging.md index 59a8c811..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/ @@ -64,3 +68,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/01-nameservice.md b/docs/versioned_docs/version-v0.50.x/02-build-your-application/01-nameservice.md index 1da2fee5..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,17 @@ cd rollchain # scaffolds your new nameservice module spawn module new nameservice -go clean -modcache - -go mod tidy +# 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 ``` 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/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 ``` 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..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. @@ -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 diff --git a/simapp/Makefile b/simapp/Makefile index 39bba614..8d5ac4da 100644 --- a/simapp/Makefile +++ b/simapp/Makefile @@ -188,9 +188,13 @@ 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) +# $(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 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