Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substrate update v4.0.0 dev rebase #347

Merged
merged 27 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ab02f65
[Client] update cargo.toml
haerdib Aug 4, 2021
f6a3296
[chain relay] update cargo.toml
haerdib Aug 4, 2021
9de887d
[Enlcave] update cargo.toml
haerdib Aug 4, 2021
6256a53
[Primitives] update cargo.tomls
haerdib Aug 4, 2021
5d44a98
[stf] update cargo.toml
haerdib Aug 4, 2021
43596b7
[worker] update cargo.toml
haerdib Aug 4, 2021
a46699b
some clean up
haerdib Aug 4, 2021
3d809b8
fix typos
haerdib Aug 4, 2021
1c1fdb3
revert some cargo updates
haerdib Aug 10, 2021
04483ca
cargo update
haerdib Aug 10, 2021
56aced2
rename susbtratee_registry to pallet_teerex
haerdib Aug 10, 2021
68fb7ae
revert version of aes - ofd
haerdib Aug 10, 2021
04afae0
remove obsolete patch
haerdib Aug 10, 2021
aac5dfe
update Cargo.toml of enclave (+cargo update)
haerdib Aug 10, 2021
78f75e2
adapt aes.rs to new version
haerdib Aug 10, 2021
c5b7ab2
adapt to new susbtrate-api-client api structure
haerdib Aug 10, 2021
8f19dd8
rename substrateeapi to pallet teerex
haerdib Aug 10, 2021
4d3403f
move sgx-runtime dep to git branhc
haerdib Aug 10, 2021
472d5ad
remove obsolete control fnction and change to substrate-api-client br…
haerdib Aug 10, 2021
fef71e1
change substate-api-client back to master
haerdib Aug 11, 2021
f43cee1
cargo fmt
haerdib Aug 11, 2021
f885b07
remove obselete wrapper-debugging functions
haerdib Aug 11, 2021
c0aa7f0
make clippy happy
haerdib Aug 11, 2021
1555c56
add getrandom-sgx patch
haerdib Aug 13, 2021
d59e1c1
rebase adaptions
haerdib Aug 13, 2021
9ddff92
change sgx-runtime dep to master
haerdib Aug 13, 2021
00c9375
add makefile make update command
haerdib Aug 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,816 changes: 643 additions & 1,173 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ members = [

#[patch."https://github.com/scs/substrate-api-client"]
#substrate-api-client = { path = "../substrate-api-client" }
#substrate-client-keystore = { path = "../substrate-api-client/client-keystore" }
#substrate-client-keystore = { path = "../substrate-api-client/client-keystore" }

#[patch."https://github.com/integritee-network/sgx-runtime"]
#sgx-runtime = { path = "../sgx-runtime/runtime", default-features = false}
#sp-io = { path = "../sgx-runtime/substrate-sgx/sp-io", default-features = false, features = ["disable_oom", "disable_panic_handler", "disable_allocator", "sgx"]}
#sgx-externalities = { path = "../sgx-runtime/substrate-sgx/externalities", default-features = false}
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ clean:
@echo "cargo clean in root directory"
@cargo clean

.PHONY: update
update:
@echo "Running cargo update.."
@cd enclave && cargo update
@cd enclave && cargo update -p sp-std --precise f651d45ce5742bc60fe8ae518c035d1638ae83d2
@cd enclave && cargo update -p sgx_tstd --precise 7c07ce0bfbacd3f4f2af53a2cdef9539018be73c
@cargo update
@cargo update -p sp-std --precise f651d45ce5742bc60fe8ae518c035d1638ae83d2
@cargo update -p sgx_tstd --precise 7c07ce0bfbacd3f4f2af53a2cdef9539018be73c
clangenb marked this conversation as resolved.
Show resolved Hide resolved

mrenclave:
@$(SGX_ENCLAVE_SIGNER) dump -enclave ./bin/enclave.signed.so -dumpfile df.out && ./extract_identity < df.out && rm df.out

Expand Down
101 changes: 23 additions & 78 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,88 +14,33 @@ tiny-bip39 = "0.6.2"
serde_json = "1.0"
clap = "2.33"
clap-nested = "0.3.1"
primitive-types = { version = "0.6.1", default-features = false, features = ["codec"] }
primitive-types = { version = "0.10.1", default-features = false, features = ["codec"] }
base58 = "0.1"
chrono = "*"
blake2-rfc = { version = "0.2.18", default-features = false}
geojson = "0.17"
ws = { version = "0.7", features = ["ssl"] }
serde = { version = "1.0", features = ["derive"] }
codec = { version = "2.0.0", package = "parity-scale-codec", features = ["derive"] }
sgx_crypto_helper = { rev = "v1.1.3", git = "https://github.com/apache/teaclave-sgx-sdk.git" }

[dependencies.substrate-api-client]
git = "https://github.com/scs/substrate-api-client"
branch = "master"

[dependencies.substrate-client-keystore]
git = "https://github.com/scs/substrate-api-client"
branch = "master"

[dependencies.serde]
features = ["derive"]
version = "1.0"

[dependencies.codec]
default-features = false
package = "parity-scale-codec"
features = ["derive"]
version = "2.0.0"

[dependencies.sp-runtime]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"

[dependencies.sc-keystore]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"

[dependencies.pallet-balances]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"
default-features=false

[dependencies.frame-system]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"
default-features=false

[dependencies.my-node-runtime]
git = "https://github.com/scs/substraTEE-node"
branch = "master"
package = "substratee-node-runtime"

[dependencies.substratee-worker-primitives]
path = "../primitives/worker"

[dependencies.substratee-node-primitives]
path = "../primitives/node"

[dependencies.substratee-api-client-extensions]
path = "../primitives/api-client-extensions"

[dependencies.substratee-stf]
path = "../stf"

[dependencies.substratee-worker-api]
path = "../worker/rpc/client"

[dependencies.sp-keyring]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"

[dependencies.sp-application-crypto]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"

[dependencies.sp-core]
git = "https://github.com/paritytech/substrate.git"
branch = "master"
version = "3.0.0"

#[patch.crates-io]
#ed25519-dalek = { git = "https://github.com/scs/ed25519-dalek.git", branch = "no_std_sgx"}
# scs / integritee
substrate-api-client = { features = ["ws-client"], git = "https://github.com/scs/substrate-api-client", branch = "master" }
substrate-client-keystore = { git = "https://github.com/scs/substrate-api-client", branch = "master" }
my-node-runtime = { git = "https://github.com/integritee-network/integritee-node", branch = "master", package = "integritee-node-runtime" }

# substrate dependencies
sp-runtime = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sc-keystore = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-keyring = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-application-crypto = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-core = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "master" }

