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

Remove Dynamic Transaction #478

Closed
2 tasks done
salman01zp opened this issue Apr 25, 2023 · 1 comment · Fixed by #477
Closed
2 tasks done

Remove Dynamic Transaction #478

salman01zp opened this issue Apr 25, 2023 · 1 comment · Fixed by #477
Assignees
Labels
difficulty: medium 🚩 p1 🟠 Issue should be resolved sooner than later

Comments

@salman01zp
Copy link
Contributor

salman01zp commented Apr 25, 2023

Overview

Since subxt introduced encoding SubmittableExtrinsic we can directly enqueue signed SubmittableExtrinsic bytes in tx-queue and then later execute it.

For more details
https://github.com/paritytech/subxt/blob/master/CHANGELOG.md#0250---2022-11-16

Enqueue Transaction

let acknowledge_proposal_tx = tx_api.acknowledge_proposal(
            nonce.clone(),
            src_chain_id,
            ResourceId(resource_id.into_bytes()),
            BoundedVec(proposal.to_vec()),
        );

 let signer = &self.pair;
 let signed_acknowledge_proposal_tx = self
       .client
       .tx()
       .create_signed(&acknowledge_proposal_tx, signer, Default::default())
       .await?;

// Enqueue transaction in substrate transaction queue
        QueueStore::<Vec<u8>>::enqueue_item(
            &self.store,
            tx_key,
            signed_acknowledge_proposal_tx.into_encoded(),
        )?;

Dequeue and execute Transaction

// dequeue signed transaction
 let maybe_call_data = store.dequeue_item(
    SledQueueKey::from_substrate_chain_id(chain_id),
)?;
if let Some(payload) = maybe_call_data {
    let signed_extrinsic = SubmittableExtrinsic::from_bytes(
        client.clone(),
        payload,
    );

    // dry run test
    let dry_run_outcome = signed_extrinsic.dry_run(None).await;

    // watch_extrinsic submits and returns transaction subscription
    let mut progress = signed_extrinsic
    .submit_and_watch()
    .map_err(Into::into)
    .map_err(backoff::Error::transient)
   .await?;

Checklist

  • Update Substrate Bridge Handler
  • Remove Dynamic transactions
@salman01zp salman01zp added p1 🟠 Issue should be resolved sooner than later difficulty: medium 🚩 labels Apr 25, 2023
@salman01zp salman01zp self-assigned this Apr 25, 2023
@shekohex
Copy link
Collaborator

This actually could also solve #474.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: medium 🚩 p1 🟠 Issue should be resolved sooner than later
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants