Skip to content

Commit b947994

Browse files
committed
Azure pipeline fixes
1 parent d4e5049 commit b947994

File tree

13 files changed

+75
-52
lines changed

13 files changed

+75
-52
lines changed

deployment/ci/bootstrap_init.sh

+13-10
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ set -euvo pipefail
55
rm -rf ~/.secretd/*
66
rm -rf /opt/secret/.sgx_secrets/*
77

8-
secretd config chain-id secretdev-1
9-
secretd config keyring-backend test
8+
secretd config set client chain-id secretdev-1
9+
secretd config set client keyring-backend test
1010

1111
secretd init banana --chain-id secretdev-1
1212

@@ -25,17 +25,20 @@ echo $b_mnemonic | secretd keys add b --recover
2525
echo $c_mnemonic | secretd keys add c --recover
2626
echo $d_mnemonic | secretd keys add d --recover
2727

28-
secretd add-genesis-account "$(secretd keys show -a a)" 1000000000000000000uscrt
29-
secretd add-genesis-account "$(secretd keys show -a b)" 1000000000000000000uscrt
30-
secretd add-genesis-account "$(secretd keys show -a c)" 1000000000000000000uscrt
31-
secretd add-genesis-account "$(secretd keys show -a d)" 1000000000000000000uscrt
28+
secretd genesis add-genesis-account "$(secretd keys show -a a)" 1000000000000000000uscrt
29+
secretd genesis add-genesis-account "$(secretd keys show -a b)" 1000000000000000000uscrt
30+
secretd genesis add-genesis-account "$(secretd keys show -a c)" 1000000000000000000uscrt
31+
secretd genesis add-genesis-account "$(secretd keys show -a d)" 1000000000000000000uscrt
3232

33-
secretd gentx a 1000000uscrt --chain-id secretdev-1
33+
secretd genesis gentx a 1000000uscrt --chain-id secretdev-1
3434

35-
secretd collect-gentxs
36-
secretd validate-genesis
35+
secretd genesis collect-gentxs
36+
secretd genesis validate
3737

3838
secretd init-bootstrap
39-
secretd validate-genesis
39+
secretd genesis validate
40+
41+
# Setup LCD
42+
perl -i -pe 's;address = "tcp://localhost:1317";address = "tcp://0.0.0.0:1317";' ~/.secretd/config/app.toml
4043

4144
source /opt/sgxsdk/environment && RUST_BACKTRACE=1 secretd start --rpc.laddr tcp://0.0.0.0:26657 --bootstrap

deployment/ci/node_init.sh

+18-15
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ rm -rf ~/.secretd
1414
NO_TESTS="${NO_TESTS:-}"
1515

1616
mkdir -p /root/.secretd/.node
17-
secretd config keyring-backend test
18-
secretd config node tcp://bootstrap:26657
19-
secretd config chain-id secretdev-1
17+
secretd config set client chain-id secretdev-1
18+
secretd config set client keyring-backend test
19+
secretd config set client node tcp://bootstrap:26657
2020

2121
secretd init "$(hostname)" --chain-id secretdev-1 || true
2222

@@ -32,7 +32,13 @@ sleep 20
3232

3333
cp /tmp/.secretd/keyring-test /root/.secretd/ -r
3434

35-
secretd init-enclave
35+
sed -i 's|//,"collateral_service": "https://api.trustedservices.intel.com/sgx/certification/v4/"|,"collateral_service": "https://pccs.scrtlabs.com/sgx/certification/v4/"|' /etc/sgx_default_qcnl.conf
36+
sed -i 's|"pccs_url": "https://localhost:8081/sgx/certification/v4/"|"pccs_url": "https://global.acccache.azure.net/sgx/certification/v3/"|' /etc/sgx_default_qcnl.conf
37+
38+
groupadd sgx_prv
39+
usermod -a -G sgx_prv $(whoami)
40+
41+
secretd init-enclave --no-epid
3642

3743
PUBLIC_KEY=$(secretd dump /opt/secret/.sgx_secrets/pubkey.bin 2> /dev/null)
3844

@@ -51,9 +57,9 @@ secretd configure-secret node-master-key.txt "$SEED"
5157

5258
cp /tmp/.secretd/config/genesis.json /root/.secretd/config/genesis.json
5359

54-
secretd validate-genesis
60+
secretd genesis validate
5561

56-
secretd config node tcp://localhost:26657
62+
secretd config set client node tcp://localhost:26657
5763

5864
if [ ! -z "$NO_TESTS" ]
5965
then
@@ -73,7 +79,7 @@ function wait_for_tx () {
7379
done
7480
}
7581

76-
until (secretd status 2>&1 | jq -e '(.SyncInfo.latest_block_height | tonumber) > 0' &>/dev/null); do
82+
until (secretd status 2>&1 | jq -e '(.sync_info.latest_block_height | tonumber) > 0' &>/dev/null); do
7783
echo "Waiting for chain to start..."
7884
sleep 1
7985
done
@@ -82,32 +88,30 @@ sleep 5
8288

8389
# store wasm code on-chain so we could later instantiate it
8490
export STORE_TX_HASH=$(
85-
yes |
86-
secretd tx compute store erc20.wasm --from a --gas 1200000 --gas-prices 0.25uscrt --output json |
91+
secretd tx compute store erc20.wasm --from a --gas 1200000 --gas-prices 0.25uscrt --output json -y |
8792
jq -r .txhash
8893
)
8994

9095
wait_for_tx "$STORE_TX_HASH" "Waiting for store to finish on-chain..."
9196

9297
# test storing of wasm code (this doesn't touch sgx yet)
9398
secretd q tx "$STORE_TX_HASH" --output json |
94-
jq -e '.logs[].events[].attributes[] | select(.key == "code_id" and .value == "1")'
99+
jq -e '.events[].attributes[] | select(.key == "code_id" and .value == "1")'
95100

96101
# init the contract (ocall_init + write_db + canonicalize_address)
97102
# a is a tendermint address (will be used in transfer: https://github.com/CosmWasm/cosmwasm-examples/blob/f2f0568ebc90d812bcfaa0ef5eb1da149a951552/erc20/src/contract.rs#L110)
98103
# secret1f395p0gg67mmfd5zcqvpnp9cxnu0hg6rjep44t is just a random address
99104
# balances are set to 108 & 53 at init
100105
INIT_TX_HASH=$(
101-
yes |
102-
secretd tx compute instantiate 1 "{\"decimals\":10,\"initial_balances\":[{\"address\":\"$(secretd keys show a -a)\",\"amount\":\"108\"},{\"address\":\"secret1f395p0gg67mmfd5zcqvpnp9cxnu0hg6rjep44t\",\"amount\":\"53\"}],\"name\":\"ReuvenPersonalRustCoin\",\"symbol\":\"RPRC\"}" --label RPRCCoin --output json --gas-prices 0.25uscrt --from a |
106+
secretd tx compute instantiate 1 "{\"decimals\":10,\"initial_balances\":[{\"address\":\"$(secretd keys show a -a)\",\"amount\":\"108\"},{\"address\":\"secret1f395p0gg67mmfd5zcqvpnp9cxnu0hg6rjep44t\",\"amount\":\"53\"}],\"name\":\"ReuvenPersonalRustCoin\",\"symbol\":\"RPRC\"}" --label RPRCCoin --output json --gas-prices 0.25uscrt --from a -y |
103107
jq -r .txhash
104108
)
105109

106110
wait_for_tx "$INIT_TX_HASH" "Waiting for instantiate to finish on-chain..."
107111

108112
export CONTRACT_ADDRESS=$(
109113
secretd q tx "$INIT_TX_HASH" --output json |
110-
jq -er '.logs[].events[].attributes[] | select(.key == "contract_address") | .value' |
114+
jq -er '.events[].attributes[] | select(.key == "contract_address") | .value' |
111115
head -1
112116
)
113117

@@ -119,8 +123,7 @@ secretd q compute query "$CONTRACT_ADDRESS" "{\"balance\":{\"address\":\"secret1
119123

120124
# transfer 10 balance (ocall_handle + read_db + write_db + humanize_address + canonicalize_address)
121125
TRANSFER_TX_HASH=$(
122-
yes |
123-
secretd tx compute execute --from a "$CONTRACT_ADDRESS" '{"transfer":{"amount":"10","recipient":"secret1f395p0gg67mmfd5zcqvpnp9cxnu0hg6rjep44t"}}' --gas-prices 0.25uscrt --output json 2> /dev/null |
126+
secretd tx compute execute --from a "$CONTRACT_ADDRESS" '{"transfer":{"amount":"10","recipient":"secret1f395p0gg67mmfd5zcqvpnp9cxnu0hg6rjep44t"}}' --gas-prices 0.25uscrt --output json -y 2> /dev/null |
124127
jq -r .txhash
125128
)
126129

deployment/ci/query-load-test/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"devDependencies": {
44
"@types/node": "^17.0.23",
55
"axios": "^0.26.1",
6-
"secretjs": "1.7.1-beta.0",
6+
"secretjs": "1.15.0-beta.3",
77
"typescript": "^4.6.3"
88
},
99
"dependencies": {

deployment/ci/query-load-test/test.js

+18-7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ const CHAIN_ID = "secretdev-1";
1212
const c_mnemonic =
1313
"chair love bleak wonder skirt permit say assist aunt credit roast size obtain minute throw sand usual age smart exact enough room shadow charge";
1414

15+
const getValueFromEvents = (events, key) => {
16+
if (!events) {
17+
return "";
18+
}
19+
20+
for (const e of events) {
21+
for (const a of e.attributes) {
22+
if (`${e.type}.${a.key}` === key) {
23+
return String(a.value);
24+
}
25+
}
26+
}
27+
28+
return "";
29+
}
30+
1531
// Returns a client with which we can interact with secret network
1632
const initializeClient = async (endpoint, chainId) => {
1733
const wallet = new Wallet(c_mnemonic);
@@ -163,13 +179,9 @@ const uploadContract = async (
163179
throw new Error(`Failed to upload contract`);
164180
}
165181

166-
const codeIdKv = uploadReceipt.jsonLog[0].events[0].attributes.find(
167-
(a) => {
168-
return a.key === "code_id";
169-
}
170-
);
182+
const codeIdKv = getValueFromEvents(uploadReceipt.events, "message.code_id");
171183

172-
const codeId = Number(codeIdKv.value);
184+
const codeId = Number(codeIdKv);
173185
console.log(`${contractName} contract codeId: ${codeId}`);
174186

175187
const codeHash = (await client.query.compute.codeHashByCodeId({code_id: String(codeId)})).code_hash;
@@ -215,7 +227,6 @@ const initializeContract = async (
215227
gasLimit: 4000000,
216228
}
217229
);
218-
219230
console.log(`decrypt: ${JSON.stringify(contract)}`)
220231

221232
if (contract.code !== 0) {

deployment/dockerfiles/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# `--target compile-secretd` - image with compiled enclave and secretd
99

1010
ARG SCRT_BASE_IMAGE_ENCLAVE=ghcr.io/scrtlabs/sgx-rust:2204-1.1.6
11-
ARG SCRT_RELEASE_BASE_IMAGE=ghcr.io/scrtlabs/release-base:22.04-2.20-dcap
11+
ARG SCRT_RELEASE_BASE_IMAGE=ghcr.io/scrtlabs/release-base:22.04-2.25-dcap
1212

1313
# ***************** PREPARE COMPILE ENCLAVE ************** #
1414

deployment/dockerfiles/base-images/app.Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
FROM ubuntu:jammy as runtime_base
1+
FROM ubuntu:jammy AS runtime_base
22

33
LABEL maintainer=enigmampc
44

55
# SGX version parameters
6-
ARG SDK_VERSION=2.20
7-
ARG SGX_VERSION=2.20.100.4
8-
ARG PSW_VERSION=2.20.100.4-jammy1
6+
ARG SDK_VERSION=2.25
7+
ARG SGX_VERSION=2.25.100.3
8+
ARG PSW_VERSION=2.25.100.3-jammy1
99
ARG OS_REVESION=jammy1
10-
ARG DCAP_VERSION=1.17.100.4-jammy1
10+
ARG DCAP_VERSION=1.22.100.3-jammy1
1111
#RUN apt-get update && \
1212
# apt-get install -y --no-install-recommends \
1313
# #### Base utilities ####
@@ -93,4 +93,4 @@ RUN echo -e 'no\n/opt' | ./sgx/sgx_linux_x64_sdk_${SGX_VERSION}.bin && \
9393
##
9494
ENV LD_LIBRARY_PATH=/opt/sgxsdk/libsgx-enclave-common/
9595
#
96-
##RUN SGX_DEBUG=0 SGX_MODE=HW SGX_PRERELEASE=1 make
96+
##RUN SGX_DEBUG=0 SGX_MODE=HW SGX_PRERELEASE=1 make

deployment/dockerfiles/ibc/docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: "3.9"
22
services:
33
localsecret-1:
4-
image: "ghcr.io/scrtlabs/localsecret:v0.0.0"
4+
image: "ghcr.io/scrtlabs/localsecret:beta"
55
# ports are only here in case interaction
66
# between localhost and container is desired
77
ports:
@@ -21,7 +21,7 @@ services:
2121
timeout: 5s
2222
retries: 5
2323
localsecret-2:
24-
image: "ghcr.io/scrtlabs/localsecret:v0.0.0"
24+
image: "ghcr.io/scrtlabs/localsecret:beta"
2525
# ports are only here in case interaction
2626
# between localhost and container is desired
2727
ports:

deployment/dockerfiles/tests/compile-contracts.Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
FROM ghcr.io/scrtlabs/release-base:20.04-2.20
1+
FROM ghcr.io/scrtlabs/release-base:22.04-2.25-dcap
22

3-
ARG NODE_VERSION=16
3+
ARG NODE_VERSION=18
44

55
RUN mkdir -p /opt/secret/.sgx_secrets
66

77
COPY scripts/install-wasm-tools.sh install-wasm-tools.sh
88
RUN chmod +x install-wasm-tools.sh
99
RUN ./install-wasm-tools.sh
1010

11-
RUN $HOME/.cargo/bin/rustup install 1.61
11+
RUN $HOME/.cargo/bin/rustup install 1.71
12+
RUN $HOME/.cargo/bin/rustup default 1.71
1213
RUN $HOME/.cargo/bin/rustup target add wasm32-unknown-unknown
1314

1415
ENV GOROOT=/usr/local/go
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# This dockerfile contains tests that require a full network to run, and require a running node that is connected to the network
22

3-
FROM ghcr.io/scrtlabs/compile-contracts:1.10.0
3+
FROM ghcr.io/scrtlabs/compile-contracts:1.15.2
44

55
COPY deployment/ci/query-load-test query-load-test
66

77
WORKDIR query-load-test
88

99
RUN npm install
1010

11-
ENTRYPOINT ["node", "test.js"]
11+
ENTRYPOINT ["node", "test.js"]

deployment/dockerfiles/tests/system-tests.Dockerfile

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This dockerfile contains tests that only test the compute module, using a single node. They do not execute tests
22
# on multiple nodes, nor do they require a full network or interfaces with user libraries, network latency, etc.
33

4-
FROM ghcr.io/scrtlabs/compile-contracts:1.10.0
4+
FROM ghcr.io/scrtlabs/compile-contracts:1.15.2
55

66
RUN mkdir -p /opt/secret/.sgx_secrets
77

@@ -26,6 +26,7 @@ COPY cmd cmd
2626
RUN true
2727
COPY client client
2828
COPY ias_keys ias_keys
29+
COPY eip191 eip191
2930

3031
COPY spid.txt ias_keys/develop/spid.txt
3132
COPY spid.txt ias_keys/sw_dummy/spid.txt
@@ -43,7 +44,11 @@ COPY deployment/ci/go-tests-bench.sh .
4344
RUN chmod +x go-tests.sh
4445
RUN chmod +x go-tests-bench.sh
4546

46-
COPY --from=azcr.io/enigmampc/ci-base-image-local /go/src/github.com/enigmampc/SecretNetwork/go-cosmwasm/target/release/libgo_cosmwasm.so ./go-cosmwasm/api/libgo_cosmwasm.so
47-
COPY --from=azcr.io/enigmampc/ci-base-image-local /go/src/github.com/enigmampc/SecretNetwork/go-cosmwasm/librust_cosmwasm_enclave.signed.so x/compute/internal/keeper/librust_cosmwasm_enclave.signed.so
47+
COPY --from=azcr.io/enigmampc/ci-base-image-local /go/src/github.com/scrtlabs/SecretNetwork/go-cosmwasm/target/release/libgo_cosmwasm.so ./go-cosmwasm/api/libgo_cosmwasm.so
48+
COPY --from=azcr.io/enigmampc/ci-base-image-local /go/src/github.com/scrtlabs/SecretNetwork/go-cosmwasm/librust_cosmwasm_enclave.signed.so x/compute/internal/keeper/librust_cosmwasm_enclave.signed.so
49+
50+
RUN ln -s /usr/lib/x86_64-linux-gnu/libsgx_dcap_quoteverify.so.1 /usr/lib/x86_64-linux-gnu/libsgx_dcap_quoteverify.so
51+
RUN ln -s /usr/lib/x86_64-linux-gnu/libsgx_epid.so.1 /usr/lib/x86_64-linux-gnu/libsgx_epid.so
52+
RUN ln -s /usr/lib/x86_64-linux-gnu/libsgx_dcap_ql.so.1 /usr/lib/x86_64-linux-gnu/libsgx_dcap_ql.so
4853

4954
ENTRYPOINT ["/bin/bash", "go-tests.sh"]

go-cosmwasm/api/link_std.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
package api
55

6-
// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lgo_cosmwasm -lsgx_dcap_ql -lsgx_dcap_quoteverify
6+
// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lgo_cosmwasm -lsgx_dcap_ql -lsgx_dcap_quoteverify -lsgx_epid
77
import "C"

scripts/install-wasm-tools.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ cargo install pwasm-utils-cli --bin wasm-prune --force
8181
if [[ "$OSTYPE" == "linux-gnu" ]]; then
8282
set -e
8383

84-
sudo apt-get install -y wabt
84+
$MAKE_ME_ROOT apt-get install -y wabt
8585
fi
8686

8787
echo ""
Binary file not shown.

0 commit comments

Comments
 (0)