Skip to content

Commit 33a7261

Browse files
committed
#303 Upgrade Cosmos-SDK to v0.47.3
- Update docs Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com> Signed-off-by: Abdulbois <abdulbois123@gmail.com>
1 parent 2488685 commit 33a7261

17 files changed

+78
-116
lines changed

Dockerfile

-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,13 @@ ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
3737
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
3838

3939
RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.3.0
40-
RUN go install github.com/cometbft/cometbft/cmd/cometbft@v0.37.4
4140

4241
############################
4342
# STEP 2 build node image
4443
############################
4544
FROM ubuntu:20.04
4645

4746
COPY --from=builder /go/bin/cosmovisor /usr/bin/
48-
COPY --from=builder /go/bin/cometbft /usr/bin/
4947

5048
# test user
5149
ARG TEST_USER

README-DEV.md

-9
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,6 @@ Re-generate cosmos base openapi (service API from cosmos exposed in DCL) using [
221221
./scripts/cosmos-swagger-gen.sh tx
222222
```
223223
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/cometbft/cometbft/issues/7640> and <https://github.com/cometbft/cometbft/issues/7641>
228-
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.
230-
231-
Also don't forget to update the link to the Tendermint RPC in [Swagger UI](docs/index.html).
232-
233224
## Other
234225
235226
For more details, please have a look at [Cosmos SDK tutorial](https://tutorials.cosmos.network/).

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ See [Run Light Client Proxy](docs/running-light-client-proxy.md) for details how
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/cometbft/cometbft/lite2)
168-
- [Rust Light Client implementation](https://docs.rs/tendermint-light-client/0.23.3/tendermint_light_client/)
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/)
169169
- 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.
170170

171171

cmd/dcld/cmd/root.go

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ func initRootCmd(
184184
txCommand(),
185185
keys.Commands(app.DefaultNodeHome),
186186
)
187+
188+
rootCmd.AddCommand(LightCmd)
187189
}
188190

189191
// queryCommand returns the sub-command to send queries to the app.

docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ services:
113113
networks:
114114
localnet:
115115
ipv4_address: 192.167.10.7
116-
command: sh -c "sleep 10 && cometbft light dclchain -p tcp://192.167.10.2:26657 -w tcp://192.167.10.3:26657,tcp://192.167.10.4:26657 --laddr=tcp://0.0.0.0:8888 --log_level=debug"
116+
command: cosmovisor run light dclchain -p tcp://192.167.10.2:26657 -w tcp://192.167.10.3:26657,tcp://192.167.10.4:26657 --start-timeout=20 --log-level=debug
117117

118118

119119
networks:

integration_tests/cli/common.sh

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ check_response() {
7979

8080
if [[ "$(_check_response "$_result" "$_expected_string" "$_mode")" != true ]]; then
8181
echo "${GREEN}ERROR:${RESET} command failed. The expected string: '$_expected_string' not found in the result: $_result"
82+
docker logs -n 100 lightclient0
8283
exit 1
8384
fi
8485
}

integration_tests/run-all.sh

+29-29
Original file line numberDiff line numberDiff line change
@@ -128,26 +128,26 @@ cleanup_pool
128128
#fi
129129

130130
# Light Client Proxy Cli shell tests
131-
#if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "light" ]]; then
132-
# CLI_SHELL_TESTS=$(find integration_tests/light_client_proxy -type f -name '*.sh' -not -name "common.sh" | sort)
133-
#
134-
# for CLI_SHELL_TEST in ${CLI_SHELL_TESTS}; do
135-
# init_pool
136-
#
137-
# log "*****************************************************************************************"
138-
# log "Running $CLI_SHELL_TEST"
139-
# log "*****************************************************************************************"
140-
#
141-
# if bash "$CLI_SHELL_TEST" &>${DETAILED_OUTPUT_TARGET}; then
142-
# log "$CLI_SHELL_TEST finished successfully"
143-
# else
144-
# log "$CLI_SHELL_TEST failed"
145-
# exit 1
146-
# fi
147-
#
148-
# cleanup_pool
149-
# done
150-
#fi
131+
if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "light" ]]; then
132+
CLI_SHELL_TESTS=$(find integration_tests/light_client_proxy -type f -name '*.sh' -not -name "common.sh" | sort)
133+
134+
for CLI_SHELL_TEST in ${CLI_SHELL_TESTS}; do
135+
init_pool
136+
137+
log "*****************************************************************************************"
138+
log "Running $CLI_SHELL_TEST"
139+
log "*****************************************************************************************"
140+
141+
if bash "$CLI_SHELL_TEST" &>${DETAILED_OUTPUT_TARGET}; then
142+
log "$CLI_SHELL_TEST finished successfully"
143+
else
144+
log "$CLI_SHELL_TEST failed"
145+
exit 1
146+
fi
147+
148+
cleanup_pool
149+
done
150+
fi
151151

152152
# Go rest tests
153153
#if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "rest" ]]; then
@@ -176,15 +176,15 @@ cleanup_pool
176176
#fi
177177

178178
# Deploy tests
179-
#if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "deploy" ]]; then
180-
# DEPLOY_SHELL_TEST="./integration_tests/deploy/test_deploy.sh"
181-
# if bash "$DEPLOY_SHELL_TEST" &>${DETAILED_OUTPUT_TARGET}; then
182-
# log "$DEPLOY_SHELL_TEST finished successfully"
183-
# else
184-
# log "$DEPLOY_SHELL_TEST failed"
185-
# exit 1
186-
# fi
187-
#fi
179+
if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "deploy" ]]; then
180+
DEPLOY_SHELL_TEST="./integration_tests/deploy/test_deploy.sh"
181+
if bash "$DEPLOY_SHELL_TEST" &>${DETAILED_OUTPUT_TARGET}; then
182+
log "$DEPLOY_SHELL_TEST finished successfully"
183+
else
184+
log "$DEPLOY_SHELL_TEST failed"
185+
exit 1
186+
fi
187+
fi
188188

189189
# Upgrade procedure tests
190190
if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "upgrade" ]]; then

integration_tests/upgrade/common.sh

+14-19
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ create_new_account(){
107107
eval $__resultvar="'$name'"
108108

109109
local roles="$2"
110-
110+
local dcld = ${3:-dcld}
111111
echo "Account name: $name"
112112

113113
echo "Generate key for $name"
114-
(echo $passphrase; echo $passphrase) | dcld keys add "$name"
114+
(echo $passphrase; echo $passphrase) | $dcld keys add "$name"
115115

116-
address=$(echo $passphrase | dcld keys show $name -a)
117-
pubkey=$(echo $passphrase | dcld keys show $name -p)
116+
address=$(echo $passphrase | $dcld keys show $name -a)
117+
pubkey=$(echo $passphrase | $dcld keys show $name -p)
118118

119119
echo "Jack proposes account for \"$name\" with roles: \"$roles\""
120-
result=$(echo $passphrase | dcld tx auth propose-add-account --address="$address" --pubkey="$pubkey" --roles=$roles --from jack --yes)
120+
result=$(echo $passphrase | $dcld tx auth propose-add-account --address="$address" --pubkey="$pubkey" --roles=$roles --from jack --yes)
121121
check_response "$result" "\"code\": 0"
122122
echo "$result"
123123

124124
echo "Alice approves account for \"$name\" with roles: \"$roles\""
125-
result=$(echo $passphrase | dcld tx auth approve-add-account --address="$address" --from alice --yes)
125+
result=$(echo $passphrase | $dcld tx auth approve-add-account --address="$address" --from alice --yes)
126126
check_response "$result" "\"code\": 0"
127127
echo "$result"
128128
}
@@ -131,20 +131,15 @@ create_new_vendor_account(){
131131

132132
local _name="$1"
133133
local _vid="$2"
134+
local dcld = ${3:-dcld}
135+
136+
echo $passphrase | $dcld keys add "$_name"
137+
_address=$(echo $passphrase | $dcld keys show $_name -a)
138+
_pubkey=$(echo $passphrase | $dcld keys show $_name -p)
139+
140+
result=$(echo $passphrase | $dcld tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --roles=Vendor --vid=$_vid --pid_ranges=$_pid_ranges --from jack --yes)
141+
check_response "$result" "\"code\": 0"
134142

135-
echo $passphrase | dcld keys add "$_name"
136-
_address=$(echo $passphrase | dcld keys show $_name -a)
137-
_pubkey=$(echo $passphrase | dcld keys show $_name -p)
138-
139-
local _result=""
140-
if [ $# -eq 3 ]; then
141-
local _pid_ranges="$3"
142-
echo "Jack proposes account for \"$_name\" with Vendor role and with [$_pid_ranges] associated Product IDs"
143-
_result=$(echo $passphrase | dcld tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --roles=Vendor --vid=$_vid --pid_ranges=$_pid_ranges --from jack --yes)
144-
else
145-
echo "Jack proposes account for \"$_name\" with Vendor role"
146-
_result=$(echo $passphrase | dcld tx auth propose-add-account --address="$_address" --pubkey="$_pubkey" --roles=Vendor --vid=$_vid --from jack --yes)
147-
fi
148143
}
149144

150145

integration_tests/upgrade/test-upgrade-0.12-to-1.2.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ company_legal_name="LegalCompanyName"
255255
company_preferred_name="CompanyPreferredName"
256256
vendor_landing_page_url="https://www.example.com"
257257

258-
dcld config broadcast-mode block
258+
$DCLD_BIN_OLD config broadcast-mode block
259259

260260
random_string user_1
261261
echo "$user_1 generates keys"
@@ -279,10 +279,10 @@ user_3_address=$(echo $passphrase | $DCLD_BIN_OLD keys show $user_3 -a)
279279
user_3_pubkey=$(echo $passphrase | $DCLD_BIN_OLD keys show $user_3 -p)
280280

281281
echo "Create Vendor account $vendor_account"
282-
create_new_vendor_account $vendor_account $vid
282+
create_new_vendor_account $vendor_account $vid $DCLD_BIN_OLD
283283

284284
echo "Create CertificationCenter account"
285-
create_new_account certification_center_account "CertificationCenter"
285+
create_new_account certification_center_account "CertificationCenter" $DCLD_BIN_OLD
286286

287287
random_string trustee_account_4
288288
random_string trustee_account_5

integration_tests/upgrade/test-upgrade-1.2-to-1.3.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,10 @@ user_3_address=$(echo $passphrase | $DCLD_BIN_OLD keys show $user_3 -a)
283283
user_3_pubkey=$(echo $passphrase | $DCLD_BIN_OLD keys show $user_3 -p)
284284

285285
echo "Create Vendor account $vendor_account"
286-
create_new_vendor_account $vendor_account $vid
286+
create_new_vendor_account $vendor_account $vid $DCLD_BIN_OLD
287287

288288
echo "Create CertificationCenter account"
289-
create_new_account certification_center_account "CertificationCenter"
289+
create_new_account certification_center_account "CertificationCenter" $DCLD_BIN_OLD
290290

291291
random_string trustee_account_4
292292
random_string trustee_account_5

proto/buf.gen.pulsar.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ managed:
1515
override:
1616
plugins:
1717
- name: go-grpc
18-
out: ../types
19-
opt: paths=source_relative
18+
out: ..

scripts/Dockerfile

+16-34
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,30 @@ RUN curl -L https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o /tmp/go.
1515
&& go version \
1616
&& rm -f /tmp/go.tar.gz
1717

18-
# Install protoc
19-
ARG PROTOC_VERSION
20-
ENV PROTOC_VERSION=${PROTOC_VERSION:-3.19.4}
21-
RUN PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip \
22-
&& curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP} \
23-
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
24-
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
25-
&& rm -f $PROTOC_ZIP
26-
27-
# Install grpc-gateway tools
28-
ENV PROTOC_GEN_GRPC_GATEWAY_VERSION=v2.8.0
29-
ENV PROTOC_GEN_OPENAPIV2_VERSION=v2.8.0
18+
# Install tools
19+
ENV BUF_BUILD=v1.29.0
20+
ENV PROTOC_GEN_GRPC_GATEWAY_VERSION=v2.19.0
21+
ENV PROTOC_GEN_OPENAPIV2_VERSION=v2.19.0
3022
ENV PROTOC_GEN_SWAGGER_VERSION=v1.16.0
23+
ENV PROTOC_GEN_GO_COSMOS=v1.4.10
24+
ENV PROTOC_GEN_GO_PULSAR=v1.0.0-beta.2
25+
ENV PROTOC_GEN_GO=v1.32.0
26+
ENV PROTOC_GEN_GO_GRPC=v1.1.0
3127

3228
RUN go install \
33-
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${PROTOC_GEN_GRPC_GATEWAY_VERSION} \
34-
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${PROTOC_GEN_OPENAPIV2_VERSION}
29+
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@${PROTOC_GEN_GRPC_GATEWAY_VERSION} \
30+
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${PROTOC_GEN_OPENAPIV2_VERSION} \
31+
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${PROTOC_GEN_SWAGGER_VERSION} \
3532

36-
RUN go install \
37-
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${PROTOC_GEN_SWAGGER_VERSION}
33+
RUN go install github.com/bufbuild/buf/cmd/buf@${BUF_BUILD}
34+
RUN go install github.com/cosmos/gogoproto/protoc-gen-gocosmos@${PROTOC_GEN_GO_COSMOS}
35+
RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@${PROTOC_GEN_GO_PULSAR}
36+
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_GO}
37+
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC}
3838

3939
RUN npm install -g swagger-combine
4040

4141

42-
# Install starport
43-
ARG STARPORT_VERSION
44-
ENV STARPORT_VERSION=${STARPORT_VERSION:-0.19.5}
45-
#ENV STARPORT_VERSION=${STARPORT_VERSION:-dev}
46-
47-
RUN if [ "$STARPORT_VERSION" = "dev" ]; then \
48-
curl -L https://github.com/tendermint/starport/archive/refs/heads/develop.zip -o /tmp/starport.zip && \
49-
cd /tmp \
50-
&& unzip starport.zip \
51-
&& cd starport-develop \
52-
&& make build \
53-
&& cp ./dist/starport /usr/local/bin; \
54-
else \
55-
curl https://get.starport.network/starport@v${STARPORT_VERSION}! -o /tmp/startport \
56-
&& bash /tmp/startport \
57-
&& rm /tmp/startport; \
58-
fi
59-
6042
ENV PATH="/root/go/bin:${PATH}"
6143
ENV PATH="${PATH}:/usr/local/bin"
6244

scripts/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
The [Dockerfile](./Dockerfile) might be handy for the following cases:
88

9-
- when you want to use not yet release (dev) version of `starport`
10-
- when you don't want to setup starport or swagger dependencies locally by some reason
9+
- when you don't want to setup Ignite or Swagger dependencies locally by some reason
1110

1211
`[Note]` If you want to install dependencies locally, try to use versions specified in [Dockerfile](./Dockerfile) to avoid errors while running scripts
1312

@@ -25,10 +24,10 @@ docker run -it -v "$PWD":/dcl <name[:tag]> /bin/bash
2524

2625
## Scripts
2726

28-
Build proto (for example `starport chain build`).
27+
Build proto (for example `buf generate --template buf.gen.gogo.yaml`).
2928

3029
```bash
31-
starport chain build
30+
./scripts/protocgen.sh
3231
```
3332

3433
Generate Cosmos base openapi

scripts/cosmos-swagger-gen.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ echo "Generating Cosmos openapi for '$TYPE'"
66
CONFIG_FILE="$PWD/scripts/swagger/config/cosmos-$TYPE-config.json"
77
OUTPUT_FILE="$PWD/docs/static/cosmos-$TYPE-openapi.json"
88

9-
COSMOS_SDK_VERSION="v0.44.4"
9+
COSMOS_SDK_VERSION="v0.47.8"
1010

1111
rm -rf ./tmp-swagger-gen
1212
mkdir -p ./tmp-swagger-gen

scripts/swagger/config/cosmos-base-config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"swagger": "2.0",
33
"info": {
44
"title": "cosmos/base/tendermint/v1beta1/query.proto",
5-
"version": "v0.44.4","description": "A REST interface for base service endpoints"
5+
"version": "v0.47.8","description": "A REST interface for base service endpoints"
66
},
77
"apis": [
88
{

scripts/swagger/config/cosmos-tx-config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"swagger": "2.0",
33
"info": {
44
"title": "cosmos/tx/v1beta1/service.proto",
5-
"version": "v0.44.4","description": "A REST interface for tx service endpoints"
5+
"version": "v0.47.8","description": "A REST interface for tx service endpoints"
66
},
77
"apis": [
88
{

scripts/swagger/protoc-swagger-gen.sh

+1-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ for dir in $proto_dirs; do
1515
# generate swagger files (filter query files)
1616
query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \))
1717
if [[ ! -z "$query_file" ]]; then
18-
protoc \
19-
-I "proto" \
20-
-I "third_party/proto" \
21-
"$query_file" \
22-
--swagger_out=./swagger-out \
23-
--swagger_opt=logtostderr=true --swagger_opt=fqn_for_swagger_name=true --swagger_opt=simple_operation_ids=true
18+
buf generate --template buf.gen.swagger.yaml "$query_file"
2419
fi
2520
done
2621

0 commit comments

Comments
 (0)