#local dependencies
substratee-node-primitives = { path = "../primitives/node" }
substratee-worker-primitives = { path = "../primitives/worker" }
substratee-api-client-extensions = { path = "../primitives/api-client-extensions" }
substratee-stf = { path = "../stf" }
substratee-worker-api = { path = "../worker/rpc/client" }
haerdib marked this conversation as resolved.
Show resolved Hide resolved
47 changes: 24 additions & 23 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use clap_nested::{Command, Commander};
use codec::{Decode, Encode};
use log::*;
use my_node_runtime::{
substratee_registry::Request, AccountId, BalancesCall, Call, Event, Hash, Signature,
pallet_teerex::Request, AccountId, BalancesCall, Call, Event, Hash, Signature,
};

use sp_core::{crypto::Ss58Codec, sr25519 as sr25519_core, Pair, H256};
Expand All @@ -51,15 +51,17 @@ use sp_runtime::{
use std::{convert::TryFrom, result::Result as StdResult, sync::mpsc::channel, thread};
use substrate_api_client::{
compose_extrinsic, compose_extrinsic_offline,
events::EventsDecoder,
extrinsic::xt_primitives::{GenericAddress, UncheckedExtrinsicV4},
node_metadata::Metadata,
rpc::{
ws_client::{EventsDecoder, Subscriber},
WsRpcClient,
},
utils::FromHexString,
Api, XtStatus,
Api, Metadata, RpcClient, XtStatus,
};

use substrate_client_keystore::{KeystoreExt, LocalKeystore};
use substratee_api_client_extensions::{SubstrateeRegistryApi, TEEREX};
use substratee_api_client_extensions::{PalletTeerexApi, TEEREX};
use substratee_stf::{ShardIdentifier, TrustedCallSigned, TrustedOperation};
use substratee_worker_api::direct_client::{DirectApi, DirectClient as DirectWorkerApi};
use substratee_worker_primitives::{DirectRequestStatus, RpcRequest, RpcResponse, RpcReturnValue};
Expand Down Expand Up @@ -423,14 +425,14 @@ fn main() {
}
}

