Skip to content

Commit

Permalink
Merge pull request #2 from Lazychain/gjermund/rename-to-lazy-chain
Browse files Browse the repository at this point in the history
chore: rename to LazyChain
  • Loading branch information
gjermundgaraba authored Jun 26, 2024
2 parents b8f7563 + 1861e47 commit b9dbf8e
Show file tree
Hide file tree
Showing 45 changed files with 298 additions and 302 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build Slothchain 💤"
name: "Build LazyChain 💤"

on:
workflow_dispatch:
Expand All @@ -15,10 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build Slothchain
uses: ignite/cli/actions/cli@main
with:
args: chain build
- name: Build LazyChain
run: make build
20 changes: 10 additions & 10 deletions .github/workflows/interslothtest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "E2E Test Slothchain 💤"
name: "E2E Test LazyChain 💤"

on:
workflow_dispatch:
Expand All @@ -9,9 +9,9 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: slothchain
SLOTHCHAIN_IMAGE_REPOSITORY: ghcr.io/gjermundgaraba/slothchain
SLOTHCHAIN_IMAGE_VERSION: latest # TODO: It would be better to get a specific version of the image
IMAGE_NAME: lazychain
LAZYCHAIN_IMAGE_REPOSITORY: ghcr.io/lazychain/lazychain
LAZYCHAIN_IMAGE_VERSION: latest # TODO: It would be better to get a specific version of the image

jobs:
build-docker-image:
Expand All @@ -33,9 +33,9 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
tags: ghcr.io/gjermundgaraba/slothchain:latest # TODO: It would better to create a commit specific tag
tags: ghcr.io/lazychain/lazychain:latest # TODO: It would better to create a commit specific tag

interslothtest:
interchaintest:
runs-on: ubuntu-latest
needs: [build-docker-image]
steps:
Expand All @@ -50,10 +50,10 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
cache-dependency-path: 'interslothtest/go.sum'
cache-dependency-path: 'interchaintest/go.sum'

- name: Load Docker Image
run: docker pull ${{ env.SLOTHCHAIN_IMAGE_REPOSITORY }}:${{ env.SLOTHCHAIN_IMAGE_VERSION }}
run: docker pull ${{ env.LAZYCHAIN_IMAGE_REPOSITORY }}:${{ env.LAZYCHAIN_IMAGE_VERSION }}

- name: Run interslothtest
run: make interslothtest
- name: Run interchaintest
run: make interchaintest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ astral/

artifacts/
build/
restart-slothchaind.sh
restart-lazychaind.sh
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ linters-settings:
- prefix(cosmossdk.io)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/gjermundgaraba/slothchain)
- prefix(github.com/Lazychain/lazychain)
custom-order: true
revive:
enable-all-rules: true
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FROM alpine:3.16

RUN apk --update add jq

COPY --from=builder /code/build/slothchaind /usr/bin/slothchaind
COPY --from=builder /code/build/lazychaind /usr/bin/lazychaind

WORKDIR /opt

Expand Down
32 changes: 16 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/make -f

BINDIR ?= $(GOPATH)/bin
BINARY_NAME := "slothchaind"
CHAIN_NAME := "slothchain"
BINARY_NAME := "lazychaind"
CHAIN_NAME := "lazychain"
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true
Expand Down Expand Up @@ -115,11 +115,11 @@ build-windows-amd64: go.sum
LEDGER_ENABLED=false GOOS=windows GOARCH=amd64 $(MAKE) build

go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@echo "--> Download go modules to local cache 💤"
@go mod download

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@echo "--> Ensure dependencies have not been modified 💤"
@go mod verify

clean:
Expand All @@ -131,33 +131,33 @@ clean:
###############################################################################

local-docker:
@echo "Building slothchain:local"
@docker build -t slothchain:local .
@echo "Building lazychain:local 💤"
@docker build -t lazychain:local .

###############################################################################
### Run locally ###
###############################################################################

localinterslothchain:
@echo "Spinning up localinterslothchain environment"
@cd interslothtest && go run ./localinterslothchain
local-interchaintest:
@echo "Spinning up local interchain environment 💤"
@cd interchaintest && go run ./local-interchain

