diff --git a/cli/demo_direct_call.sh b/cli/demo_direct_call.sh index b39c462d34..0cb33decd4 100755 --- a/cli/demo_direct_call.sh +++ b/cli/demo_direct_call.sh @@ -47,7 +47,6 @@ echo "Using worker-rpc-port ${RPORT}" AMOUNTSHIELD=50000000000 AMOUNTTRANSFER=40000000000 -TIMEOUT="timeout 30s " CLIENT="./../bin/integritee-cli -p ${NPORT} -P ${RPORT}" if [ "$READMRENCLAVE" = "file" ] @@ -73,26 +72,26 @@ echo " Bob's incognito account = ${ICGACCOUNTBOB}" echo "" echo "* Issue ${AMOUNTSHIELD} tokens to Alice's incognito account" -$TIMEOUT ${CLIENT} trusted set-balance ${ICGACCOUNTALICE} ${AMOUNTSHIELD} --mrenclave ${MRENCLAVE} --direct +${CLIENT} trusted set-balance ${ICGACCOUNTALICE} ${AMOUNTSHIELD} --mrenclave ${MRENCLAVE} --direct echo "" echo "Get balance of Alice's incognito account" -$TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} +${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} echo "" #send funds from Alice to bobs account echo "* Send ${AMOUNTTRANSFER} funds from Alice's incognito account to Bob's incognito account" -$TIMEOUT $CLIENT trusted transfer ${ICGACCOUNTALICE} ${ICGACCOUNTBOB} ${AMOUNTTRANSFER} --mrenclave ${MRENCLAVE} --direct +$CLIENT trusted transfer ${ICGACCOUNTALICE} ${ICGACCOUNTBOB} ${AMOUNTTRANSFER} --mrenclave ${MRENCLAVE} --direct echo "" echo "* Get balance of Alice's incognito account" -RESULT=$($TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} | xargs) +RESULT=$(${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} | xargs) echo $RESULT echo "" echo "* Bob's incognito account balance" -RESULT=$($TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTBOB} --mrenclave ${MRENCLAVE} | xargs) +RESULT=$(${CLIENT} trusted balance ${ICGACCOUNTBOB} --mrenclave ${MRENCLAVE} | xargs) echo $RESULT echo "" diff --git a/cli/demo_shielding_unshielding.sh b/cli/demo_shielding_unshielding.sh index 4d824c2b47..eff7916cd6 100755 --- a/cli/demo_shielding_unshielding.sh +++ b/cli/demo_shielding_unshielding.sh @@ -49,7 +49,6 @@ AMOUNTSHIELD=50000000000 AMOUNTTRANSFER=25000000000 AMOUNTUNSHIELD=15000000000 -TIMEOUT="timeout 30s " CLIENT="./../bin/integritee-cli -p ${NPORT} -P ${RPORT}" echo "* Query on-chain enclave registry:" @@ -90,7 +89,7 @@ echo "" sleep 10 echo "* Shield ${AMOUNTSHIELD} tokens to Alice's incognito account" -${TIMEOUT} ${CLIENT} shield-funds //Alice ${ICGACCOUNTALICE} ${AMOUNTSHIELD} ${MRENCLAVE} ${WORKERPORT} +${CLIENT} shield-funds //Alice ${ICGACCOUNTALICE} ${AMOUNTSHIELD} ${MRENCLAVE} ${WORKERPORT} echo "" echo "* Waiting 10 seconds" @@ -98,7 +97,7 @@ sleep 10 echo "" echo "Get balance of Alice's incognito account" -$TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} +${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} echo "" echo "* Get balance of Alice's on-chain account" @@ -106,19 +105,19 @@ ${CLIENT} balance "//Alice" echo "" echo "* Send ${AMOUNTTRANSFER} funds from Alice's incognito account to Bob's incognito account" -$TIMEOUT $CLIENT trusted transfer ${ICGACCOUNTALICE} ${ICGACCOUNTBOB} ${AMOUNTTRANSFER} --mrenclave ${MRENCLAVE} +$CLIENT trusted transfer ${ICGACCOUNTALICE} ${ICGACCOUNTBOB} ${AMOUNTTRANSFER} --mrenclave ${MRENCLAVE} echo "" echo "* Get balance of Alice's incognito account" -$TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} +${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} echo "" echo "* Bob's incognito account balance" -$TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTBOB} --mrenclave ${MRENCLAVE} +${CLIENT} trusted balance ${ICGACCOUNTBOB} --mrenclave ${MRENCLAVE} echo "" echo "* Un-shield ${AMOUNTUNSHIELD} tokens from Alice's incognito account" -$TIMEOUT ${CLIENT} trusted unshield-funds ${ICGACCOUNTALICE} //Alice ${AMOUNTUNSHIELD} ${MRENCLAVE} --mrenclave ${MRENCLAVE} --xt-signer //Alice +${CLIENT} trusted unshield-funds ${ICGACCOUNTALICE} //Alice ${AMOUNTUNSHIELD} ${MRENCLAVE} --mrenclave ${MRENCLAVE} --xt-signer //Alice echo "" echo "* Waiting 10 seconds" @@ -126,7 +125,7 @@ sleep 10 echo "" echo "Get balance of Alice's incognito account" -RESULT=$($TIMEOUT ${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} | xargs) +RESULT=$(${CLIENT} trusted balance ${ICGACCOUNTALICE} --mrenclave ${MRENCLAVE} | xargs) echo $RESULT echo "* Get balance of Alice's on-chain account" diff --git a/cli/src/main.rs b/cli/src/main.rs index fa79242f4d..965da57333 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -531,8 +531,11 @@ fn send_request(matches: &ArgMatches<'_>, call: TrustedCallSigned) -> Option, call: TrustedCallSigned) -> Option("H256").unwrap(); loop { - let ret: ProposedSidechainBlockArgs = _chain_api - .wait_for_event::( + let ret: ProcessedParentchainBlockArgs = _chain_api + .wait_for_event::( TEEREX, - "ProposedSidechainBlock", + "ProcessedParentchainBlock", Some(decoder.clone()), &events_out, ) .unwrap(); - info!("ProposedSidechainBlock event received"); - debug!("Expected stf block Hash: {:?}", block_hash); - debug!("Confirmed stf block Hash: {:?}", ret.payload); - if ret.payload == block_hash { - return Some(ret.payload.encode()) + info!("Confirmation of ProcessedParentchainBlock received"); + debug!("Expected block Hash: {:?}", block_hash); + debug!("Confirmed stf block Hash: {:?}", ret.block_hash); + if ret.block_hash == block_hash { + return Some(ret.block_hash.encode()) } } } @@ -661,9 +664,10 @@ fn send_direct_request( #[allow(dead_code)] #[derive(Decode)] -struct ProposedSidechainBlockArgs { +struct ProcessedParentchainBlockArgs { signer: AccountId, - payload: H256, + block_hash: H256, + merkle_root: H256, } fn listen(matches: &ArgMatches<'_>) { @@ -690,24 +694,23 @@ fn listen(matches: &ArgMatches<'_>) { let _events = Vec::>::decode(&mut _er_enc); blocks += 1; match _events { - Ok(evts) => { + Ok(evts) => for evr in &evts { println!("decoded: phase {:?} event {:?}", evr.phase, evr.event); match &evr.event { - /* Event::balances(be) => { + Event::Balances(be) => { println!(">>>>>>>>>> balances event: {:?}", be); match &be { - pallet_balances::RawEvent::Transfer(transactor, dest, value, fee) => { - println!("Transactor: {:?}", transactor); - println!("Destination: {:?}", dest); + pallet_balances::Event::Transfer(from, to, value) => { + println!("From: {:?}", from); + println!("To: {:?}", to); println!("Value: {:?}", value); - println!("Fee: {:?}", fee); - } + }, _ => { debug!("ignoring unsupported balances event"); - } + }, } - },*/ + }, Event::Teerex(ee) => { println!(">>>>>>>>>> integritee event: {:?}", ee); count += 1; @@ -767,8 +770,7 @@ fn listen(matches: &ArgMatches<'_>) { }, _ => debug!("ignoring unsupported module event: {:?}", evr.event), } - } - }, + }, Err(_) => error!("couldn't decode event record list"), } }