Skip to content

Commit 8dd1938

Browse files
Add description files.
And some linting.
1 parent 1a953f4 commit 8dd1938

File tree

6 files changed

+168
-35
lines changed

6 files changed

+168
-35
lines changed

Dockerfile-ubuntu

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM --platform=linux/amd64 ubuntu:22.04
2+
3+
# Change your versions here
4+
ENV GO_VERSION=1.18.3
5+
ENV IGNITE_VERSION=0.22.1
6+
7+
ENV LOCAL=/usr/local
8+
ENV GOROOT=$LOCAL/go
9+
ENV HOME=/root
10+
ENV GOPATH=$HOME/go
11+
ENV PATH=$GOROOT/bin:$GOPATH/bin:$PATH
12+
13+
RUN mkdir -p $GOPATH/bin
14+
15+
ENV PACKAGES curl gcc
16+
RUN apt-get update
17+
RUN apt-get install -y $PACKAGES
18+
19+
# Install Go
20+
RUN curl -L https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C $LOCAL -xzf -
21+
22+
# Install ignite
23+
RUN curl -L https://get.ignite.com/cli@v${IGNITE_VERSION}! | bash
24+
25+
RUN apt-get clean
26+
27+
EXPOSE 1317 4500 5000 26657
28+
29+
WORKDIR /checkers
30+
31+
# Create the image
32+
# $ docker build -f Dockerfile-ubuntu . -t checkers_i
33+
# To test only 1 command
34+
# $ docker run --rm -it -v $(pwd):/checkers -w /checkers checkers_i bash -c
35+
# To build container
36+
# $ docker create --name checkers -i -v $(pwd):/checkers -w /checkers -p 1317:1317 -p 4500:4500 -p 26657:26657 checkers_i
37+
# $ docker start checkers
38+
# To run server on it
39+
# $ docker exec -it checkers ignite chain serve --reset-once
40+
# In other shell, to query it
41+
# $ docker exec -it checkers checkersd query checkers list-stored-game

push-branch.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
commitRegex="^([0-9a-f]{40}) Add branch ([0-9a-zA-Z\-]*).*$"
4+
5+
if [[ $1 =~ $commitRegex ]];
6+
then
7+
echo Pushing ${BASH_REMATCH[2]} as ${BASH_REMATCH[1]};
8+
git push -f origin ${BASH_REMATCH[1]}:refs/heads/${BASH_REMATCH[2]}
9+
fi

push-branches.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
git log --pretty=oneline --no-decorate --grep="Add branch [0-9a-zA-Z\-]*" | \
4+
xargs -I {} ./push-branch.sh {}

