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

Failsafe when sending signed XCM transaction. #492

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

gianfra-t
Copy link
Contributor

Issue #484.

The current theory for why this error happened, is that connection with Assethub's RPC dropped between sending the transaction and receiving the confirmation event, as it's hard to see another reason why this function could have failed, knowing the actual extrinsic did not.

Given that, we introduce a new error type TransactionInclusionError for the case where the transaction is included in a block, yet for some reason signAndSend fails.

In this scenario, we will fetch all the events for the block once it is available, and attempt to find the relevant XcmSent event.

@gianfra-t gianfra-t linked an issue Feb 28, 2025 that may be closed by this pull request
@gianfra-t gianfra-t self-assigned this Feb 28, 2025
@gianfra-t gianfra-t requested a review from a team February 28, 2025 19:49
Copy link

netlify bot commented Feb 28, 2025

Deploy Preview for pendulum-pay ready!

Name Link
🔨 Latest commit 981d8dd
🔍 Latest deploy log https://app.netlify.com/sites/pendulum-pay/deploys/67c214949b5b670008750a06
😎 Deploy Preview https://deploy-preview-492--pendulum-pay.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@ebma ebma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good and makes sense to me 👍 I assume you are basing this on assumptions and we are not really sure if it will work, e.g. it could be that the callback we pass to signAndSend() doesn't even trigger after we encounter the error and the inBlockHash would never assign.

I'm fine if we merge this based on the assumption that it works. We'd only need to make sure that the happy path also still works as expected. Have you tested an AssetHub offramp with these changes already @gianfra-t?

const event = xcmSentEvents
.map((event) => parseEventXcmSent(event))
.filter((event) => {
return event.originAddress == address;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How confident are we that this comparison works as expected and we don't need to convert between different encodings of originAddress and address?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Double signing when offramping from assethub.
2 participants