webb-tools / relayer

🕸️ The Webb Relayer Network

Home Page:https://webb-tools.github.io/relayer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TASK] Process DKG/Substrate extrinsic calls through Tx queue

shekohex opened this issue · comments

Overview

DKG should make use of the Substrate Transaction Queue instead of in-place sending transactions.

Task Checklist

  • Create transactions in-place and encode them.
  • Make use of the Substrate tx queue.
  • Process all extrinsic calls made to DKG and substrate through the tx queue like from here

Is there an example somewhere how this tx queue should be used?

Is there an example somewhere how this tx queue should be used?

Here is an example of using the transaction queue:

// Enqueue transaction call data in protocol-substrate transaction queue
let execute_proposal_call = ExecuteProposal {
src_id: typed_chain_id.chain_id(),
proposal_data: BoundedVec(proposal_data.clone()),
signature: BoundedVec(signature.clone()),
};
// webb dynamic payload
let execute_proposal_tx = WebbDynamicTxPayload {
pallet_name: Cow::Borrowed("SignatureBridge"),
call_name: Cow::Borrowed("execute_proposal"),
fields: vec![
Value::u128(u128::from(typed_chain_id.chain_id())),
Value::from_bytes(proposal_data),
Value::from_bytes(signature),
],
};
let data_hash = utils::keccak256(execute_proposal_call.encode());
let tx_key = SledQueueKey::from_substrate_with_custom_key(
chain_id,
make_execute_proposal_key(data_hash),
);
// Enqueue WebbDynamicTxPayload in protocol-substrate transaction queue
QueueStore::<WebbDynamicTxPayload>::enqueue_item(
&store,
tx_key,
execute_proposal_tx,
)?;