tangle-network / relayer

🕸️ The Webb Relayer Network
https://webb-tools.github.io/relayer/
Apache License 2.0
22 stars 13 forks source link

[BUG] Dkg node connection fails #377

Closed salman01zp closed 1 year ago

salman01zp commented 1 year ago

Summary

While creating DkgBridgeRegistryBackend it uses OnlineClient::<PolkadotConfig>::new() method to create a dkg client which by default points to a locally running node on ws://127.0.0.1:9944.

pub async fn new() -> Result<OnlineClient<T>, Error> {
        let url = "ws://127.0.0.1:9944";
        OnlineClient::from_url(url).await
    }

Solution

We should connect to the node using the wss URL provided by node configuration with the from_url method.

pub async fn from_url(url: impl AsRef<str>) -> Result<OnlineClient<T>, Error> {
        let client = default_rpc_client(url).await?;
        OnlineClient::from_rpc_client(Arc::new(client)).await
    }

We also store DKG client in DkgProposalSigningBackend and directly use by making it public.

pub struct DkgProposalSigningBackend {
    pub client: DkgClient,
    pub pair: PairSigner<PolkadotConfig, Sr25519Pair>,
    pub typed_chain_id: webb_proposals::TypedChainId,
}
shekohex commented 1 year ago

Closed by #378 #379