fn get_chain_api(matches: &ArgMatches<'_>) -> Api<sr25519::Pair> {
fn get_chain_api(matches: &ArgMatches<'_>) -> Api<sr25519::Pair, WsRpcClient> {
let url = format!(
"{}:{}",
matches.value_of("node-url").unwrap(),
matches.value_of("node-port").unwrap()
);
info!("connecting to {}", url);
Api::<sr25519::Pair>::new(url).unwrap()
Api::<sr25519::Pair, WsRpcClient>::new(WsRpcClient::new(&url)).unwrap()
}

fn perform_trusted_operation(matches: &ArgMatches<'_>, top: &TrustedOperation) -> Option<Vec<u8>> {
Expand Down Expand Up @@ -691,11 +693,11 @@ fn listen(matches: &ArgMatches<'_>) {
}
}
},*/
Event::SubstrateeRegistry(ee) => {
Event::Teerex(ee) => {
println!(">>>>>>>>>> substraTEE event: {:?}", ee);
count += 1;
match &ee {
my_node_runtime::substratee_registry::RawEvent::AddedEnclave(
my_node_runtime::pallet_teerex::RawEvent::AddedEnclave(
accountid,
url,
) => {
Expand All @@ -706,12 +708,12 @@ fn listen(matches: &ArgMatches<'_>) {
.unwrap_or_else(|_| "error".to_string())
);
},
my_node_runtime::substratee_registry::RawEvent::RemovedEnclave(
my_node_runtime::pallet_teerex::RawEvent::RemovedEnclave(
accountid,
) => {
println!("RemovedEnclave: {:?}", accountid);
},
my_node_runtime::substratee_registry::RawEvent::UpdatedIpfsHash(
my_node_runtime::pallet_teerex::RawEvent::UpdatedIpfsHash(
shard,
idx,
ipfs_hash,
Expand All @@ -723,15 +725,13 @@ fn listen(matches: &ArgMatches<'_>) {
ipfs_hash
);
},
my_node_runtime::substratee_registry::RawEvent::Forwarded(
shard,
) => {
my_node_runtime::pallet_teerex::RawEvent::Forwarded(shard) => {
println!(
"Forwarded request for shard {}",
shard.encode().to_base58()
);
},
my_node_runtime::substratee_registry::RawEvent::CallConfirmed(
my_node_runtime::pallet_teerex::RawEvent::CallConfirmed(
accountid,
call_hash,
) => {
Expand All @@ -740,7 +740,7 @@ fn listen(matches: &ArgMatches<'_>) {
accountid, call_hash
);
},
my_node_runtime::substratee_registry::RawEvent::BlockConfirmed(
my_node_runtime::pallet_teerex::RawEvent::BlockConfirmed(
accountid,
block_hash,
) => {
Expand All @@ -749,12 +749,12 @@ fn listen(matches: &ArgMatches<'_>) {
accountid, block_hash
);
},
my_node_runtime::substratee_registry::RawEvent::ShieldFunds(
my_node_runtime::pallet_teerex::RawEvent::ShieldFunds(
incognito_account,
) => {
println!("ShieldFunds for {:?}", incognito_account);
},
my_node_runtime::substratee_registry::RawEvent::UnshieldedFunds(
my_node_runtime::pallet_teerex::RawEvent::UnshieldedFunds(
public_account,
) => {
println!("UnshieldFunds for {:?}", public_account);
Expand All @@ -770,10 +770,11 @@ fn listen(matches: &ArgMatches<'_>) {
}
}

// subscribes to he substratee_registry events of type CallConfirmed
pub fn subscribe_to_call_confirmed<P: Pair>(api: Api<P>) -> H256
// subscribes to he pallet_teerex events of type CallConfirmed
pub fn subscribe_to_call_confirmed<P: Pair, Client: 'static>(api: Api<P, Client>) -> H256
where
MultiSignature: From<P::Signature>,
Client: RpcClient + Subscriber + Send,
{
let (events_in, events_out) = channel();

Expand All @@ -794,16 +795,16 @@ where
if let Ok(evts) = _events {
for evr in &evts {
info!("received event {:?}", evr.event);
if let Event::SubstrateeRegistry(pe) = &evr.event {
if let my_node_runtime::substratee_registry::RawEvent::CallConfirmed(
if let Event::Teerex(pe) = &evr.event {
if let my_node_runtime::pallet_teerex::RawEvent::CallConfirmed(
sender,
payload,
) = &pe
{
println!("[+] Received confirm call from {}", sender);
return payload.clone().to_owned()
} else {
debug!("received unknown event from SubstraTeeRegistry: {:?}", evr.event)
debug!("received unknown event from Teerex: {:?}", evr.event)
}
}
}
Expand Down
Loading