Skip to content

Commit 9ff9839

Browse files
DenisRybasashcherbakovToktar
authored
PKI Revocation (#475)
* added add_revocation_distribution_point_msg * updated msg_add_pki_revocation_distr_point structure * added script for add-revoc-distr-point msg * added update-pki-revocation-distribution-point msg * generated delete-pki-revocation-distribution-point msg * added PKIRevocationDistributionPoint entity * fixed build errors * added validations, fixed errors * fixed naming * finished renaming * validations added * fixed circular dependency * added validations * added errors for validations * fixed build errors * fixed error * Changed PkiRevocationDistributionPoint query Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Changed PkiRevocationDistributionPointAll query Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * changed CLI command Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * changed delete_pki_revocation_distribution_point cli command Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * changed query_pki_revocation_distribution_point cli command Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * changed add_pki_revocation_distribution_point command Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/keeper/grpc_query_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/client/cli/tx_update_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * processed comments * fixed errors * rebuilt code * processed comments * processed comments * processed comments * ADD_PKI_REVOCATION_DISTRIBUTION_POINT dynamic validations added * updated msg_server_add_pki_revocation_distribution_point * added validations for msg_server_update_pki_revocation_distribution_point * added validations for msg_server_delete_pki_revocation_distribution_point * added msg tests, fixed bugs * added msg_tests for update * added msg tests for delete * msg_add_revocation_distribution_point tests added, bugs fixed * added positive msg tests * added handler tests, fixed bugs * code cleanup, re-checked validations * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/keeper/msg_server_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/keeper/msg_server_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * processed comments * processed comments * processed comments * added revocation point query by issuerSubjectKeyId * processed comments * constants and integration tests added * txs and queries updated * updated validations and tests * fixed bugs * linted * linted * linted * code cleanup * fixed error * code cleanup * fixed linter warnings * updated validations * processed comments * updated RevocationPointsBySubjectKeyID * added logic for RevocationPointsBySubjectKeyID * added tests, fixed bugs * linted * cleanup * Update x/pki/types/message_add_pki_revocation_distribution_point.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/x509/x509.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/keeper/grpc_query_pki_revocation_distribution_points_by_issuer_subject_key_id.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * Update x/pki/x509/x509.go Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> * made error description better * fixed error * fixed tests * processed comments * Update PKI handler tests * Update GetPkiRevocationDistributionPoint and tests * fix linter * Update tests and Makefile * Update genlocalnetconfig.sh * Update Makefile.test * Update genlocalnetconfig.sh --------- Co-authored-by: Alexander Shcherbakov <alexander.sherbakov@dsr-corporation.com> Co-authored-by: toktar <renata.toktar@dsr-corporation.com>
1 parent 0da4c14 commit 9ff9839

File tree

171 files changed

+15765
-1967
lines changed

Some content is hidden

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

171 files changed

+15765
-1967
lines changed

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
############################
2020
# STEP 1 build cosmovisor
2121
############################
22-
FROM ubuntu:latest AS builder
22+
FROM ubuntu:20.04 AS builder
2323

2424
ARG GO_VERSION
2525
ENV GO_VERSION=1.19.4
@@ -41,7 +41,7 @@ RUN go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0
4141
############################
4242
# STEP 2 build node image
4343
############################
44-
FROM ubuntu:latest
44+
FROM ubuntu:20.04
4545

4646
COPY --from=builder /go/bin/cosmovisor /usr/bin/
4747

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PACKAGES = $(shell go list ./... | grep -v '/integration_tests')
22

33
ifndef DCL_VERSION
4-
DCL_VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
4+
DCL_VERSION := $(shell echo $(shell git describe --tags --always) | sed 's/^v//')
55
endif
66

77
ifndef DCL_COMMIT

Makefile.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ifndef DCL_VERSION
2-
DCL_VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
2+
DCL_VERSION := $(shell echo $(shell git describe --tags --always) | sed 's/^v//')
33
endif
44

55
ifndef DCL_COMMIT
@@ -34,7 +34,7 @@ localnet_init:
3434
/bin/bash ./genlocalnetappbins.sh
3535

3636
localnet_init_latest_stable_release:
37-
/bin/bash ./genlocalnetconfig.sh
37+
/bin/bash ./genlocalnetconfig.sh ${MAINNET_STABLE_VERSION}
3838
/bin/bash ./genlocalnetappbins.sh "" "" "" ${MAINNET_STABLE_VERSION}
3939

4040
localnet_start:

README-DEV.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ It's recommended to develop and deploy the App on Ubuntu 18.04 or Ubuntu 20.04.
5555
./integration_tests/run-all.sh
5656
```
5757

58-
If you want to run a particular group of tests (cli, light, rest), you can
58+
If you want to run a particular group of tests (cli, light, rest, deploy, upgrade), you can
5959

6060
```bash
6161
./integration_tests/run-all.sh cli

app/app.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
tmos "github.com/tendermint/tendermint/libs/os"
3535
dbm "github.com/tendermint/tm-db"
3636
"github.com/zigbee-alliance/distributed-compliance-ledger/docs"
37+
dclpkitypes "github.com/zigbee-alliance/distributed-compliance-ledger/types/pki"
3738
compliancemodule "github.com/zigbee-alliance/distributed-compliance-ledger/x/compliance"
3839
compliancemodulekeeper "github.com/zigbee-alliance/distributed-compliance-ledger/x/compliance/keeper"
3940
compliancetypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/compliance/types"
@@ -52,7 +53,6 @@ import (
5253
modelmoduletypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/model/types"
5354
pkimodule "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki"
5455
pkimodulekeeper "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/keeper"
55-
pkimoduletypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/pki/types"
5656
validatormodule "github.com/zigbee-alliance/distributed-compliance-ledger/x/validator"
5757
validatormodulekeeper "github.com/zigbee-alliance/distributed-compliance-ledger/x/validator/keeper"
5858
validatormoduletypes "github.com/zigbee-alliance/distributed-compliance-ledger/x/validator/types"
@@ -253,7 +253,7 @@ func New(
253253
dclauthmoduletypes.StoreKey,
254254
validatormoduletypes.StoreKey,
255255
dclupgrademoduletypes.StoreKey,
256-
pkimoduletypes.StoreKey,
256+
dclpkitypes.StoreKey,
257257
vendorinfomoduletypes.StoreKey,
258258
modelmoduletypes.StoreKey,
259259
compliancetypes.StoreKey,
@@ -399,8 +399,8 @@ func New(
399399

400400
app.PkiKeeper = *pkimodulekeeper.NewKeeper(
401401
appCodec,
402-
keys[pkimoduletypes.StoreKey],
403-
keys[pkimoduletypes.MemStoreKey],
402+
keys[dclpkitypes.StoreKey],
403+
keys[dclpkitypes.MemStoreKey],
404404

405405
app.DclauthKeeper,
406406
)
@@ -542,7 +542,7 @@ func New(
542542
validatormoduletypes.ModuleName,
543543
dclgenutilmoduletypes.ModuleName,
544544
dclupgrademoduletypes.ModuleName,
545-
pkimoduletypes.ModuleName,
545+
dclpkitypes.ModuleName,
546546
vendorinfomoduletypes.ModuleName,
547547
modelmoduletypes.ModuleName,
548548
compliancetypes.ModuleName,
@@ -777,7 +777,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
777777
paramsKeeper.Subspace(validatormoduletypes.ModuleName)
778778
paramsKeeper.Subspace(dclgenutilmoduletypes.ModuleName)
779779
paramsKeeper.Subspace(dclupgrademoduletypes.ModuleName)
780-
paramsKeeper.Subspace(pkimoduletypes.ModuleName)
780+
paramsKeeper.Subspace(dclpkitypes.ModuleName)
781781
paramsKeeper.Subspace(vendorinfomoduletypes.ModuleName)
782782
paramsKeeper.Subspace(modelmoduletypes.ModuleName)
783783
paramsKeeper.Subspace(compliancetypes.ModuleName)

genlocalnetconfig.sh

+39-30
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
set -euo pipefail
1717

18+
MAINNET_STABLE_VERSION="${1:-""}"
1819
DCL_OBSERVERS="${DCL_OBSERVERS:-}"
1920
LOCALNET_DIR=".localnet"
2021

@@ -27,6 +28,7 @@ fi
2728
DCL_DIR="$HOME/.dcl"
2829
KEYPASSWD=test1234 # NOTE not necessary actually since we yse 'test' keyring backend now
2930
CHAIN_ID=dclchain
31+
DCL_BINARY=dcld
3032

3133
rm -rf "$DCL_DIR"
3234

@@ -37,48 +39,55 @@ if [[ -n "$DCL_OBSERVERS" ]]; then
3739
mkdir "$LOCALNET_DIR/observer0"
3840
fi
3941

42+
if [ -n "$MAINNET_STABLE_VERSION" ]; then
43+
wget "https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/${MAINNET_STABLE_VERSION}/dcld"
44+
chmod ugo+x dcld
45+
DCL_BINARY=./dcld
46+
fi
47+
48+
4049
# client
4150

42-
dcld config chain-id "$CHAIN_ID"
43-
dcld config output json
44-
dcld config node "tcp://localhost:26657"
45-
dcld config keyring-backend test
46-
dcld config broadcast-mode block
51+
$DCL_BINARY config chain-id "$CHAIN_ID"
52+
$DCL_BINARY config output json
53+
$DCL_BINARY config node "tcp://localhost:26657"
54+
$DCL_BINARY config keyring-backend test
55+
$DCL_BINARY config broadcast-mode block
4756

48-
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | dcld keys add jack
49-
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | dcld keys add alice
50-
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | dcld keys add bob
51-
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | dcld keys add anna
57+
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | $DCL_BINARY keys add jack
58+
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | $DCL_BINARY keys add alice
59+
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | $DCL_BINARY keys add bob
60+
(echo "$KEYPASSWD"; echo "$KEYPASSWD") | $DCL_BINARY keys add anna
5261

5362
# common keyring (client) data for all the nodes
5463
# TODO issue 99: do we need all the keys on all the nodes
55-
jack_address=$(echo "$KEYPASSWD" | dcld keys show jack -a)
56-
jack_pubkey=$(echo "$KEYPASSWD" | dcld keys show jack -p)
64+
jack_address=$(echo "$KEYPASSWD" | $DCL_BINARY keys show jack -a)
65+
jack_pubkey=$(echo "$KEYPASSWD" | $DCL_BINARY keys show jack -p)
5766

58-
alice_address=$(echo "$KEYPASSWD" | dcld keys show alice -a)
59-
alice_pubkey=$(echo "$KEYPASSWD" | dcld keys show alice -p)
67+
alice_address=$(echo "$KEYPASSWD" | $DCL_BINARY keys show alice -a)
68+
alice_pubkey=$(echo "$KEYPASSWD" | $DCL_BINARY keys show alice -p)
6069

61-
bob_address=$(echo "$KEYPASSWD" | dcld keys show bob -a)
62-
bob_pubkey=$(echo "$KEYPASSWD" | dcld keys show bob -p)
70+
bob_address=$(echo "$KEYPASSWD" | $DCL_BINARY keys show bob -a)
71+
bob_pubkey=$(echo "$KEYPASSWD" | $DCL_BINARY keys show bob -p)
6372

64-
anna_address=$(echo "$KEYPASSWD" | dcld keys show anna -a)
65-
anna_pubkey=$(echo "$KEYPASSWD" | dcld keys show anna -p)
73+
anna_address=$(echo "$KEYPASSWD" | $DCL_BINARY keys show anna -a)
74+
anna_pubkey=$(echo "$KEYPASSWD" | $DCL_BINARY keys show anna -p)
6675

6776
mv "$DCL_DIR"/* $LOCALNET_DIR/client
6877

6978

7079
function add_genesis_accounts {
71-
dcld add-genesis-account --address="$jack_address" --pubkey="$jack_pubkey" --roles="Trustee,NodeAdmin"
72-
dcld add-genesis-account --address="$alice_address" --pubkey="$alice_pubkey" --roles="Trustee,NodeAdmin"
73-
dcld add-genesis-account --address="$bob_address" --pubkey="$bob_pubkey" --roles="Trustee,NodeAdmin"
74-
dcld add-genesis-account --address="$anna_address" --pubkey="$anna_pubkey" --roles="NodeAdmin"
80+
$DCL_BINARY add-genesis-account --address="$jack_address" --pubkey="$jack_pubkey" --roles="Trustee,NodeAdmin"
81+
$DCL_BINARY add-genesis-account --address="$alice_address" --pubkey="$alice_pubkey" --roles="Trustee,NodeAdmin"
82+
$DCL_BINARY add-genesis-account --address="$bob_address" --pubkey="$bob_pubkey" --roles="Trustee,NodeAdmin"
83+
$DCL_BINARY add-genesis-account --address="$anna_address" --pubkey="$anna_pubkey" --roles="NodeAdmin"
7584
}
7685

7786

7887
function gentx {
7988
local _node_name="$1"
8089
local _key_name="$2"
81-
echo "$KEYPASSWD" | dcld gentx "$_key_name" --chain-id "$CHAIN_ID" --moniker "$_node_name"
90+
echo "$KEYPASSWD" | $DCL_BINARY gentx "$_key_name" --chain-id "$CHAIN_ID" --moniker "$_node_name"
8291
}
8392

8493

@@ -87,7 +96,7 @@ function init_node {
8796
local _key_name="${2:-}"
8897
local _copy_only="${3:-}"
8998

90-
dcld init "$_node_name" --chain-id "$CHAIN_ID"
99+
$DCL_BINARY init "$_node_name" --chain-id "$CHAIN_ID"
91100
cp -R "$LOCALNET_DIR"/client/* "$DCL_DIR"
92101

93102
# we need to make them in an app state for each node
@@ -125,8 +134,8 @@ done
125134

126135
# Embed them into genesis
127136

128-
dcld collect-gentxs
129-
dcld validate-genesis
137+
$DCL_BINARY collect-gentxs
138+
$DCL_BINARY validate-genesis
130139

131140
# Update genesis for all nodes
132141

@@ -185,11 +194,11 @@ function init_light_client_proxy {
185194

186195
rm -rf "$DCL_DIR"
187196

188-
dcld config chain-id "$CHAIN_ID"
189-
dcld config node "tcp://localhost:26657"
190-
dcld config broadcast-mode block
191-
dcld config keyring-backend test
192-
dcld config broadcast-mode block
197+
$DCL_BINARY config chain-id "$CHAIN_ID"
198+
$DCL_BINARY config node "tcp://localhost:26657"
199+
$DCL_BINARY config broadcast-mode block
200+
$DCL_BINARY config keyring-backend test
201+
$DCL_BINARY config broadcast-mode block
193202

194203
cp -R "$LOCALNET_DIR"/client/* "$DCL_DIR"
195204

0 commit comments

Comments
 (0)