###############################################################################
### Linting ###
### Testing ###
###############################################################################

interslothtest:
@echo "Running interslothtest"
@cd interslothtest && go test -race -v -run TestICS20TestSuite/TestIBCTokenTransfers ./...
@cd interslothtest && go test -race -v -run TestICS20TestSuite/TestTIAGasToken ./...
@cd interslothtest && go test -race -v -run TestICS721TestSuite/TestICS721 ./...
interchaintest:
@echo "Running interchaintest 💤"
@cd interchaintest && go test -race -count=1 -v -run TestICS20TestSuite/TestIBCTokenTransfers ./...
@cd interchaintest && go test -race -count=1 -v -run TestICS20TestSuite/TestTIAGasToken ./...
@cd interchaintest && go test -race -count=1 -v -run TestICS721TestSuite/TestICS721 ./...

###############################################################################
### Linting ###
###############################################################################

lint:
@echo "--> Running linter"
@echo "--> Running linter 💤"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=10m

format:
Expand Down
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SlothChain 🦥
# LazyChain 🦥

LM... 🦥💤

Expand All @@ -8,10 +8,10 @@ LM... 🦥💤
$ make install
```

## Interslothtest
## Interchaintest

The interslothtest directory contains an e2e test suite for the Slothchain IBC setup:
- Slothchain
The interchaintest directory contains an e2e test suite for the LazyChain IBC setup:
- LazyChain
- Stargaze
- Celestia

Expand All @@ -23,44 +23,44 @@ First you need to build the local docker image:
$ make local-docker
```

> You can also specify the image with environment variables `SLOTHCHAIN_IMAGE_REPOSITORY` and `SLOTHCHAIN_IMAGE_VERSION`.
> For instance, you can run the latest built in CI with `SLOTHCHAIN_IMAGE_REPOSITORY=ghcr.io/gjermundgaraba/slothchain` and `SLOTHCHAIN_IMAGE_VERSION=latest`.
> You can also specify the image with environment variables `LAZYCHAIN_IMAGE_REPOSITORY` and `LAZYCHAIN_IMAGE_VERSION`.
> For instance, you can run the latest built in CI with `LAZYCHAIN_IMAGE_REPOSITORY=ghcr.io/Lazychain/lazychain` and `LAZYCHAIN_IMAGE_VERSION=latest`.
You can run the test suite with the following command:
```bash
$ cd interslothtest
$ cd interchaintest
$ go test -v -p 1 ./...
```

### Run a lazy 💤 local interslothchain environment
### Run a lazy 💤 local interlazychain environment

The repo has a very lazy option if you want to run a full local environment with a single command.

The environment consists of:
- Slothchain (duh... 🦥)
- LazyChain (duh... 🦥)
- Stargaze
- Celestia
- Relayer

The environment sets up all the above components and configures:
- User with funds on all chains (mnemonic: `curve govern feature draw giggle one enemy shop wonder cross castle oxygen business obscure rule detail chaos dirt pause parrot tail lunch merit rely`)
- An NFT contract on Stargaze (to mimic the Sloth collection)
- ICS721 deployed on Stargaze and Slothchain
- IBC connection between Slothchain and Stargaze
- ICS721 deployed on Stargaze and LazyChain
- IBC connection between LazyChain and Stargaze
- Channels for both ICS20 between all chains
- Channels for ICS721 between Slothchain and Stargaze
- Channels for ICS721 between LazyChain and Stargaze

To transfer, see the command section below.

There are some pre-requisites to run the interslothchain environment:
There are some pre-requisites to run the interlazychain environment:
- Go
- Docker
- slothchain:local image built (`make local-docker`)
- lazychain:local image built (`make local-docker`)

To run it:
```bash
$ cd interslothtest
$ go run ./localinterslothchain
$ cd interchaintest
$ go run ./local-interchain
```

It takes a while to spin up everything, deploy the contracts and whatnot, but once it is finished it will output something like following:
Expand All @@ -70,8 +70,8 @@ Sloth user address: lazy1ct9r7k20kp7z2m90066h6h2anq0rvmmrhwcl0w
Stargaze user address: stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk
Celestia user address: celestia1ct9r7k20kp7z2m90066h6h2anq0rvmmrtnldz2

