Skip to content

Commit

Permalink
tune log levels for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
brenzi committed Sep 11, 2023
1 parent 8b31434 commit 87f596a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl IssueNodeTemplateXtCmd {

match rpc_return_value.status {
DirectRequestStatus::Ok => {
println!("NodeTemplate Idex has been issued successfully.");
println!("NodeTemplate Index has been issued successfully.");
},
_ => {
let error_msg = "Node Template Xt issuance failed";
Expand Down
24 changes: 10 additions & 14 deletions enclave-runtime/src/rpc/encointer_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use itp_component_container::ComponentGetter;
use itp_ocall_api::EnclaveOnChainOCallApi;
use itp_stf_primitives::types::AccountId;
use itp_storage::{storage_double_map_key, StorageHasher};
use itp_types::{WorkerRequest, WorkerResponse, parentchain::ParentchainId};
use itp_types::{parentchain::ParentchainId, WorkerRequest, WorkerResponse};
use log::*;
use std::cmp::min;

Expand Down Expand Up @@ -52,12 +52,7 @@ fn get_reputation_ocall_api(
cid: CommunityIdentifier,
cindex: CeremonyIndexType,
) -> Reputation {
println!(
"requesting reputation for {:?}: cid is :{}, cindex is: {}",
prover,
cid,
cindex.clone()
);
info!("requesting reputation for {:?}: cid is :{}, cindex is: {}", prover, cid, cindex.clone());
let unverified_reputation = Reputation::Unverified;

let ocall_api = GLOBAL_OCALL_API_COMPONENT.get();
Expand All @@ -77,13 +72,14 @@ fn get_reputation_ocall_api(
trace!("storage_hash is : {}", hex::encode(storage_hash.clone()));

let requests = vec![WorkerRequest::ChainStorage(storage_hash, None)];
let mut resp: Vec<WorkerResponse<Vec<u8>>> = match ocall_api.worker_request(requests, &ParentchainId::TargetA) {
Ok(response) => response,
Err(e) => {
error!("Worker response decode failed. Error: {:?}", e);
return unverified_reputation
},
};
let mut resp: Vec<WorkerResponse<Vec<u8>>> =
match ocall_api.worker_request(requests, &ParentchainId::TargetA) {
Ok(response) => response,
Err(e) => {
error!("Worker response decode failed. Error: {:?}", e);
return unverified_reputation
},
};

let first = match resp.pop() {
None => {
Expand Down
4 changes: 1 addition & 3 deletions enclave-runtime/src/rpc/worker_api_direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,12 @@ fn issue_node_template_xt_inner(params: Params) -> Result<(), String> {
let subject_template_idx: u32 = Decode::decode(&mut subject_template_idx_bytes.as_slice())
.map_err(|e| format!("{:?}", e))?;

println!("subject index on template is {}", subject_template_idx);
println!("subject index on node-template is {}", subject_template_idx);

let call = OpaqueCall::from_tuple(&((7u8, 0u8), subject_template_idx));
println!("encoded call: 0x{}", hex::encode(call.encode()));
let extrinsics_factory = get_extrinsic_factory_from_target_b_solo_or_parachain().unwrap();
let extrinsics: Vec<OpaqueExtrinsic> =
extrinsics_factory.create_extrinsics(&[call], None).unwrap();
println!("sending {} extrinsics: {:?}", extrinsics.len(), extrinsics);
let validator_access = get_validator_accessor_from_target_b_solo_or_parachain().unwrap();
validator_access
.execute_mut_on_validator(|v| v.send_extrinsics(extrinsics))
Expand Down
12 changes: 8 additions & 4 deletions local-setup/py/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,24 @@ def run_in_background(self, log_file: TextIO, flags: [str] = None, subcommand_fl

# Todo: make this configurable
env = dict(os.environ, RUST_LOG='warn,ws=warn,sp_io=error,'
'substrate_api_client=warn,'
'substrate_api_client=error,'
'jsonrpsee_ws_client=warn,'
'jsonrpsee_ws_server=warn,'
'enclave_runtime=info,'
'integritee_service=warn,'
'enclave_runtime::rpc::encointer_utils=info,'
'enclave_runtime::rpc::worker_api_direct=trace,'
'itp_stf_state_handler=debug,'
'itp_extrinsics_factory=trace,'
'itp_extrinsics_factory=warn,'
'its_consensus_common=debug,'
'its_consensus_aura=trace,'
'itc_parentchain_indirect_calls_executor=info,'
'itc_parentchain_light_client=info,'
'itc_parentchain_block_importer=debug,'
'ita_stf=debug,'
'integritee_service=trace')
'integritee_service=debug,'
'integritee_service::parentchain_handler=warn,'
'integritee_service::ocall_bridge=warn,'
'integritee_service::account_funding=warn')
worker_cmd = self._assemble_cmd(flags=flags, subcommand_flags=subcommand_flags)
print("worker command is "+ str(worker_cmd))
return Popen(
Expand Down
13 changes: 7 additions & 6 deletions service/src/account_funding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ fn ensure_account_has_funds(api: &ParentchainApi, accountid: &AccountId32) -> Re
);
// check account balance
let free_balance = api.get_free_balance(accountid)?;
info!("TEE's free balance = {:?} (Account: {})", free_balance, accountid);
debug!("TEE's free balance = {:?} (Account: {})", free_balance, accountid);

let existential_deposit = api.get_existential_deposit()?;
info!("Existential deposit is = {:?}", existential_deposit);
debug!("Existential deposit is = {:?}", existential_deposit);
let balance_transfer_fee = api
.get_fee_details(
api.balance_transfer_allow_death(
Expand All @@ -119,15 +119,15 @@ fn ensure_account_has_funds(api: &ParentchainApi, accountid: &AccountId32) -> Re
.inclusion_fee
.unwrap()
.inclusion_fee();
info!("Balance Transfer Fee is = {:?}", balance_transfer_fee);
debug!("Balance Transfer Fee is = {:?}", balance_transfer_fee);

let min_required_funds = existential_deposit
.saturating_mul(EXISTENTIAL_DEPOSIT_FACTOR_FOR_INIT_FUNDS)
.saturating_add(balance_transfer_fee.saturating_mul(100));
let missing_funds = min_required_funds.saturating_sub(free_balance);

if missing_funds > 0 {
info!("Transfer {:?} from Alice to {}", missing_funds, accountid);
debug!("Transfer {:?} from Alice to {}", missing_funds, accountid);
bootstrap_funds_from_alice(api, accountid, missing_funds)?;
}
Ok(())
Expand Down Expand Up @@ -165,7 +165,7 @@ fn bootstrap_funds_from_alice(
trace!(" Alice's Account Nonce is {}", nonce);

if funding_amount > alice_free {
println!(
error!(
"funding amount is too high: please change EXISTENTIAL_DEPOSIT_FACTOR_FOR_INIT_FUNDS ({:?})",
funding_amount
);
Expand All @@ -176,7 +176,8 @@ fn bootstrap_funds_from_alice(
alice_signer_api.set_signer(ParentchainExtrinsicSigner::new(alice));

println!(
"[+] send extrinsic: bootstrap funding Enclave from Alice's funds (genesis hash {})",
"[+] send extrinsic: bootstrap funding Enclave from Alice's funds: {:?} (genesis hash {})",
funding_amount,
api.genesis_hash()
);
let xt = alice_signer_api
Expand Down

0 comments on commit 87f596a

Please sign in to comment.