Skip to content

Commit cd4614e

Browse files
authored
Merge pull request #536 from zigbee-alliance/#303-Upgrade-Cosmos-SDK
#303 Upgrade Cosmos SDK
2 parents 50ef772 + a7c4b32 commit cd4614e

File tree

956 files changed

+178578
-11567
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

956 files changed

+178578
-11567
lines changed

.github/.wordlist.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,9 @@ li
8383
md
8484
pdf
8585
ul
86-
WebSocket
86+
WebSocket
87+
cometbft
88+
CometBFT
89+
CometBFT's
90+
distributedcoplianceledger
91+
zigbeealliance

.github/actions/setup-molecule/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
steps:
2525
- uses: actions/setup-python@v3
2626
with:
27-
python-version: '3.x'
27+
python-version: '3.10'
2828
- name: install dependencies
2929
shell: bash
3030
run: pip install -r deployment/test-requirements.txt

.github/workflows/on-demand_molecule.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ name: Check All Molecule tests
1818
on:
1919
push:
2020
branches:
21-
- master
21+
- dev
2222
paths:
2323
- deployment/test-requirements.txt
2424
- deployment/ansible/roles/**
2525
pull_request:
2626
branches:
27-
- master
27+
- dev
2828
paths:
2929
- deployment/test-requirements.txt
3030
- deployment/ansible/roles/**

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ jobs:
129129
runs-on: ${{ matrix.os }}
130130
steps:
131131
- name: Set up Go 1.x
132-
uses: actions/setup-go@v3
132+
uses: actions/setup-go@v4
133133
with:
134-
go-version: ^1.16
134+
go-version: ^1.20
135135

136136
- name: Check out code into the Go module directory
137137
uses: actions/checkout@v2

.github/workflows/verify.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ jobs:
5656
if: needs.changes.outputs.workflows == 'true'
5757
name: Run actionlint tool to verify lint issues in GitHub actions
5858
runs-on: ubuntu-latest
59-
needs:
60-
- changes
59+
# needs:
60+
# - changes
6161
steps:
6262
- uses: actions/checkout@master
6363
- uses: reviewdog/action-actionlint@v1
@@ -85,9 +85,9 @@ jobs:
8585
needs:
8686
- lint
8787
steps:
88-
- uses: actions/setup-go@v3
88+
- uses: actions/setup-go@v4
8989
with:
90-
go-version: ^1.17
90+
go-version: ^1.20
9191
- uses: actions/checkout@v3
9292
- uses: actions/cache@v3
9393
if: ${{ !env.ACT }}
@@ -111,9 +111,9 @@ jobs:
111111
needs:
112112
- changes
113113
steps:
114-
- uses: actions/setup-go@v3
114+
- uses: actions/setup-go@v4
115115
with:
116-
go-version: ^1.17
116+
go-version: ^1.20
117117
- uses: actions/checkout@v3
118118
- uses: actions/cache@v3
119119
with:
@@ -134,13 +134,13 @@ jobs:
134134
- changes
135135
steps:
136136
- uses: actions/checkout@v3
137-
- uses: actions/setup-go@v3
137+
- uses: actions/setup-go@v4
138138
with:
139-
go-version: 1.17
139+
go-version: 1.21
140140
- name: golangci-lint
141-
uses: golangci/golangci-lint-action@v3.6.0
141+
uses: golangci/golangci-lint-action@v3
142142
with:
143-
version: v1.46.0
143+
version: v1.55
144144
args: --timeout 5m0s
145145
check:
146146
if: always()

.golangci.yml

+31
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,34 @@ linters:
5050
- nonamedreturns
5151
- exhaustruct
5252
- gofumpt
53+
- depguard
54+
- deadcode
55+
- godot
56+
- inamedparam
57+
- goconst
58+
- nosnakecase
59+
- perfsprint
60+
- unparam
61+
- revive
62+
63+
issues:
64+
exclude-rules:
65+
- path: _test\.go$
66+
linters:
67+
- goconst
68+
- stylecheck
69+
- testifylint
70+
- nosnakecase
71+
- perfsprint
72+
- dupword
73+
- testifylint
74+
- path: helpers\.go$
75+
linters:
76+
- goconst
77+
- stylecheck
78+
- testifylint
79+
- nosnakecase
80+
- perfsprint
81+
- dupword
82+
- testifylint
83+

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
FROM ubuntu:20.04 AS builder
2323

2424
ARG GO_VERSION
25-
ENV GO_VERSION=1.19.4
25+
ENV GO_VERSION=1.20
2626

2727
RUN apt-get update --fix-missing
2828
RUN apt-get install -y wget git gcc
@@ -36,7 +36,7 @@ ENV GOPATH /go
3636
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
3737
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
3838

39-
RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
39+
RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.3.0
4040

4141
############################
4242
# STEP 2 build node image

Dockerfile-build

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
FROM ubuntu:20.04 AS builder
2121

2222
ARG GO_VERSION
23-
ENV GO_VERSION=1.19.4
23+
ENV GO_VERSION=1.20
2424

2525
RUN apt-get update
2626
RUN apt-get install -y wget git gcc make

README-DEV.md

+22-19
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,16 @@ Please take into account the following when sending a PR:
153153

154154
## How To Add a new Module or Transaction
155155

156-
- Use [starport](https://github.com/tendermint/starport) command to scaffold the module.
157-
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).
156+
- Use [ignite v0.27.1](https://github.com/ignite/cli) command to scaffold the module.
157+
Consider using a docker container built from the provided [Dockerfile](scripts/Dockerfile) to have a predictable version of ignite. See [README.md](scripts/README.md).
158158
- Have a look at the scripts and commands used for generation of existing modules, messages and CRUD operations and do it in a similar way
159159
(for example [PKI module commands](scripts/starport/upgrade-0.44/07.pki_types.sh)).
160+
-
161+
**Note**:
162+
1. On previous scaffolding of modules `starport` cli used instead of `ignite`.
163+
While generating new module, command structure will the same except it must start with `ignite`.
164+
2. After execution of command `ignite scaffold ...` generated `.proto` files will be added into `proto/distributedcoplianceledger/{module}/{proto}`
165+
. So make sure to put contents of generated proto files into related folders inside `proto/zigbeealliance/..` folder.
160166
- If a new transaction with a new data in state (key-value) and new queries needs to be created, then both message and CRUD commands need to be executed.
161167
- If just a message to update existing state values need to be created, then a message command is enough.
162168
- Adjust the generated code
@@ -166,19 +172,18 @@ Please take into account the following when sending a PR:
166172
- add `(cosmos_proto.scalar) = "cosmos.AddressString"` annotation for all fields with address/account type (such as `signer` or `owner`).
167173
- fix types if needed in `proto/<module>/<entity>.proto` files
168174
- 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`.
169-
- Note2: for `uint16` type: use `int32` during starport scaffolding, and add custom validation (annotations above) to check the lower and upper bounds.
170-
- 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.
171-
- build proto (for example `starport chain build`). Fix compilation errors if any.
175+
- Note2: for `uint16` type: use `int32` during ignite scaffolding, and add custom validation (annotations above) to check the lower and upper bounds.
176+
- Note3: for `uint32` type: use `int32` during ignite scaffolding, then replace it by `uint32` in .proto files, re-generate the code and fix compilation errors.
177+
- build proto (for example `ignite chain build`). Fix compilation errors if any.
172178
- generate openapi docs from proto using (`scripts/dcl-swagger-gen.sh`). It's recommended to run from container built from [Dockerfile](scripts/Dockerfile)
173179
174180
- **Note1**: colons (`:`) are part of subject-id in PKI module, but colons are not allowed in gRPC REST URLs by default.
175181
`allow_colon_final_segments=true` should be used as a workaround.
176182
So, make sure that `runtime.AssumeColonVerbOpt(false)` in `/x/pki/types/query.pb.gw.go`.
177183
It's usually sufficient to revert the generated changes in `/x/pki/types/query.pb.gw.go`.
178-
- **Note2**: move `compliance_info.pb.go` and `compliance_history_item.pb.go` to `types/compliance` and adjust the import in other places accordingly.
179184
It may be easier just to revert changes in all `*.pb.go` files not affected by your changes in `.proto`
180-
- **Note3**: `starport chain build` needs to be called only if you made manual changes in `.proto` files.
181-
There is no need to call `starport chain build` again once all errors and adjustments above are done. It's sufficient just to build the project via usual ways (such as `make build`)
185+
- **Note3**: `ignite chain build` needs to be called only if you made manual changes in `.proto` files.
186+
There is no need to call `ignite chain build` again once all errors and adjustments above are done. It's sufficient just to build the project via usual ways (such as `make build`)
182187
- Add static validation for new messages:
183188
- Call `validator.Validate(msg)` in `ValidateBasic` methods for all generated messages
184189
- Add additional checks to `ValidateBasic` that do not depend on the state (key-value) and order of transactions
@@ -195,19 +200,19 @@ Please take into account the following when sending a PR:
195200

196201
## How To Make Changes in Data Model for Existing Modules
197202

198-
- Use [starport](https://github.com/tendermint/starport) command to scaffold the module.
199-
Consider using the provided [Dockerfile](scripts/Dockerfile) to have a predictable version of starport. See [README.md](scripts/README.md).
203+
- Use [ignite](https://github.com/ignite/cli) command to scaffold the module.
204+
Consider using the provided [Dockerfile](scripts/Dockerfile) to have a predictable version of ignite. See [README.md](scripts/README.md).
200205
- **Never change `.pb` files manually**. Do the changes in `.proto` files.
201-
- Every time `.proto` files change, re-generate the code (for example `starport chain build`) and fix compilation errors if any.
206+
- Every time `.proto` files change, re-generate the code (for example `ignite chain build`) and fix compilation errors if any.
202207
- Update openapi docs from proto using (`scripts/dcl-swagger-gen.sh`). It's recommended to run from container built from [Dockerfile](scripts/Dockerfile).
203208
- **Note1**: colons (`:`) are part of subject-id in PKI module, but colons are not allowed in gRPC REST URLs by default.
204209
`allow_colon_final_segments=true` should be used as a workaround.
205210
So, make sure that `runtime.AssumeColonVerbOpt(false)` in `/x/pki/types/query.pb.gw.go`.
206211
It's usually sufficient to revert the generated changes in `/x/pki/types/query.pb.gw.go`.
207212
- **Note2**: move `compliance_info.pb.go` and `compliance_history_item.pb.go` to `types/compliance` and adjust the import in other places accordingly.
208213
It may be easier just to revert changes in all `*.pb.go` files not affected by your changes in `.proto`
209-
- **Note3**: `starport chain build` needs to be called only if you made manual changes in `.proto` files.
210-
There is no need to call `starport chain build` again once all errors and adjustments above are done. It's sufficient just to build the project via usual ways (such as `make build`)
214+
- **Note3**: `ignite chain build` needs to be called only if you made manual changes in `.proto` files.
215+
There is no need to call `ignite chain build` again once all errors and adjustments above are done. It's sufficient just to build the project via usual ways (such as `make build`)
211216
212217
213218
## Update Cosmos-sdk Version
@@ -221,14 +226,12 @@ Re-generate cosmos base openapi (service API from cosmos exposed in DCL) using [
221226
./scripts/cosmos-swagger-gen.sh tx
222227
```
223228
224-
## Update Tendermint Version
225-
226-
Please note, that we depend on the Tendermint fork <https://github.com/zigbee-alliance/tendermint/releases/tag/v0.34.140>
227-
due to hotfixes for <https://github.com/tendermint/tendermint/issues/7640> and <https://github.com/tendermint/tendermint/issues/7641>
229+
## Update CometBFT Version
230+
Please note, that we depend on the CometBFT fork https://github.com/zigbee-alliance/cometbft/releases/tag/v0.37.5
231+
due to hotfixes for https://github.com/tendermint/tendermint/issues/7640 and https://github.com/tendermint/tendermint/issues/7641
228232
required for Light Client Proxy.
229-
Now that fixes are merged to Tendermint master, so check if we still need to depend on the fork.
230233
231-
Also don't forget to update the link to the Tendermint RPC in [Swagger UI](docs/index.html).
234+
Also don't forget to update the link to the CometBFT RPC in [Swagger UI](docs/index.html).
232235

233236
## Other
234237

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ DC Ledger is a public permissioned Ledger which can be used for two main use cas
1818

1919
More information about use cases can be found in [DC Ledger Overview](./docs/design/DCL-Overview.pdf) and [Use Case Diagrams](docs/use_cases).
2020

21-
DC Ledger is based on [Tendermint](https://tendermint.com/) and [Cosmos SDK](https://cosmos.network/sdk).
21+
DC Ledger is based on [CometBFT](https://cometbft.com/) and [Cosmos SDK](https://cosmos.network/sdk).
2222

2323
DC Ledger is a public permissioned ledger in the following sense:
2424

@@ -40,7 +40,7 @@ In order to send write transactions to the ledger you need:
4040

4141
### Pool of Nodes
4242

43-
- A network of Tendermint-based validator nodes (Validators and Observers) maintaining the ledger.
43+
- A network of CometBFT-based validator nodes (Validators and Observers) maintaining the ledger.
4444
- Every validator node (`dcld` binary) runs DC Ledger application code (based on Cosmos SDK) implementing the use cases.
4545
- See the proposed deployment in [deployment](docs/deployment.png) and [deployment-detailed](docs/deployment-detailed.png).
4646
- See recommended design for DCL MainNet deployment on AWS in [aws deployment](./docs/deployment-design-aws.md)
@@ -54,7 +54,7 @@ In order to send write transactions to the ledger you need:
5454
- **Private Sentry Node:** a full node to connect other Validator or Sentry nodes only; should not be accessed by clients.
5555
- **Public Sentry Node:** a full node to connect other external full nodes (possibly observer nodes).
5656
- **Observer Node (ON):** a full node that doesn't participate in consensus. Should be used to receive read/write requests from the clients.
57-
- **Light Client Proxy Node**: doesn't contain a full replication of data. Can be used as a proxy to untrusted Full nodes for single-value query requests sent via CLI or Tendermint RPC.
57+
- **Light Client Proxy Node**: doesn't contain a full replication of data. Can be used as a proxy to untrusted Full nodes for single-value query requests sent via CLI or CometBFT RPC.
5858
It will verify all state proofs automatically.
5959
- **Seed Node**: provides a list of peers which a node can connect to.
6060

@@ -64,7 +64,7 @@ See
6464
- [Deployment-detailed](docs/deployment-detailed.png).
6565
- [Deployment Recommendations](https://github.com/zigbee-alliance/distributed-compliance-ledger/wiki/DCL-MainNet-Deployment)
6666
- [Deployment Recommendations for AWS](./docs/deployment-design-aws.md)
67-
- <https://docs.tendermint.com/v0.34/tendermint-core/validators.html>
67+
- <https://docs.cometbft.com/v0.37/core/validators>
6868
- [Run Light Client Proxy](docs/running-light-client-proxy.md)
6969

7070
### Clients
@@ -79,7 +79,7 @@ A Light Client Proxy can be connected to multiple nodes and will verify the stat
7979
- [CLI](#cli)
8080
- [REST](#rest)
8181
- [gRPC](#grpc)
82-
- [Tendermint RPC and Light Client](#tendermint-rpc-and-light-client)
82+
- [CometBFT RPC and Light Client](#cometbft-rpc-and-light-client)
8383

8484
**Please note, that multi-value queries don't have state proofs support and should be sent to trusted nodes only.**
8585

@@ -126,7 +126,7 @@ See [Run local pool](README-DEV.md#run-local-pool) section in [README-DEV.md](RE
126126

127127
Should be used if there are no trusted Observer or Validator nodes to connect.
128128

129-
It can be a proxy for CLI or direct requests from code done via Tendermint RPC.
129+
It can be a proxy for CLI or direct requests from code done via CometBFT RPC.
130130

131131
Please note, that CLI can use a Light Client proxy only for single-value query requests.
132132
A Full Node (Validator or Observer) should be used for multi-value query requests and write requests.
@@ -139,7 +139,7 @@ See [Run Light Client Proxy](docs/running-light-client-proxy.md) for details how
139139

140140
- **There are no state proofs in REST, so REST queries should be sent to trusted Validator or Observer nodes only.**
141141
- OpenAPI specification: <https://zigbee-alliance.github.io/distributed-compliance-ledger/>.
142-
- Any running node exposes a REST API at port `1317`. See <https://docs.cosmos.network/v0.45/core/grpc_rest.html>.
142+
- Any running node exposes a REST API at port `1317`. See <https://docs.cosmos.network/v0.47/learn/advanced/grpc_rest>.
143143
- See [transactions](docs/transactions.md) for a full list of endpoints.
144144
- REST HTTP(S) queries can be directly used for read requests.
145145
See [How to read from the Ledger](docs/transactions.md#how-to-read-from-the-ledger).
@@ -150,23 +150,23 @@ See [Run Light Client Proxy](docs/running-light-client-proxy.md) for details how
150150
### gRPC
151151

152152
- **There are no state proofs in gRPC, so gRPC queries should be sent to trusted Validator or Observer nodes only.**
153-
- Any running node exposes a REST API at port `9090`. See <https://docs.cosmos.network/v0.45/core/grpc_rest.html>.
153+
- Any running node exposes a REST API at port `9090`. See <https://docs.cosmos.network/v0.47/learn/advanced/grpc_rest>.
154154
- A client code can be generated for all popular languages from the proto files [proto](proto), see <https://grpc.io/docs/languages/>.
155155
- The generated client code can be used for read and write requests, i.e. generation and signing of transactions
156156
See [How to read from the Ledger](docs/transactions.md#how-to-read-from-the-ledger) and [How to write to the Ledger](docs/transactions.md#how-to-write-to-the-ledger) for details.
157157

158-
### Tendermint RPC and Light Client
158+
### CometBFT RPC and Light Client
159159

160-
- Tendermint RPC is exposed by every running node at port `26657`. See <https://docs.cosmos.network/v0.45/core/grpc_rest.html#tendermint-rpc>.
161-
- Tendermint RPC supports state proofs. Tendermint's Light Client library can be used to verify the state proofs.
160+
- CometBFT RPC is exposed by every running node at port `26657`. See <https://docs.cosmos.network/v0.47/learn/advanced/grpc_rest#cometbft-rpc>.
161+
- CometBFT RPC supports state proofs. CometBFT's Light Client library can be used to verify the state proofs.
162162
So, if Light Client API is used, then it's possible to communicate with non-trusted nodes.
163163
- Please note, that multi-value queries don't have state proofs support and should be sent to trusted nodes only.
164164
- There are currently no DC Ledger specific API libraries for various platforms and languages,
165165
but they may be provided in the future.
166166
- The following libraries can be used as light clients:
167-
- [Golang Light Client implementation](https://pkg.go.dev/github.com/tendermint/tendermint/lite2)
168-
- [Rust Light Client implementation](https://docs.rs/tendermint-light-client/0.23.3/tendermint_light_client/)
169-
- Refer to [this doc](./docs/tendermint-rpc.md) to see how to [subscribe](./docs/tendermint-rpc.md#subscribe) to a Tendermint WebSocket based events and/or [query](./docs/tendermint-rpc.md#querying-application-components) an application components.
167+
- [Golang Light Client implementation](https://pkg.go.dev/github.com/cometbft/cometbft/light)
168+
- [Rust Light Client implementation](https://docs.rs/cometbft-light-client/0.1.0-alpha.2/cometbft_light_client/)
169+
- Refer to [this doc](./docs/cometbft-rpc.md) to see how to [subscribe](./docs/cometbft-rpc.md#subscribe) to a CometBFT WebSocket based events and/or [query](./docs/cometbft-rpc.md#querying-application-components) an application components.
170170

171171

172172
### Instructions
@@ -227,5 +227,5 @@ the following instructions from [how-to.md](docs/how-to.md) can be used for ever
227227
- [Running Node](docs/running-node.md)
228228
- [Pool Upgrade](docs/pool-upgrade.md)
229229
- [Pool Upgrade How To Guide](docs/pool-upgrade-how-to.md)
230-
- [Tendermint](https://tendermint.com/)
230+
- [CometBFT](https://cometbft.com/)
231231
- [Cosmos SDK](https://cosmos.network/sdk)

0 commit comments

Comments
 (0)