Slothchain chain-id: slothtestchain-1
Slothchain RPC address: tcp://localhost:63921
LazyChain chain-id: lazytestchain-1
LazyChain RPC address: tcp://localhost:63921
Stargaze chain-id: stargazetest-1
Stargaze RPC address: tcp://localhost:63910
Celestia chain-id: celestiatest-1
Expand All @@ -90,31 +90,31 @@ Press Ctrl+C to stop...

### Commands

Slothchaind has some built-in commands to interact directly with the sloths.
- `slothchaind tx sloths transfer [from] [to] [nft-id] [--flags]`
- `slothchaind q sloths owned-by [address] [--flags]`
The `lazychaind` binary has some built-in commands to interact directly with the sloths.
- `lazychaind tx sloths transfer [from] [to] [nft-id] [--flags]`
- `lazychaind q sloths owned-by [address] [--flags]`

Both commands have a `--mainnet` and `--testnet` flag to fill in all the necessary flags for the respective chain.
They are not implemented at the moment, but will be once testnet and mainnet are live.

#### Transfer transaction

This command will transfer an NFT from one chain to another using ICS721 (it supports both Stargaze->Slothchain and Slothchain->Stargaze).
This command will transfer an NFT from one chain to another using ICS721 (it supports both Stargaze->LazyChain and LazyChain->Stargaze).
It does not currently support transfer between two addresses on the same chain.

With `--mainnet` or `--testnet` flag from stargaze to slothchain
With `--mainnet` or `--testnet` flag from Stargaze to LazyChain
```bash
$ slothchaind tx sloths transfer stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk lazy1u0g894r00fu3rnh7ft35yzk9smyaxscyhax3vs 1 --testnet
$ lazychaind tx sloths transfer stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk lazy1u0g894r00fu3rnh7ft35yzk9smyaxscyhax3vs 1 --testnet
```

With `--mainnet` or `--testnet` flag from slothchain to stargaze
With `--mainnet` or `--testnet` flag from LazyChain to Stargaze
```bash
$ slothchaind tx sloths transfer lazy1u0g894r00fu3rnh7ft35yzk9smyaxscyhax3vs stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk 1 --testnet
$ lazychaind tx sloths transfer lazy1u0g894r00fu3rnh7ft35yzk9smyaxscyhax3vs stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk 1 --testnet
```

With all override flags (necessary for local interslothchain):
With all override flags (necessary for local interchain environment)
```bash
$ slothchaind tx sloths transfer stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk lazy1ct9r7k20kp7z2m90066h6h2anq0rvmmrhwcl0w 1 --node tcp://localhost:57023 --chain-id stargazetest-1 --nft-contract stars14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9srsl6sm --ics721-contract stars1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrq096cja --ics721-channel channel-1 --gas auto --gas-adjustment 1.5 --keyring-backend test
$ lazychaind tx sloths transfer stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk lazy1ct9r7k20kp7z2m90066h6h2anq0rvmmrhwcl0w 1 --node tcp://localhost:57023 --chain-id stargazetest-1 --nft-contract stars14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9srsl6sm --ics721-contract stars1nc5tatafv6eyq7llkr2gv50ff9e22mnf70qgjlv737ktmt4eswrq096cja --ics721-channel channel-1 --gas auto --gas-adjustment 1.5 --keyring-backend test
```

#### Owned By query
Expand All @@ -123,12 +123,12 @@ This command will query all the NFTs owned by a specific address on a specific c

With `--mainnet` or `--testnet` flag:
```bash
$ slothchaind q sloths owned-by stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk --testnet
$ lazychaind q sloths owned-by stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk --testnet
```

With all override flags (necessary for local interslothchain):
With all override flags (necessary for local interlazychain):
```bash
$ slothchaind q sloths owned-by stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk --node tcp://localhost:57023 --nft-contract stars14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9srsl6sm
$ lazychaind q sloths owned-by stars1ct9r7k20kp7z2m90066h6h2anq0rvmmrw9eqnk --node tcp://localhost:57023 --nft-contract stars14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9srsl6sm
```
## 💤
Too... Lazy... To... Write... More... 🦥
Loading

0 comments on commit b9dbf8e

Please sign in to comment.