From a76bfcbd21bd3e6df260093a814f754b157aeafb Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 15:52:01 -0500 Subject: [PATCH 01/10] wget local-ic, Windows setup docs --- Makefile | 8 ++++-- README.md | 24 ++++++++++------- docs/SYSTEM_SETUP.md | 60 ++++++++++++++++++++++++++++++++++++----- scripts/bump_localic.sh | 3 +++ spawn/cfg.go | 2 +- spawn/version_check.go | 9 ++++++- 6 files changed, 86 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index ccae4ad6..5246033e 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,12 @@ get-heighliner: get-localic: @echo "Installing local-interchain" - git clone --branch v8.7.0 https://github.com/strangelove-ventures/interchaintest.git interchaintest-downloader - cd interchaintest-downloader/local-interchain && make install +# git clone --branch v8.7.0 https://github.com/strangelove-ventures/interchaintest.git interchaintest-downloader +# cd interchaintest-downloader/local-interchain && make install + wget https://github.com/strangelove-ventures/interchaintest/releases/download/v8.7.0/local-ic + chmod +x local-ic + mv local-ic $(shell go env GOPATH)/bin + @sleep 0.1 @echo ✅ local-interchain installed $(shell which local-ic) .PHONY: get-heighliner diff --git a/README.md b/README.md index 0c48719a..dc887e5b 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,11 @@ https://github.com/rollchains/spawn/assets/31943163/ecc21ce4-c42c-4ff2-8e73-897c - [`go 1.22+`](https://go.dev/doc/install) - [`Docker`](https://docs.docker.com/get-docker/) -[MacOS + Ubuntu Setup](./docs/SYSTEM_SETUP.md) +## Setup Guides + +[MacOS](./docs/SYSTEM_SETUP.md#macos-setup) +[Ubuntu](./docs/SYSTEM_SETUP.md#ubuntu-setup) +[Windows](./docs/SYSTEM_SETUP.md#windows-setup) --- @@ -44,9 +48,11 @@ git checkout v0.50.7 make install make get-localic -# If you get "command 'spawn' not found", make sure to add go to your path -# Run the following in your terminal to test, then add to your ~/.bashrc or similar +# If you get "command 'spawn' not found", add to path +# Run the following in your terminal to test +# Then add to ~/.bashrc (linux) or ~/.zshrc (mac) export PATH="$PATH:$(go env GOPATH)/bin" +echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc ``` 2. Create your chain using the `spawn` command and customize it to your needs! @@ -58,12 +64,12 @@ GITHUB_USERNAME=rollchains # * tokenfactory,globalfee,ibc-packetforward,ibc-ratelimit,cosmwasm,wasm-light-client,optimistic-execution,ignite-cli,block-explorer spawn new rollchain \ ---consensus=proof-of-authority `# proof-of-authority,proof-of-stake,interchain-security` \ ---bech32=roll `# the prefix for addresses` \ ---denom=uroll `# the coin denomination to create` \ ---bin=rolld `# the name of the binary` \ ---disabled=cosmwasm,globalfee,block-explorer `# disable features.` \ ---org=${GITHUB_USERNAME} `# the github username or organization to use for the module imports, optional` +--consensus=proof-of-authority \ +--bech32=roll \ +--denom=uroll \ +--bin=rolld \ +--disabled=cosmwasm,globalfee,block-explorer \ +--org=${GITHUB_USERNAME} ``` diff --git a/docs/SYSTEM_SETUP.md b/docs/SYSTEM_SETUP.md index b8ba4868..08b0e759 100644 --- a/docs/SYSTEM_SETUP.md +++ b/docs/SYSTEM_SETUP.md @@ -16,22 +16,68 @@ brew install go brew install docker ``` -# Ubuntu +## Windows Setup + +```bash +# Install WSL in powershell +wsl --install +reboot + +# Setup WSL Ubuntu Image +wsl.exe --install Ubuntu-24.04 + +# Open wsl instance +wsl + +# update and add snap if not already installed +sudo apt update && sudo apt install snapd + +# Install Go (Snap) +sudo snap info go +sudo snap install go --channel=1.23/stable --classic + +# Install Basics +sudo apt install make gcc git jq + +# Install github-cli +sudo snap install gh + +# Install docker +sudo snap install docker +sudo chmod 666 /var/run/docker.sock + +# Setup base github config +git config --global user.email "yourEmail@gmail.com" +git config --global user.name "Your Name" + +# Fix the path +echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc +export PATH=$PATH:$(go env GOPATH)/bin +``` + +# Ubuntu Setup ```bash # Base -sudo apt-get install make gcc +sudo apt install make gcc git # Github CLI - https://github.com/cli/cli curl -sS https://webi.sh/gh | sh gh auth login # Golang -wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz -sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz -echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc -export PATH=$PATH:/usr/local/go/bin +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 + +# fix paths +echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc +export PATH=$PATH:$(go env GOPATH)/bin # Docker sudo apt -y install docker.io -``` \ No newline at end of file + +# Setup base github config +git config --global user.email "yourEmail@gmail.com" +git config --global user.name "Your Name" +``` diff --git a/scripts/bump_localic.sh b/scripts/bump_localic.sh index 362e56cb..0548d48a 100644 --- a/scripts/bump_localic.sh +++ b/scripts/bump_localic.sh @@ -10,3 +10,6 @@ find . -type f -name "Dockerfile" -exec sed -i "s/v[0-9]\.[0-9]\.[0-9]\/local-ic GIT_REPO="https://github.com/strangelove-ventures/interchaintest" GIT_REPO=$(echo $GIT_REPO | sed 's/\//\\\//g') # https:\/\/github.com\/strangelove-ventures\/interchaintest find . -type f -name "Makefile" -exec sed -i "s/v[0-9]\.[0-9]\.[0-9] $GIT_REPO/$NEW_VERSION $GIT_REPO/g" {} \; + +# replace https://github.com/strangelove-ventures/interchaintest/releases/download/v8.7.0/local-ic in makefile +find . -type f -name "Makefile" -exec sed -i "s/https:\/\/github.com\/strangelove-ventures\/interchaintest\/releases\/download\/v[0-9]\.[0-9]\.[0-9]\/local-ic/https:\/\/github.com\/strangelove-ventures\/interchaintest\/releases\/download\/$NEW_VERSION\/local-ic/g" {} \; diff --git a/spawn/cfg.go b/spawn/cfg.go index c9049e40..0057bbdc 100644 --- a/spawn/cfg.go +++ b/spawn/cfg.go @@ -166,7 +166,7 @@ func (cfg *NewChainConfig) CreateNewChain() error { // Set proper pairings for modules to be disabled if others are enabled cfg.SetProperFeaturePairs() - logger.Debug("Spawning new app", "app", NewDirName) + logger.Info("Spawning new app", "name", NewDirName) logger.Debug("NewChain Disabled features", "features", cfg.DisabledModules) if err := os.MkdirAll(NewDirName, 0755); err != nil { diff --git a/spawn/version_check.go b/spawn/version_check.go index 0b446618..de8e4acc 100644 --- a/spawn/version_check.go +++ b/spawn/version_check.go @@ -17,7 +17,7 @@ import ( var ( RunCheckInterval = 24 * time.Hour howToInstallBinary = map[string]string{ - "local-ic": "git clone https://github.com/strangelove-ventures/interchaintest.git && cd interchaintest/local-interchain && git checkout __VERSION__ && make install", + "local-ic": "wget https://github.com/strangelove-ventures/interchaintest/releases/download/__VERSION__/local-ic && mv local-ic $HOME/go/bin && chmod +x $HOME/go/bin/local-ic", "spawn": "git clone https://github.com/rollchains/spawn.git && cd spawn && git checkout __VERSION__ && make install", } BinaryToGithubAPI = map[string]string{ @@ -150,7 +150,14 @@ func WhereIsBinInstalled(binName string) string { // OutOfDateCheckLog logs & returns true if it is out of date. func OutOfDateCheckLog(logger *slog.Logger, binName, current, latest string) bool { + + if current == "" { + logger.Error("Could not find "+binName+" binary", "install", GetInstallMsg(howToInstallBinary[binName], latest)) + return true + } + isOutOfDate := semver.Compare(current, latest) < 0 + if isOutOfDate { logger.Error( "New "+binName+" version available", From 1c1710e6443c0456acfc35278a1cf7388023e86d Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 15:57:06 -0500 Subject: [PATCH 02/10] note --- docs/SYSTEM_SETUP.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/SYSTEM_SETUP.md b/docs/SYSTEM_SETUP.md index 08b0e759..1ab175e9 100644 --- a/docs/SYSTEM_SETUP.md +++ b/docs/SYSTEM_SETUP.md @@ -14,6 +14,8 @@ brew install go # Docker brew install docker + +# Continue to main README.md to install spawn & local-ic ``` ## Windows Setup @@ -53,6 +55,8 @@ git config --global user.name "Your Name" # Fix the path echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc export PATH=$PATH:$(go env GOPATH)/bin + +# Continue to main README.md to install spawn & local-ic ``` # Ubuntu Setup @@ -80,4 +84,6 @@ sudo apt -y install docker.io # Setup base github config git config --global user.email "yourEmail@gmail.com" git config --global user.name "Your Name" + +# Continue to main README.md to install spawn & local-ic ``` From 68b5564cb2fc0401a7afd9d55bb6c34abf54b63c Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:00:14 -0500 Subject: [PATCH 03/10] try console --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc887e5b..1d5f1ba6 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc 2. Create your chain using the `spawn` command and customize it to your needs! -```shell +```console GITHUB_USERNAME=rollchains # Available Features: From 5e5ab3128f371cb7fbeb3d3e00de9086507787d6 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:01:16 -0500 Subject: [PATCH 04/10] bash --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1d5f1ba6..6201884c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ In this tutorial, we'll create and interact with a new Cosmos-SDK blockchain cal 1. Clone this repo and install -```shell +```bash git clone https://github.com/rollchains/spawn.git cd spawn git checkout v0.50.7 @@ -57,7 +57,7 @@ echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc 2. Create your chain using the `spawn` command and customize it to your needs! -```console +```bash GITHUB_USERNAME=rollchains # Available Features: @@ -78,7 +78,7 @@ spawn new rollchain \ 3. Spin up a local testnet for your chain -```shell +```bash cd rollchain # Starts 2 networks for the IBC testnet at http://127.0.0.1:8080. @@ -91,7 +91,7 @@ make testnet 4. Open a new terminal window and send a transaction on your new chain -```shell +```bash # list the keys that have been provisioned with funds in genesis rolld keys list @@ -105,7 +105,7 @@ rolld q bank balances $(rolld keys show acc1 -a) 5. (optional) Send an IBC transaction -```shell +```bash # submit a cross chain transfer from acc0 to the other address rolld tx ibc-transfer transfer transfer channel-0 cosmos1hj5fveer5cjtn4wd6wstzugjfdxzl0xpxvjjvr 7uroll --from=acc0 --chain-id=localchain-1 --yes @@ -120,7 +120,7 @@ local-ic interact localcosmos-1 query 'bank balances cosmos1hj5fveer5cjtn4wd6wst 6. Push your new chain to a github repository -```shell +```bash # Create a new repository on GitHub from the gh cli gh repo create rollchain --source=. --remote=upstream --push --private ``` From 2796c1ec31a69af71b7c935f6396b7bf20566e8b Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:05:18 -0500 Subject: [PATCH 05/10] tweaks --- README.md | 9 +++++---- docs/SYSTEM_SETUP.md | 8 -------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6201884c..651099e4 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,13 @@ https://github.com/rollchains/spawn/assets/31943163/ecc21ce4-c42c-4ff2-8e73-897c - [`go 1.22+`](https://go.dev/doc/install) - [`Docker`](https://docs.docker.com/get-docker/) +- [`git`](https://git-scm.com/) -## Setup Guides +## System Setup -[MacOS](./docs/SYSTEM_SETUP.md#macos-setup) -[Ubuntu](./docs/SYSTEM_SETUP.md#ubuntu-setup) -[Windows](./docs/SYSTEM_SETUP.md#windows-setup) +* [MacOS](./docs/SYSTEM_SETUP.md#macos-setup) +* [Ubuntu](./docs/SYSTEM_SETUP.md#ubuntu-setup) +* [Windows](./docs/SYSTEM_SETUP.md#windows-setup) --- diff --git a/docs/SYSTEM_SETUP.md b/docs/SYSTEM_SETUP.md index 1ab175e9..935f2b30 100644 --- a/docs/SYSTEM_SETUP.md +++ b/docs/SYSTEM_SETUP.md @@ -52,10 +52,6 @@ sudo chmod 666 /var/run/docker.sock git config --global user.email "yourEmail@gmail.com" git config --global user.name "Your Name" -# Fix the path -echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc -export PATH=$PATH:$(go env GOPATH)/bin - # Continue to main README.md to install spawn & local-ic ``` @@ -74,10 +70,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 -# fix paths -echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc -export PATH=$PATH:$(go env GOPATH)/bin - # Docker sudo apt -y install docker.io From eb658c8f3c960a8b5000545f02bcbf50ce81bc69 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:09:57 -0500 Subject: [PATCH 06/10] clean up --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 651099e4..09edae9a 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc ```bash GITHUB_USERNAME=rollchains -# Available Features: -# * tokenfactory,globalfee,ibc-packetforward,ibc-ratelimit,cosmwasm,wasm-light-client,optimistic-execution,ignite-cli,block-explorer - +# Spawn a new chain with no interactions required +# If the `--consensus` or `--disabled` flags are not present, +# a selector UI will appear in your terminal. spawn new rollchain \ --consensus=proof-of-authority \ --bech32=roll \ @@ -71,8 +71,6 @@ spawn new rollchain \ --bin=rolld \ --disabled=cosmwasm,globalfee,block-explorer \ --org=${GITHUB_USERNAME} - - ``` > *NOTE:* `spawn` creates a ready to use repository complete with `git` and GitHub CI. It can be quickly pushed to a new repository getting you and your team up and running quickly. From cc268b71997da82f6def297e564acd277dbf848e Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:10:49 -0500 Subject: [PATCH 07/10] see all options --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 09edae9a..b735b551 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,8 @@ echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc ```bash GITHUB_USERNAME=rollchains -# Spawn a new chain with no interactions required # If the `--consensus` or `--disabled` flags are not present, -# a selector UI will appear in your terminal. +# a selector UI will appear in your terminal to see all options. spawn new rollchain \ --consensus=proof-of-authority \ --bech32=roll \ From b7365aacbd04429ac00ee618c848874aaa79399d Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:11:05 -0500 Subject: [PATCH 08/10] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b735b551..8e3cbb18 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ rolld keys list rolld tx bank send acc0 $(rolld keys show acc1 -a) 1337uroll --chain-id=localchain-1 # enter "y" to confirm the transaction -# then query your balances tfor proof the transaction executed successfully +# then query your balances for proof the transaction executed successfully rolld q bank balances $(rolld keys show acc1 -a) ``` From 8c2fe233dfa1627e022ada6374f3b7dd6fae67a3 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:11:34 -0500 Subject: [PATCH 09/10] h1 --- docs/SYSTEM_SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SYSTEM_SETUP.md b/docs/SYSTEM_SETUP.md index 935f2b30..e372dcfc 100644 --- a/docs/SYSTEM_SETUP.md +++ b/docs/SYSTEM_SETUP.md @@ -18,7 +18,7 @@ brew install docker # Continue to main README.md to install spawn & local-ic ``` -## Windows Setup +# Windows Setup ```bash # Install WSL in powershell From efffd406a57b7e079004fc7b7ed7b12ffd7d1be5 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Fri, 30 Aug 2024 16:23:16 -0500 Subject: [PATCH 10/10] docker desktop --- docs/SYSTEM_SETUP.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/SYSTEM_SETUP.md b/docs/SYSTEM_SETUP.md index e372dcfc..dfe628f4 100644 --- a/docs/SYSTEM_SETUP.md +++ b/docs/SYSTEM_SETUP.md @@ -23,7 +23,7 @@ brew install docker ```bash # Install WSL in powershell wsl --install -reboot +Restart-Computer # Setup WSL Ubuntu Image wsl.exe --install Ubuntu-24.04 @@ -45,7 +45,11 @@ sudo apt install make gcc git jq sudo snap install gh # Install docker +https://docs.docker.com/desktop/wsl/#turn-on-docker-desktop-wsl-2 +# or snap: sudo snap install docker + +# Fix versioning for interaction of commands sudo chmod 666 /var/run/docker.sock # Setup base github config