Set latest height/hash as trusted height/hash (#89)
This commit is contained in:
parent
8feb20b7b8
commit
473f9622f7
4 changed files with 12 additions and 20 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -762,6 +762,7 @@ dependencies = [
|
||||||
"cw2",
|
"cw2",
|
||||||
"cw20",
|
"cw20",
|
||||||
"cw20-base",
|
"cw20-base",
|
||||||
|
"getrandom",
|
||||||
"hex",
|
"hex",
|
||||||
"k256",
|
"k256",
|
||||||
"quartz-cw",
|
"quartz-cw",
|
||||||
|
|
|
@ -21,8 +21,8 @@ loader.env.MYAPP_DATA = { passthrough = true }
|
||||||
|
|
||||||
loader.argv = ["enclave",
|
loader.argv = ["enclave",
|
||||||
"--chain-id", "testing",
|
"--chain-id", "testing",
|
||||||
"--trusted-height", "1",
|
"--trusted-height", "{{ trusted_height }}",
|
||||||
"--trusted-hash", "9A5627F601CA82FF4C3967BAE6521B67B6CECB8FF6FCBAE11A1DF563192E7EB9"]
|
"--trusted-hash", "{{ trusted_hash }}"]
|
||||||
|
|
||||||
fs.mounts = [
|
fs.mounts = [
|
||||||
{ uri = "file:{{ gramine.runtimedir() }}", path = "/lib" },
|
{ uri = "file:{{ gramine.runtimedir() }}", path = "/lib" },
|
||||||
|
|
|
@ -24,6 +24,7 @@ CMD="wasmd --node http://$NODE_URL"
|
||||||
|
|
||||||
cd "$ROOT/cycles-quartz/apps/transfers"
|
cd "$ROOT/cycles-quartz/apps/transfers"
|
||||||
export TRUSTED_HASH=$(cat trusted.hash)
|
export TRUSTED_HASH=$(cat trusted.hash)
|
||||||
|
export TRUSTED_HEIGHT=$(cat trusted.height)
|
||||||
|
|
||||||
echo "using CMD: $CMD"
|
echo "using CMD: $CMD"
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
|
@ -85,7 +86,7 @@ echo "contract $CONTRACT"
|
||||||
cargo run -vvv -- --chain-id testing \
|
cargo run -vvv -- --chain-id testing \
|
||||||
--primary "http://$NODE_URL" \
|
--primary "http://$NODE_URL" \
|
||||||
--witnesses "http://$NODE_URL" \
|
--witnesses "http://$NODE_URL" \
|
||||||
--trusted-height 1 \
|
--trusted-height $TRUSTED_HEIGHT \
|
||||||
--trusted-hash $TRUSTED_HASH \
|
--trusted-hash $TRUSTED_HASH \
|
||||||
--contract-address $CONTRACT \
|
--contract-address $CONTRACT \
|
||||||
--storage-key "quartz_session" \
|
--storage-key "quartz_session" \
|
||||||
|
|
|
@ -16,20 +16,14 @@ echo "--------------------------------------------------------"
|
||||||
echo "set trusted hash"
|
echo "set trusted hash"
|
||||||
|
|
||||||
cd "$DIR_QUARTZ_TM_PROVER"
|
cd "$DIR_QUARTZ_TM_PROVER"
|
||||||
cargo run -- --chain-id testing \
|
CHAIN_STATUS=$($CMD status)
|
||||||
--primary "http://$NODE_URL" \
|
TRUSTED_HASH=$(echo "$CHAIN_STATUS" | jq -r .SyncInfo.latest_block_hash)
|
||||||
--witnesses "http://$NODE_URL" \
|
TRUSTED_HEIGHT=$(echo "$CHAIN_STATUS" | jq -r .SyncInfo.latest_block_height)
|
||||||
--trusted-height 1 \
|
|
||||||
--trusted-hash "5237772462A41C0296ED688A0327B8A60DF310F08997AD760EB74A70D0176C27" \
|
|
||||||
--contract-address "wasm14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0phg4d" \
|
|
||||||
--storage-key "quartz_session" \
|
|
||||||
--trace-file light-client-proof.json &> $DIR_QUARTZ_APP/output
|
|
||||||
|
|
||||||
cd $DIR_QUARTZ_APP
|
|
||||||
cat output | grep found | head -1 | awk '{print $NF}' | sed 's/\x1b\[[0-9;]*m//g' > trusted.hash
|
|
||||||
export TRUSTED_HASH=$(cat trusted.hash)
|
|
||||||
echo "... $TRUSTED_HASH"
|
echo "... $TRUSTED_HASH"
|
||||||
rm output
|
|
||||||
|
cd ""$DIR_QUARTZ_APP""
|
||||||
|
echo "$TRUSTED_HASH" > trusted.hash
|
||||||
|
echo "$TRUSTED_HEIGHT" > trusted.height
|
||||||
|
|
||||||
echo "--------------------------------------------------------"
|
echo "--------------------------------------------------------"
|
||||||
echo "configure gramine"
|
echo "configure gramine"
|
||||||
|
@ -38,10 +32,6 @@ cd "$DIR_QUARTZ_ENCLAVE"
|
||||||
echo "... gen priv key if it doesnt exist"
|
echo "... gen priv key if it doesnt exist"
|
||||||
gramine-sgx-gen-private-key > /dev/null 2>&1 || : # may fail
|
gramine-sgx-gen-private-key > /dev/null 2>&1 || : # may fail
|
||||||
|
|
||||||
echo "... update manifest template with trusted hash $TRUSTED_HASH"
|
|
||||||
sed -i -r "s/(\"--trusted-hash\", \")[A-Z0-9]+(\"])/\1$TRUSTED_HASH\2/" quartz.manifest.template
|
|
||||||
|
|
||||||
|
|
||||||
echo "... create manifest"
|
echo "... create manifest"
|
||||||
gramine-manifest \
|
gramine-manifest \
|
||||||
-Dlog_level="error" \
|
-Dlog_level="error" \
|
||||||
|
|
Loading…
Reference in a new issue