Skip to content

Commit 371f0b9

Browse files
brenziclangenbwhalelephantelectronixChristian Langenbacher
authored
Upgrade upstream 0.6.12 sub2.0.0 (#31)
* 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>
1 parent 2e77df9 commit 371f0b9

File tree

28 files changed

+3858
-2664
lines changed

28 files changed

+3858
-2664
lines changed

Cargo.lock

Lines changed: 2059 additions & 1022 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# substraTEE-worker
22

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

55
SubstraTEE worker for SubstraTEE node
66

client/Cargo.toml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "encointer-client-teeproxy"
3-
version = "0.6.11-sub2.0.0-alpha.7"
3+
version = "0.6.12-sub2.0.0"
44
authors = ["Supercomputing Systems AG <info@scs.ch>"]
55
edition = "2018"
66

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

2929
[dependencies.encointer-ceremonies]
3030
default-features = false
3131
git = "https://github.com/encointer/pallets"
32-
tag = "v0.3.4"
32+
tag = "v0.3.6"
3333
package = "pallet-encointer-ceremonies"
3434

3535
[dependencies.encointer-currencies]
3636
default-features = false
3737
git = "https://github.com/encointer/pallets"
38-
tag = "v0.3.4"
38+
tag = "v0.3.6"
3939
package = "pallet-encointer-currencies"
4040

4141
[dependencies.encointer-balances]
4242
default-features = false
4343
git = "https://github.com/encointer/pallets"
44-
tag = "v0.3.4"
44+
tag = "v0.3.6"
4545
package = "pallet-encointer-balances"
4646

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

5151
[dependencies.serde]
5252
features = ["derive"]
@@ -57,23 +57,23 @@ version = "1.0"
5757
default-features = false
5858
package = "parity-scale-codec"
5959
features = ["derive"]
60-
version = "1.3.0"
60+
version = "1.3.1"
6161

6262
[dependencies.sp-core]
63-
version = '2.0.0-alpha.7'
63+
version = '2.0.0'
6464

6565
[dependencies.sp-runtime]
66-
version = '2.0.0-alpha.7'
66+
version = '2.0.0'
6767

6868
[dependencies.sc-keystore]
69-
version = '2.0.0-alpha.7'
69+
version = '2.0.0'
7070

7171
[dependencies.pallet-balances]
72-
version = '2.0.0-alpha.7'
72+
version = '2.0.0'
7373
default-features=false
7474

7575
[dependencies.frame-system]
76-
version = '2.0.0-alpha.7'
76+
version = '2.0.0'
7777
default-features=false
7878

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

9090
[dependencies.sp-keyring]
91-
version = '2.0.0-alpha.7'
91+
version = '2.0.0'
9292

9393
[dependencies.sp-application-crypto]
94-
version = '2.0.0-alpha.7'
94+
version = '2.0.0'
9595

9696
#[patch.crates-io]
9797
#ed25519-dalek = { git = "https://github.com/scs/ed25519-dalek.git", branch = "no_std_sgx"}

client/bootstrap_demo_currency.sh

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,38 @@
44
#
55
# bootstrap a bot currency on Encointer Cantillon Testnet
66

7+
### first, start node
8+
# encointer-node-teeproxy --dev --ws-port 9979 -linfo,encointer=debug,runtime=debug
9+
#
10+
### then, start worker
11+
# encointer-worker init-shard
12+
# encointer-worker signing-key
13+
# encointer-worker shielding-key
14+
# encointer-worker -p 9979 run
15+
#
16+
# then run this script
17+
#
18+
### cleanup
19+
# encointer-node-teeproxy purge-chain --dev
20+
# bin/> rm -rf shards
21+
# bin/> rm chain_relay_db.bin
22+
23+
# encointer-worker init-shard
724
## Cantillon node endpoint
825
#NURL=wss://cantillon.encointer.org
926
#NPORT=443
1027
## Cantillon worker endpoint
1128
#WURL=wss://substratee03.scs.ch
1229
#WPORT=443
1330

14-
# locals
31+
# local
1532
NURL=ws://127.0.0.1
1633
NPORT=9979
1734
WURL=ws://127.0.0.1
1835
WPORT=2000
1936

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

22-
wait_for_phase() {
23-
current_phase=$($CLIENT get-phase)
24-
25-
echo "waiting for phase: $1 ..."
26-
27-
while [ "$current_phase" != "$1" ]; do
28-
echo "current phase: $current_phase ... waiting for phase $1"
29-
sleep 10
30-
current_phase=$($CLIENT get-phase)
31-
done
32-
33-
echo "current_phase is $1, progress script"
34-
}
35-
3639
echo "Using node address: $NURL:$NPORT"
3740
echo "Using worker address: $WURL:$WPORT"
3841
echo ""
@@ -47,7 +50,23 @@ echo $cid
4750
# list currenies
4851
$CLIENT list-currencies
4952

50-
wait_for_phase REGISTERING
53+
phase=$($CLIENT get-phase)
54+
echo "phase is $phase"
55+
if [ "$phase" == "REGISTERING" ]; then
56+
echo "that's fine"
57+
elif [ "$phase" == "ASSIGNING" ]; then
58+
echo "need to advance"
59+
$CLIENT next-phase
60+
$CLIENT next-phase
61+
echo "* Waiting 30 seconds such that phase change happened in enclave"
62+
sleep 30
63+
elif [ "$phase" == "ATTESTING" ]; then
64+
echo "need to advance"
65+
$CLIENT next-phase
66+
echo "* Waiting 30 seconds such that phase change happened in enclave"
67+
sleep 30
68+
fi
69+
5170

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

69-
$CLIENT trusted register-participant $account1 --mrenclave $MRENCLAVE --shard $cid
70-
$CLIENT trusted register-participant $account2 --mrenclave $MRENCLAVE --shard $cid
71-
$CLIENT trusted register-participant $account3 --mrenclave $MRENCLAVE --shard $cid
88+
timeout 10s $CLIENT trusted register-participant $account1 --mrenclave $MRENCLAVE --shard $cid
89+
timeout 10s $CLIENT trusted register-participant $account2 --mrenclave $MRENCLAVE --shard $cid
90+
timeout 10s $CLIENT trusted register-participant $account3 --mrenclave $MRENCLAVE --shard $cid
7291

7392
echo "*** registered participants"
74-
sleep 10 # the above returns before TrustedCalls have been executed
93+
sleep 30 # the above returns before TrustedCalls have been executed
7594

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

81-
wait_for_phase ASSIGNING
100+
$CLIENT next-phase
101+
# should now be ASSIGNING
82102

83103
echo "* Waiting 30 seconds such that phase change happened in enclave"
84104
sleep 30
85105
echo ""
86106

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

89-
wait_for_phase ATTESTING
109+
$CLIENT next-phase
110+
# should now be ATTESTING
90111

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

104125
echo "*** sign each others claims"
105-
witness1_2=$($CLIENT sign-claim $account1 $claim2)
106-
witness1_3=$($CLIENT sign-claim $account1 $claim3)
126+
witness1_2=$($CLIENT trusted sign-claim $account1 $claim2 --mrenclave $MRENCLAVE --shard $cid)
127+
witness1_3=$($CLIENT trusted sign-claim $account1 $claim3 --mrenclave $MRENCLAVE --shard $cid)
107128

108-
witness2_1=$($CLIENT sign-claim $account2 $claim1)
109-
witness2_3=$($CLIENT sign-claim $account2 $claim3)
129+
witness2_1=$($CLIENT trusted sign-claim $account2 $claim1 --mrenclave $MRENCLAVE --shard $cid)
130+
witness2_3=$($CLIENT trusted sign-claim $account2 $claim3 --mrenclave $MRENCLAVE --shard $cid)
110131

111-
witness3_1=$($CLIENT sign-claim $account3 $claim1)
112-
witness3_2=$($CLIENT sign-claim $account3 $claim2)
132+
witness3_1=$($CLIENT trusted sign-claim $account3 $claim1 --mrenclave $MRENCLAVE --shard $cid)
133+
witness3_2=$($CLIENT trusted sign-claim $account3 $claim2 --mrenclave $MRENCLAVE --shard $cid)
113134

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

124-
wait_for_phase REGISTERING
145+
$CLIENT next-phase
146+
# should now be REGISTERING
125147

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

client/demo_private_tx.sh

Lines changed: 0 additions & 43 deletions
This file was deleted.

client/demo_shielding_unshielding.sh

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)