-
Notifications
You must be signed in to change notification settings - Fork 46
Fix event decoding in cli + remove timeout in demos #507
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -531,8 +531,11 @@ fn send_request(matches: &ArgMatches<'_>, call: TrustedCallSigned) -> Option<Vec | |
| // send and watch extrinsic until block is executed | ||
| let block_hash = | ||
| _chain_api.send_extrinsic(xt.hex_encode(), XtStatus::InBlock).unwrap().unwrap(); | ||
| info!("stf call extrinsic sent. Block Hash: {:?}", block_hash); | ||
| info!("waiting for confirmation of stf call"); | ||
| info!( | ||
| "Trusted call extrinsic sent and sucessfully included in parentchain block with hash {:?}.", | ||
| block_hash | ||
| ); | ||
| info!("Waiting for execution confirmation from enclave..."); | ||
| let (events_in, events_out) = channel(); | ||
| _chain_api.subscribe_events(events_in).unwrap(); | ||
|
|
||
|
|
@@ -541,19 +544,19 @@ fn send_request(matches: &ArgMatches<'_>, call: TrustedCallSigned) -> Option<Vec | |
| decoder.register_type_size::<Hash>("H256").unwrap(); | ||
|
|
||
| loop { | ||
| let ret: ProposedSidechainBlockArgs = _chain_api | ||
| .wait_for_event::<ProposedSidechainBlockArgs>( | ||
| let ret: ProcessedParentchainBlockArgs = _chain_api | ||
| .wait_for_event::<ProcessedParentchainBlockArgs>( | ||
|
Comment on lines
+547
to
+548
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So here we waited for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm honestly not 100% sure what the previous problem was, but I think it might have been partially fixed by cleaning up the Confirmations on the worker side th PR #501 and now fixing the Block listening event... But the tests pass now without a Timeout. Is that not convincing enough?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they pass consistently, I am convinced. :D |
||
| 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 { | ||
|
Comment on lines
-664
to
+667
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small but significant change in how to read this code 😄 |
||
| 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::<frame_system::EventRecord<Event, Hash>>::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"), | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the timeout means that we potentially wait forever? Or what was the motivation?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is true. But since this is used as a CI test, I think we should know if no fitting confirmation is issued by the parentchain.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So my motiviation: Wait forever such that we know something is wrong.