@@ -51,84 +51,84 @@ $SECRETCLI status --output=json | jq
51
51
# ----- NODE STATUS CHECK - END -----
52
52
53
53
# ------ NODE REGISTRATION - START ------
54
- if [ -f $SCRT_SGX_STORAGE /attectation_cert.der ]; then
55
- rm ${SCRT_SGX_STORAGE} /attectation_cert.der
56
- fi
57
- ./secretd init-enclave
58
- if [ $? -ne 0 ]; then
59
- echo " Failed to initialize SGX enclave"
60
- exit 1
61
- fi
62
-
63
- if [ ! -f ${SCRT_SGX_STORAGE} /attestation_cert.der ]; then
64
- echo " Failed to generate attestation_cert.der certificate"
65
- exit 1
66
- fi
67
-
68
- PUBLIC_KEY=$( ./secretd parse ${SCRT_SGX_STORAGE} /attestation_cert.der 2> /dev/null | cut -c 3-)
69
- if [ -z $PUBLIC_KEY ]; then
70
- echo " Failed to parse attestation_cert.der certificate"
71
- exit 1
72
- fi
73
- echo " Certificate public key: $PUBLIC_KEY "
74
-
75
- # On-chain registration and attestation
76
- json_register=$( mktemp -p $TMP_DIR )
77
- ./secretd tx register auth ${SCRT_SGX_STORAGE} /attestation_cert.der -y --from a --fees 3000uscrt --keyring-backend ${KEYRING} --home ${SECRETD_HOME} --output json | jq > $json_register
78
- if [ $? -ne 0 ]; then
79
- echo " Failed to register/auth node"
80
- exit 1
81
- fi
82
- code_id=$( cat $json_register | jq " .code" )
83
- if [[ ${code_id} -ne 0 ]]; then
84
- echo " Failed to register/auth node. Code: ${code_id} . Error: $( cat $json_register | jq ' .raw_log' ) "
85
- exit 1
86
- fi
87
- sleep 5s
88
- txhash=$( cat $json_register | jq " .txhash" | tr -d ' "' )
89
- $SECRETCLI q tx --type=hash " $txhash " --output json | jq > $json_register
90
- code_id=$( cat $json_register | jq " .code" )
91
- if [[ ${code_id} -ne 0 ]]; then
92
- echo " Failed to register/auth node. Error: $( cat $json_register | jq ' .raw_log' ) "
93
- exit 1
94
- fi
95
-
96
- SEED=$( ./secretd query register seed $PUBLIC_KEY | cut -c 3-)
97
- if [ -z $SEED ]; then
98
- echo " Failed to obtain encrypted seed"
99
- exit 1
100
- fi
101
- echo " Encrypted seed: $SEED "
102
- sleep 5s
103
- ./secretd query register secret-network-params
104
- if [ ! -f ./io-master-key.txt ] || [ ! -f ./node-master-key.txt ]; then
105
- echo " Failed to generate IO and Node Exch master key"
106
- exit 1
107
- fi
108
- ls -lh ./io-master-key.txt ./node-master-key.txt
109
-
110
- mkdir -p ${SECRETD_HOME} /.node
111
- ./secretd configure-secret node-master-key.txt $SEED --home ${SECRETD_HOME}
112
- if [ $? -ne 0 ]; then
113
- echo " Failed to configure secret node"
114
- exit 1
115
- fi
116
-
54
+ # if [ -f $SCRT_SGX_STORAGE/attectation_cert.der ]; then
55
+ # rm ${SCRT_SGX_STORAGE}/attectation_cert.der
56
+ # fi
57
+ # ./secretd init-enclave
58
+ # if [ $? -ne 0 ]; then
59
+ # echo "Failed to initialize SGX enclave"
60
+ # exit 1
61
+ # fi
62
+ #
63
+ # if [ ! -f ${SCRT_SGX_STORAGE}/attestation_cert.der ]; then
64
+ # echo "Failed to generate attestation_cert.der certificate"
65
+ # exit 1
66
+ # fi
67
+ #
68
+ # PUBLIC_KEY=$(./secretd parse ${SCRT_SGX_STORAGE}/attestation_cert.der 2> /dev/null | cut -c 3-)
69
+ # if [ -z $PUBLIC_KEY ]; then
70
+ # echo "Failed to parse attestation_cert.der certificate"
71
+ # exit 1
72
+ # fi
73
+ # echo "Certificate public key: $PUBLIC_KEY"
74
+ #
75
+ # # On-chain registration and attestation
76
+ # json_register=$(mktemp -p $TMP_DIR)
77
+ # ./secretd tx register auth ${SCRT_SGX_STORAGE}/attestation_cert.der -y --from a --keyring-backend ${KEYRING} --home ${SECRETD_HOME} --output json | jq > $json_register
78
+ # if [ $? -ne 0 ]; then
79
+ # echo "Failed to register/auth node"
80
+ # exit 1
81
+ # fi
82
+ # code_id=$(cat $json_register | jq ".code")
83
+ # if [[ ${code_id} -ne 0 ]]; then
84
+ # echo "Failed to register/auth node. Code: ${code_id}. Error: $(cat $json_register | jq '.raw_log')"
85
+ # exit 1
86
+ # fi
87
+ # sleep 5s
88
+ # txhash=$(cat $json_register | jq ".txhash" | tr -d '"')
89
+ # $SECRETCLI q tx --type=hash "$txhash" --output json | jq > $json_register
90
+ # code_id=$(cat $json_register | jq ".code")
91
+ # if [[ ${code_id} -ne 0 ]]; then
92
+ # echo "Failed to register/auth node. Error: $(cat $json_register | jq '.raw_log')"
93
+ # exit 1
94
+ # fi
95
+ #
96
+ # SEED=$(./secretd query register seed $PUBLIC_KEY | cut -c 3-)
97
+ # if [ -z $SEED ]; then
98
+ # echo "Failed to obtain encrypted seed"
99
+ # exit 1
100
+ # fi
101
+ # echo "Encrypted seed: $SEED"
102
+ # sleep 5s
103
+ # ./secretd query register secret-network-params
104
+ # if [ ! -f ./io-master-key.txt ] || [ ! -f ./node-master-key.txt ]; then
105
+ # echo "Failed to generate IO and Node Exch master key"
106
+ # exit 1
107
+ # fi
108
+ # ls -lh ./io-master-key.txt ./node-master-key.txt
109
+ #
110
+ # mkdir -p ${SECRETD_HOME}/.node
111
+ # ./secretd configure-secret node-master-key.txt $SEED --home ${SECRETD_HOME}
112
+ # if [ $? -ne 0 ]; then
113
+ # echo "Failed to configure secret node"
114
+ # exit 1
115
+ # fi
116
+ #
117
117
# Skip adding persistent peers seeds to config
118
118
119
119
# Optimize SGX memory for heavy contract calculations (e.g. NFT minting)
120
- sed -i.bak -e " s/^contract-memory-enclave-cache-size *=.*/contract-memory-enclave-cache-size = \" 15\" /" ${SECRETD_HOME} /config/app.toml
120
+ # sed -i.bak -e "s/^contract-memory-enclave-cache-size *=.*/contract-memory-enclave-cache-size = \"15\"/" ${SECRETD_HOME}/config/app.toml
121
121
122
122
# Set min gas price
123
- perl -i -pe ' s/^minimum-gas-prices = .+?$/minimum-gas-prices = "0.0125uscrt"/' ${SECRETD_HOME} /config/app.toml
123
+ # perl -i -pe 's/^minimum-gas-prices = .+?$/minimum-gas-prices = "0.0125uscrt"/' ${SECRETD_HOME}/config/app.toml
124
124
125
- NODE_ID=$( ./secretd tendermint show-node-id --home ${SECRETD_HOME} )
126
- if [ -z $NODE_ID ]; then
127
- echo " Failed to obtain node id"
128
- exit 1
129
- fi
130
- echo " Node ID: ${NODE_ID} "
131
- echo " <======= Secret Node registration successful ======>"
125
+ # NODE_ID=$(./secretd tendermint show-node-id --home ${SECRETD_HOME})
126
+ # if [ -z $NODE_ID ]; then
127
+ # echo "Failed to obtain node id"
128
+ # exit 1
129
+ # fi
130
+ # echo "Node ID: ${NODE_ID}"
131
+ # echo "<======= Secret Node registration successful ======>"
132
132
133
133
# ------ NODE REGISTRATION - END --------
134
134
@@ -209,7 +209,7 @@ sleep 5s
209
209
$SECRETCLI q tx --type=hash " $txhash " --output json | jq
210
210
$SECRETCLI q bank balances $address_scrt --home=$SECRETD_HOME --output=json | jq
211
211
212
- txhash=$( $SECRETCLI tx compute store ./integration-tests/test-contracts/contract.wasm.gz -y --gas 950000 --fees 12500uscrt -- from $address_scrt --chain-id=$CHAINID --keyring-backend ${KEYRING} --home=$SECRETD_HOME --output=json | jq " .txhash" | sed ' s/"//g' )
212
+ txhash=$( $SECRETCLI tx compute store ./integration-tests/test-contracts/contract.wasm.gz -y --gas 950000 --from $address_scrt --chain-id=$CHAINID --keyring-backend ${KEYRING} --home=$SECRETD_HOME --output=json | jq " .txhash" | sed ' s/"//g' )
213
213
sleep 5s
214
214
$SECRETCLI q tx --type=hash " $txhash " --output json | jq
215
215
$SECRETCLI q compute list-code --home=$SECRETD_HOME --output json | jq
@@ -219,7 +219,7 @@ CONTRACT_LABEL="counterContract"
219
219
TMPFILE=$( mktemp -p $TMP_DIR )
220
220
221
221
res_comp_1=$( mktemp -p $TMP_DIR )
222
- $SECRETCLI tx compute instantiate 1 ' {"count": 1}' --from $address_scrt --fees 5000uscrt -- label $CONTRACT_LABEL -y --keyring-backend ${KEYRING} --home=$SECRETD_HOME --chain-id $CHAINID --output json | jq > $res_comp_1
222
+ $SECRETCLI tx compute instantiate 1 ' {"count": 1}' --from $address_scrt --label $CONTRACT_LABEL -y --keyring-backend ${KEYRING} --home=$SECRETD_HOME --chain-id $CHAINID --output json | jq > $res_comp_1
223
223
txhash=$( cat $res_comp_1 | jq " .txhash" | sed ' s/"//g' )
224
224
sleep 5s
225
225
res_q_tx=$( mktemp -p $TMP_DIR )
@@ -241,7 +241,7 @@ if [[ ${expected_count} -ne 1 ]]; then
241
241
fi
242
242
# Scenario 1 - execute by query by contract label
243
243
json_compute_s1=$( mktemp -p $TMP_DIR )
244
- $SECRETCLI tx compute execute --label $CONTRACT_LABEL --from scrtsc ' {"increment":{}}' -y --home $SECRETD_HOME --keyring-backend ${KEYRING} --chain-id $CHAINID --fees 3000uscrt -- output json | jq > $json_compute_s1
244
+ $SECRETCLI tx compute execute --label $CONTRACT_LABEL --from scrtsc ' {"increment":{}}' -y --home $SECRETD_HOME --keyring-backend ${KEYRING} --chain-id $CHAINID --output json | jq > $json_compute_s1
245
245
code_id=$( cat $json_compute_s1 | jq " .code" )
246
246
if [[ ${code_id} -ne 0 ]]; then
247
247
cat $json_compute_s1 | jq " .raw_log"
@@ -258,7 +258,7 @@ if [[ ${expected_count} -ne 2 ]]; then
258
258
fi
259
259
# Scenario 2 - execute by contract address
260
260
json_compute_s2=$( mktemp -p $TMP_DIR )
261
- $SECRETCLI tx compute execute $contr_addr --from scrtsc ' {"increment":{}}' -y --home $SECRETD_HOME --keyring-backend ${KEYRING} --chain-id $CHAINID --fees 3000uscrt -- output json | jq > $json_compute_s2
261
+ $SECRETCLI tx compute execute $contr_addr --from scrtsc ' {"increment":{}}' -y --home $SECRETD_HOME --keyring-backend ${KEYRING} --chain-id $CHAINID --output json | jq > $json_compute_s2
262
262
code_id=$( cat $json_compute_s2 | jq " .code" )
263
263
if [[ ${code_id} -ne 0 ]]; then
264
264
cat $json_compute_s2 | jq " .raw_log"
487
487
# TMP_DIR=$(mktemp -d -p $(pwd))
488
488
unsigned_tx_file=$TMP_DIR /unsigned_tx.json
489
489
amount_to_send=" 10000"
490
- $SECRETCLI tx bank send $address_a $address_b ${amount_to_send} uscrt --fees=5000uscrt -- generate-only --output=json > $unsigned_tx_file
490
+ $SECRETCLI tx bank send $address_a $address_b ${amount_to_send} uscrt --generate-only --output=json > $unsigned_tx_file
491
491
492
492
unsigned_tx_file_aux=$TMP_DIR /unsigned_tx_aux.json
493
493
amount_to_send=" 10000"
494
- $SECRETCLI tx bank send $address_a $address_b ${amount_to_send} uscrt --fee-payer=${address_b} --fees=5000uscrt -- generate-only --output=json > $unsigned_tx_file_aux
494
+ $SECRETCLI tx bank send $address_a $address_b ${amount_to_send} uscrt --fee-payer=${address_b} --generate-only --output=json > $unsigned_tx_file_aux
495
495
496
496
# direct sign mode
497
497
signed_tx_file_direct=$TMP_DIR /signed_tx_direct.json
@@ -548,11 +548,11 @@ if [[ ! $? ]]; then
548
548
fi
549
549
550
550
# multisig
551
- $SECRETCLI keys add --multisig=a,b,c --multisig-threshold 2 abc --home=$SECRETD_HOME
551
+ $SECRETCLI keys add --multisig=a,b,c --multisig-threshold 2 abc --home=$SECRETD_HOME --keyring-backend ${KEYRING}
552
552
address_abc=$( $SECRETCLI keys show -a abc --keyring-backend ${KEYRING} --home=$SECRETD_HOME )
553
553
554
554
$SECRETCLI q bank balance $address_abc uscrt --output=json | jq ' .balance.amount'
555
- $SECRETCLI tx bank send $address_a $address_abc 100000uscrt --fees=2500uscrt - y --keyring-backend ${KEYRING} --home ${SECRETD_HOME}
555
+ $SECRETCLI tx bank send $address_a $address_abc 100000uscrt -y --keyring-backend ${KEYRING} --home ${SECRETD_HOME}
556
556
sleep 5s
557
557
$SECRETCLI q bank balance $address_abc uscrt --output=json | jq ' .balance.amount'
558
558
@@ -561,7 +561,7 @@ signed_a=$TMP_DIR/aSig.json
561
561
signed_b=$TMP_DIR /bSig.json
562
562
signed_multisig=$TMP_DIR /signed_multisig.json
563
563
amount_to_send_multisig=" 1000"
564
- $SECRETCLI tx bank send $address_abc $address_a ${amount_to_send_multisig} uscrt --fees=5000uscrt -- generate-only --output=json > $unsigned_tx_file_multisig
564
+ $SECRETCLI tx bank send $address_abc $address_a ${amount_to_send_multisig} uscrt --generate-only --output=json > $unsigned_tx_file_multisig
565
565
566
566
$SECRETCLI tx sign --multisig=abc --from a --output=json $unsigned_tx_file_multisig --keyring-backend ${KEYRING} --home ${SECRETD_HOME} > $signed_a
567
567
if [ $? -ne 0 ]; then
596
596
echo " Tx: $txhash Code:$( cat $qtx_json | jq ' .code' ) RawLog:$( cat $qtx_json | jq ' .raw_log' ) "
597
597
# ------ SIGNING - END --------
598
598
599
+ cleanup
600
+
599
601
set +x
600
602
echo " *** INTEGRATION TESTS PASSED! ***"
601
603
exit 0
0 commit comments