You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README-DEV.md
+54-28
Original file line number
Diff line number
Diff line change
@@ -4,34 +4,42 @@ Please note, that the only officially supported platform now is Linux.
4
4
It's recommended to develop and deploy the App on Ubuntu 18.04 or Ubuntu 20.04.
5
5
6
6
## Pre-requisites
7
-
1. Install Go as described at https://golang.org/doc/install
7
+
8
+
1. Install Go as described at <https://golang.org/doc/install>
8
9
- Ensure that the following line has been appended to `/etc/profile`:
9
-
```
10
+
11
+
```bash
10
12
export PATH=$PATH:/usr/local/go/bin
11
13
```
14
+
12
15
- Ensure that the following line has been appended to `~/.profile`:
13
-
```
16
+
17
+
```bash
14
18
export PATH=$PATH:~/go/bin
15
19
```
16
-
2. Install Docker as described at https://docs.docker.com/engine/install/ubuntu/
20
+
21
+
2. Install Docker as described at <https://docs.docker.com/engine/install/ubuntu/>
17
22
- In `Installation methods` section follow `Install using the repository` method
18
23
- Check whether your user of Ubuntu has been added to `docker` group using the following command:
19
-
```
24
+
25
+
```bash
20
26
getent group docker | awk -F: '{print $4}'
21
27
```
22
-
- If it has not been added, add it using `Manage Docker as a non-root user` section from https://docs.docker.com/engine/install/linux-postinstall/
23
-
3. Install Docker Compose as described at https://docs.docker.com/compose/install/
28
+
29
+
- If it has not been added, add it using `Manage Docker as a non-root user` section from <https://docs.docker.com/engine/install/linux-postinstall/>
30
+
3. Install Docker Compose as described at <https://docs.docker.com/compose/install/>
24
31
25
32
## Build and test
26
33
27
34
1. Building
28
-
```
35
+
36
+
```bash
29
37
make build
30
38
make install
31
39
```
32
40
33
-
34
41
2. Run unit tests
42
+
35
43
```bash
36
44
make test
37
45
```
@@ -42,10 +50,13 @@ It's recommended to develop and deploy the App on Ubuntu 18.04 or Ubuntu 20.04.
42
50
REST integration tests need to have a backend running (CLI in REST mode).
43
51
44
52
The following script will start all necessary things and run all the tests:
53
+
45
54
```bash
46
55
./integration_tests/run-all.sh
47
56
```
57
+
48
58
If you want to run a particular group of tests (cli, light, rest), you can
59
+
49
60
```bash
50
61
./integration_tests/run-all.sh cli
51
62
./integration_tests/run-all.sh light
@@ -62,38 +73,42 @@ It's recommended to develop and deploy the App on Ubuntu 18.04 or Ubuntu 20.04.
62
73
# OR
63
74
go test <path-to-go-test-file> # to run REST or gRPC go test
64
75
```
65
-
76
+
66
77
4. Run deployment test
67
-
78
+
68
79
The deployment test verifies deployment steps described in [docs/running-node.md](./docs/running-node.md).
69
80
70
81
```bash
71
82
./integration_tests/deploy/test_deploy.sh
72
83
```
73
84
74
-
75
85
## Run local pool
86
+
76
87
The easiest way to run a local pool is to start it in Docker.
77
88
78
89
Validator nodes only (no Observers):
90
+
79
91
```bash
80
92
make install
81
93
make localnet_init
82
94
make localnet_start
83
95
```
84
96
85
97
Validator and Observer nodes:
98
+
86
99
```bash
87
100
make install
88
101
DCL_OBSERVERS=1 make localnet_init
89
102
make localnet_start
90
-
```
103
+
```
91
104
92
105
This will start a local pool of 4 validator nodes in Docker. The nodes will expose their RPC endpoints on ports `26657`, `26659`, `26661`, `26663` correspondingly.
93
106
94
-
Stopping the network:
107
+
Stopping the network:
95
108
96
-
make localnet_stop
109
+
```bash
110
+
make localnet_stop
111
+
```
97
112
98
113
Then you can start the network again with the existing data using `make localnet_start`
99
114
@@ -102,20 +117,25 @@ It will remove `.dcl` directories from your user home directory (`~`), remove `.
102
117
and initialize a new network data using `make localnet_init`.
103
118
104
119
## CLI
120
+
105
121
Start a local pool as described above, and then just execute
106
-
```
122
+
123
+
```bash
107
124
dcld
108
125
```
126
+
109
127
Have a look at [How To](docs/how-to.md) and [transactions](docs/transactions.md) for instructions how to configure and use the CLI.
110
128
111
129
## REST
130
+
112
131
Start a local pool as described above.
113
132
114
-
Every node exposes a REST API at `http://<node-host>:1317` (see https://docs.cosmos.network/master/core/grpc_rest.html).
133
+
Every node exposes a REST API at `http://<node-host>:1317` (see <https://docs.cosmos.network/master/core/grpc_rest.html>).
115
134
116
135
Have a look at [transactions](docs/transactions.md) for a full list of REST endpoints.
117
136
118
137
## Contributing
138
+
119
139
Please take into account the following when sending a PR:
120
140
121
141
1) Make sure the new functionality has unit tests added
@@ -131,6 +151,7 @@ Please take into account the following when sending a PR:
131
151
- run integration tests
132
152
133
153
## How To Add a new Module
154
+
134
155
- Use [starport](https://github.com/tendermint/starport) command to scaffold the module.
135
156
Consider using a docker container built from the provided [Dockerfile](scripts/Dockerfile) to have a predictable version of starport. See [README.md](scripts/README.md).
136
157
- Have a look at the scripts and commands used forgeneration of existing modules and do itin a similar way
@@ -141,55 +162,60 @@ Please take into account the following when sending a PR:
141
162
- add message validation as annotations (`validate` tags) in`proto/<module>/tx.proto`
142
163
- add `(cosmos_proto.scalar) = "cosmos.AddressString"` annotation for all fields with address/account type (such as `signer` or `owner`).
143
164
- fix types if needed in`proto/<module>/<entity>.proto` files
144
-
- Note1: `unit64` will be returned as string if the output is a JSON format. So, it's better to use `uint64` only when it's really `uint64`.
165
+
- Note1: `unit64` will be returned as string if the output is a JSON format. So, it's better to use `uint64` only when it's really `uint64`.
145
166
- Note2: for`uint16` type: use `int32` during starport scaffolding, and add custom validation (annotations above) to check the lower and upper bounds.
146
167
- Note3: for`uint32` type: use `int32` during starport scaffolding, then replace it by `uint32`in .proto files, re-generate the code and fix compilation errors.
147
168
- build proto (for example `starport chain build`). Fix compilation errors if any.
148
169
- generate openapi docs from proto using (`scripts/dcl-swagger-gen.sh`). recommended to run from container built from [Dockerfile](scripts/Dockerfile)
149
170
150
171
- **Note1**: colons (`:`) are part of subject-id in PKI module, but colons are not allowed in gRPC REST URLs by default.
151
172
`allow_colon_final_segments=true` should be used as a workaround.
152
-
So, make sure that `runtime.AssumeColonVerbOpt(false)` in `/x/pki/types/query.pb.gw.go`.
173
+
So, make sure that `runtime.AssumeColonVerbOpt(false)`in`/x/pki/types/query.pb.gw.go`.
153
174
It's usually sufficient to revert the generated changes in `/x/pki/types/query.pb.gw.go`.
154
175
- Call `validator.Validate(msg)` in `ValidateBasic` methods for all generated messages
155
176
- Implement business logic in `msg_server_xxx.go`
156
177
- Improve `NotFound` error processing:
157
-
- replace `status.Error(codes.InvalidArgument, "not found")` to `status.Error(codes.NotFound, "not found")` in every generated `grpc_query_xxx.go` to return 404 error in REST.
178
+
- replace `status.Error(codes.InvalidArgument, "not found")` to `status.Error(codes.NotFound, "not found")` in every generated `grpc_query_xxx.go` to return 404 error in REST.
158
179
- Support state proof for single value queries in CLI:
159
-
- use `cli.QueryWithProof` instead of cosmos queries that doesn't support state proofs
160
-
- add proper handling for list queries and write requests when used with a light client proxy
180
+
- use `cli.QueryWithProof` instead of cosmos queries that doesn't support state proofs
181
+
- add proper handling for list queries and write requests when used with a light client proxy
161
182
(see `IsWriteInsteadReadRpcError` and `IsKeyNotFoundRpcError`)
162
183
- Add unit tests (see other modules for reference)
163
184
- Add CLI-based integration tests to `integration_tests/cli/<module>` (see other modules for reference)
164
185
- Add gRPC/REST-based integration tests to `integration_tests/grpc_rest/<module>` (see other modules for reference)
165
186
166
187
## How To Make Changes in Data Model for Existing Modules
188
+
167
189
- Use [starport](https://github.com/tendermint/starport) command to scaffold the module.
168
190
Consider using the provided [Dockerfile](scripts/Dockerfile) to have a predictable version of starport. See [README.md](scripts/README.md).
169
191
- **Never change `.pb` files manually**. Do the changes in`.proto` files.
170
192
- Every time`.proto` files change, re-generate the code (for example `starport chain build`) and fix compilation errors if any.
171
193
- Update openapi docs from proto using (`scripts/dcl-swagger-gen.sh`). recommended to run from container built from [Dockerfile](scripts/Dockerfile)
172
194
- **Note1**: colons (`:`) are part of subject-id in PKI module, but colons are not allowed in gRPC REST URLs by default.
173
195
`allow_colon_final_segments=true` should be used as a workaround.
174
-
So, make sure that `runtime.AssumeColonVerbOpt(false)` in `/x/pki/types/query.pb.gw.go`.
175
-
It's usually sufficient to revert the generated changes in `/x/pki/types/query.pb.gw.go`.
196
+
So, make sure that `runtime.AssumeColonVerbOpt(false)`in`/x/pki/types/query.pb.gw.go`.
197
+
It's usually sufficient to revert the generated changes in `/x/pki/types/query.pb.gw.go`.
176
198
177
199
## Update Cosmos-sdk Version
200
+
178
201
Re-generate cosmos base openapi (service API from cosmos exposed in DCL) using [cosmos-swagger-gen.sh](scripts/cosmos-swagger-gen.sh) from the project root:
202
+
179
203
- Consider using a docker container built from the provided [Dockerfile](scripts/Dockerfile) to have a predictable version of swagger
180
-
```
204
+
205
+
```bash
181
206
./scripts/cosmos-swagger-gen.sh base
182
207
./scripts/cosmos-swagger-gen.sh tx
183
208
```
184
209
185
210
## Update Tendermint Version
186
-
Please note, that we depend on the Tendermint fork https://github.com/zigbee-alliance/tendermint/releases/tag/v0.34.140
187
-
due to hotfixes for https://github.com/tendermint/tendermint/issues/7640 and https://github.com/tendermint/tendermint/issues/7641
211
+
212
+
Please note, that we depend on the Tendermint fork <https://github.com/zigbee-alliance/tendermint/releases/tag/v0.34.140>
213
+
due to hotfixes for <https://github.com/tendermint/tendermint/issues/7640> and <https://github.com/tendermint/tendermint/issues/7641>
188
214
required for Light Client Proxy.
189
215
Now that fixes are merged to Tendermint master, so check if we still need to depend on the fork.
190
216
191
217
Also don't forget to update the link to the Tendermint RPC in [Swagger UI](docs/index.html).
192
218
193
219
## Other
194
-
For more details, please have a look at [Cosmos SDK tutorial](https://tutorials.cosmos.network/).
195
220
221
+
For more details, please have a look at [Cosmos SDK tutorial](https://tutorials.cosmos.network/).
0 commit comments