Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Use custom struct for Orchestrator - Node jsonrpc communication #26

@RedaOps

Description

@RedaOps

Right now, the Orchestrator uses bitcoincore_rpc::jsonrpc::Response struct for deserialising responses from MPC nodes.

#[derive(Debug, Clone, Deserialize, Serialize)]
/// A JSONRPC response object.
pub struct Response {
    /// A result if there is one, or [`None`].
    pub result: Option<Box<RawValue>>,
    /// An error if there is one, or [`None`].
    pub error: Option<error::RpcError>,
    /// Identifier for this Request, which should match that of the request.
    pub id: serde_json::Value,
    /// jsonrpc field, MUST be "2.0".
    pub jsonrpc: Option<String>,
}

This is working as expected, since the structure follows the standardised jsonrpc response, and nodes send replies using jsonrpsee_core::RpcResult. However, we should use the same package/structure on both sides.

On top of that, I suggest using the jsonrpsee client for jsonrpc requests, instead of the reqwest library. (examples)

I suggest using jsonrpsee's Response struct for deserialization in the following places:

https://github.com/sigma0-xyz/zkbitcoin/blob/601b6a4ad94db02dff358c2f7baf92912c78e687/src/committee/orchestrator.rs#L174-L185

https://github.com/sigma0-xyz/zkbitcoin/blob/601b6a4ad94db02dff358c2f7baf92912c78e687/src/committee/orchestrator.rs#L344-L356

https://github.com/sigma0-xyz/zkbitcoin/blob/601b6a4ad94db02dff358c2f7baf92912c78e687/src/committee/orchestrator.rs#L407-L420

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions