Skip to content

Commit

Permalink
Upgrade upstream 0.6.12 sub2.0.0 (#31)
Browse files Browse the repository at this point in the history
* automatic-shard-joining-and-per-shard-updates-on-block (integritee-network#160)

* [enclave] update_map contains options. This is needed if a storage value needs to be deleted in the STF
[enclave, stf] perform state updates per shard, auto join new shards

* [worker] only feed 100 blocks at a time into the chain relay. Improved logging while syncing to keep track of sync status

* [WorkerApi] Remove default protocol ws.

* update ipfs version (integritee-network#165)

Co-authored-by: bwty <whalelephant@users.noreply.github.com>

* Implement Ipfs read and write with verification in enclave

this implements gitcoin bounty integritee-network#70 
Co-authored-by: bwty <whalelephant@users.noreply.github.com>

* Encointer contributions upstreaming (integritee-network#174)

* [enclave] ! fix: init-shard if it does not exist
* back up chain relay db before update in case of file corruption
* clean up chain relay sync logging
* Ws server refactor (#13)
* changed ws_server completely. Requests from client are now handled in the worker main event loop to prevent race conditions with on state/chain_relay access.
* [ws_server] remove unwrap and send instead "invalid_client_request" to client
* updating block number in stf state
* [enclave/chain_relay] store only hashes of the headers instead of the headers themselves
* enclave: patch log and env_logger to mesalock
* worker should panic if it can't write to shard
* add public getters for unpermissioned statistics (#16)
* don't request key provisioning form other worker. assume its there or generate new (dangerous!)
* bump version to 0.6.11 like encointer reference release

Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com>
Co-authored-by: Marcel Frei <marcel.frei@electronix.ch>
Co-authored-by: Christian Langenbacher <christian.langenbacher91@gmail.com>

* fix integritee-network#176 and update some dependiencies

* upgrade to upstream 2.0.0-rc5
fix .dispatch filtering introduced in paritytech/substrate#6318
depend on tag version for sgx-runtime

* Upgrade upstream 2.0.0 (integritee-network#182)

* enclave builds
* worker and client builds
* fix metadata module index
* successfully tested shielding-unshielding example

* fix merge. builds and demo works

Co-authored-by: clangenb <37865735+clangenb@users.noreply.github.com>
Co-authored-by: bwty <18553484+whalelephant@users.noreply.github.com>
Co-authored-by: bwty <whalelephant@users.noreply.github.com>
Co-authored-by: bwty <email-me@belsy.space>
Co-authored-by: Marcel Frei <marcel.frei@electronix.ch>
Co-authored-by: Christian Langenbacher <christian.langenbacher91@gmail.com>
  • Loading branch information
7 people committed Nov 3, 2020
1 parent 2e77df9 commit 371f0b9
Show file tree
Hide file tree
Showing 28 changed files with 3,858 additions and 2,664 deletions.
3,081 changes: 2,059 additions & 1,022 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# substraTEE-worker

![badge](https://img.shields.io/badge/substrate-2.0.0--alpha.7-success)
![badge](https://img.shields.io/badge/substrate-2.0.0-success)

SubstraTEE worker for SubstraTEE node

Expand Down
28 changes: 14 additions & 14 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "encointer-client-teeproxy"
version = "0.6.11-sub2.0.0-alpha.7"
version = "0.6.12-sub2.0.0"
authors = ["Supercomputing Systems AG <info@scs.ch>"]
edition = "2018"

Expand All @@ -23,30 +23,30 @@ geojson = "0.17"
[dependencies.encointer-scheduler]
default-features = false
git = "https://github.com/encointer/pallets"
tag = "v0.3.4"
tag = "v0.3.6"
package = "pallet-encointer-scheduler"

[dependencies.encointer-ceremonies]
default-features = false
git = "https://github.com/encointer/pallets"
tag = "v0.3.4"
tag = "v0.3.6"
package = "pallet-encointer-ceremonies"

[dependencies.encointer-currencies]
default-features = false
git = "https://github.com/encointer/pallets"
tag = "v0.3.4"
tag = "v0.3.6"
package = "pallet-encointer-currencies"

[dependencies.encointer-balances]
default-features = false
git = "https://github.com/encointer/pallets"
tag = "v0.3.4"
tag = "v0.3.6"
package = "pallet-encointer-balances"

[dependencies.substrate-api-client]
git = "https://github.com/scs/substrate-api-client"
tag = "v0.4.6-sub2.0.0-alpha.7"
tag = "v0.4.10-sub2.0.0"

[dependencies.serde]
features = ["derive"]
Expand All @@ -57,23 +57,23 @@ version = "1.0"
default-features = false
package = "parity-scale-codec"
features = ["derive"]
version = "1.3.0"
version = "1.3.1"

[dependencies.sp-core]
version = '2.0.0-alpha.7'
version = '2.0.0'

[dependencies.sp-runtime]
version = '2.0.0-alpha.7'
version = '2.0.0'

[dependencies.sc-keystore]
version = '2.0.0-alpha.7'
version = '2.0.0'

[dependencies.pallet-balances]
version = '2.0.0-alpha.7'
version = '2.0.0'
default-features=false

[dependencies.frame-system]
version = '2.0.0-alpha.7'
version = '2.0.0'
default-features=false

[dependencies.my-node-runtime]
Expand All @@ -88,10 +88,10 @@ path = "../stf"
path = "../worker/worker-api"

[dependencies.sp-keyring]
version = '2.0.0-alpha.7'
version = '2.0.0'

[dependencies.sp-application-crypto]
version = '2.0.0-alpha.7'
version = '2.0.0'

#[patch.crates-io]
#ed25519-dalek = { git = "https://github.com/scs/ed25519-dalek.git", branch = "no_std_sgx"}
80 changes: 51 additions & 29 deletions client/bootstrap_demo_currency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,38 @@
#
# bootstrap a bot currency on Encointer Cantillon Testnet

### first, start node
# encointer-node-teeproxy --dev --ws-port 9979 -linfo,encointer=debug,runtime=debug
#
### then, start worker
# encointer-worker init-shard
# encointer-worker signing-key
# encointer-worker shielding-key
# encointer-worker -p 9979 run
#
# then run this script
#
### cleanup
# encointer-node-teeproxy purge-chain --dev
# bin/> rm -rf shards
# bin/> rm chain_relay_db.bin

# encointer-worker init-shard
## Cantillon node endpoint
#NURL=wss://cantillon.encointer.org
#NPORT=443
## Cantillon worker endpoint
#WURL=wss://substratee03.scs.ch
#WPORT=443

# locals
# local
NURL=ws://127.0.0.1
NPORT=9979
WURL=ws://127.0.0.1
WPORT=2000

CLIENT="./../bin/encointer-client-teeproxy -u $NURL -p $NPORT -U $WURL -P $WPORT"

wait_for_phase() {
current_phase=$($CLIENT get-phase)

echo "waiting for phase: $1 ..."

while [ "$current_phase" != "$1" ]; do
echo "current phase: $current_phase ... waiting for phase $1"
sleep 10
current_phase=$($CLIENT get-phase)
done

echo "current_phase is $1, progress script"
}

echo "Using node address: $NURL:$NPORT"
echo "Using worker address: $WURL:$WPORT"
echo ""
Expand All @@ -47,7 +50,23 @@ echo $cid
# list currenies
$CLIENT list-currencies

wait_for_phase REGISTERING
phase=$($CLIENT get-phase)
echo "phase is $phase"
if [ "$phase" == "REGISTERING" ]; then
echo "that's fine"
elif [ "$phase" == "ASSIGNING" ]; then
echo "need to advance"
$CLIENT next-phase
$CLIENT next-phase
echo "* Waiting 30 seconds such that phase change happened in enclave"
sleep 30
elif [ "$phase" == "ATTESTING" ]; then
echo "need to advance"
$CLIENT next-phase
echo "* Waiting 30 seconds such that phase change happened in enclave"
sleep 30
fi


read MRENCLAVE <<< $($CLIENT list-workers | awk '/ MRENCLAVE: / { print $2 }')
#cid=7eLSZLSMShw4ju9GvuMmoVgeZxZimtvsGTSvLEdvcRqQ
Expand All @@ -66,27 +85,29 @@ account3=//CharlieIncognito
$CLIENT trusted get-registration $account1 --mrenclave $MRENCLAVE --shard $cid
# should be zero

$CLIENT trusted register-participant $account1 --mrenclave $MRENCLAVE --shard $cid
$CLIENT trusted register-participant $account2 --mrenclave $MRENCLAVE --shard $cid
$CLIENT trusted register-participant $account3 --mrenclave $MRENCLAVE --shard $cid
timeout 10s $CLIENT trusted register-participant $account1 --mrenclave $MRENCLAVE --shard $cid
timeout 10s $CLIENT trusted register-participant $account2 --mrenclave $MRENCLAVE --shard $cid
timeout 10s $CLIENT trusted register-participant $account3 --mrenclave $MRENCLAVE --shard $cid

echo "*** registered participants"
sleep 10 # the above returns before TrustedCalls have been executed
sleep 30 # the above returns before TrustedCalls have been executed

# should be 1,2 and 3
$CLIENT trusted get-registration $account1 --mrenclave $MRENCLAVE --shard $cid
$CLIENT trusted get-registration $account2 --mrenclave $MRENCLAVE --shard $cid
$CLIENT trusted get-registration $account3 --mrenclave $MRENCLAVE --shard $cid

wait_for_phase ASSIGNING
$CLIENT next-phase
# should now be ASSIGNING

echo "* Waiting 30 seconds such that phase change happened in enclave"
sleep 30
echo ""

$CLIENT trusted info --mrenclave $MRENCLAVE --shard $cid

wait_for_phase ATTESTING
$CLIENT next-phase
# should now be ATTESTING

echo "* Waiting 30 seconds such that phase change happened in enclave"
sleep 30
Expand All @@ -102,14 +123,14 @@ echo "Claim2 = ${claim2}"
echo "Claim3 = ${claim3}"

echo "*** sign each others claims"
witness1_2=$($CLIENT sign-claim $account1 $claim2)
witness1_3=$($CLIENT sign-claim $account1 $claim3)
witness1_2=$($CLIENT trusted sign-claim $account1 $claim2 --mrenclave $MRENCLAVE --shard $cid)
witness1_3=$($CLIENT trusted sign-claim $account1 $claim3 --mrenclave $MRENCLAVE --shard $cid)

witness2_1=$($CLIENT sign-claim $account2 $claim1)
witness2_3=$($CLIENT sign-claim $account2 $claim3)
witness2_1=$($CLIENT trusted sign-claim $account2 $claim1 --mrenclave $MRENCLAVE --shard $cid)
witness2_3=$($CLIENT trusted sign-claim $account2 $claim3 --mrenclave $MRENCLAVE --shard $cid)

witness3_1=$($CLIENT sign-claim $account3 $claim1)
witness3_2=$($CLIENT sign-claim $account3 $claim2)
witness3_1=$($CLIENT trusted sign-claim $account3 $claim1 --mrenclave $MRENCLAVE --shard $cid)
witness3_2=$($CLIENT trusted sign-claim $account3 $claim2 --mrenclave $MRENCLAVE --shard $cid)

echo "*** send witnesses to chain"
$CLIENT trusted register-attestations $account1 $witness2_1 $witness3_1 --mrenclave $MRENCLAVE --shard $cid
Expand All @@ -121,7 +142,8 @@ $CLIENT trusted get-attestations $account1 --mrenclave $MRENCLAVE --shard $cid
$CLIENT trusted get-attestations $account2 --mrenclave $MRENCLAVE --shard $cid
$CLIENT trusted get-attestations $account3 --mrenclave $MRENCLAVE --shard $cid

wait_for_phase REGISTERING
$CLIENT next-phase
# should now be REGISTERING

echo "* Waiting 30 seconds such that phase change happened in enclave"
sleep 30
Expand Down
43 changes: 0 additions & 43 deletions client/demo_private_tx.sh

This file was deleted.

103 changes: 0 additions & 103 deletions client/demo_shielding_unshielding.sh

This file was deleted.

Loading

0 comments on commit 371f0b9

Please sign in to comment.