readme-ignite.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# checkers
2+
**checkers** is a blockchain built using Cosmos SDK and Tendermint and created with [Ignite CLI](https://ignite.com/cli).
3+
4+
## Get started
5+
6+
```
7+
ignite chain serve
8+
```
9+
10+
`serve` command installs dependencies, builds, initializes, and starts your blockchain in development.
11+
12+
### Configure
13+
14+
Your blockchain in development can be configured with `config.yml`. To learn more, see the [Ignite CLI docs](https://docs.ignite.com).
15+
16+
### Web Frontend
17+
18+
Ignite CLI has scaffolded a Vue.js-based web app in the `vue` directory. Run the following commands to install dependencies and start the app:
19+
20+
```
21+
cd vue
22+
npm install
23+
npm run serve
24+
```
25+
26+
The frontend app is built using the `@starport/vue` and `@starport/vuex` packages. For details, see the [monorepo for Ignite front-end development](https://github.com/ignite-hq/web).
27+
28+
## Release
29+
To release a new version of your blockchain, create and push a new tag with `v` prefix. A new draft release with the configured targets will be created.
30+
31+
```
32+
git tag v0.1
33+
git push origin v0.1
34+
```
35+
36+
After a draft release is created, make your final changes from the release page and publish it.
37+
38+
### Install
39+
To install the latest version of your blockchain node's binary, execute the following command on your machine:
40+
41+
```
42+
curl https://get.ignite.com/b9lab/checkers@latest! | sudo bash
43+
```
44+
`b9lab/checkers` should match the `username` and `repo_name` of the Github repository to which the source code was pushed. Learn more about [the install process](https://github.com/allinbits/starport-installer).
45+
46+
## Learn more
47+
48+
- [Ignite CLI](https://ignite.com/cli)
49+
- [Tutorials](https://docs.ignite.com/guide)
50+
- [Ignite CLI docs](https://docs.ignite.com)
51+
- [Cosmos SDK docs](https://docs.cosmos.network)
52+
- [Developer Chat](https://discord.gg/ignite)

readme.md

+55-35
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,72 @@
1-
# checkers
2-
**checkers** is a blockchain built using Cosmos SDK and Tendermint and created with [Ignite CLI](https://ignite.com/cli).
1+
# Checkers tutorial project
32

4-
## Get started
3+
This is a companion project of the Cosmos SDK tutorials. Its object is to show various features of the Cosmos SDK and of Ignite, along with the progression of the code as elements and features are added.
54

6-
```
7-
ignite chain serve
5+
The progression of the code is demonstrated via the help of branches and diffs.
6+
7+
## Build steps taken
8+
9+
All the build steps were run inside the Docker container.
10+
11+
```sh
12+
$ ignite scaffold chain github.com/b9lab/checkers
813
```
914

10-
`serve` command installs dependencies, builds, initializes, and starts your blockchain in development.
15+
## Progressive feature branches
1116

12-
### Configure
17+
The project is created with a clean list of commits in order to demonstrate the natural progression of the project. In this sense, there is no late commit that fixes an error introduced earlier. If there is a fix for an error introduced earlier, the fix should be squashed with the earlier commit that introduced the error. This may require some conflict resolution.
1318

14-
Your blockchain in development can be configured with `config.yml`. To learn more, see the [Ignite CLI docs](https://docs.ignite.com).
19+
Having a clean list of commits makes it possible to do meaningful `compare`s.
1520

16-
### Web Frontend
21+
To make it easier to link to the content at the different stages of the project's progression, a number of branches have been created at commits that have `Add branch the-branch-name` as message. Be careful with the commit message as it depends on it matching the `"Add branch [0-9a-zA-Z\-]*"` regular expression.
1722

18-
Ignite CLI has scaffolded a Vue.js-based web app in the `vue` directory. Run the following commands to install dependencies and start the app:
23+
The script `push-branches.sh` is used to extract these commits and force push them to the appropriate branch in the repository. After having made changes, you should run this script, and also manually force push to `main`.
1924

20-
```
21-
cd vue
22-
npm install
23-
npm run serve
24-
```
25+
Versions used here are:
2526

26-
The frontend app is built using the `@starport/vue` and `@starport/vuex` packages. For details, see the [monorepo for Ignite front-end development](https://github.com/ignite-hq/web).
27+
* Go: 1.18.3
28+
* Ignite (formerly Starport): 0.22.1
29+
* Cosmos SDK: v0.45.4
2730

28-
## Release
29-
To release a new version of your blockchain, create and push a new tag with `v` prefix. A new draft release with the configured targets will be created.
31+
Branches:
3032

31-
```
32-
git tag v0.1
33-
git push origin v0.1
34-
```
33+
* [`ignite-start`](../../tree/ignite-start)
3534

36-
After a draft release is created, make your final changes from the release page and publish it.
35+
## Version 1 progressive tags
3736

38-
### Install
39-
To install the latest version of your blockchain node's binary, execute the following command on your machine:
37+
Versions used in version 1 are:
4038

41-
```
42-
curl https://get.ignite.com/b9lab/checkers@latest! | sudo bash
43-
```
44-
`b9lab/checkers` should match the `username` and `repo_name` of the Github repository to which the source code was pushed. Learn more about [the install process](https://github.com/allinbits/starport-installer).
39+
* Go: 1.16.15
40+
* Ignite (formerly Starport): 0.17.3
41+
* Cosmos SDK: v0.42.6
42+
* NodeJs: 16.x
4543

46-
## Learn more
44+
Tags:
4745

48-
- [Ignite CLI](https://ignite.com/cli)
49-
- [Tutorials](https://docs.ignite.com/guide)
50-
- [Ignite CLI docs](https://docs.ignite.com)
51-
- [Cosmos SDK docs](https://docs.cosmos.network)
52-
- [Developer Chat](https://discord.gg/ignite)
46+
* [`v1-starport-start`](../../tree/v1-starport-start)
47+
* [`v1-rules-added`](../../tree/v1-rules-added), [diff](../../compare/v1-starport-start..v1-rules-added)
48+
* [`v1-stored-game`](../../tree/v1-stored-game), [diff](../../compare/v1-rules-added..v1-stored-game)
49+
* [`v1-full-game-object`](../../tree/v1-full-game-object), [diff](../../compare/v1-stored-game..v1-full-game-object)
50+
* [`v1-create-game-msg`](../../tree/v1-create-game-msg), [diff](../../compare/v1-full-game-object..v1-create-game-msg)
51+
* [`v1-create-game-handler`](../../tree/v1-create-game-handler), [diff](../../compare/v1-create-game-msg..v1-create-game-handler)
52+
* [`v1-play-move-msg`](../../tree/v1-play-move-msg), [diff](../../compare/v1-create-game-handler..v1-play-move-msg)
53+
* [`v1-play-move-handler`](../../tree/v1-play-move-handler), [diff](../../compare/v1-play-move-msg..v1-play-move-handler)
54+
* [`v1-two-events`](../../tree/v1-two-events), [diff](../../compare/v1-play-move-handler..v1-two-events)
55+
* [`v1-reject-game-msg`](../../tree/v1-reject-game-msg), [diff](../../compare/v1-two-events..v1-reject-game-msg)
56+
* [`v1-reject-game-handler`](../../tree/v1-reject-game-handler), [diff](../../compare/v1-reject-game-msg..v1-reject-game-handler)
57+
* [`v1-game-fifo`](../../tree/v1-game-fifo), [diff](../../compare/v1-reject-game-handler..v1-game-fifo)
58+
* [`v1-game-deadline`](../../tree/v1-game-deadline), [diff](../../compare/v1-game-fifo..v1-game-deadline)
59+
* [`v1-game-winner`](../../tree/v1-game-winner), [diff](../../compare/v1-game-deadline..v1-game-winner)
60+
* [`v1-forfeit-game`](../../tree/v1-forfeit-game), [diff](../../compare/v1-game-winner..v1-forfeit-game)
61+
* [`v1-game-wager`](../../tree/v1-game-wager), [diff](../../compare/v1-forfeit-game..v1-game-wager)
62+
* [`v1-payment-winning`](../../tree/v1-payment-winning), [diff](../../compare/v1-game-wager..v1-payment-winning)
63+
* [`v1-gas-meter`](../../tree/v1-gas-meter), [diff](../../compare/v1-payment-winning..v1-gas-meter)
64+
* [`v1-can-play-move-query`](../../tree/v1-can-play-move-query), [diff](../../compare/v1-gas-meter..v1-can-play-move-query)
65+
* [`v1-can-play-move-handler`](../../tree/v1-can-play-move-handler), [diff](../../compare/v1-can-play-move-query..v1-can-play-move-handler)
66+
* [`v1-wager-denomination`](../../tree/v1-wager-denomination), [diff](../../compare/v1-can-play-move-handler..v1-wager-denomination)
67+
* [`v1-cosmjs-elements`](../../tree/v1-cosmjs-elements), [diff](../../compare/v1-wager-denomination..v1-cosmjs-elements)
68+
* [`v1-player-info-object`](../../tree/v1-player-info-object), [diff](../../compare/v1-cosmjs-elements..v1-player-info-object)
69+
* [`v1-player-info-handling`](../../tree/v1-player-info-handling), [diff](../../compare/v1-player-info-object..v1-player-info-handling)
70+
* [`v1-leaderboard-object`](../../tree/v1-leaderboard-object), [diff](../../compare/v1-player-info-handling..v1-leaderboard-object)
71+
* [`v1-leaderboard-handling`](../../tree/v1-leaderboard-handling), [diff](../../compare/v1-leaderboard-object..v1-leaderboard-handling)
72+
* [`v1-genesis-migration`](../../tree/v1-genesis-migration), [diff](../../compare/v1-leaderboard-handling..v1-genesis-migration)

x/checkers/keeper/msg_server_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ import (
88
"github.com/b9lab/checkers/x/checkers/keeper"
99
"github.com/b9lab/checkers/x/checkers/types"
1010
sdk "github.com/cosmos/cosmos-sdk/types"
11+
"github.com/stretchr/testify/require"
1112
)
1213

1314
func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) {
1415
k, ctx := keepertest.CheckersKeeper(t)
1516
return keeper.NewMsgServerImpl(*k), sdk.WrapSDKContext(ctx)
1617
}
18+
19+
func TestMsgServer(t *testing.T) {
20+
msgServer, context := setupMsgServer(t)
21+
require.NotNil(t, msgServer)
22+
require.NotNil(t, context)
23+
}

0 commit comments

Comments
 (0)