Skip to content

Return full extrinsic information, even when xt has failed #617

@haerdib

Description

@haerdib

We currently throw away all xt information if it has failed:

In function

async fn submit_and_watch_opaque_extrinsic_until(
&self,
encoded_extrinsic: &Bytes,
watch_until: XtStatus,
) -> Result<ExtrinsicReport<Self::Hash>> {
let mut report = self
.submit_and_watch_opaque_extrinsic_until_without_events(encoded_extrinsic, watch_until)
.await?;
if watch_until < XtStatus::InBlock {
return Ok(report)
}
let block_hash = report.block_hash.ok_or(Error::BlockHashNotFound)?;
let extrinsic_events =
self.fetch_events_for_extrinsic(block_hash, report.extrinsic_hash).await?;
// Ensure that the extrins has been successful. If not, return an error.
for event in &extrinsic_events {
event.check_if_failed()?;
}
report.events = Some(extrinsic_events);
Ok(report)
}

We only return the dispatch error if the xt has failed. This only tells us why the extrinsic has failed, but not the xt_hash, nor the events for it. Even though it has been fetched previously.

So I'm proposing to return an Error that returns all the information: see #616

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions