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

[ISSUE] Handle subxt errors

salman01zp opened this issue · comments

Description

The relayer is silently passing Subxt errors which need to be fixed. This issue was found when an API request with outdated metadata was sent to the tangle node.

Expected behavior: Return error
Current behavior: Silently passing

After adding logs to isolate the issue it was found that the API request failed. Updating metadata should resolve this error but we need to handle this error correctly

let maybe_signed_acknowledge_proposal_tx = self
    .client
    .tx()
    .create_signed(&acknowledge_proposal_tx, signer, Default::default())
    .await;
let signed_acknowledge_proposal_tx =
    match maybe_signed_acknowledge_proposal_tx {
        Ok(tx) => tx,
        Err(e) => {
            tracing::error!(?e, "failed to sign tx");
            return Err(webb_relayer_utils::Error::Generic(
                "failed to sign tx",
            ));
        }
};

Logs:

{"timestamp":"2023-05-17T11:27:50.901043Z","level":"ERROR",
"message":"failed to sign acknowledge proposal tx","e":"Metadata(IncompatibleCallMetadata(\"DKGProposals\", \"acknowledge_proposal\"))",
"target":"webb_proposal_signing_backends::dkg","spans":[{"address":"0x8314…40a9",
"tag":"VAnchor Contract Watcher","name":"run"},{"name":"handle_event"}]}

Fyi, there is a feature in subxt that watches the runtime upgrades and fetches the latest metadata, without restarting the relayer or anything, I would say we could experiment using it.
See: https://docs.rs/subxt/0.28.0/subxt/client/struct.OnlineClient.html#method.updater
Src: https://github.com/paritytech/subxt/blob/81494027c8f5ae62d44883167585d5e557f0fcba/subxt/src/client/online_client.rs#L317