@@ -22,10 +22,10 @@ wget -O dcld-initial "https://github.com/zigbee-alliance/distributed-compliance-
22
22
chmod ugo+x dcld-initial
23
23
24
24
DCLD_BIN=" ./dcld-initial"
25
+ $DCLD_BIN config broadcast-mode block
25
26
26
27
container=" validator-demo"
27
28
add_validator_node () {
28
- # FIXME: as it's called before upgrade, mainnet stable version of dcld needs to be used (not the latest master)
29
29
random_string account
30
30
address=" "
31
31
LOCALNET_DIR=" .localnet"
@@ -41,15 +41,9 @@ add_validator_node() {
41
41
passphrase=" test1234"
42
42
docker_network=" distributed-compliance-ledger_localnet"
43
43
44
- docker build -f Dockerfile-build -t dcld-build .
45
- docker container create --name dcld-build-inst dcld-build
46
- docker cp dcld-build-inst:/go/bin/dcld ./
47
- docker rm dcld-build-inst
48
-
49
44
docker run -d --name $container --ip $ip -p " $node_p2p_port -$node_client_port :26656-26657" --network $docker_network -i dcledger
50
45
51
- docker cp ./dcld " $container " :" $DCL_USER_HOME " /
52
- rm -f ./dcld
46
+ docker cp $DCLD_BIN " $container " :" $DCL_USER_HOME " /dcld
53
47
54
48
test_divider
55
49
@@ -78,30 +72,30 @@ add_validator_node() {
78
72
79
73
address=" $( docker exec $container /bin/sh -c " echo $passphrase | ./dcld keys show $account -a" ) "
80
74
pubkey=" $( docker exec $container /bin/sh -c " echo $passphrase | ./dcld keys show $account -p" ) "
81
- alice_address=" $( dcld keys show alice -a) "
82
- bob_address=" $( dcld keys show bob -a) "
83
- jack_address=" $( dcld keys show jack -a) "
75
+ alice_address=" $( $DCLD_BIN keys show alice -a) "
76
+ bob_address=" $( $DCLD_BIN keys show bob -a) "
77
+ jack_address=" $( $DCLD_BIN keys show jack -a) "
84
78
echo " Create account for $account and Assign NodeAdmin role"
85
- echo $passphrase | dcld tx auth propose-add-account --address=" $address " --pubkey=" $pubkey " --roles=" NodeAdmin" --from jack --yes
86
- echo $passphrase | dcld tx auth approve-add-account --address=" $address " --from alice --yes
87
- echo $passphrase | dcld tx auth approve-add-account --address=" $address " --from bob --yes
79
+ echo $passphrase | $DCLD_BIN tx auth propose-add-account --address=" $address " --pubkey=" $pubkey " --roles=" NodeAdmin" --from jack --yes
80
+ echo $passphrase | $DCLD_BIN tx auth approve-add-account --address=" $address " --from alice --yes
81
+ echo $passphrase | $DCLD_BIN tx auth approve-add-account --address=" $address " --from bob --yes
88
82
89
83
test_divider
90
84
vaddress=$( docker exec $container ./dcld tendermint show-address)
91
85
vpubkey=$( docker exec $container ./dcld tendermint show-validator)
92
86
93
87
echo " Check pool response for yet unknown node \" $node_name \" "
94
- result=$( dcld query validator node --address " $address " )
88
+ result=$( $DCLD_BIN query validator node --address " $address " )
95
89
check_response " $result " " Not Found"
96
90
echo " $result "
97
- result=$( dcld query validator last-power --address " $address " )
91
+ result=$( $DCLD_BIN query validator last-power --address " $address " )
98
92
check_response " $result " " Not Found"
99
93
echo " $result "
100
94
101
95
echo " $account Add Node \" $node_name \" to validator set"
102
96
103
97
! read -r -d ' ' _script << EOF
104
- set -eu; echo test1234 | dcld tx validator add-node --pubkey='$vpubkey ' --moniker="$node_name " --from="$account " --yes
98
+ set -eu; echo test1234 | $DCLD_BIN tx validator add-node --pubkey='$vpubkey ' --moniker="$node_name " --from="$account " --yes
105
99
EOF
106
100
result=" $( docker exec " $container " /bin/sh -c " echo test1234 | ./dcld tx validator add-node --pubkey='$vpubkey ' --moniker=" $node_name " --from=" $account " --yes" ) "
107
101
check_response " $result " " \" code\" : 0"
119
113
docker exec -d $container cosmovisor start
120
114
sleep 10
121
115
122
- result=$( dcld query validator node --address " $address " )
116
+ result=$( $DCLD_BIN query validator node --address " $address " )
123
117
validator_address=$( echo " $result " | jq -r ' .owner' )
124
118
echo " $result "
125
119
}
@@ -199,10 +193,18 @@ user_3_address=$(echo $passphrase | $DCLD_BIN keys show $user_3 -a)
199
193
user_3_pubkey=$( echo $passphrase | $DCLD_BIN keys show $user_3 -p)
200
194
201
195
echo " Create Vendor account $vendor_account "
202
- create_new_vendor_account $vendor_account $vid
196
+ result=" $( echo $passphrase | $DCLD_BIN keys add " $vendor_account " ) "
197
+ _address=$( echo $passphrase | $DCLD_BIN keys show $vendor_account -a)
198
+ _pubkey=$( echo $passphrase | $DCLD_BIN keys show $vendor_account -p)
199
+ result=" $( echo $passphrase | $DCLD_BIN tx auth propose-add-account --address=" $_address " --pubkey=" $_pubkey " --vid=" $vid " --roles=" Vendor" --from jack --yes) "
203
200
204
201
echo " Create CertificationCenter account"
205
- create_new_account certification_center_account " CertificationCenter"
202
+ certification_center_account=" certification_center_account_"
203
+ result=" $( echo $passphrase | $DCLD_BIN keys add $certification_center_account ) "
204
+ _address=$( echo $passphrase | $DCLD_BIN keys show $certification_center_account -a)
205
+ _pubkey=$( echo $passphrase | $DCLD_BIN keys show $certification_center_account -p)
206
+ result=" $( echo $passphrase | $DCLD_BIN tx auth propose-add-account --address=" $_address " --pubkey=" $_pubkey " --roles=" CertificationCenter" --from jack --yes) "
207
+ result=" $( echo $passphrase | $DCLD_BIN tx auth approve-add-account --address=" $_address " --from alice --yes) "
206
208
207
209
random_string trustee_account_4
208
210
random_string trustee_account_5
@@ -470,14 +472,14 @@ test_divider
470
472
471
473
echo " Disable node"
472
474
# FIXME: use proper binary (not dcld but $DCLD_BIN)
473
- result=$( docker exec " $container " /bin/sh -c " echo test1234 | dcld tx validator disable-node --from=$account --yes" )
475
+ result=$( docker exec " $container " /bin/sh -c " echo test1234 | ./ dcld tx validator disable-node --from=$account --yes" )
474
476
check_response " $result " " \" code\" : 0"
475
477
476
478
test_divider
477
479
478
480
echo " Enable node"
479
481
# FIXME: use proper binary (not dcld but $DCLD_BIN)
480
- result=$( docker exec " $container " /bin/sh -c " echo test1234 | dcld tx validator enable-node --from=$account --yes" )
482
+ result=$( docker exec " $container " /bin/sh -c " echo test1234 | ./ dcld tx validator enable-node --from=$account --yes" )
481
483
check_response " $result " " \" code\" : 0"
482
484
483
485
test_divider
@@ -502,7 +504,7 @@ test_divider
502
504
503
505
echo " Enable node"
504
506
# FIXME: use proper binary (not dcld but $DCLD_BIN)
505
- result=$( docker exec " $container " /bin/sh -c " echo test1234 | dcld tx validator enable-node --from=$account --yes" )
507
+ result=$( docker exec " $container " /bin/sh -c " echo test1234 | ./ dcld tx validator enable-node --from=$account --yes" )
506
508
check_response " $result " " \" code\" : 0"
507
509
508
510
test_divider
0 commit comments